-;; TeX.
-
-;(defvar tex-font-lock-keywords
-; ;; Regexps updated with help from Ulrik Dickow <dickow@nbi.dk>.
-; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}"
-; 2 font-lock-function-name-face)
-; ("\\\\\\(cite\\|label\\|pageref\\|ref\\){\\([^} \t\n]+\\)}"
-; 2 font-lock-constant-face)
-; ;; It seems a bit dubious to use `bold' and `italic' faces since we might
-; ;; not be able to display those fonts.
-; ("{\\\\bf\\([^}]+\\)}" 1 'bold keep)
-; ("{\\\\\\(em\\|it\\|sl\\)\\([^}]+\\)}" 2 'italic keep)
-; ("\\\\\\([a-zA-Z@]+\\|.\\)" . font-lock-keyword-face)
-; ("^[ \t\n]*\\\\def[\\\\@]\\(\\w+\\)" 1 font-lock-function-name-face keep))
-; ;; Rewritten and extended for LaTeX2e by Ulrik Dickow <dickow@nbi.dk>.
-; '(("\\\\\\(begin\\|end\\|newcommand\\){\\([a-zA-Z0-9\\*]+\\)}"
-; 2 font-lock-function-name-face)
-; ("\\\\\\(cite\\|label\\|pageref\\|ref\\){\\([^} \t\n]+\\)}"
-; 2 font-lock-constant-face)
-; ("^[ \t]*\\\\def\\\\\\(\\(\\w\\|@\\)+\\)" 1 font-lock-function-name-face)
-; "\\\\\\([a-zA-Z@]+\\|.\\)"
-; ;; It seems a bit dubious to use `bold' and `italic' faces since we might
-; ;; not be able to display those fonts.
-; ;; LaTeX2e: \emph{This is emphasized}.
-; ("\\\\emph{\\([^}]+\\)}" 1 'italic keep)
-; ;; LaTeX2e: \textbf{This is bold}, \textit{...}, \textsl{...}
-; ("\\\\text\\(\\(bf\\)\\|it\\|sl\\){\\([^}]+\\)}"
-; 3 (if (match-beginning 2) 'bold 'italic) keep)
-; ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables.
-; ("\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)"
-; 3 (if (match-beginning 2) 'bold 'italic) keep))
-
-;; Rewritten with the help of Alexandra Bac <abac@welcome.disi.unige.it>.
-(defconst tex-font-lock-keywords-1
- (eval-when-compile
- (let* (;;
- ;; Names of commands whose arg should be fontified as heading, etc.
- (headings (regexp-opt '("title" "begin" "end") t))
- ;; These commands have optional args.
- (headings-opt (regexp-opt
- '("chapter" "part"
- "section" "subsection" "subsubsection"
- "section*" "subsection*" "subsubsection*"
- "paragraph" "subparagraph" "subsubparagraph"
- "paragraph*" "subparagraph*" "subsubparagraph*"
- "newcommand" "renewcommand" "newenvironment"
- "newtheorem"
- "newcommand*" "renewcommand*" "newenvironment*"
- "newtheorem*")
- t))
- (variables (regexp-opt
- '("newcounter" "newcounter*" "setcounter" "addtocounter"
- "setlength" "addtolength" "settowidth")
- t))
- (includes (regexp-opt
- '("input" "include" "includeonly" "bibliography"
- "epsfig" "psfig" "epsf")
- t))
- (includes-opt (regexp-opt
- '("nofiles" "usepackage"
- "includegraphics" "includegraphics*")
- t))
- ;; Miscellany.
- (slash "\\\\")
- (opt "\\(\\[[^]]*\\]\\)?")
- (arg "{\\([^}]+\\)")
- (opt-depth (regexp-opt-depth opt))
- (arg-depth (regexp-opt-depth arg))
- )
- (list
- ;;
- ;; Heading args.
- (list (concat slash headings arg)
- (+ (regexp-opt-depth headings) arg-depth)
- 'font-lock-function-name-face)
- (list (concat slash headings-opt opt arg)
- (+ (regexp-opt-depth headings-opt) opt-depth arg-depth)
- 'font-lock-function-name-face)
- ;;
- ;; Variable args.
- (list (concat slash variables arg)
- (+ (regexp-opt-depth variables) arg-depth)
- 'font-lock-variable-name-face)
- ;;
- ;; Include args.
- (list (concat slash includes arg)
- (+ (regexp-opt-depth includes) arg-depth)
- 'font-lock-builtin-face)
- (list (concat slash includes-opt opt arg)
- (+ (regexp-opt-depth includes-opt) opt-depth arg-depth)
- 'font-lock-builtin-face)
- ;;
- ;; Definitions. I think.
- '("^[ \t]*\\\\def\\\\\\(\\(\\w\\|@\\)+\\)"
- 1 font-lock-function-name-face)
- )))
- "Subdued expressions to highlight in TeX modes.")
-
-(defconst tex-font-lock-keywords-2
- (append tex-font-lock-keywords-1
- (eval-when-compile
- (let* (;;
- ;; Names of commands whose arg should be fontified with fonts.
- (bold (regexp-opt '("bf" "textbf" "textsc" "textup"
- "boldsymbol" "pmb") t))
- (italic (regexp-opt '("it" "textit" "textsl" "emph") t))
- (type (regexp-opt '("texttt" "textmd" "textrm" "textsf") t))
- ;;
- ;; Names of commands whose arg should be fontified as a citation.
- (citations (regexp-opt
- '("label" "ref" "pageref" "vref" "eqref")
- t))
- (citations-opt (regexp-opt
- '("cite" "caption" "index" "glossary"
- "footnote" "footnotemark" "footnotetext")
- t))
- ;;
- ;; Names of commands that should be fontified.
- (specials (regexp-opt
- '("\\"
- "linebreak" "nolinebreak" "pagebreak" "nopagebreak"
- "newline" "newpage" "clearpage" "cleardoublepage"
- "displaybreak" "allowdisplaybreaks" "enlargethispage")
- t))
- (general "\\([a-zA-Z@]+\\**\\|[^ \t\n]\\)")
- ;;
- ;; Miscellany.
- (slash "\\\\")
- (opt "\\(\\[[^]]*\\]\\)?")
- (arg "{\\([^}]+\\)")
- (opt-depth (regexp-opt-depth opt))
- (arg-depth (regexp-opt-depth arg))
- )
- (list
- ;;
- ;; Citation args.
- (list (concat slash citations arg)
- (+ (regexp-opt-depth citations) arg-depth)
- 'font-lock-constant-face)
- (list (concat slash citations-opt opt arg)
- (+ (regexp-opt-depth citations-opt) opt-depth arg-depth)
- 'font-lock-constant-face)
- ;;
- ;; Command names, special and general.
- (cons (concat slash specials) 'font-lock-warning-face)
- (concat slash general)
- ;;
- ;; Font environments. It seems a bit dubious to use `bold' etc. faces
- ;; since we might not be able to display those fonts.
- (list (concat slash bold arg)
- (+ (regexp-opt-depth bold) arg-depth)
- '(quote bold) 'keep)
- (list (concat slash italic arg)
- (+ (regexp-opt-depth italic) arg-depth)
- '(quote italic) 'keep)
- (list (concat slash type arg)
- (+ (regexp-opt-depth type) arg-depth)
- '(quote bold-italic) 'keep)
- ;;
- ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables.
- (list (concat "\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>"
- "\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)")
- 3 '(if (match-beginning 2) 'bold 'italic) 'keep)
- ))))
- "Gaudy expressions to highlight in TeX modes.")
-
-(defvar tex-font-lock-keywords tex-font-lock-keywords-1
- "Default expressions to highlight in TeX modes.")
-\f