@@ -1,410 +1,235 @@
1−;; Math
1+;; General syntax
7−;; This highlights the whole environment like vimtex does
10− name: (word) @_env)) @text.math
12− "displaymath" "displaymath*"
13− "equation" "equation*"
14− "multline" "multline*"
15− "eqnarray" "eqnarray*"
21− "flalign" "flalign*"))
23−[
4+(command_name) @function
24− (generic_command_name)
27− "\\DeclareRobustCommand"
28− "\\DeclareMathOperator"
30− "\\caption"
5+(caption
42−] @function.macro
6+ command: _ @function)
45− "\\ref"
9+ key: (_) @variable.parameter
46− "\\vref"
10+ value: (_))
73− "\\cite"
13+ (comment)
74− "\\cite*"
14+ (line_comment)
75− "\\Cite"
15+ (block_comment)
76− "\\nocite"
16+ (comment_environment)
77− "\\citet"
17+] @comment
132− "\\ref"
20+ (brack_group)
133− "\\vref"
21+ (brack_group_argc)
134− "\\Vref"
22+] @variable.parameter
24+[(operator) "="] @operator
152−[
26+"\\item" @punctuation.special
28+((word) @punctuation.delimiter
29+ (#eq? @punctuation.delimiter "&"))
164−[
31+["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX
33+;; General environments
35+ command: _ @function.builtin
36+ name: (curly_group_text (text) @function.macro))
215− "\\acrshort"
39+ command: _ @function.builtin
216− "\\Acrshort"
40+ name: (curly_group_text (text) @function.macro))
218− "\\acrshortpl"
42+;; Definitions and references
219− "\\Acrshortpl"
43+(new_command_definition
220− "\\ACRshortpl"
44+ command: _ @function.macro
221− "\\acrlong"
45+ declaration: (curly_group_command_name (_) @function))
222− "\\Acrlong"
46+(old_command_definition
223− "\\ACRlong"
47+ command: _ @function.macro
224− "\\acrlongpl"
48+ declaration: (_) @function)
225− "\\Acrlongpl"
49+(let_command_definition
226− "\\ACRlongpl"
50+ command: _ @function.macro
227− "\\acrfull"
51+ declaration: (_) @function)
229− "\\ACRfull"
53+(environment_definition
230− "\\acrfullpl"
54+ command: _ @function.macro
231− "\\Acrfullpl"
55+ name: (curly_group_text (_) @constant))
233− "\\acs"
57+(theorem_definition
258−] @function.macro
58+ command: _ @function.macro
259−
59+ name: (curly_group_text (_) @constant))
260−(comment) @comment
60+
261−
61+(paired_delimiter_definition
262−(bracket_group) @variable.parameter
62+ command: _ @function.macro
263−
63+ declaration: (curly_group_command_name (_) @function))
264−[(math_operator) "="] @operator
266−[
65+(label_definition
267− "\\usepackage"
66+ command: _ @function.macro
268− "\\documentclass"
67+ name: (curly_group_text (_) @label))
269− "\\input"
68+(label_reference_range
270− "\\include"
69+ command: _ @function.macro
271− "\\subfile"
70+ from: (curly_group_text (_) @label)
272− "\\subfileinclude"
71+ to: (curly_group_text (_) @label))
273− "\\subfileinclude"
72+(label_reference
274− "\\includegraphics"
73+ command: _ @function.macro
275− "\\addbibresource"
74+ names: (curly_group_text_list (_) @label))
276− "\\bibliography"
75+(label_number
277− "\\includesvg"
76+ command: _ @function.macro
278− "\\includeinkscape"
77+ name: (curly_group_text (_) @label)
279− "\\usepgflibrary"
78+ number: (_) @markup.link.label)
281−] @keyword.control.import
284− "\\part"
81+ command: _ @function.macro
285− "\\chapter"
82+ keys: (curly_group_text_list) @string)
287− "\\subsection"
84+(glossary_entry_definition
288− "\\subsubsection"
85+ command: _ @function.macro
289− "\\paragraph"
86+ name: (curly_group_text (_) @string))
290− "\\subparagraph"
87+(glossary_entry_reference
291−] @type
88+ command: _ @function.macro
89+ name: (curly_group_text (_) @string))
92+ command: _ @function.macro
93+ name: (curly_group_text (_) @string))
95+ command: _ @function.macro
96+ name: (curly_group_text (_) @string))
99+ command: _ @function.macro
100+ name: (curly_group_text (_) @string))
102+ command: _ @function.macro
103+ name: (curly_group_text (_) @string))
293−"\\item" @punctuation.special
105+;; Math
295−((word) @punctuation.delimiter
107+(displayed_equation) @markup.raw.block
296−(#eq? @punctuation.delimiter "&"))
108+(inline_formula) @markup.raw.inline
298−["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
110+(math_environment
112+ command: _ @function.builtin
113+ name: (curly_group_text (text) @markup.raw)))
300−(label_definition
115+(math_environment
301− name: (_) @text.reference)
116+ (text) @markup.raw)
303− label: (_) @text.reference)
304−(equation_label_reference
305− label: (_) @text.reference)
307− label: (_) @text.reference)
309− label: (_) @text.reference)
311−(citation
118+(math_environment
312− key: (word) @text.reference)
119+ (end
120+ command: _ @function.builtin
121+ name: (curly_group_text (text) @markup.raw)))
314−(key_val_pair
123+;; Sectioning
315− key: (_) @variable.parameter
124+(title_declaration
316− value: (_))
125+ command: _ @namespace
126+ options: (brack_group (_) @markup.heading)?
127+ text: (curly_group (_) @markup.heading))
318−["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
129+(author_declaration
130+ command: _ @namespace
131+ authors: (curly_group_author_list
132+ ((author)+ @markup.heading)))
135+ command: _ @namespace
136+ toc: (brack_group (_) @markup.heading)?
321− text: (brace_group) @markup.heading)
137+ text: (curly_group (_) @markup.heading))
140+ command: _ @namespace
141+ toc: (brack_group (_) @markup.heading)?
324− text: (brace_group) @markup.heading)
142+ text: (curly_group (_) @markup.heading))
145+ command: _ @namespace
146+ toc: (brack_group (_) @markup.heading)?
327− text: (brace_group) @markup.heading)
147+ text: (curly_group (_) @markup.heading))
329(subsection
149(subsection
150+ command: _ @namespace
151+ toc: (brack_group (_) @markup.heading)?
330− text: (brace_group) @markup.heading)
152+ text: (curly_group (_) @markup.heading))
332(subsubsection
154(subsubsection
155+ command: _ @namespace
156+ toc: (brack_group (_) @markup.heading)?
333− text: (brace_group) @markup.heading)
157+ text: (curly_group (_) @markup.heading))
335(paragraph
159(paragraph
160+ command: _ @namespace
161+ toc: (brack_group (_) @markup.heading)?
336− text: (brace_group) @markup.heading)
162+ text: (curly_group (_) @markup.heading))
338(subparagraph
164(subparagraph
165+ command: _ @namespace
166+ toc: (brack_group (_) @markup.heading)?
339− text: (brace_group) @markup.heading)
167+ text: (curly_group (_) @markup.heading))
341−((environment
169+;; Beamer frames
343− name: (word) @_frame)
172+ name: (curly_group_text
345− child: (text) @markup.heading))
173+ (text) @markup.heading)
346− (#eq? @_frame "frame"))
174+ (#any-of? @markup.heading "frame"))
176+ (curly_group (_) @markup.heading))
348((generic_command
178((generic_command
349− name:(generic_command_name) @_name
179+ command: (command_name) @_name
350− arg: (brace_group
180+ arg: (curly_group
351 (text) @markup.heading))
181 (text) @markup.heading))
352− (#eq? @_name "\\frametitle"))
182+ (#eq? @_name "\\frametitle"))
354;; Formatting
184;; Formatting
356((generic_command
185((generic_command
357− name:(generic_command_name) @_name
186+ command: (command_name) @_name
358− arg: (_) @markup.italic)
187+ arg: (curly_group (_) @markup.italic))
359− (#eq? @_name "\\emph"))
188+ (#eq? @_name "\\emph"))
361((generic_command
190((generic_command
362− name:(generic_command_name) @_name
191+ command: (command_name) @_name
363− arg: (_) @markup.italic)
192+ arg: (curly_group (_) @markup.italic))
364− (#match? @_name "^(\\\\textit|\\\\mathit)$"))
193+ (#match? @_name "^(\\\\textit|\\\\mathit)$"))
366((generic_command
195((generic_command
367− name:(generic_command_name) @_name
196+ command: (command_name) @_name
368− arg: (_) @markup.bold)
197+ arg: (curly_group (_) @markup.bold))
369− (#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
198+ (#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
371((generic_command
200((generic_command
372− name:(generic_command_name) @_name
201+ command: (command_name) @_name
374− arg: (_) @markup.link.url)
203+ arg: (curly_group (_) @markup.link.uri))
375− (#match? @_name "^(\\\\url|\\\\href)$"))
204+ (#match? @_name "^(\\\\url|\\\\href)$"))
377−(ERROR) @error
206+;; File inclusion commands
379−[
208+ command: _ @keyword.storage.type
380− "\\begin"
209+ path: (curly_group_path) @string)
382−] @text.environment
211+(package_include
383−
212+ command: _ @keyword.storage.type
384−(begin
213+ paths: (curly_group_path_list) @string)
385− name: (_) @text.environment.name
214+
386− (#not-any-of? @text.environment.name
215+(latex_include
387− "displaymath" "displaymath*"
216+ command: _ @keyword.control.import
388− "equation" "equation*"
217+ path: (curly_group_path) @string)
389− "multline" "multline*"
218+(import_include
390− "eqnarray" "eqnarray*"
219+ command: _ @keyword.control.import
391− "align" "align*"
220+ directory: (curly_group_path) @string
392− "array" "array*"
221+ file: (curly_group_path) @string)
393− "split" "split*"
222+
394− "alignat" "alignat*"
223+(bibtex_include
395− "gather" "gather*"
224+ command: _ @keyword.control.import
396− "flalign" "flalign*"))
225+ path: (curly_group_path) @string)
397−
226+(biblatex_include
398−(end
227+ "\\addbibresource" @include
399− name: (_) @text.environment.name
228+ glob: (curly_group_glob_pattern) @string.regex)
400− (#not-any-of? @text.environment.name
229+
401− "displaymath" "displaymath*"
230+(graphics_include
402− "equation" "equation*"
231+ command: _ @keyword.control.import
403− "multline" "multline*"
232+ path: (curly_group_path) @string)
404− "eqnarray" "eqnarray*"
233+(tikz_library_import
405− "align" "align*"
234+ command: _ @keyword.control.import
406− "array" "array*"
235+ paths: (curly_group_path_list) @string)
408− "alignat" "alignat*"
410− "flalign" "flalign*"))