4 " Maintainer: Dr. Charles E. Campbell, Jr. <Charles.E.Campbell.1@gsfc.nasa.gov>
5 " Last Change: May 16, 2001
9 " 1. If you have a \begin{verbatim} that appears to overrun its boundaries,
12 " 2. Run-on equations ($..$ and $$..$$, particularly) can also be stopped
13 " by suitable use of %stopzone.
15 " 3. If you have a slow computer, you may wish to modify
17 " syn sync maxlines=200
18 " syn sync minlines=50
20 " to values that are more to your liking.
22 " 4. There is no match-syncing for $...$ and $$...$$; hence large
23 " equation blocks constructed that way may exhibit syncing problems.
24 " (there's no difference between begin/end patterns)
26 " 5. If you have the variable "tex_no_error" defined then none of the
27 " lexical error-checking will be done.
29 " ie. let tex_no_error=1
31 " For version 5.x: Clear all syntax items
32 " For version 6.x: Quit when a syntax file was already loaded
35 elseif exists("b:current_syntax")
39 " (La)TeX keywords only use the letters a-zA-Z
40 " but _ is the only one that causes problems.
41 let b:extfname=expand("%:e")
44 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
49 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
56 syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathError,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
57 syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
58 syn cluster texMatchGroup contains=@texMathZones,texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile
59 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
60 syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathError,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone
61 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathError,texMathMatcher,texMathOper,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
62 syn cluster texMathZones contains=texMathZoneA,texMathZoneB,texMathZoneC,texMathZoneD,texMathZoneE,texMathZoneF,texMathZoneG,texMathZoneH,texMathZoneI,texMathZoneJ,texMathZoneK,texMathZoneL,texMathZoneM,texMathZoneN,texMathZoneO,texMathZoneP,texMathZoneQ,texMathZoneR,texMathZoneS,texMathZoneT,texMathZoneU,texMathZoneV,texMathZoneW
64 " Try to flag {} and () mismatches
65 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
66 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError
67 syn region texParen start="(" end=")" contains=@texMatchGroup
68 syn match texError "[}\])]"
69 syn match texMathError "}" contained
70 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
73 " Instead of trying to be All Knowing, I just match \..alphameric..
74 " Note that *.tex files may not have "@" in their \commands
75 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
76 syn match texStatement "\\[a-zA-Z@]\+"
78 syn match texStatement "\\\a\+"
79 syn match texError "\\\a*@[a-zA-Z@]*"
82 " TeX/LaTeX delimiters
83 syn match texDelimiter "&"
84 syn match texDelimiter "\\\\"
86 " texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents
87 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
88 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
89 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
91 syn match texAccent "\\[bcdvuH]\A"me=e-1
92 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
94 syn match texAccent "\\[bcdvuH]$"
95 syn match texAccent +\\[=^.\~"`']+
96 syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
97 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
99 " \begin{}/\end{} section markers
100 syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName
101 syn region texSectionName matchgroup=Delimiter start="{" end="}" contained
103 " \documentclass, \documentstyle, \usepackage
104 syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs
105 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName
108 syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
109 syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies
110 syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
111 syn match texInputCurlies "[{}]" contained
112 syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained
114 " Type Styles (LaTeX 2.09)
115 syn match texTypeStyle "\\rm\>"
116 syn match texTypeStyle "\\em\>"
117 syn match texTypeStyle "\\bf\>"
118 syn match texTypeStyle "\\it\>"
119 syn match texTypeStyle "\\sl\>"
120 syn match texTypeStyle "\\sf\>"
121 syn match texTypeStyle "\\sc\>"
122 syn match texTypeStyle "\\tt\>"
124 " Type Styles: attributes, commands, families, etc (LaTeX2E)
125 syn match texTypeStyle "\\textbf\>"
126 syn match texTypeStyle "\\textit\>"
127 syn match texTypeStyle "\\textmd\>"
128 syn match texTypeStyle "\\textrm\>"
129 syn match texTypeStyle "\\textsc\>"
130 syn match texTypeStyle "\\textsf\>"
131 syn match texTypeStyle "\\textsl\>"
132 syn match texTypeStyle "\\texttt\>"
133 syn match texTypeStyle "\\textup\>"
135 syn match texTypeStyle "\\mathbf\>"
136 syn match texTypeStyle "\\mathcal\>"
137 syn match texTypeStyle "\\mathit\>"
138 syn match texTypeStyle "\\mathnormal\>"
139 syn match texTypeStyle "\\mathrm\>"
140 syn match texTypeStyle "\\mathsf\>"
141 syn match texTypeStyle "\\mathtt\>"
143 syn match texTypeStyle "\\rmfamily\>"
144 syn match texTypeStyle "\\sffamily\>"
145 syn match texTypeStyle "\\ttfamily\>"
147 syn match texTypeStyle "\\itshape\>"
148 syn match texTypeStyle "\\scshape\>"
149 syn match texTypeStyle "\\slshape\>"
150 syn match texTypeStyle "\\upshape\>"
152 syn match texTypeStyle "\\bfseries\>"
153 syn match texTypeStyle "\\mdseries\>"
156 syn match texTypeSize "\\tiny\>"
157 syn match texTypeSize "\\scriptsize\>"
158 syn match texTypeSize "\\footnotesize\>"
159 syn match texTypeSize "\\small\>"
160 syn match texTypeSize "\\normalsize\>"
161 syn match texTypeSize "\\large\>"
162 syn match texTypeSize "\\Large\>"
163 syn match texTypeSize "\\LARGE\>"
164 syn match texTypeSize "\\huge\>"
165 syn match texTypeSize "\\Huge\>"
168 syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
169 syn match texSpaceCodeChar "`.\{-}="me=e-1
171 " Sections, subsections, etc
172 syn match texSection "\\\(sub\)*section\*\=\>"
173 syn match texSection "\\\(title\|author\|part\|chapter\|paragraph\|subparagraph\)\>"
174 syn match texSection "\\begin\s*{\s*abstract\s*}\|\\end\s*{\s*abstract\s*}"
176 " Bad Math (mismatched)
177 syn match texBadMath "\\end\s*{\s*\(split\|align\|gather\|alignat\|flalign\|multline\)\s*}"
178 syn match texBadMath "\\end\s*{\s*\(equation\|eqnarray\|displaymath\)\*\=\s*}"
179 syn match texBadMath "\\[\])]"
182 syn region texMathZoneA start="\\begin\s*{\s*align\*\s*}" end="\\end\s*{\s*align\*\s*}" keepend contains=@texMathZoneGroup
183 syn region texMathZoneB start="\\begin\s*{\s*alignat\*\s*}" end="\\end\s*{\s*alignat\*\s*}" keepend contains=@texMathZoneGroup
184 syn region texMathZoneC start="\\begin\s*{\s*alignat\s*}" end="\\end\s*{\s*alignat\s*}" keepend contains=@texMathZoneGroup
185 syn region texMathZoneD start="\\begin\s*{\s*align\s*}" end="\\end\s*{\s*align\s*}" keepend contains=@texMathZoneGroup
186 syn region texMathZoneE start="\\begin\s*{\s*eqnarray\*\s*}" end="\\end\s*{\s*eqnarray\*\s*}" keepend contains=@texMathZoneGroup
187 syn region texMathZoneF start="\\begin\s*{\s*eqnarray\s*}" end="\\end\s*{\s*eqnarray\s*}" keepend contains=@texMathZoneGroup
188 syn region texMathZoneG start="\\begin\s*{\s*equation\*\s*}" end="\\end\s*{\s*equation\*\s*}" keepend contains=@texMathZoneGroup
189 syn region texMathZoneH start="\\begin\s*{\s*equation\s*}" end="\\end\s*{\s*equation\s*}" keepend contains=@texMathZoneGroup
190 syn region texMathZoneI start="\\begin\s*{\s*flalign\*\s*}" end="\\end\s*{\s*flalign\*\s*}" keepend contains=@texMathZoneGroup
191 syn region texMathZoneJ start="\\begin\s*{\s*flalign\s*}" end="\\end\s*{\s*flalign\s*}" keepend contains=@texMathZoneGroup
192 syn region texMathZoneK start="\\begin\s*{\s*gather\*\s*}" end="\\end\s*{\s*gather\*\s*}" keepend contains=@texMathZoneGroup
193 syn region texMathZoneL start="\\begin\s*{\s*gather\s*}" end="\\end\s*{\s*gather\s*}" keepend contains=@texMathZoneGroup
194 syn region texMathZoneM start="\\begin\s*{\s*math\*\s*}" end="\\end\s*{\s*math\*\s*}" keepend contains=@texMathZoneGroup
195 syn region texMathZoneN start="\\begin\s*{\s*math\s*}" end="\\end\s*{\s*math\s*}" keepend contains=@texMathZoneGroup
196 syn region texMathZoneO start="\\begin\s*{\s*multline\s*}" end="\\end\s*{\s*multline\s*}" keepend contains=@texMathZoneGroup
197 syn region texMathZoneP start="\\begin\s*{\s*split\s*}" end="\\end\s*{\s*split\s*}" keepend contains=@texMathZoneGroup
198 syn region texMathZoneQ start="\\begin\s*{\s*displaymath\*\s*}" end="\\end\s*{\s*displaymath\*\s*}" keepend contains=@texMathZoneGroup
199 syn region texMathZoneR start="\\begin\s*{\s*displaymath\s*}" end="\\end\s*{\s*displaymath\s*}" keepend contains=@texMathZoneGroup
200 syn region texMathZoneS start="\\begin\s*{\s*multline\*\s*}" end="\\end\s*{\s*multline\*\s*}" keepend contains=@texMathZoneGroup
202 syn region texMathZoneT matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
203 syn region texMathZoneU matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
204 syn region texMathZoneV matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
205 syn region texMathZoneW matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
207 syn match texMathOper "[_^=]" contained
209 " \left..something.. and \right..something.. support
210 syn match texMathDelimBad contained "."
211 syn match texMathDelim "\\\(left\|right\)\>" nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
212 syn match texMathDelim "\\\(left\|right\)arrow\>"
213 syn match texMathDelim "\\lefteqn\>"
214 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
215 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
216 syn keyword texMathDelimKey contained Downarrow backslash lceil rceil uparrow
217 syn keyword texMathDelimKey contained Uparrow downarrow lfloor rfloor updownarrow
218 syn keyword texMathDelimKey contained Updownarrow langle rangle
220 " special TeX characters ( \$ \& \% \# \{ \} \_ \S \P )
221 syn match texSpecialChar "\\[$&%#{}_]"
222 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
223 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
225 syn match texSpecialChar "\\[SP@]\A"me=e-1
227 syn match texSpecialChar "\\\\"
228 syn match texOnlyMath "[_^]"
229 syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
231 " Comments: Normal TeX LaTeX : %....
232 " Documented TeX Format: ^^A... -and- leading %s (only)
233 syn cluster texCommentGroup contains=texTodo
235 syn keyword texTodo contained combak fixme todo
237 if b:extfname == "dtx"
238 syn match texComment "\^\^A.*$" contains=@texCommentGroup
239 syn match texComment "^%\+" contains=@texCommentGroup
241 syn match texComment "%.*$" contains=@texCommentGroup
244 " separate lines used for verb` and verb# so that the end conditions
245 " will appropriately terminate. Ideally vim would let me save a
246 " character from the start pattern and re-use it in the end-pattern.
247 syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>"
249 syn region texZone start="\\verb`" end="`\|%stopzone\>"
250 syn region texZone start="\\verb#" end="#\|%stopzone\>"
252 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
253 syn region texZone start="\\verb\z([^ \ta-zA-Z@]\)" end="\z1\|%stopzone\>"
255 syn region texZone start="\\verb\z([^ \ta-zA-Z]\)" end="\z1\|%stopzone\>"
258 syn region texZone start="@samp{" end="}\|%stopzone\>"
259 syn region texRefZone matchgroup=texStatement start="\\nocite{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
260 syn region texRefZone matchgroup=texStatement start="\\bibliography{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
261 syn region texRefZone matchgroup=texStatement start="\\cite{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
262 syn region texRefZone matchgroup=texStatement start="\\label{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
263 syn region texRefZone matchgroup=texStatement start="\\pageref{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
264 syn region texRefZone matchgroup=texStatement start="\\ref{" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter
266 " handle newcommand, newenvironment
267 syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
268 syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
269 syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
270 syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
271 syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
272 syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
273 syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
274 syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
276 syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
277 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
278 syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
279 syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
281 syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
282 syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
284 syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
285 syn match texDefParm contained "#\d\+"
288 syn match texLength "\<\d\+\(\.\d\+\)\=\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>"
290 " TeX String Delimiters
291 syn match texString "\(``\|''\|,,\)"
293 " LaTeX synchronization
294 syn sync maxlines=200
297 syn sync match texSyncMathZoneA grouphere texMathZoneA "\\begin\s*{\s*align\*\s*}"
298 syn sync match texSyncMathZoneB grouphere texMathZoneB "\\begin\s*{\s*alignat\*\s*}"
299 syn sync match texSyncMathZoneC grouphere texMathZoneC "\\begin\s*{\s*alignat\s*}"
300 syn sync match texSyncMathZoneD grouphere texMathZoneD "\\begin\s*{\s*align\s*}"
301 syn sync match texSyncMathZoneE grouphere texMathZoneE "\\begin\s*{\s*eqnarray\*\s*}"
302 syn sync match texSyncMathZoneF grouphere texMathZoneF "\\begin\s*{\s*eqnarray\s*}"
303 syn sync match texSyncMathZoneG grouphere texMathZoneG "\\begin\s*{\s*equation\*\s*}"
304 syn sync match texSyncMathZoneH grouphere texMathZoneH "\\begin\s*{\s*equation\s*}"
305 syn sync match texSyncMathZoneI grouphere texMathZoneI "\\begin\s*{\s*flalign\*\s*}"
306 syn sync match texSyncMathZoneJ grouphere texMathZoneJ "\\begin\s*{\s*flalign\s*}"
307 syn sync match texSyncMathZoneK grouphere texMathZoneK "\\begin\s*{\s*gather\*\s*}"
308 syn sync match texSyncMathZoneL grouphere texMathZoneL "\\begin\s*{\s*gather\s*}"
309 syn sync match texSyncMathZoneM grouphere texMathZoneM "\\begin\s*{\s*math\*\s*}"
310 syn sync match texSyncMathZoneN grouphere texMathZoneN "\\begin\s*{\s*math\s*}"
311 syn sync match texSyncMathZoneO grouphere texMathZoneO "\\begin\s*{\s*multline\s*}"
312 syn sync match texSyncMathZoneP grouphere texMathZoneP "\\begin\s*{\s*split\s*}"
313 syn sync match texSyncMathZoneQ grouphere texMathZoneQ "\\begin\s*{\s*displaymath\*\s*}"
314 syn sync match texSyncMathZoneR grouphere texMathZoneR "\\begin\s*{\s*displaymath\s*}"
315 syn sync match texSyncMathZoneS grouphere texMathZoneS "\\begin\s*{\s*multline\*\s*}"
316 syn sync match texSyncMathZoneT grouphere texMathZoneT "\\("
317 syn sync match texSyncMathZoneU grouphere texMathZoneU "\\\["
319 syn sync match texSyncMathZoneA groupthere NONE "\\end\s*{\s*align\*\s*}"
320 syn sync match texSyncMathZoneB groupthere NONE "\\end\s*{\s*alignat\*\s*}"
321 syn sync match texSyncMathZoneC groupthere NONE "\\end\s*{\s*alignat\s*}"
322 syn sync match texSyncMathZoneD groupthere NONE "\\end\s*{\s*align\s*}"
323 syn sync match texSyncMathZoneE groupthere NONE "\\end\s*{\s*eqnarray\*\s*}"
324 syn sync match texSyncMathZoneF groupthere NONE "\\end\s*{\s*eqnarray\s*}"
325 syn sync match texSyncMathZoneG groupthere NONE "\\end\s*{\s*equation\*\s*}"
326 syn sync match texSyncMathZoneH groupthere NONE "\\end\s*{\s*equation\s*}"
327 syn sync match texSyncMathZoneI groupthere NONE "\\end\s*{\s*flalign\*\s*}"
328 syn sync match texSyncMathZoneJ groupthere NONE "\\end\s*{\s*flalign\s*}"
329 syn sync match texSyncMathZoneK groupthere NONE "\\end\s*{\s*gather\*\s*}"
330 syn sync match texSyncMathZoneL groupthere NONE "\\end\s*{\s*gather\s*}"
331 syn sync match texSyncMathZoneM groupthere NONE "\\end\s*{\s*math\*\s*}"
332 syn sync match texSyncMathZoneN groupthere NONE "\\end\s*{\s*math\s*}"
333 syn sync match texSyncMathZoneO groupthere NONE "\\end\s*{\s*multline\s*}"
334 syn sync match texSyncMathZoneP groupthere NONE "\\end\s*{\s*split\s*}"
335 syn sync match texSyncMathZoneQ groupthere NONE "\\end\s*{\s*displaymath\*\s*}"
336 syn sync match texSyncMathZoneR groupthere NONE "\\end\s*{\s*displaymath\s*}"
337 syn sync match texSyncMathZoneS groupthere NONE "\\end\s*{\s*multline\*\s*}"
338 syn sync match texSyncMathZoneT groupthere NONE "\\)"
339 syn sync match texSyncMathZoneU groupthere NONE "\\\]"
340 syn sync match texSyncStop groupthere NONE "%stopzone\>"
342 " The $..$ and $$..$$ make for impossible sync patterns.
343 " The following grouptheres coupled with minlines above
344 " help improve the odds of good syncing.
345 syn sync match texSyncMathZoneS groupthere NONE "\\end{abstract}"
346 syn sync match texSyncMathZoneS groupthere NONE "\\end{center}"
347 syn sync match texSyncMathZoneS groupthere NONE "\\end{description}"
348 syn sync match texSyncMathZoneS groupthere NONE "\\end{enumerate}"
349 syn sync match texSyncMathZoneS groupthere NONE "\\end{itemize}"
350 syn sync match texSyncMathZoneS groupthere NONE "\\end{table}"
351 syn sync match texSyncMathZoneS groupthere NONE "\\end{tabular}"
352 syn sync match texSyncMathZoneS groupthere NONE "\\\(sub\)*section\>"
354 " Define the default highlighting.
355 " For version 5.7 and earlier: only when not done already
356 " For version 5.8 and later: only when an item doesn't have highlighting yet
357 if version >= 508 || !exists("did_tex_syntax_inits")
359 let did_tex_syntax_inits = 1
360 command -nargs=+ HiLink hi link <args>
362 command -nargs=+ HiLink hi def link <args>
365 " TeX highlighting groups which should share similar highlighting
366 if !exists("tex_no_error")
367 HiLink texBadMath texError
368 HiLink texMathDelimBad texError
369 HiLink texMathError texError
370 if b:extfname != "sty" && b:extfname != "cls" && b:extfname != "clo" && b:extfname != "dtx" && b:extfname != "ltx"
371 HiLink texOnlyMath texError
373 HiLink texError Error
376 HiLink texDefCmd texDef
377 HiLink texDefName texDef
378 HiLink texDocType texCmdName
379 HiLink texDocTypeArgs texCmdArgs
380 HiLink texInputFileOpt texCmdArgs
381 HiLink texInputCurlies texDelimiter
382 HiLink texLigature texSpecialChar
383 HiLink texMathDelimSet1 texMathDelim
384 HiLink texMathDelimSet2 texMathDelim
385 HiLink texMathDelimKey texMathDelim
386 HiLink texMathMatcher texMath
387 HiLink texMathZoneA texMath
388 HiLink texMathZoneB texMath
389 HiLink texMathZoneC texMath
390 HiLink texMathZoneD texMath
391 HiLink texMathZoneE texMath
392 HiLink texMathZoneF texMath
393 HiLink texMathZoneG texMath
394 HiLink texMathZoneH texMath
395 HiLink texMathZoneI texMath
396 HiLink texMathZoneJ texMath
397 HiLink texMathZoneK texMath
398 HiLink texMathZoneL texMath
399 HiLink texMathZoneM texMath
400 HiLink texMathZoneN texMath
401 HiLink texMathZoneO texMath
402 HiLink texMathZoneP texMath
403 HiLink texMathZoneQ texMath
404 HiLink texMathZoneR texMath
405 HiLink texMathZoneS texMath
406 HiLink texMathZoneT texMath
407 HiLink texMathZoneU texMath
408 HiLink texMathZoneV texMath
409 HiLink texMathZoneW texMath
410 HiLink texSectionMarker texCmdName
411 HiLink texSectionName texSection
412 HiLink texSpaceCode texStatement
413 HiLink texTypeSize texType
414 HiLink texTypeStyle texType
416 " Basic TeX highlighting groups
417 HiLink texCmdArgs Number
418 HiLink texCmdName Statement
419 HiLink texComment Comment
420 HiLink texDef Statement
421 HiLink texDefParm Special
422 HiLink texDelimiter Delimiter
423 HiLink texInput Special
424 HiLink texInputFile Special
425 HiLink texLength Number
426 HiLink texMath Special
427 HiLink texMathDelim Statement
428 HiLink texMathOper Operator
429 HiLink texNewCmd Statement
430 HiLink texNewEnv Statement
431 HiLink texRefZone Special
432 HiLink texSection PreCondit
433 HiLink texSpecialChar SpecialChar
434 HiLink texStatement Statement
435 HiLink texString String
438 HiLink texZone PreCondit
444 let b:current_syntax = "tex"