1 rizwank 1.1 /**
2 * Name: tex
3 * Description: TeX/LaTeX command, comment and math highlighting.
4 * Author: Toni Giorgino <toni@pcape2.pi.infn.it>
5 */
6
7 /* Syntactically highlights _every_ TeX command. A more specialized
8 * LaTeX mode might instead operate by keyword, eg. reproducing text
9 * emphasis and boldface, perhaps cluttering the output too much.
10 * Label and reference highlighting is a better candidate for a To Do
11 * list. Please report modifications. TG
12 */
13
14 state tex extends HighlightEntry
15 {
16 /* escaped comment mark */
17 /\\\\%/ {
18 language_print ($0);
19 }
20
21 /* comment */
22 rizwank 1.1 /%/ {
23 comment_face (true);
24 language_print ($0);
25 call (eat_one_line);
26 comment_face (false);
27 }
28
29 /* one non-letter commands */
30 /\\\\[^[:alpha:]]/ {
31 keyword_face (true);
32 language_print ($0);
33 keyword_face (false);
34 }
35
36 /* multi letter commands */
37 /\\\\[[:alpha:]]+/ {
38 keyword_face (true);
39 language_print ($0);
40 keyword_face (false);
41 }
42
43 rizwank 1.1 /* display math environment */
44 /\$\$[^$]+\$\$/ {
45 string_face (true);
46 language_print ($0);
47 string_face (false);
48 }
49
50 /* inline math environment */
51 /\$[^$]+\$/ {
52 variable_name_face (true);
53 language_print ($0);
54 variable_name_face (false);
55 }
56 }
57
58
59 /*
60 Local variables:
61 mode: c
62 End:
63 */
|