xref: /vim-8.2.3635/runtime/syntax/tex.vim (revision 325b7a2f)
1" Vim syntax file
2" Language:	TeX
3" Maintainer:	Dr. Charles E. Campbell, Jr. <[email protected]>
4" Last Change:	Jun 15, 2004
5" Version:	25
6" URL:		http://www.erols.com/astronaut/vim/index.html#vimlinks_syntax
7"
8" Notes: {{{1
9"
10" 1. If you have a \begin{verbatim} that appears to overrun its boundaries,
11"    use %stopzone.
12"
13" 2. Run-on equations ($..$ and $$..$$, particularly) can also be stopped
14"    by suitable use of %stopzone.
15"
16" 3. If you have a slow computer, you may wish to modify
17"
18"	syn sync maxlines=200
19"	syn sync minlines=50
20"
21"    to values that are more to your liking.
22"
23" 4. There is no match-syncing for $...$ and $$...$$; hence large
24"    equation blocks constructed that way may exhibit syncing problems.
25"    (there's no difference between begin/end patterns)
26"
27" 5. If you have the variable "g:tex_no_error" defined then none of the
28"    lexical error-checking will be done.
29"
30"    ie. let g:tex_no_error=1
31
32" Version Clears: {{{1
33" For version 5.x: Clear all syntax items
34" For version 6.x: Quit when a syntax file was already loaded
35if version < 600
36  syntax clear
37elseif exists("b:current_syntax")
38  finish
39endif
40
41" Define the default highlighting. {{{1
42" For version 5.7 and earlier: only when not done already
43" For version 5.8 and later: only when an item doesn't have highlighting yet
44if version >= 508 || !exists("did_tex_syntax_inits")
45 let did_tex_syntax_inits = 1
46 if version < 508
47  command -nargs=+ HiLink hi link <args>
48 else
49  command -nargs=+ HiLink hi def link <args>
50 endif
51endif
52if exists("g:tex_tex") && !exists("g:tex_no_error")
53 let g:tex_no_error= 1
54endif
55
56" Determine whether or not to use "*.sty" mode
57" The user may override the normal determination by setting
58"   g:tex_stylish to 1      (for    "*.sty" mode)
59"    or to           0 else (normal "*.tex" mode)
60" or on a buffer-by-buffer basis with b:tex_stylish
61let b:extfname=expand("%:e")
62if exists("g:tex_stylish")
63 let b:tex_stylish= g:tex_stylish
64elseif !exists("b:tex_stylish")
65 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
66  let b:tex_stylish= 1
67 else
68  let b:tex_stylish= 0
69 endif
70endif
71
72" (La)TeX keywords: only use the letters a-zA-Z {{{1
73" but _ is the only one that causes problems.
74if version < 600
75  set isk-=_
76  if b:tex_stylish
77    set isk+=@
78  endif
79else
80  setlocal isk-=_
81  if b:tex_stylish
82    setlocal isk+=@
83  endif
84endif
85
86" Clusters: {{{1
87" --------
88syn cluster texCmdGroup		contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
89if !exists("g:tex_no_error")
90 syn cluster texCmdGroup	add=texMathError
91endif
92syn cluster texEnvGroup		contains=texMatcher,texMathDelim,texSpecialChar,texStatement
93syn cluster texMatchGroup	contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption
94syn cluster texRefGroup		contains=texMatcher,texComment,texDelimiter
95if !exists("tex_no_math")
96 syn cluster texMathZones	contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
97 syn cluster texMatchGroup	add=@texMathZones
98 syn cluster texMathDelimGroup	contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
99 syn cluster texMathMatchGroup	contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone
100 syn cluster texMathZoneGroup	contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
101 if !exists("g:tex_no_error")
102  syn cluster texMathMatchGroup	add=texMathError
103  syn cluster texMathZoneGroup	add=texMathError
104 endif
105endif
106
107" Try to flag {} and () mismatches: {{{1
108if !exists("g:tex_no_error")
109 syn region texMatcher		matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]"	end="}"		contains=@texMatchGroup,texError
110 syn region texMatcher		matchgroup=Delimiter start="\["				end="]"		contains=@texMatchGroup,texError
111else
112 syn region texMatcher		matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]"	end="}"		contains=@texMatchGroup
113 syn region texMatcher		matchgroup=Delimiter start="\["				end="]"		contains=@texMatchGroup
114endif
115syn region texParen		start="("						end=")"		contains=@texMatchGroup
116if !exists("g:tex_no_error")
117 syn match  texError		"[}\])]"
118endif
119if !exists("tex_no_math")
120 if !exists("g:tex_no_error")
121  syn match  texMathError	"}"	contained
122 endif
123 syn region texMathMatcher	matchgroup=Delimiter start="{"  skip="\\\\\|\\}"  end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
124endif
125
126" TeX/LaTeX keywords: {{{1
127" Instead of trying to be All Knowing, I just match \..alphameric..
128" Note that *.tex files may not have "@" in their \commands
129if exists("g:tex_tex") || b:tex_stylish
130  syn match texStatement	"\\[a-zA-Z@]\+"
131else
132  syn match texStatement	"\\\a\+"
133  if !exists("g:tex_no_error")
134   syn match texError		"\\\a*@[a-zA-Z@]*"
135  endif
136endif
137
138" TeX/LaTeX delimiters: {{{1
139syn match texDelimiter		"&"
140syn match texDelimiter		"\\\\"
141
142" Tex/Latex Options: {{{1
143syn match texOption	"[^\\]\zs#\d\+\|^#\d\+"
144
145" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
146if b:tex_stylish
147  syn match texAccent		"\\[bcdvuH][^a-zA-Z@]"me=e-1
148  syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
149else
150  syn match texAccent		"\\[bcdvuH]\A"me=e-1
151  syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
152endif
153syn match texAccent		"\\[bcdvuH]$"
154syn match texAccent		+\\[=^.\~"`']+
155syn match texAccent		+\\['=t'.c^ud"vb~Hr]{\a}+
156syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
157
158" \begin{}/\end{} section markers: {{{1
159syn match  texSectionMarker	"\\begin\>\|\\end\>" nextgroup=texSectionName
160syn region texSectionName	matchgroup=Delimiter start="{" end="}"  contained nextgroup=texSectionModifier
161syn region texSectionModifier	matchgroup=Delimiter start="\[" end="]" contained
162
163" \documentclass, \documentstyle, \usepackage: {{{1
164syn match  texDocType		"\\documentclass\>\|\\documentstyle\>\|\\usepackage\>"	nextgroup=texSectionName,texDocTypeArgs
165syn region texDocTypeArgs	matchgroup=Delimiter start="\[" end="]"			contained	nextgroup=texSectionName
166
167" TeX input: {{{1
168syn match texInput		"\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7				contains=texStatement
169syn match texInputFile		"\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}"	contains=texStatement,texInputCurlies
170syn match texInputFile		"\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}"		contains=texStatement,texInputCurlies,texInputFileOpt
171syn match texInputCurlies	"[{}]"								contained
172syn region texInputFileOpt	matchgroup=Delimiter start="\[" end="\]"			contained
173
174" Type Styles (LaTeX 2.09): {{{1
175syn match texTypeStyle		"\\rm\>"
176syn match texTypeStyle		"\\em\>"
177syn match texTypeStyle		"\\bf\>"
178syn match texTypeStyle		"\\it\>"
179syn match texTypeStyle		"\\sl\>"
180syn match texTypeStyle		"\\sf\>"
181syn match texTypeStyle		"\\sc\>"
182syn match texTypeStyle		"\\tt\>"
183
184" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
185syn match texTypeStyle		"\\textbf\>"
186syn match texTypeStyle		"\\textit\>"
187syn match texTypeStyle		"\\textmd\>"
188syn match texTypeStyle		"\\textrm\>"
189syn match texTypeStyle		"\\textsc\>"
190syn match texTypeStyle		"\\textsf\>"
191syn match texTypeStyle		"\\textsl\>"
192syn match texTypeStyle		"\\texttt\>"
193syn match texTypeStyle		"\\textup\>"
194syn match texTypeStyle		"\\emph\>"
195
196syn match texTypeStyle		"\\mathbb\>"
197syn match texTypeStyle		"\\mathbf\>"
198syn match texTypeStyle		"\\mathcal\>"
199syn match texTypeStyle		"\\mathfrak\>"
200syn match texTypeStyle		"\\mathit\>"
201syn match texTypeStyle		"\\mathnormal\>"
202syn match texTypeStyle		"\\mathrm\>"
203syn match texTypeStyle		"\\mathsf\>"
204syn match texTypeStyle		"\\mathtt\>"
205
206syn match texTypeStyle		"\\rmfamily\>"
207syn match texTypeStyle		"\\sffamily\>"
208syn match texTypeStyle		"\\ttfamily\>"
209
210syn match texTypeStyle		"\\itshape\>"
211syn match texTypeStyle		"\\scshape\>"
212syn match texTypeStyle		"\\slshape\>"
213syn match texTypeStyle		"\\upshape\>"
214
215syn match texTypeStyle		"\\bfseries\>"
216syn match texTypeStyle		"\\mdseries\>"
217
218" Some type sizes: {{{1
219syn match texTypeSize		"\\tiny\>"
220syn match texTypeSize		"\\scriptsize\>"
221syn match texTypeSize		"\\footnotesize\>"
222syn match texTypeSize		"\\small\>"
223syn match texTypeSize		"\\normalsize\>"
224syn match texTypeSize		"\\large\>"
225syn match texTypeSize		"\\Large\>"
226syn match texTypeSize		"\\LARGE\>"
227syn match texTypeSize		"\\huge\>"
228syn match texTypeSize		"\\Huge\>"
229
230" Spacecodes (TeX'isms): {{{1
231" \mathcode`\^^@="2201  \delcode`\(="028300  \sfcode`\)=0 \uccode`X=`X  \lccode`x=`x
232syn match texSpaceCode		"\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
233syn match texSpaceCodeChar    "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)"	contained
234
235" Sections, subsections, etc: {{{1
236syn match texSection		"\\\(sub\)*section\*\=\>"
237syn match texSection		"\\\(title\|author\|part\|chapter\|paragraph\|subparagraph\)\>"
238syn match texSection		"\\begin\s*{\s*abstract\s*}\|\\end\s*{\s*abstract\s*}"
239
240" Bad Math (mismatched): {{{1
241if !exists("tex_no_math")
242 syn match texBadMath		"\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
243 syn match texBadMath		"\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
244 syn match texBadMath		"\\[\])]"
245endif
246
247" Math Zones: {{{1
248if !exists("tex_no_math")
249 " TexNewMathZone: creates a mathzone with the given suffix and mathzone name. {{{2
250 "                 Starred forms are created if starform is true.  Starred
251 "                 forms have syntax group and synchronization groups with a
252 "                 "S" appended.  Handles: cluster, syntax, sync, and HiLink.
253 fun! TexNewMathZone(sfx,mathzone,starform)
254   let grpname  = "texMathZone".a:sfx
255   let syncname = "texSyncMathZone".a:sfx
256   exe "syn cluster texMathZones add=".grpname
257   exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'
258   exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
259   exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
260   exe 'HiLink '.grpname.' texMath'
261   if a:starform
262    let grpname  = "texMathZone".a:sfx.'S'
263    let syncname = "texSyncMathZone".a:sfx.'S'
264    exe "syn cluster texMathZones add=".grpname
265    exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'
266    exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
267    exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
268    exe 'HiLink '.grpname.' texMath'
269   endif
270 endfun
271
272 " Standard Math Zones: {{{2
273 call TexNewMathZone("A","align",1)
274 call TexNewMathZone("B","alignat",1)
275 call TexNewMathZone("C","displaymath",1)
276 call TexNewMathZone("D","eqnarray",1)
277 call TexNewMathZone("E","equation",1)
278 call TexNewMathZone("F","flalign",1)
279 call TexNewMathZone("G","gather",1)
280 call TexNewMathZone("H","math",1)
281 call TexNewMathZone("I","multline",1)
282 call TexNewMathZone("J","subequations",0)
283 call TexNewMathZone("K","xalignat",1)
284 call TexNewMathZone("L","xxalignat",0)
285
286 " Inline Math Zones: {{{2
287 syn region texMathZoneV	matchgroup=Delimiter start="\\("	matchgroup=Delimiter end="\\)\|%stopzone\>"	keepend contains=@texMathZoneGroup
288 syn region texMathZoneW	matchgroup=Delimiter start="\\\["	matchgroup=Delimiter end="\\]\|%stopzone\>"	keepend contains=@texMathZoneGroup
289 syn region texMathZoneX	matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>"	contains=@texMathZoneGroup
290 syn region texMathZoneY	matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>"	keepend		contains=@texMathZoneGroup
291 syn region texMathZoneZ	matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>"	contains=@texMathZoneGroup
292
293 syn match texMathOper		"[_^=]" contained
294
295 " \left..something.. and \right..something.. support: {{{2
296 syn match   texMathDelimBad	contained		"\S"
297 syn match   texMathDelim	contained		"\\\(left\|right\|[bB]igg\=[lr]\)\>"	skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
298 syn match   texMathDelim	contained		"\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
299 syn match   texMathDelim	contained		"\\lefteqn\>"
300 syn match   texMathDelimSet2	contained	"\\"		nextgroup=texMathDelimKey,texMathDelimBad
301 syn match   texMathDelimSet1	contained	"[<>()[\]|/.]\|\\[{}|]"
302 syn keyword texMathDelimKey	contained	backslash       lceil           lVert           rgroup          uparrow
303 syn keyword texMathDelimKey	contained	downarrow       lfloor          rangle          rmoustache      Uparrow
304 syn keyword texMathDelimKey	contained	Downarrow       lgroup          rbrace          rvert           updownarrow
305 syn keyword texMathDelimKey	contained	langle          lmoustache      rceil           rVert           Updownarrow
306 syn keyword texMathDelimKey	contained	lbrace          lvert           rfloor
307endif
308
309" Special TeX characters  ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
310syn match texSpecialChar	"\\[$&%#{}_]"
311if b:tex_stylish
312  syn match texSpecialChar	"\\[SP@][^a-zA-Z@]"me=e-1
313else
314  syn match texSpecialChar	"\\[SP@]\A"me=e-1
315endif
316syn match texSpecialChar	"\\\\"
317if !exists("tex_no_math")
318 syn match texOnlyMath		"[_^]"
319endif
320syn match texSpecialChar	"\^\^[0-9a-f]\{2}\|\^\^\S"
321
322" Comments: {{{1
323"    Normal TeX LaTeX     :   %....
324"    Documented TeX Format:  ^^A...	-and-	leading %s (only)
325syn cluster texCommentGroup	contains=texTodo,@Spell
326syn case ignore
327syn keyword texTodo		contained		combak	fixme	todo
328syn case match
329if b:extfname == "dtx"
330  syn match texComment		"\^\^A.*$"	contains=@texCommentGroup
331  syn match texComment		"^%\+"		contains=@texCommentGroup
332else
333  syn match texComment		"%.*$"		contains=@texCommentGroup
334endif
335
336" Separate lines used for verb` and verb# so that the end conditions {{{1
337" will appropriately terminate.  Ideally vim would let me save a
338" character from the start pattern and re-use it in the end-pattern.
339syn region texZone		start="\\begin{verbatim}"		end="\\end{verbatim}\|%stopzone\>"
340if version < 600
341 syn region texZone		start="\\verb\*\=`"			end="`\|%stopzone\>"
342 syn region texZone		start="\\verb\*\=#"			end="#\|%stopzone\>"
343else
344  if b:tex_stylish
345    syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z@]\)"	end="\z1\|%stopzone\>"
346  else
347    syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z]\)"	end="\z1\|%stopzone\>"
348  endif
349endif
350
351" Tex Reference Zones: {{{1
352syn region texZone		matchgroup=texStatement start="@samp{"			end="}\|%stopzone\>"	contains=@texRefGroup
353syn region texRefZone		matchgroup=texStatement start="\\nocite{"		end="}\|%stopzone\>"	contains=@texRefGroup
354syn region texRefZone		matchgroup=texStatement start="\\bibliography{"		end="}\|%stopzone\>"	contains=@texRefGroup
355syn region texRefZone		matchgroup=texStatement start="\\cite\([tp]\*\=\)\={"	end="}\|%stopzone\>"	contains=@texRefGroup
356syn region texRefZone		matchgroup=texStatement start="\\label{"		end="}\|%stopzone\>"	contains=@texRefGroup
357syn region texRefZone		matchgroup=texStatement start="\\\(page\|eq\)ref{"	end="}\|%stopzone\>"	contains=@texRefGroup
358syn region texRefZone		matchgroup=texStatement start="\\v\=ref{"		end="}\|%stopzone\>"	contains=@texRefGroup
359
360" Handle newcommand, newenvironment : {{{1
361syn match  texNewCmd				"\\newcommand\>"			nextgroup=texCmdName skipwhite skipnl
362syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
363syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]"		nextgroup=texCmdBody skipwhite skipnl
364syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]"	matchgroup=Delimiter end="}" contains=@texCmdGroup
365syn match  texNewEnv				"\\newenvironment\>"			nextgroup=texEnvName skipwhite skipnl
366syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texEnvBgn skipwhite skipnl
367syn region texEnvBgn  contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
368syn region texEnvEnd  contained matchgroup=Delimiter start="{"rs=s+1  end="}"		skipwhite skipnl contains=@texEnvGroup
369
370" Definitions/Commands: {{{1
371syn match texDefCmd				"\\def\>"				nextgroup=texDefName skipwhite skipnl
372if b:tex_stylish
373  syn match texDefName contained		"\\[a-zA-Z@]\+"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
374  syn match texDefName contained		"\\[^a-zA-Z@]"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
375else
376  syn match texDefName contained		"\\\a\+"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
377  syn match texDefName contained		"\\\A"					nextgroup=texDefParms,texCmdBody skipwhite skipnl
378endif
379syn match texDefParms  contained		"#[^{]*"	contains=texDefParm	nextgroup=texCmdBody skipwhite skipnl
380syn match  texDefParm  contained		"#\d\+"
381
382" TeX Lengths: {{{1
383syn match  texLength		"\<\d\+\(\.\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>"
384
385" TeX String Delimiters: {{{1
386syn match texString		"\(``\|''\|,,\)"
387
388" LaTeX synchronization: {{{1
389syn sync maxlines=200
390syn sync minlines=50
391
392syn  sync match texSyncStop			groupthere NONE		"%stopzone\>"
393
394" Synchronization: {{{1
395" The $..$ and $$..$$ make for impossible sync patterns
396" (one can't tell if a "$$" starts or stops a math zone by itself)
397" The following grouptheres coupled with minlines above
398" help improve the odds of good syncing.
399if !exists("tex_no_math")
400 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{abstract}"
401 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{center}"
402 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{description}"
403 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{enumerate}"
404 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{itemize}"
405 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{table}"
406 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{tabular}"
407 syn sync match texSyncMathZoneA		groupthere NONE		"\\\(sub\)*section\>"
408endif
409
410" Highlighting: {{{1
411if did_tex_syntax_inits == 1
412 let did_tex_syntax_inits= 2
413  " TeX highlighting groups which should share similar highlighting
414  if !exists("g:tex_no_error")
415   if !exists("tex_no_math")
416    HiLink texBadMath		texError
417    HiLink texMathDelimBad	texError
418    HiLink texMathError		texError
419    if !b:tex_stylish
420      HiLink texOnlyMath	texError
421    endif
422   endif
423   HiLink texError		Error
424  endif
425
426  HiLink texDefCmd		texDef
427  HiLink texDefName		texDef
428  HiLink texDocType		texCmdName
429  HiLink texDocTypeArgs		texCmdArgs
430  HiLink texInputFileOpt	texCmdArgs
431  HiLink texInputCurlies	texDelimiter
432  HiLink texLigature		texSpecialChar
433  if !exists("tex_no_math")
434   HiLink texMathDelimSet1	texMathDelim
435   HiLink texMathDelimSet2	texMathDelim
436   HiLink texMathDelimKey	texMathDelim
437   HiLink texMathMatcher	texMath
438   HiLink texMathZoneW		texMath
439   HiLink texMathZoneX		texMath
440   HiLink texMathZoneY		texMath
441   HiLink texMathZoneZ		texMath
442  endif
443  HiLink texSectionMarker	texCmdName
444  HiLink texSectionName		texSection
445  HiLink texSpaceCode		texStatement
446  HiLink texTypeSize		texType
447  HiLink texTypeStyle		texType
448
449   " Basic TeX highlighting groups
450  HiLink texCmdArgs		Number
451  HiLink texCmdName		Statement
452  HiLink texComment		Comment
453  HiLink texDef			Statement
454  HiLink texDefParm		Special
455  HiLink texDelimiter		Delimiter
456  HiLink texInput		Special
457  HiLink texInputFile		Special
458  HiLink texLength		Number
459  HiLink texMath		Special
460  HiLink texMathDelim		Statement
461  HiLink texMathOper		Operator
462  HiLink texNewCmd		Statement
463  HiLink texNewEnv		Statement
464  HiLink texOption		Number
465  HiLink texRefZone		Special
466  HiLink texSection		PreCondit
467  HiLink texSpaceCodeChar	Special
468  HiLink texSpecialChar		SpecialChar
469  HiLink texStatement		Statement
470  HiLink texString		String
471  HiLink texTodo		Todo
472  HiLink texType		Type
473  HiLink texZone		PreCondit
474
475  delcommand HiLink
476endif
477
478" Current Syntax: {{{1
479unlet b:extfname
480let   b:current_syntax = "tex"
481" vim: ts=8 fdm=marker
482