@@ -1,410 +1,235 @@
1−;; Math
2−[
3− (displayed_equation)
4− (inline_formula)
5−] @text.math
6−
7−;; This highlights the whole environment like vimtex does
8−((environment
9− (begin
10− name: (word) @_env)) @text.math
11− (#any-of? @_env
12− "displaymath" "displaymath*"
13− "equation" "equation*"
14− "multline" "multline*"
15− "eqnarray" "eqnarray*"
16− "align" "align*"
17− "array" "array*"
18− "split" "split*"
19− "alignat" "alignat*"
20− "gather" "gather*"
21− "flalign" "flalign*"))
1+;; General syntax
2+(ERROR) @error
223
23−[
24− (generic_command_name)
25− "\\newcommand"
26− "\\renewcommand"
27− "\\DeclareRobustCommand"
28− "\\DeclareMathOperator"
29− "\\newglossaryentry"
30− "\\caption"
31− "\\label"
32− "\\newlabel"
33− "\\color"
34− "\\colorbox"
35− "\\textcolor"
36− "\\pagecolor"
37− "\\definecolor"
38− "\\definecolorset"
39− "\\newtheorem"
40− "\\declaretheorem"
41− "\\newacronym"
42−] @function.macro
4+(command_name) @function
5+(caption
6+ command: _ @function)
437
44−[
45− "\\ref"
46− "\\vref"
47− "\\Vref"
48− "\\autoref"
49− "\\pageref"
50− "\\cref"
51− "\\Cref"
52− "\\cref*"
53− "\\Cref*"
54− "\\namecref"
55− "\\nameCref"
56− "\\lcnamecref"
57− "\\namecrefs"
58− "\\nameCrefs"
59− "\\lcnamecrefs"
60− "\\labelcref"
61− "\\labelcpageref"
62− "\\crefrange"
63− "\\crefrange"
64− "\\Crefrange"
65− "\\Crefrange"
66− "\\crefrange*"
67− "\\crefrange*"
68− "\\Crefrange*"
69− "\\Crefrange*"
70−] @function.macro
8+(key_value_pair
9+ key: (_) @variable.parameter
10+ value: (_))
7111
7212[
73− "\\cite"
74− "\\cite*"
75− "\\Cite"
76− "\\nocite"
77− "\\citet"
78− "\\citep"
79− "\\citet*"
80− "\\citep*"
81− "\\citeauthor"
82− "\\citeauthor*"
83− "\\Citeauthor"
84− "\\Citeauthor*"
85− "\\citetitle"
86− "\\citetitle*"
87− "\\citeyear"
88− "\\citeyear*"
89− "\\citedate"
90− "\\citedate*"
91− "\\citeurl"
92− "\\fullcite"
93− "\\citeyearpar"
94− "\\citealt"
95− "\\citealp"
96− "\\citetext"
97− "\\parencite"
98− "\\parencite*"
99− "\\Parencite"
100− "\\footcite"
101− "\\footfullcite"
102− "\\footcitetext"
103− "\\textcite"
104− "\\Textcite"
105− "\\smartcite"
106− "\\Smartcite"
107− "\\supercite"
108− "\\autocite"
109− "\\Autocite"
110− "\\autocite*"
111− "\\Autocite*"
112− "\\volcite"
113− "\\Volcite"
114− "\\pvolcite"
115− "\\Pvolcite"
116− "\\fvolcite"
117− "\\ftvolcite"
118− "\\svolcite"
119− "\\Svolcite"
120− "\\tvolcite"
121− "\\Tvolcite"
122− "\\avolcite"
123− "\\Avolcite"
124− "\\notecite"
125− "\\notecite"
126− "\\pnotecite"
127− "\\Pnotecite"
128− "\\fnotecite"
129−] @function.macro
13+ (comment)
14+ (line_comment)
15+ (block_comment)
16+ (comment_environment)
17+] @comment
13018
13119[
132− "\\ref"
133− "\\vref"
134− "\\Vref"
135− "\\autoref"
136− "\\pageref"
137− "\\cref"
138− "\\Cref"
139− "\\cref*"
140− "\\Cref*"
141− "\\namecref"
142− "\\nameCref"
143− "\\lcnamecref"
144− "\\namecrefs"
145− "\\nameCrefs"
146− "\\lcnamecrefs"
147− "\\labelcref"
148− "\\labelcpageref"
149−] @function.macro
20+ (brack_group)
21+ (brack_group_argc)
22+] @variable.parameter
15023
24+[(operator) "="] @operator
15125
152−[
153− "\\crefrange"
154− "\\crefrange"
155− "\\Crefrange"
156− "\\Crefrange"
157− "\\crefrange*"
158− "\\crefrange*"
159− "\\Crefrange*"
160− "\\Crefrange*"
161−] @function.macro
26+"\\item" @punctuation.special
16227
28+((word) @punctuation.delimiter
29+ (#eq? @punctuation.delimiter "&"))
16330
164−[
165− "\\gls"
166− "\\Gls"
167− "\\GLS"
168− "\\glspl"
169− "\\Glspl"
170− "\\GLSpl"
171− "\\glsdisp"
172− "\\glslink"
173− "\\glstext"
174− "\\Glstext"
175− "\\GLStext"
176− "\\glsfirst"
177− "\\Glsfirst"
178− "\\GLSfirst"
179− "\\glsplural"
180− "\\Glsplural"
181− "\\GLSplural"
182− "\\glsfirstplural"
183− "\\Glsfirstplural"
184− "\\GLSfirstplural"
185− "\\glsname"
186− "\\Glsname"
187− "\\GLSname"
188− "\\glssymbol"
189− "\\Glssymbol"
190− "\\glsdesc"
191− "\\Glsdesc"
192− "\\GLSdesc"
193− "\\glsuseri"
194− "\\Glsuseri"
195− "\\GLSuseri"
196− "\\glsuserii"
197− "\\Glsuserii"
198− "\\GLSuserii"
199− "\\glsuseriii"
200− "\\Glsuseriii"
201− "\\GLSuseriii"
202− "\\glsuseriv"
203− "\\Glsuseriv"
204− "\\GLSuseriv"
205− "\\glsuserv"
206− "\\Glsuserv"
207− "\\GLSuserv"
208− "\\glsuservi"
209− "\\Glsuservi"
210− "\\GLSuservi"
211−] @function.macro
31+["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX
21232
33+;; General environments
34+(begin
35+ command: _ @function.builtin
36+ name: (curly_group_text (text) @function.macro))
21337
214−[
215− "\\acrshort"
216− "\\Acrshort"
217− "\\ACRshort"
218− "\\acrshortpl"
219− "\\Acrshortpl"
220− "\\ACRshortpl"
221− "\\acrlong"
222− "\\Acrlong"
223− "\\ACRlong"
224− "\\acrlongpl"
225− "\\Acrlongpl"
226− "\\ACRlongpl"
227− "\\acrfull"
228− "\\Acrfull"
229− "\\ACRfull"
230− "\\acrfullpl"
231− "\\Acrfullpl"
232− "\\ACRfullpl"
233− "\\acs"
234− "\\Acs"
235− "\\acsp"
236− "\\Acsp"
237− "\\acl"
238− "\\Acl"
239− "\\aclp"
240− "\\Aclp"
241− "\\acf"
242− "\\Acf"
243− "\\acfp"
244− "\\Acfp"
245− "\\ac"
246− "\\Ac"
247− "\\acp"
248− "\\glsentrylong"
249− "\\Glsentrylong"
250− "\\glsentrylongpl"
251− "\\Glsentrylongpl"
252− "\\glsentryshort"
253− "\\Glsentryshort"
254− "\\glsentryshortpl"
255− "\\Glsentryshortpl"
256− "\\glsentryfullpl"
257− "\\Glsentryfullpl"
258−] @function.macro
259−
260−(comment) @comment
261−
262−(bracket_group) @variable.parameter
263−
264−[(math_operator) "="] @operator
38+(end
39+ command: _ @function.builtin
40+ name: (curly_group_text (text) @function.macro))
41+
42+;; Definitions and references
43+(new_command_definition
44+ command: _ @function.macro
45+ declaration: (curly_group_command_name (_) @function))
46+(old_command_definition
47+ command: _ @function.macro
48+ declaration: (_) @function)
49+(let_command_definition
50+ command: _ @function.macro
51+ declaration: (_) @function)
52+
53+(environment_definition
54+ command: _ @function.macro
55+ name: (curly_group_text (_) @constant))
56+
57+(theorem_definition
58+ command: _ @function.macro
59+ name: (curly_group_text (_) @constant))
60+
61+(paired_delimiter_definition
62+ command: _ @function.macro
63+ declaration: (curly_group_command_name (_) @function))
26564
266−[
267− "\\usepackage"
268− "\\documentclass"
269− "\\input"
270− "\\include"
271− "\\subfile"
272− "\\subfileinclude"
273− "\\subfileinclude"
274− "\\includegraphics"
275− "\\addbibresource"
276− "\\bibliography"
277− "\\includesvg"
278− "\\includeinkscape"
279− "\\usepgflibrary"
280− "\\usetikzlibrary"
281−] @keyword.control.import
65+(label_definition
66+ command: _ @function.macro
67+ name: (curly_group_text (_) @label))
68+(label_reference_range
69+ command: _ @function.macro
70+ from: (curly_group_text (_) @label)
71+ to: (curly_group_text (_) @label))
72+(label_reference
73+ command: _ @function.macro
74+ names: (curly_group_text_list (_) @label))
75+(label_number
76+ command: _ @function.macro
77+ name: (curly_group_text (_) @label)
78+ number: (_) @markup.link.label)
28279
283−[
284− "\\part"
285− "\\chapter"
286− "\\section"
287− "\\subsection"
288− "\\subsubsection"
289− "\\paragraph"
290− "\\subparagraph"
291−] @type
80+(citation
81+ command: _ @function.macro
82+ keys: (curly_group_text_list) @string)
83+
84+(glossary_entry_definition
85+ command: _ @function.macro
86+ name: (curly_group_text (_) @string))
87+(glossary_entry_reference
88+ command: _ @function.macro
89+ name: (curly_group_text (_) @string))
90+
91+(acronym_definition
92+ command: _ @function.macro
93+ name: (curly_group_text (_) @string))
94+(acronym_reference
95+ command: _ @function.macro
96+ name: (curly_group_text (_) @string))
97+
98+(color_definition
99+ command: _ @function.macro
100+ name: (curly_group_text (_) @string))
101+(color_reference
102+ command: _ @function.macro
103+ name: (curly_group_text (_) @string))
292104
293−"\\item" @punctuation.special
105+;; Math
294106
295−((word) @punctuation.delimiter
296−(#eq? @punctuation.delimiter "&"))
107+(displayed_equation) @markup.raw.block
108+(inline_formula) @markup.raw.inline
297109
298−["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
110+(math_environment
111+ (begin
112+ command: _ @function.builtin
113+ name: (curly_group_text (text) @markup.raw)))
299114
300−(label_definition
301− name: (_) @text.reference)
302−(label_reference
303− label: (_) @text.reference)
304−(equation_label_reference
305− label: (_) @text.reference)
306−(label_reference
307− label: (_) @text.reference)
308−(label_number
309− label: (_) @text.reference)
115+(math_environment
116+ (text) @markup.raw)
310117
311−(citation
312− key: (word) @text.reference)
118+(math_environment
119+ (end
120+ command: _ @function.builtin
121+ name: (curly_group_text (text) @markup.raw)))
313122
314−(key_val_pair
315− key: (_) @variable.parameter
316− value: (_))
123+;; Sectioning
124+(title_declaration
125+ command: _ @namespace
126+ options: (brack_group (_) @markup.heading)?
127+ text: (curly_group (_) @markup.heading))
317128
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)))
319133
320134(chapter
321− text: (brace_group) @markup.heading)
135+ command: _ @namespace
136+ toc: (brack_group (_) @markup.heading)?
137+ text: (curly_group (_) @markup.heading))
322138
323139(part
324− text: (brace_group) @markup.heading)
140+ command: _ @namespace
141+ toc: (brack_group (_) @markup.heading)?
142+ text: (curly_group (_) @markup.heading))
325143
326144(section
327− text: (brace_group) @markup.heading)
145+ command: _ @namespace
146+ toc: (brack_group (_) @markup.heading)?
147+ text: (curly_group (_) @markup.heading))
328148
329149(subsection
330− text: (brace_group) @markup.heading)
150+ command: _ @namespace
151+ toc: (brack_group (_) @markup.heading)?
152+ text: (curly_group (_) @markup.heading))
331153
332154(subsubsection
333− text: (brace_group) @markup.heading)
155+ command: _ @namespace
156+ toc: (brack_group (_) @markup.heading)?
157+ text: (curly_group (_) @markup.heading))
334158
335159(paragraph
336− text: (brace_group) @markup.heading)
160+ command: _ @namespace
161+ toc: (brack_group (_) @markup.heading)?
162+ text: (curly_group (_) @markup.heading))
337163
338164(subparagraph
339− text: (brace_group) @markup.heading)
165+ command: _ @namespace
166+ toc: (brack_group (_) @markup.heading)?
167+ text: (curly_group (_) @markup.heading))
340168
341−((environment
169+;; Beamer frames
170+(generic_environment
342171 (begin
343− name: (word) @_frame)
344− (brace_group
345− child: (text) @markup.heading))
346− (#eq? @_frame "frame"))
172+ name: (curly_group_text
173+ (text) @markup.heading)
174+ (#any-of? @markup.heading "frame"))
175+ .
176+ (curly_group (_) @markup.heading))
347177
348178((generic_command
349− name:(generic_command_name) @_name
350− arg: (brace_group
179+ command: (command_name) @_name
180+ arg: (curly_group
351181 (text) @markup.heading))
352− (#eq? @_name "\\frametitle"))
182+ (#eq? @_name "\\frametitle"))
353183
354184;; Formatting
355−
356185((generic_command
357− name:(generic_command_name) @_name
358− arg: (_) @markup.italic)
359− (#eq? @_name "\\emph"))
186+ command: (command_name) @_name
187+ arg: (curly_group (_) @markup.italic))
188+ (#eq? @_name "\\emph"))
360189
361190((generic_command
362− name:(generic_command_name) @_name
363− arg: (_) @markup.italic)
364− (#match? @_name "^(\\\\textit|\\\\mathit)$"))
191+ command: (command_name) @_name
192+ arg: (curly_group (_) @markup.italic))
193+ (#match? @_name "^(\\\\textit|\\\\mathit)$"))
365194
366195((generic_command
367− name:(generic_command_name) @_name
368− arg: (_) @markup.bold)
369− (#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
196+ command: (command_name) @_name
197+ arg: (curly_group (_) @markup.bold))
198+ (#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
370199
371200((generic_command
372− name:(generic_command_name) @_name
201+ command: (command_name) @_name
373202 .
374− arg: (_) @markup.link.url)
375− (#match? @_name "^(\\\\url|\\\\href)$"))
376−
377−(ERROR) @error
378−
379−[
380− "\\begin"
381− "\\end"
382−] @text.environment
383−
384−(begin
385− name: (_) @text.environment.name
386− (#not-any-of? @text.environment.name
387− "displaymath" "displaymath*"
388− "equation" "equation*"
389− "multline" "multline*"
390− "eqnarray" "eqnarray*"
391− "align" "align*"
392− "array" "array*"
393− "split" "split*"
394− "alignat" "alignat*"
395− "gather" "gather*"
396− "flalign" "flalign*"))
397−
398−(end
399− name: (_) @text.environment.name
400− (#not-any-of? @text.environment.name
401− "displaymath" "displaymath*"
402− "equation" "equation*"
403− "multline" "multline*"
404− "eqnarray" "eqnarray*"
405− "align" "align*"
406− "array" "array*"
407− "split" "split*"
408− "alignat" "alignat*"
409− "gather" "gather*"
410− "flalign" "flalign*"))
203+ arg: (curly_group (_) @markup.link.uri))
204+ (#match? @_name "^(\\\\url|\\\\href)$"))
205+
206+;; File inclusion commands
207+(class_include
208+ command: _ @keyword.storage.type
209+ path: (curly_group_path) @string)
210+
211+(package_include
212+ command: _ @keyword.storage.type
213+ paths: (curly_group_path_list) @string)
214+
215+(latex_include
216+ command: _ @keyword.control.import
217+ path: (curly_group_path) @string)
218+(import_include
219+ command: _ @keyword.control.import
220+ directory: (curly_group_path) @string
221+ file: (curly_group_path) @string)
222+
223+(bibtex_include
224+ command: _ @keyword.control.import
225+ path: (curly_group_path) @string)
226+(biblatex_include
227+ "\\addbibresource" @include
228+ glob: (curly_group_glob_pattern) @string.regex)
229+
230+(graphics_include
231+ command: _ @keyword.control.import
232+ path: (curly_group_path) @string)
233+(tikz_library_import
234+ command: _ @keyword.control.import
235+ paths: (curly_group_path_list) @string)