latex mode
This commit is contained in:
parent
aaa7abe505
commit
5379fa6647
2 changed files with 44 additions and 23 deletions
22
demo/docs/latex.tex
Normal file
22
demo/docs/latex.tex
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
\usepackage{amsmath}
|
||||||
|
\title{\LaTeX}
|
||||||
|
\date{}
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
\LaTeX{} is a document preparation system for the \TeX{}
|
||||||
|
typesetting program. It offers programmable desktop publishing
|
||||||
|
features and extensive facilities for automating most aspects of
|
||||||
|
typesetting and desktop publishing, including numbering and
|
||||||
|
cross-referencing, tables and figures, page layout, bibliographies,
|
||||||
|
and much more. \LaTeX{} was originally written in 1984 by Leslie
|
||||||
|
Lamport and has become the dominant method for using \TeX; few
|
||||||
|
people write in plain \TeX{} anymore. The current version is
|
||||||
|
\LaTeXe.
|
||||||
|
|
||||||
|
% This is a comment; it will not be shown in the final output.
|
||||||
|
% The following shows a little of the typesetting power of LaTeX:
|
||||||
|
\begin{align}
|
||||||
|
E &= mc^2 \\
|
||||||
|
m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}
|
||||||
|
\end{align}
|
||||||
|
\end{document}
|
||||||
|
|
@ -6,29 +6,28 @@ var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightR
|
||||||
var LatexHighlightRules = function()
|
var LatexHighlightRules = function()
|
||||||
{
|
{
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [
|
"start" : [{
|
||||||
{
|
|
||||||
// A tex command e.g. \foo
|
// A tex command e.g. \foo
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)",
|
regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)",
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
// Curly and square braces
|
// Curly and square braces
|
||||||
token : "keyword",
|
token : "lparen",
|
||||||
regex : "[\\{\\}\\]\\[]"
|
regex : "[[({]"
|
||||||
},
|
}, {
|
||||||
{
|
// Curly and square braces
|
||||||
|
token : "rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
// Inline math between two $ symbols
|
// Inline math between two $ symbols
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
|
regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
// A comment. Tex comments start with % and go to
|
// A comment. Tex comments start with % and go to
|
||||||
// the end of the line
|
// the end of the line
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "%.*$"
|
regex : "%.*$"
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue