Skip to content

Commit faa2051

Browse files
authored
Merge pull request rxi#70 from lite-xl/improve-tex-syntax
Attempt to improve tex syntax highlighting
2 parents 2472c48 + e93bfb1 commit faa2051

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

plugins/language_tex.lua

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@ syntax.add {
55
files = { "%.tex$" },
66
comment = "%%",
77
patterns = {
8-
{ pattern = {"%%", "\n"}, type = "comment" },
9-
{ pattern = "&", type = "operator" },
10-
{ pattern = "\\\\", type = "operator" },
11-
{ pattern = {"%$", "%$"}, type = "operator" },
12-
{ pattern = {"\\%[", "\\]"}, type = "operator" },
13-
{ pattern = {"{", "}"}, type = "keyword" },
14-
{ pattern = "\\%w*", type = "keyword2" },
8+
{ pattern = "%%.-\n", type = "comment" },
9+
{ pattern = "\\documentclass().-{()%a%w+()}", type = {"keyword", "symbol", "function", "symbol"} },
10+
{ pattern = "\\usepackage", type = "keyword" },
11+
{ pattern = "\\chapter", type = "keyword" },
12+
{ pattern = "\\section", type = "keyword" },
13+
{ pattern = "\\subsection", type = "keyword" },
14+
{ pattern = "\\paragraph", type = "keyword" },
15+
{ pattern = "\\subparagraph", type = "keyword" },
16+
{ pattern = "\\begin(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
17+
{ pattern = "\\end(){()%a%w+()}", type = {"keyword2", "symbol", "function", "symbol"} },
18+
{ pattern = "\\%a%w+()%*", type = {"keyword2", "operator"} },
19+
{ pattern = "\\%a%w+", type = "keyword2" },
20+
{ pattern = "&", type = "operator" },
21+
{ pattern = "\\\\", type = "operator" },
22+
{ pattern = "%$", type = "operator" },
23+
{ pattern = "\\[%[%]()]", type = "operator" },
1524
},
1625
symbols = {}
1726
}

0 commit comments

Comments
 (0)