blob: 95bfc057d17e0a03d2ac643e2b1870f329fc3f8c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: TeX
Bram Moolenaar488c6512005-08-11 20:09:58 +00003" Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM>
Bram Moolenaar81af9252010-12-10 20:35:50 +01004" Last Change: Sep 17, 2010
5" Version: 60
Bram Moolenaar488c6512005-08-11 20:09:58 +00006" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +00007"
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
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020040scriptencoding utf-8
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
42" Define the default highlighting. {{{1
43" For version 5.7 and earlier: only when not done already
44" For version 5.8 and later: only when an item doesn't have highlighting yet
45if version >= 508 || !exists("did_tex_syntax_inits")
46 let did_tex_syntax_inits = 1
47 if version < 508
48 command -nargs=+ HiLink hi link <args>
49 else
50 command -nargs=+ HiLink hi def link <args>
51 endif
52endif
53if exists("g:tex_tex") && !exists("g:tex_no_error")
54 let g:tex_no_error= 1
55endif
56
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020057" let user determine which classes of concealment will be supported
Bram Moolenaar7fc0c062010-08-10 21:43:35 +020058" a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020059if !exists("g:tex_conceal")
Bram Moolenaar7fc0c062010-08-10 21:43:35 +020060 let s:tex_conceal= 'admgs'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020061else
62 let s:tex_conceal= g:tex_conceal
63endif
64
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000065" Determine whether or not to use "*.sty" mode {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000066" The user may override the normal determination by setting
67" g:tex_stylish to 1 (for "*.sty" mode)
68" or to 0 else (normal "*.tex" mode)
69" or on a buffer-by-buffer basis with b:tex_stylish
Bram Moolenaar81af9252010-12-10 20:35:50 +010070let s:extfname=expand("%:e")
Bram Moolenaar071d4272004-06-13 20:20:40 +000071if exists("g:tex_stylish")
72 let b:tex_stylish= g:tex_stylish
73elseif !exists("b:tex_stylish")
Bram Moolenaar81af9252010-12-10 20:35:50 +010074 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx"
Bram Moolenaar071d4272004-06-13 20:20:40 +000075 let b:tex_stylish= 1
76 else
77 let b:tex_stylish= 0
78 endif
79endif
80
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000081" handle folding {{{1
82if !exists("g:tex_fold_enabled")
83 let g:tex_fold_enabled= 0
84elseif g:tex_fold_enabled && !has("folding")
Bram Moolenaarab194812005-09-14 21:40:12 +000085 let g:tex_fold_enabled= 0
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000086 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support"
87endif
88if g:tex_fold_enabled && &fdm == "manual"
Bram Moolenaar00a927d2010-05-14 23:24:24 +020089 setl fdm=syntax
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000090endif
91
Bram Moolenaar071d4272004-06-13 20:20:40 +000092" (La)TeX keywords: only use the letters a-zA-Z {{{1
93" but _ is the only one that causes problems.
94if version < 600
Bram Moolenaar81af9252010-12-10 20:35:50 +010095 set isk=a-z,A-Z
Bram Moolenaar071d4272004-06-13 20:20:40 +000096 if b:tex_stylish
97 set isk+=@
98 endif
99else
Bram Moolenaar81af9252010-12-10 20:35:50 +0100100 setlocal isk=a-z,A-Z
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101 if b:tex_stylish
102 setlocal isk+=@
103 endif
104endif
105
106" Clusters: {{{1
107" --------
108syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
109if !exists("g:tex_no_error")
110 syn cluster texCmdGroup add=texMathError
111endif
112syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
Bram Moolenaar488c6512005-08-11 20:09:58 +0000113syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000114syn 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,@Spell
Bram Moolenaar5c736222010-01-06 20:54:52 +0100115syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000116syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117if !exists("tex_no_math")
118 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
119 syn cluster texMatchGroup add=@texMathZones
120 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
121 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
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200122 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123 if !exists("g:tex_no_error")
124 syn cluster texMathMatchGroup add=texMathError
125 syn cluster texMathZoneGroup add=texMathError
126 endif
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000127 syn cluster texMathZoneGroup add=@NoSpell
128 " following used in the \part \chapter \section \subsection \subsubsection
129 " \paragraph \subparagraph \author \title highlighting
130 syn cluster texDocGroup contains=texPartZone,@texPartGroup
131 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone
132 syn cluster texChapterGroup contains=texSectionZone,texParaZone
133 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone
134 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone
135 syn cluster texSubSubSectionGroup contains=texParaZone
136 syn cluster texParaGroup contains=texSubParaZone
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200137 if has("conceal") && &enc == 'utf-8'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200138 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
139 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200140 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141endif
142
143" Try to flag {} and () mismatches: {{{1
144if !exists("g:tex_no_error")
145 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
146 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError
147else
148 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup
149 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup
150endif
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000151syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152if !exists("g:tex_no_error")
153 syn match texError "[}\])]"
154endif
155if !exists("tex_no_math")
156 if !exists("g:tex_no_error")
157 syn match texMathError "}" contained
158 endif
159 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
160endif
161
162" TeX/LaTeX keywords: {{{1
163" Instead of trying to be All Knowing, I just match \..alphameric..
164" Note that *.tex files may not have "@" in their \commands
165if exists("g:tex_tex") || b:tex_stylish
166 syn match texStatement "\\[a-zA-Z@]\+"
167else
168 syn match texStatement "\\\a\+"
169 if !exists("g:tex_no_error")
170 syn match texError "\\\a*@[a-zA-Z@]*"
171 endif
172endif
173
174" TeX/LaTeX delimiters: {{{1
175syn match texDelimiter "&"
176syn match texDelimiter "\\\\"
177
178" Tex/Latex Options: {{{1
179syn match texOption "[^\\]\zs#\d\+\|^#\d\+"
180
181" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
182if b:tex_stylish
183 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
184 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
185else
186 syn match texAccent "\\[bcdvuH]\A"me=e-1
187 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
188endif
189syn match texAccent "\\[bcdvuH]$"
190syn match texAccent +\\[=^.\~"`']+
191syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
192syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
193
194" \begin{}/\end{} section markers: {{{1
195syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName
Bram Moolenaar5c736222010-01-06 20:54:52 +0100196syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier contains=texComment
197syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198
199" \documentclass, \documentstyle, \usepackage: {{{1
200syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs
Bram Moolenaar5c736222010-01-06 20:54:52 +0100201syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000203" Preamble syntax-based folding support: {{{1
204if g:tex_fold_enabled && has("folding")
Bram Moolenaar5c736222010-01-06 20:54:52 +0100205 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texMatchGroup
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000206endif
207
Bram Moolenaar071d4272004-06-13 20:20:40 +0000208" TeX input: {{{1
209syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +0100210syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
212syn match texInputCurlies "[{}]" contained
Bram Moolenaar5c736222010-01-06 20:54:52 +0100213syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214
215" Type Styles (LaTeX 2.09): {{{1
216syn match texTypeStyle "\\rm\>"
217syn match texTypeStyle "\\em\>"
218syn match texTypeStyle "\\bf\>"
219syn match texTypeStyle "\\it\>"
220syn match texTypeStyle "\\sl\>"
221syn match texTypeStyle "\\sf\>"
222syn match texTypeStyle "\\sc\>"
223syn match texTypeStyle "\\tt\>"
224
225" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
226syn match texTypeStyle "\\textbf\>"
227syn match texTypeStyle "\\textit\>"
228syn match texTypeStyle "\\textmd\>"
229syn match texTypeStyle "\\textrm\>"
230syn match texTypeStyle "\\textsc\>"
231syn match texTypeStyle "\\textsf\>"
232syn match texTypeStyle "\\textsl\>"
233syn match texTypeStyle "\\texttt\>"
234syn match texTypeStyle "\\textup\>"
235syn match texTypeStyle "\\emph\>"
236
237syn match texTypeStyle "\\mathbb\>"
238syn match texTypeStyle "\\mathbf\>"
239syn match texTypeStyle "\\mathcal\>"
240syn match texTypeStyle "\\mathfrak\>"
241syn match texTypeStyle "\\mathit\>"
242syn match texTypeStyle "\\mathnormal\>"
243syn match texTypeStyle "\\mathrm\>"
244syn match texTypeStyle "\\mathsf\>"
245syn match texTypeStyle "\\mathtt\>"
246
247syn match texTypeStyle "\\rmfamily\>"
248syn match texTypeStyle "\\sffamily\>"
249syn match texTypeStyle "\\ttfamily\>"
250
251syn match texTypeStyle "\\itshape\>"
252syn match texTypeStyle "\\scshape\>"
253syn match texTypeStyle "\\slshape\>"
254syn match texTypeStyle "\\upshape\>"
255
256syn match texTypeStyle "\\bfseries\>"
257syn match texTypeStyle "\\mdseries\>"
258
259" Some type sizes: {{{1
260syn match texTypeSize "\\tiny\>"
261syn match texTypeSize "\\scriptsize\>"
262syn match texTypeSize "\\footnotesize\>"
263syn match texTypeSize "\\small\>"
264syn match texTypeSize "\\normalsize\>"
265syn match texTypeSize "\\large\>"
266syn match texTypeSize "\\Large\>"
267syn match texTypeSize "\\LARGE\>"
268syn match texTypeSize "\\huge\>"
269syn match texTypeSize "\\Huge\>"
270
271" Spacecodes (TeX'isms): {{{1
272" \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x
273syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
274syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
275
276" Sections, subsections, etc: {{{1
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +0000277if g:tex_fold_enabled && has("folding")
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000278 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
279 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell
280 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell
281 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell
282 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
283 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
284 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell
285 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell
286 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
287 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000288else
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000289 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
290 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
291 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell
292 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell
293 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
294 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
295 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell
296 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell
297 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell
298 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000299endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000300
301" Bad Math (mismatched): {{{1
302if !exists("tex_no_math")
Bram Moolenaar81af9252010-12-10 20:35:50 +0100303 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|smallmatrix\|xxalignat\)\s*}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
305 syn match texBadMath "\\[\])]"
306endif
307
308" Math Zones: {{{1
309if !exists("tex_no_math")
Bram Moolenaar488c6512005-08-11 20:09:58 +0000310 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000311 " Starred forms are created if starform is true. Starred
312 " forms have syntax group and synchronization groups with a
313 " "S" appended. Handles: cluster, syntax, sync, and HiLink.
314 fun! TexNewMathZone(sfx,mathzone,starform)
315 let grpname = "texMathZone".a:sfx
316 let syncname = "texSyncMathZone".a:sfx
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000317 if g:tex_fold_enabled
318 let foldcmd= " fold"
319 else
320 let foldcmd= ""
321 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000322 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000323 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000324 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
325 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100326 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000327 if a:starform
328 let grpname = "texMathZone".a:sfx.'S'
329 let syncname = "texSyncMathZone".a:sfx.'S'
330 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000331 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000332 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
333 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100334 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335 endif
336 endfun
337
338 " Standard Math Zones: {{{2
339 call TexNewMathZone("A","align",1)
340 call TexNewMathZone("B","alignat",1)
341 call TexNewMathZone("C","displaymath",1)
342 call TexNewMathZone("D","eqnarray",1)
343 call TexNewMathZone("E","equation",1)
344 call TexNewMathZone("F","flalign",1)
345 call TexNewMathZone("G","gather",1)
346 call TexNewMathZone("H","math",1)
347 call TexNewMathZone("I","multline",1)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000348 call TexNewMathZone("K","xalignat",1)
349 call TexNewMathZone("L","xxalignat",0)
350
351 " Inline Math Zones: {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200352 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200353 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
354 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
355 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
356 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
357 else
358 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
359 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
360 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
361 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
362 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200363 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000364
365 syn match texMathOper "[_^=]" contained
366
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200367 " Text Inside Math Zones: {{{2
368 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
369
Bram Moolenaar071d4272004-06-13 20:20:40 +0000370 " \left..something.. and \right..something.. support: {{{2
371 syn match texMathDelimBad contained "\S"
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200372 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
373 syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
374 syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
375 else
376 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
377 endif
378 syn match texMathDelim contained "\\\([bB]igg\=[lr]\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
Bram Moolenaar071d4272004-06-13 20:20:40 +0000379 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
380 syn match texMathDelim contained "\\lefteqn\>"
381 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
382 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
383 syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
384 syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
385 syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
386 syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
387 syn keyword texMathDelimKey contained lbrace lvert rfloor
388endif
389
390" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
391syn match texSpecialChar "\\[$&%#{}_]"
392if b:tex_stylish
393 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
394else
395 syn match texSpecialChar "\\[SP@]\A"me=e-1
396endif
397syn match texSpecialChar "\\\\"
398if !exists("tex_no_math")
399 syn match texOnlyMath "[_^]"
400endif
401syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
402
403" Comments: {{{1
404" Normal TeX LaTeX : %....
405" Documented TeX Format: ^^A... -and- leading %s (only)
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000406if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
407 syn cluster texCommentGroup contains=texTodo,@Spell
408else
409 syn cluster texCommentGroup contains=texTodo,@NoSpell
410endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411syn case ignore
Bram Moolenaar18144c82006-04-12 21:52:12 +0000412syn keyword texTodo contained combak fixme todo xxx
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413syn case match
Bram Moolenaar81af9252010-12-10 20:35:50 +0100414if s:extfname == "dtx"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000415 syn match texComment "\^\^A.*$" contains=@texCommentGroup
416 syn match texComment "^%\+" contains=@texCommentGroup
417else
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000418 if g:tex_fold_enabled
419 " allows syntax-folding of 2 or more contiguous comment lines
420 " single-line comments are not folded
421 syn match texComment "%.*$" contains=@texCommentGroup
422 syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
423 else
424 syn match texComment "%.*$" contains=@texCommentGroup
425 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000426endif
427
428" Separate lines used for verb` and verb# so that the end conditions {{{1
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200429" will appropriately terminate.
430" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
431if exists("g:tex_verbspell") && g:tex_verbspell
432 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
433 " listings package:
434 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
435 " moreverb package:
436 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
437 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
438 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
439 if version < 600
440 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell
441 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell
442 else
443 if b:tex_stylish
444 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell
445 else
446 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell
447 endif
448 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000449else
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200450 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>"
451 " listings package:
452 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>"
453 " moreverb package:
454 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>"
455 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>"
456 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>"
457 if version < 600
458 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
459 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
460 else
461 if b:tex_stylish
462 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
463 else
464 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
465 endif
466 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467endif
468
469" Tex Reference Zones: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +0100470syn match texRefZone '\\@samp\>' skipwhite nextgroup=texRefLabel
471syn match texRefZone '\\nocite\>' skipwhite nextgroup=texRefLabel
472syn match texRefZone '\\bibliography\>' skipwhite nextgroup=texRefLabel
473syn match texRefZone '\\label\>' skipwhite nextgroup=texRefLabel
474syn match texRefZone '\\\(page\|eq\)ref\>' skipwhite nextgroup=texRefLabel
475syn match texRefZone '\\v\=ref' skipwhite nextgroup=texRefLabel
476syn match texRefZone '\\cite\%([tp]\*\=\)\=' skipwhite nextgroup=texCiteOption,texCite
477syn region texRefLabel contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup
478syn region texCiteOption contained matchgroup=Delimiter start='\[' end=']' contains=@Spell,@texRefGroup,@texMathZones,texRefZone nextgroup=texCiteOption,texCite
479syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texCite
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480
481" Handle newcommand, newenvironment : {{{1
482syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
483syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
484syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
485syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
486syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
487syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
488syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
489syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
490
491" Definitions/Commands: {{{1
492syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
493if b:tex_stylish
494 syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
495 syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
496else
497 syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
498 syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
499endif
500syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
501syn match texDefParm contained "#\d\+"
502
503" TeX Lengths: {{{1
Bram Moolenaar9964e462007-05-05 17:54:07 +0000504syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000505
506" TeX String Delimiters: {{{1
507syn match texString "\(``\|''\|,,\)"
508
Bram Moolenaar5c736222010-01-06 20:54:52 +0100509" makeatletter -- makeatother sections
510if !exists("g:tex_no_error")
511 syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained
512 syn match texStyleStatement "\\[a-zA-Z@]\+" contained
513 syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
514 syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
515endif
516
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200517" Conceal mode support (supports set cole=2) {{{1
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200518if has("conceal") && &enc == 'utf-8'
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200519
520 " Math Symbols {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200521 " (many of these symbols were contributed by Björn Winckler)
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200522 if s:tex_conceal =~ 'm'
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200523 let s:texMathList=[
524 \ ['angle' , '∠'],
525 \ ['approx' , '≈'],
526 \ ['ast' , '∗'],
527 \ ['asymp' , '≍'],
528 \ ['backepsilon' , '∍'],
529 \ ['backsimeq' , '≃'],
530 \ ['barwedge' , '⊼'],
531 \ ['because' , '∵'],
532 \ ['between' , '≬'],
533 \ ['bigcap' , '∩'],
534 \ ['bigcup' , '∪'],
535 \ ['bigodot' , '⊙'],
536 \ ['bigoplus' , '⊕'],
537 \ ['bigotimes' , '⊗'],
538 \ ['bigsqcup' , '⊔'],
539 \ ['bigtriangledown', '∇'],
540 \ ['bigvee' , '⋁'],
541 \ ['bigwedge' , '⋀'],
542 \ ['blacksquare' , '∎'],
543 \ ['bot' , '⊥'],
544 \ ['boxdot' , '⊡'],
545 \ ['boxminus' , '⊟'],
546 \ ['boxplus' , '⊞'],
547 \ ['boxtimes' , '⊠'],
548 \ ['bumpeq' , '≏'],
549 \ ['Bumpeq' , '≎'],
550 \ ['cap' , '∩'],
551 \ ['Cap' , '⋒'],
552 \ ['cdot' , '·'],
553 \ ['cdots' , '⋯'],
554 \ ['circ' , '∘'],
555 \ ['circeq' , '≗'],
556 \ ['circlearrowleft', '↺'],
557 \ ['circlearrowright', '↻'],
558 \ ['circledast' , '⊛'],
559 \ ['circledcirc' , '⊚'],
560 \ ['complement' , '∁'],
561 \ ['cong' , '≅'],
562 \ ['coprod' , '∐'],
563 \ ['cup' , '∪'],
564 \ ['Cup' , '⋓'],
565 \ ['curlyeqprec' , '⋞'],
566 \ ['curlyeqsucc' , '⋟'],
567 \ ['curlyvee' , '⋎'],
568 \ ['curlywedge' , '⋏'],
569 \ ['dashv' , '⊣'],
570 \ ['diamond' , '⋄'],
571 \ ['div' , '÷'],
572 \ ['doteq' , '≐'],
573 \ ['doteqdot' , '≑'],
574 \ ['dotplus' , '∔'],
575 \ ['dotsb' , '⋯'],
576 \ ['dotsc' , '…'],
577 \ ['dots' , '…'],
578 \ ['dotsi' , '⋯'],
579 \ ['dotso' , '…'],
580 \ ['doublebarwedge' , '⩞'],
581 \ ['downarrow' , '↓'],
582 \ ['Downarrow' , '⇓'],
583 \ ['emptyset' , '∅'],
584 \ ['eqcirc' , '≖'],
585 \ ['eqsim' , '≂'],
586 \ ['eqslantgtr' , '⪖'],
587 \ ['eqslantless' , '⪕'],
588 \ ['equiv' , '≡'],
589 \ ['exists' , '∃'],
590 \ ['fallingdotseq' , '≒'],
591 \ ['forall' , '∀'],
592 \ ['ge' , '≥'],
593 \ ['geq' , '≥'],
594 \ ['geqq' , '≧'],
595 \ ['gets' , '←'],
596 \ ['gneqq' , '≩'],
597 \ ['gtrdot' , '⋗'],
598 \ ['gtreqless' , '⋛'],
599 \ ['gtrless' , '≷'],
600 \ ['gtrsim' , '≳'],
601 \ ['hookleftarrow' , '↩'],
602 \ ['hookrightarrow' , '↪'],
603 \ ['iiint' , '∭'],
604 \ ['iint' , '∬'],
605 \ ['Im' , 'ℑ'],
606 \ ['in' , '∈'],
607 \ ['infty' , '∞'],
608 \ ['int' , '∫'],
609 \ ['lceil' , '⌈'],
610 \ ['ldots' , '…'],
611 \ ['le' , '≤'],
612 \ ['leftarrow' , '⟵'],
613 \ ['Leftarrow' , '⟸'],
614 \ ['leftarrowtail' , '↢'],
615 \ ['left(' , '('],
616 \ ['left\[' , '['],
617 \ ['left\\{' , '{'],
618 \ ['Leftrightarrow' , '⇔'],
619 \ ['leftrightsquigarrow', '↭'],
620 \ ['leftthreetimes' , '⋋'],
621 \ ['leq' , '≤'],
622 \ ['leqq' , '≦'],
623 \ ['lessdot' , '⋖'],
624 \ ['lesseqgtr' , '⋚'],
625 \ ['lesssim' , '≲'],
626 \ ['lfloor' , '⌊'],
627 \ ['lneqq' , '≨'],
628 \ ['ltimes' , '⋉'],
629 \ ['mapsto' , '↦'],
630 \ ['measuredangle' , '∡'],
631 \ ['mid' , '∣'],
632 \ ['mp' , '∓'],
633 \ ['nabla' , '∇'],
634 \ ['ncong' , '≇'],
635 \ ['nearrow' , '↗'],
636 \ ['ne' , '≠'],
637 \ ['neg' , '¬'],
638 \ ['neq' , '≠'],
639 \ ['nexists' , '∄'],
640 \ ['ngeq' , '≱'],
641 \ ['ngeqq' , '≱'],
642 \ ['ngtr' , '≯'],
643 \ ['ni' , '∋'],
644 \ ['nleftarrow' , '↚'],
645 \ ['nLeftarrow' , '⇍'],
646 \ ['nLeftrightarrow', '⇎'],
647 \ ['nleq' , '≰'],
648 \ ['nleqq' , '≰'],
649 \ ['nless' , '≮'],
650 \ ['nmid' , '∤'],
651 \ ['notin' , '∉'],
652 \ ['nprec' , '⊀'],
653 \ ['nrightarrow' , '↛'],
654 \ ['nRightarrow' , '⇏'],
655 \ ['nsim' , '≁'],
656 \ ['nsucc' , '⊁'],
657 \ ['ntriangleleft' , '⋪'],
658 \ ['ntrianglelefteq', '⋬'],
659 \ ['ntriangleright' , '⋫'],
660 \ ['ntrianglerighteq', '⋭'],
661 \ ['nvdash' , '⊬'],
662 \ ['nvDash' , '⊭'],
663 \ ['nVdash' , '⊮'],
664 \ ['nwarrow' , '↖'],
665 \ ['odot' , '⊙'],
666 \ ['oint' , '∮'],
667 \ ['ominus' , '⊖'],
668 \ ['oplus' , '⊕'],
669 \ ['oslash' , '⊘'],
670 \ ['otimes' , '⊗'],
671 \ ['owns' , '∋'],
672 \ ['partial' , '∂'],
673 \ ['perp' , '⊥'],
674 \ ['pitchfork' , '⋔'],
675 \ ['pm' , '±'],
676 \ ['precapprox' , '⪷'],
677 \ ['prec' , '≺'],
678 \ ['preccurlyeq' , '≼'],
679 \ ['preceq' , '⪯'],
680 \ ['precnapprox' , '⪹'],
681 \ ['precneqq' , '⪵'],
682 \ ['precsim' , '≾'],
683 \ ['prod' , '∏'],
684 \ ['propto' , '∝'],
685 \ ['rceil' , '⌉'],
686 \ ['Re' , 'ℜ'],
687 \ ['rfloor' , '⌋'],
688 \ ['rightarrow' , '⟶'],
689 \ ['Rightarrow' , '⟹'],
690 \ ['rightarrowtail' , '↣'],
691 \ ['right)' , ')'],
692 \ ['right]' , ']'],
693 \ ['right\\}' , '}'],
694 \ ['rightsquigarrow', '↝'],
695 \ ['rightthreetimes', '⋌'],
696 \ ['risingdotseq' , '≓'],
697 \ ['rtimes' , '⋊'],
698 \ ['searrow' , '↘'],
699 \ ['setminus' , '∖'],
700 \ ['sim' , '∼'],
701 \ ['sphericalangle' , '∢'],
702 \ ['sqcap' , '⊓'],
703 \ ['sqcup' , '⊔'],
704 \ ['sqsubset' , '⊏'],
705 \ ['sqsubseteq' , '⊑'],
706 \ ['sqsupset' , '⊐'],
707 \ ['sqsupseteq' , '⊒'],
708 \ ['subset' , '⊂'],
709 \ ['Subset' , '⋐'],
710 \ ['subseteq' , '⊆'],
711 \ ['subseteqq' , '⫅'],
712 \ ['subsetneq' , '⊊'],
713 \ ['subsetneqq' , '⫋'],
714 \ ['succapprox' , '⪸'],
715 \ ['succ' , '≻'],
716 \ ['succcurlyeq' , '≽'],
717 \ ['succeq' , '⪰'],
718 \ ['succnapprox' , '⪺'],
719 \ ['succneqq' , '⪶'],
720 \ ['succsim' , '≿'],
721 \ ['sum' , '∑'],
722 \ ['Supset' , '⋑'],
723 \ ['supseteq' , '⊇'],
724 \ ['supseteqq' , '⫆'],
725 \ ['supsetneq' , '⊋'],
726 \ ['supsetneqq' , '⫌'],
727 \ ['surd' , '√'],
728 \ ['swarrow' , '↙'],
729 \ ['therefore' , '∴'],
730 \ ['times' , '×'],
731 \ ['to' , '→'],
732 \ ['top' , '⊤'],
733 \ ['triangleleft' , '⊲'],
734 \ ['trianglelefteq' , '⊴'],
735 \ ['triangleq' , '≜'],
736 \ ['triangleright' , '⊳'],
737 \ ['trianglerighteq', '⊵'],
738 \ ['twoheadleftarrow', '↞'],
739 \ ['twoheadrightarrow', '↠'],
740 \ ['uparrow' , '↑'],
741 \ ['Uparrow' , '⇑'],
742 \ ['updownarrow' , '↕'],
743 \ ['Updownarrow' , '⇕'],
744 \ ['varnothing' , '∅'],
745 \ ['vartriangle' , '∆'],
746 \ ['vdash' , '⊢'],
747 \ ['vDash' , '⊨'],
748 \ ['Vdash' , '⊩'],
749 \ ['vdots' , '⋮'],
750 \ ['veebar' , '⊻'],
751 \ ['vee' , '∨'],
752 \ ['Vvdash' , '⊪'],
753 \ ['wedge' , '∧'],
754 \ ['wr' , '≀']]
755 for texmath in s:texMathList
Bram Moolenaar81af9252010-12-10 20:35:50 +0100756 if texmath[0] =~ '\w$'
757 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
758 else
759 exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
760 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200761 endfor
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200762
763 if &ambw == "double"
764 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
765 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
766 else
767 syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫
768 syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪
769 endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200770 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200771
772 " Greek {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200773 if s:tex_conceal =~ 'g'
774 fun! s:Greek(group,pat,cchar)
775 exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
776 endfun
777 call s:Greek('texGreek','\\alpha\>' ,'α')
778 call s:Greek('texGreek','\\beta\>' ,'β')
779 call s:Greek('texGreek','\\gamma\>' ,'γ')
780 call s:Greek('texGreek','\\delta\>' ,'δ')
781 call s:Greek('texGreek','\\epsilon\>' ,'ϵ')
782 call s:Greek('texGreek','\\varepsilon\>' ,'ε')
783 call s:Greek('texGreek','\\zeta\>' ,'ζ')
784 call s:Greek('texGreek','\\eta\>' ,'η')
785 call s:Greek('texGreek','\\theta\>' ,'θ')
786 call s:Greek('texGreek','\\vartheta\>' ,'ϑ')
787 call s:Greek('texGreek','\\kappa\>' ,'κ')
788 call s:Greek('texGreek','\\lambda\>' ,'λ')
789 call s:Greek('texGreek','\\mu\>' ,'μ')
790 call s:Greek('texGreek','\\nu\>' ,'ν')
791 call s:Greek('texGreek','\\xi\>' ,'ξ')
792 call s:Greek('texGreek','\\pi\>' ,'π')
793 call s:Greek('texGreek','\\varpi\>' ,'ϖ')
794 call s:Greek('texGreek','\\rho\>' ,'ρ')
795 call s:Greek('texGreek','\\varrho\>' ,'ϱ')
796 call s:Greek('texGreek','\\sigma\>' ,'σ')
797 call s:Greek('texGreek','\\varsigma\>' ,'ς')
798 call s:Greek('texGreek','\\tau\>' ,'τ')
799 call s:Greek('texGreek','\\upsilon\>' ,'υ')
800 call s:Greek('texGreek','\\phi\>' ,'φ')
801 call s:Greek('texGreek','\\varphi\>' ,'ϕ')
802 call s:Greek('texGreek','\\chi\>' ,'χ')
803 call s:Greek('texGreek','\\psi\>' ,'ψ')
804 call s:Greek('texGreek','\\omega\>' ,'ω')
805 call s:Greek('texGreek','\\Gamma\>' ,'Γ')
806 call s:Greek('texGreek','\\Delta\>' ,'Δ')
807 call s:Greek('texGreek','\\Theta\>' ,'Θ')
808 call s:Greek('texGreek','\\Lambda\>' ,'Λ')
809 call s:Greek('texGreek','\\Xi\>' ,'Χ')
810 call s:Greek('texGreek','\\Pi\>' ,'Π')
811 call s:Greek('texGreek','\\Sigma\>' ,'Σ')
812 call s:Greek('texGreek','\\Upsilon\>' ,'Υ')
813 call s:Greek('texGreek','\\Phi\>' ,'Φ')
814 call s:Greek('texGreek','\\Psi\>' ,'Ψ')
815 call s:Greek('texGreek','\\Omega\>' ,'Ω')
816 delfun s:Greek
817 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200818
819 " Superscripts/Subscripts {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200820 if s:tex_conceal =~ 's'
Bram Moolenaar6b6eedf2010-08-13 14:38:12 +0200821 syn region texSuperscript matchgroup=Delimiter start='\^{' end='}' contained concealends contains=texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
822 syn region texSubscript matchgroup=Delimiter start='_{' end='}' contained concealends contains=texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200823 fun! s:SuperSub(group,leader,pat,cchar)
824 exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
825 exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
826 endfun
827 call s:SuperSub('texSuperscript','\^','0','⁰')
828 call s:SuperSub('texSuperscript','\^','1','¹')
829 call s:SuperSub('texSuperscript','\^','2','²')
830 call s:SuperSub('texSuperscript','\^','3','³')
831 call s:SuperSub('texSuperscript','\^','4','⁴')
832 call s:SuperSub('texSuperscript','\^','5','⁵')
833 call s:SuperSub('texSuperscript','\^','6','⁶')
834 call s:SuperSub('texSuperscript','\^','7','⁷')
835 call s:SuperSub('texSuperscript','\^','8','⁸')
836 call s:SuperSub('texSuperscript','\^','9','⁹')
837 call s:SuperSub('texSuperscript','\^','a','ᵃ')
838 call s:SuperSub('texSuperscript','\^','b','ᵇ')
839 call s:SuperSub('texSuperscript','\^','c','ᶜ')
840 call s:SuperSub('texSuperscript','\^','d','ᵈ')
841 call s:SuperSub('texSuperscript','\^','e','ᵉ')
842 call s:SuperSub('texSuperscript','\^','f','ᶠ')
843 call s:SuperSub('texSuperscript','\^','g','ᵍ')
844 call s:SuperSub('texSuperscript','\^','h','ʰ')
845 call s:SuperSub('texSuperscript','\^','i','ⁱ')
846 call s:SuperSub('texSuperscript','\^','j','ʲ')
847 call s:SuperSub('texSuperscript','\^','k','ᵏ')
848 call s:SuperSub('texSuperscript','\^','l','ˡ')
849 call s:SuperSub('texSuperscript','\^','m','ᵐ')
850 call s:SuperSub('texSuperscript','\^','n','ⁿ')
851 call s:SuperSub('texSuperscript','\^','o','ᵒ')
852 call s:SuperSub('texSuperscript','\^','p','ᵖ')
853 call s:SuperSub('texSuperscript','\^','r','ʳ')
854 call s:SuperSub('texSuperscript','\^','s','ˢ')
855 call s:SuperSub('texSuperscript','\^','t','ᵗ')
856 call s:SuperSub('texSuperscript','\^','u','ᵘ')
857 call s:SuperSub('texSuperscript','\^','v','ᵛ')
858 call s:SuperSub('texSuperscript','\^','w','ʷ')
859 call s:SuperSub('texSuperscript','\^','x','ˣ')
860 call s:SuperSub('texSuperscript','\^','y','ʸ')
861 call s:SuperSub('texSuperscript','\^','z','ᶻ')
862 call s:SuperSub('texSuperscript','\^','A','ᴬ')
863 call s:SuperSub('texSuperscript','\^','B','ᴮ')
864 call s:SuperSub('texSuperscript','\^','D','ᴰ')
865 call s:SuperSub('texSuperscript','\^','E','ᴱ')
866 call s:SuperSub('texSuperscript','\^','G','ᴳ')
867 call s:SuperSub('texSuperscript','\^','H','ᴴ')
868 call s:SuperSub('texSuperscript','\^','I','ᴵ')
869 call s:SuperSub('texSuperscript','\^','J','ᴶ')
870 call s:SuperSub('texSuperscript','\^','K','ᴷ')
871 call s:SuperSub('texSuperscript','\^','L','ᴸ')
872 call s:SuperSub('texSuperscript','\^','M','ᴹ')
873 call s:SuperSub('texSuperscript','\^','N','ᴺ')
874 call s:SuperSub('texSuperscript','\^','O','ᴼ')
875 call s:SuperSub('texSuperscript','\^','P','ᴾ')
876 call s:SuperSub('texSuperscript','\^','R','ᴿ')
877 call s:SuperSub('texSuperscript','\^','T','ᵀ')
878 call s:SuperSub('texSuperscript','\^','U','ᵁ')
879 call s:SuperSub('texSuperscript','\^','W','ᵂ')
880 call s:SuperSub('texSuperscript','\^','+','⁺')
881 call s:SuperSub('texSuperscript','\^','-','⁻')
882 call s:SuperSub('texSuperscript','\^','<','˂')
883 call s:SuperSub('texSuperscript','\^','>','˃')
884 call s:SuperSub('texSuperscript','\^','/','ˊ')
885 call s:SuperSub('texSuperscript','\^','(','⁽')
886 call s:SuperSub('texSuperscript','\^',')','⁾')
887 call s:SuperSub('texSuperscript','\^','\.','˙')
888 call s:SuperSub('texSuperscript','\^','=','˭')
889 call s:SuperSub('texSubscript','_','0','₀')
890 call s:SuperSub('texSubscript','_','1','₁')
891 call s:SuperSub('texSubscript','_','2','₂')
892 call s:SuperSub('texSubscript','_','3','₃')
893 call s:SuperSub('texSubscript','_','4','₄')
894 call s:SuperSub('texSubscript','_','5','₅')
895 call s:SuperSub('texSubscript','_','6','₆')
896 call s:SuperSub('texSubscript','_','7','₇')
897 call s:SuperSub('texSubscript','_','8','₈')
898 call s:SuperSub('texSubscript','_','9','₉')
899 call s:SuperSub('texSubscript','_','a','ₐ')
900 call s:SuperSub('texSubscript','_','e','ₑ')
901 call s:SuperSub('texSubscript','_','i','ᵢ')
902 call s:SuperSub('texSubscript','_','o','ₒ')
903 call s:SuperSub('texSubscript','_','u','ᵤ')
904 call s:SuperSub('texSubscript','_','+','₊')
905 call s:SuperSub('texSubscript','_','-','₋')
906 call s:SuperSub('texSubscript','_','/','ˏ')
907 call s:SuperSub('texSubscript','_','(','₍')
908 call s:SuperSub('texSubscript','_',')','₎')
909 call s:SuperSub('texSubscript','_','\.','‸')
910 call s:SuperSub('texSubscript','_','r','ᵣ')
911 call s:SuperSub('texSubscript','_','v','ᵥ')
912 call s:SuperSub('texSubscript','_','x','ₓ')
913 call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
914 call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
915 call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
916 call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
917 call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
918 delfun s:SuperSub
919 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200920
921 " Accented characters: {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200922 if s:tex_conceal =~ 'a'
923 if b:tex_stylish
924 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
925 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
926 else
927 fun! s:Accents(chr,...)
928 let i= 1
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200929 for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"]
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200930 if i > a:0
931 break
932 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200933 if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200934 let i= i + 1
935 continue
936 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200937 if accent =~ '\a'
938 exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
939 else
940 exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
941 endif
Bram Moolenaare0021c72010-07-28 17:25:21 +0200942 let i= i + 1
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200943 endfor
944 endfun
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200945 " \` \' \^ \" \~ \. \c \H \k \r \u \v
946 call s:Accents('a','à','á','â','ä','ã',' ',' ',' ','ą','å','ă','ă')
947 call s:Accents('A','À','Á','Â','Ä','Ã',' ',' ',' ','Ą','Å','Ă','Ă')
948 call s:Accents('c',' ','ć','ĉ',' ',' ','ċ','ç',' ',' ',' ',' ','č')
949 call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ','Ç',' ',' ',' ',' ','Č')
950 call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
951 call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
952 call s:Accents('e','è','é','ê','ë','ẽ','ė','ȩ',' ','ę',' ','ĕ','ě')
953 call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě')
954 call s:Accents('g',' ',' ',' ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ')
955 call s:Accents('G',' ',' ',' ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ')
956 call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
957 call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ')
958 call s:Accents('l',' ','ĺ','ľ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
959 call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
960 call s:Accents('n',' ','ń',' ',' ','ñ',' ','ņ',' ',' ',' ',' ','ň')
961 call s:Accents('N',' ','Ń',' ',' ','Ñ',' ','Ņ',' ',' ',' ',' ','Ň')
962 call s:Accents('o','ò','ó','ô','ö','õ','ȯ',' ','ő','ǫ',' ','ŏ',' ')
963 call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ',' ','Ő','Ǫ',' ','Ŏ',' ')
964 call s:Accents('r',' ','ŕ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
965 call s:Accents('R',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
966 call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ',' ',' ',' ','š')
967 call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
968 call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
969 call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
970 call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű',' ','ů','ŭ',' ')
971 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű',' ','Ů','Ŭ',' ')
972 call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
973 call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
974 call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ')
975 call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ')
976 call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ','ž')
977 call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ','Ž')
978 call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
979 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200980 delfun s:Accents
981 syn match texAccent '\\aa\>' conceal cchar=å
982 syn match texAccent '\\AA\>' conceal cchar=Å
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200983 syn match texAccent '\\o\>' conceal cchar=ø
984 syn match texAccent '\\O\>' conceal cchar=Ø
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200985 syn match texLigature '\\AE\>' conceal cchar=Æ
986 syn match texLigature '\\ae\>' conceal cchar=æ
987 syn match texLigature '\\oe\>' conceal cchar=œ
988 syn match texLigature '\\OE\>' conceal cchar=Œ
989 syn match texLigature '\\ss\>' conceal cchar=ß
990 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200991 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200992endif
993
994" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000995" LaTeX synchronization: {{{1
996syn sync maxlines=200
997syn sync minlines=50
998
999syn sync match texSyncStop groupthere NONE "%stopzone\>"
1000
1001" Synchronization: {{{1
1002" The $..$ and $$..$$ make for impossible sync patterns
1003" (one can't tell if a "$$" starts or stops a math zone by itself)
1004" The following grouptheres coupled with minlines above
1005" help improve the odds of good syncing.
1006if !exists("tex_no_math")
1007 syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
1008 syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
1009 syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
1010 syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
1011 syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
1012 syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
1013 syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
1014 syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
1015endif
1016
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001017" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001018" Highlighting: {{{1
1019if did_tex_syntax_inits == 1
1020 let did_tex_syntax_inits= 2
1021 " TeX highlighting groups which should share similar highlighting
1022 if !exists("g:tex_no_error")
1023 if !exists("tex_no_math")
1024 HiLink texBadMath texError
1025 HiLink texMathDelimBad texError
1026 HiLink texMathError texError
1027 if !b:tex_stylish
1028 HiLink texOnlyMath texError
1029 endif
1030 endif
1031 HiLink texError Error
1032 endif
1033
Bram Moolenaar071d4272004-06-13 20:20:40 +00001034 HiLink texDefCmd texDef
1035 HiLink texDefName texDef
1036 HiLink texDocType texCmdName
1037 HiLink texDocTypeArgs texCmdArgs
1038 HiLink texInputFileOpt texCmdArgs
1039 HiLink texInputCurlies texDelimiter
1040 HiLink texLigature texSpecialChar
1041 if !exists("tex_no_math")
1042 HiLink texMathDelimSet1 texMathDelim
1043 HiLink texMathDelimSet2 texMathDelim
1044 HiLink texMathDelimKey texMathDelim
1045 HiLink texMathMatcher texMath
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001046 HiLink texAccent texStatement
1047 HiLink texGreek texStatement
1048 HiLink texSuperscript texStatement
1049 HiLink texSubscript texStatement
1050 HiLink texMathSymbol texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001051 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001052 HiLink texMathZoneW texMath
1053 HiLink texMathZoneX texMath
1054 HiLink texMathZoneY texMath
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001055 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001056 HiLink texMathZoneZ texMath
1057 endif
Bram Moolenaar81af9252010-12-10 20:35:50 +01001058 HiLink texRefZone Identifier
Bram Moolenaar071d4272004-06-13 20:20:40 +00001059 HiLink texSectionMarker texCmdName
1060 HiLink texSectionName texSection
1061 HiLink texSpaceCode texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001062 HiLink texStyleStatement texStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +00001063 HiLink texTypeSize texType
1064 HiLink texTypeStyle texType
1065
1066 " Basic TeX highlighting groups
Bram Moolenaar81af9252010-12-10 20:35:50 +01001067 HiLink texCite Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001068 HiLink texCmdArgs Number
1069 HiLink texCmdName Statement
1070 HiLink texComment Comment
1071 HiLink texDef Statement
1072 HiLink texDefParm Special
1073 HiLink texDelimiter Delimiter
1074 HiLink texInput Special
1075 HiLink texInputFile Special
1076 HiLink texLength Number
1077 HiLink texMath Special
1078 HiLink texMathDelim Statement
1079 HiLink texMathOper Operator
1080 HiLink texNewCmd Statement
1081 HiLink texNewEnv Statement
1082 HiLink texOption Number
Bram Moolenaar81af9252010-12-10 20:35:50 +01001083 HiLink texRefLabel Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001084 HiLink texSection PreCondit
1085 HiLink texSpaceCodeChar Special
1086 HiLink texSpecialChar SpecialChar
1087 HiLink texStatement Statement
1088 HiLink texString String
1089 HiLink texTodo Todo
1090 HiLink texType Type
1091 HiLink texZone PreCondit
1092
1093 delcommand HiLink
1094endif
1095
1096" Current Syntax: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +01001097unlet s:extfname
Bram Moolenaar071d4272004-06-13 20:20:40 +00001098let b:current_syntax = "tex"
Bram Moolenaare90ee312010-08-05 22:08:47 +02001099" vim: ts=8 fdm=marker