blob: 3277cb2e59aa8e8b6ab582ab86e5be3f9bf62063 [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 Moolenaar74cbdf02010-08-04 23:03:17 +02004" Last Change: Aug 04, 2010
5" Version: 55
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
58" a=accents/ligatures m=math symbols g=Greek s=superscripts/subscripts
59if !exists("g:tex_conceal")
60 let s:tex_conceal= 'amgs'
61else
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
70let b:extfname=expand("%:e")
71if exists("g:tex_stylish")
72 let b:tex_stylish= g:tex_stylish
73elseif !exists("b:tex_stylish")
74 if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
75 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
95 set isk-=_
96 if b:tex_stylish
97 set isk+=@
98 endif
99else
100 setlocal isk-=_
101 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")
303 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
304 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)
348 call TexNewMathZone("J","subequations",0)
349 call TexNewMathZone("K","xalignat",1)
350 call TexNewMathZone("L","xxalignat",0)
351
352 " Inline Math Zones: {{{2
Bram Moolenaare0021c72010-07-28 17:25:21 +0200353 if has("conceal") && &enc == 'utf-8'
354 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
355 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
356 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
357 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
358 else
359 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
360 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
361 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
362 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
363 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200364 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000365
366 syn match texMathOper "[_^=]" contained
367
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200368 " Text Inside Math Zones: {{{2
369 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
370
Bram Moolenaar071d4272004-06-13 20:20:40 +0000371 " \left..something.. and \right..something.. support: {{{2
372 syn match texMathDelimBad contained "\S"
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200373 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
374 syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
375 syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
376 else
377 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
378 endif
379 syn match texMathDelim contained "\\\([bB]igg\=[lr]\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
381 syn match texMathDelim contained "\\lefteqn\>"
382 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
383 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
384 syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
385 syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
386 syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
387 syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
388 syn keyword texMathDelimKey contained lbrace lvert rfloor
389endif
390
391" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
392syn match texSpecialChar "\\[$&%#{}_]"
393if b:tex_stylish
394 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
395else
396 syn match texSpecialChar "\\[SP@]\A"me=e-1
397endif
398syn match texSpecialChar "\\\\"
399if !exists("tex_no_math")
400 syn match texOnlyMath "[_^]"
401endif
402syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
403
404" Comments: {{{1
405" Normal TeX LaTeX : %....
406" Documented TeX Format: ^^A... -and- leading %s (only)
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000407if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
408 syn cluster texCommentGroup contains=texTodo,@Spell
409else
410 syn cluster texCommentGroup contains=texTodo,@NoSpell
411endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000412syn case ignore
Bram Moolenaar18144c82006-04-12 21:52:12 +0000413syn keyword texTodo contained combak fixme todo xxx
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414syn case match
415if b:extfname == "dtx"
416 syn match texComment "\^\^A.*$" contains=@texCommentGroup
417 syn match texComment "^%\+" contains=@texCommentGroup
418else
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000419 if g:tex_fold_enabled
420 " allows syntax-folding of 2 or more contiguous comment lines
421 " single-line comments are not folded
422 syn match texComment "%.*$" contains=@texCommentGroup
423 syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
424 else
425 syn match texComment "%.*$" contains=@texCommentGroup
426 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000427endif
428
429" Separate lines used for verb` and verb# so that the end conditions {{{1
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200430" will appropriately terminate.
431" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
432if exists("g:tex_verbspell") && g:tex_verbspell
433 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
434 " listings package:
435 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
436 " moreverb package:
437 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
438 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
439 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
440 if version < 600
441 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell
442 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell
443 else
444 if b:tex_stylish
445 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell
446 else
447 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell
448 endif
449 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450else
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200451 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>"
452 " listings package:
453 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>"
454 " moreverb package:
455 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>"
456 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>"
457 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>"
458 if version < 600
459 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
460 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
461 else
462 if b:tex_stylish
463 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
464 else
465 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
466 endif
467 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000468endif
469
470" Tex Reference Zones: {{{1
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000471syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup
472syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup
473syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000474syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup
475syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
476syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
Bram Moolenaarcc016f52005-12-10 20:23:46 +0000477syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200478syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
479syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,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 Moolenaar611df5b2010-07-26 22:51:56 +0200517" Conceal mode support (supports set cole=1) {{{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 Moolenaar4b22cdb2010-08-02 22:12:46 +0200521 if s:tex_conceal =~ 'm'
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200522 syn match texMathSymbol '\\angle\>' contained conceal cchar=∠
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200523 syn match texMathSymbol '\\approx\>' contained conceal cchar=≈
524 syn match texMathSymbol '\\ast\>' contained conceal cchar=∗
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200525 syn match texMathSymbol '\\asymp\>' contained conceal cchar=≍
526 syn match texMathSymbol '\\backepsilon\>' contained conceal cchar=∍
527 syn match texMathSymbol '\\backsimeq\>' contained conceal cchar=≃
528 syn match texMathSymbol '\\barwedge\>' contained conceal cchar=⊼
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200529 syn match texMathSymbol '\\because\>' contained conceal cchar=∵
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200530 syn match texMathSymbol '\\between\>' contained conceal cchar=≬
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200531 syn match texMathSymbol '\\bigcap\>' contained conceal cchar=∩
532 syn match texMathSymbol '\\bigcup\>' contained conceal cchar=∪
533 syn match texMathSymbol '\\bigodot\>' contained conceal cchar=⊙
534 syn match texMathSymbol '\\bigoplus\>' contained conceal cchar=⊕
535 syn match texMathSymbol '\\bigotimes\>' contained conceal cchar=⊗
536 syn match texMathSymbol '\\bigsqcup\>' contained conceal cchar=⊔
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200537 syn match texMathSymbol '\\bigtriangledown\>' contained conceal cchar=∇
538 syn match texMathSymbol '\\bigvee\>' contained conceal cchar=⋁
539 syn match texMathSymbol '\\bigwedge\>' contained conceal cchar=⋀
540 syn match texMathSymbol '\\blacksquare\>' contained conceal cchar=∎
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200541 syn match texMathSymbol '\\bot\>' contained conceal cchar=⊥
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200542 syn match texMathSymbol '\\boxdot\>' contained conceal cchar=⊡
543 syn match texMathSymbol '\\boxminus\>' contained conceal cchar=⊟
544 syn match texMathSymbol '\\boxplus\>' contained conceal cchar=⊞
545 syn match texMathSymbol '\\boxtimes\>' contained conceal cchar=⊠
546 syn match texMathSymbol '\\bumpeq\>' contained conceal cchar=≏
547 syn match texMathSymbol '\\Bumpeq\>' contained conceal cchar=≎
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200548 syn match texMathSymbol '\\cap\>' contained conceal cchar=∩
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200549 syn match texMathSymbol '\\Cap\>' contained conceal cchar=⋒
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200550 syn match texMathSymbol '\\cdot\>' contained conceal cchar=·
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200551 syn match texMathSymbol '\\cdots\>' contained conceal cchar=⋯
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200552 syn match texMathSymbol '\\circ\>' contained conceal cchar=∘
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200553 syn match texMathSymbol '\\circeq\>' contained conceal cchar=≗
554 syn match texMathSymbol '\\circledast\>' contained conceal cchar=⊛
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200555 syn match texMathSymbol '\\circledcirc\>' contained conceal cchar=⊚
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200556 syn match texMathSymbol '\\complement\>' contained conceal cchar=∁
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200557 syn match texMathSymbol '\\cong\>' contained conceal cchar=≅
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200558 syn match texMathSymbol '\\coprod\>' contained conceal cchar=∐
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200559 syn match texMathSymbol '\\cup\>' contained conceal cchar=∪
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200560 syn match texMathSymbol '\\Cup\>' contained conceal cchar=⋓
561 syn match texMathSymbol '\\curlyeqprec\>' contained conceal cchar=⋞
562 syn match texMathSymbol '\\curlyeqsucc\>' contained conceal cchar=⋟
563 syn match texMathSymbol '\\curlyvee\>' contained conceal cchar=⋎
564 syn match texMathSymbol '\\curlywedge\>' contained conceal cchar=⋏
565 syn match texMathSymbol '\\dashv\>' contained conceal cchar=⊣
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200566 syn match texMathSymbol '\\diamond\>' contained conceal cchar=⋄
567 syn match texMathSymbol '\\div\>' contained conceal cchar=÷
568 syn match texMathSymbol '\\doteq\>' contained conceal cchar=≐
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200569 syn match texMathSymbol '\\doteqdot\>' contained conceal cchar=≑
570 syn match texMathSymbol '\\dotplus\>' contained conceal cchar=∔
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200571 syn match texMathSymbol '\\dotsb\>' contained conceal cchar=⋯
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200572 syn match texMathSymbol '\\dotsc\>' contained conceal cchar=…
573 syn match texMathSymbol '\\dots\>' contained conceal cchar=…
574 syn match texMathSymbol '\\dotsi\>' contained conceal cchar=⋯
575 syn match texMathSymbol '\\dotso\>' contained conceal cchar=…
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200576 syn match texMathSymbol '\\doublebarwedge\>' contained conceal cchar=⩞
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200577 syn match texMathSymbol '\\emptyset\>' contained conceal cchar=∅
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200578 syn match texMathSymbol '\\eqcirc\>' contained conceal cchar=≖
579 syn match texMathSymbol '\\eqsim\>' contained conceal cchar=≂
580 syn match texMathSymbol '\\eqslantgtr\>' contained conceal cchar=⪖
581 syn match texMathSymbol '\\eqslantless\>' contained conceal cchar=⪕
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200582 syn match texMathSymbol '\\equiv\>' contained conceal cchar=≡
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200583 syn match texMathSymbol '\\exists\>' contained conceal cchar=∃
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200584 syn match texMathSymbol '\\fallingdotseq\>' contained conceal cchar=≒
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200585 syn match texMathSymbol '\\forall\>' contained conceal cchar=∀
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200586 syn match texMathSymbol '\\ge\>' contained conceal cchar=≥
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200587 syn match texMathSymbol '\\geq\>' contained conceal cchar=≥
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200588 syn match texMathSymbol '\\geqq\>' contained conceal cchar=≧
589 syn match texMathSymbol '\\gneqq\>' contained conceal cchar=≩
590 syn match texMathSymbol '\\gtrdot\>' contained conceal cchar=⋗
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200591 syn match texMathSymbol '\\gtreqless\>' contained conceal cchar=⋛
592 syn match texMathSymbol '\\gtrless\>' contained conceal cchar=≷
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200593 syn match texMathSymbol '\\gtrsim\>' contained conceal cchar=≳
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200594 syn match texMathSymbol '\\iiint\>' contained conceal cchar=∭
595 syn match texMathSymbol '\\iint\>' contained conceal cchar=∬
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200596 syn match texMathSymbol '\\Im\>' contained conceal cchar=ℑ
597 syn match texMathSymbol '\\in\>' contained conceal cchar=∈
598 syn match texMathSymbol '\\infty\>' contained conceal cchar=∞
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200599 syn match texMathSymbol '\\int\>' contained conceal cchar=∫
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200600 syn match texMathSymbol '\\lceil\>' contained conceal cchar=⌈
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200601 syn match texMathSymbol '\\ldots\>' contained conceal cchar=…
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200602 syn match texMathSymbol '\\le\>' contained conceal cchar=≤
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200603 syn match texMathSymbol '\\leftarrow\>' contained conceal cchar=⟵
604 syn match texMathSymbol '\\Leftarrow\>' contained conceal cchar=⟸
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200605 syn match texMathSymbol '\\left(' contained conceal cchar=(
606 syn match texMathSymbol '\\left\[' contained conceal cchar=[
607 syn match texMathSymbol '\\left\\{' contained conceal cchar={
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200608 syn match texMathSymbol '\\leftthreetimes\>' contained conceal cchar=⋋
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200609 syn match texMathSymbol '\\leq\>' contained conceal cchar=≤
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200610 syn match texMathSymbol '\\leqq\>' contained conceal cchar=≦
611 syn match texMathSymbol '\\lessdot\>' contained conceal cchar=⋖
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200612 syn match texMathSymbol '\\lesseqgtr\>' contained conceal cchar=⋚
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200613 syn match texMathSymbol '\\lesssim\>' contained conceal cchar=≲
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200614 syn match texMathSymbol '\\lfloor\>' contained conceal cchar=⌊
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200615 syn match texMathSymbol '\\lneqq\>' contained conceal cchar=≨
616 syn match texMathSymbol '\\ltimes\>' contained conceal cchar=⋉
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200617 syn match texMathSymbol '\\mapsto\>' contained conceal cchar=↦
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200618 syn match texMathSymbol '\\measuredangle\>' contained conceal cchar=∡
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200619 syn match texMathSymbol '\\mid\>' contained conceal cchar=∣
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200620 syn match texMathSymbol '\\mp\>' contained conceal cchar=∓
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200621 syn match texMathSymbol '\\nabla\>' contained conceal cchar=∇
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200622 syn match texMathSymbol '\\ncong\>' contained conceal cchar=≇
623 syn match texMathSymbol '\\ne\>' contained conceal cchar=≠
624 syn match texMathSymbol '\\neg\>' contained conceal cchar=¬
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200625 syn match texMathSymbol '\\neq\>' contained conceal cchar=≠
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200626 syn match texMathSymbol '\\nexists\>' contained conceal cchar=∄
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200627 syn match texMathSymbol '\\ngeq\>' contained conceal cchar=≱
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200628 syn match texMathSymbol '\\ngeqq\>' contained conceal cchar=≱
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200629 syn match texMathSymbol '\\ngtr\>' contained conceal cchar=≯
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200630 syn match texMathSymbol '\\ni\>' contained conceal cchar=∋
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200631 syn match texMathSymbol '\\nleq\>' contained conceal cchar=≰
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200632 syn match texMathSymbol '\\nleqq\>' contained conceal cchar=≰
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200633 syn match texMathSymbol '\\nless\>' contained conceal cchar=≮
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200634 syn match texMathSymbol '\\nmid\>' contained conceal cchar=∤
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200635 syn match texMathSymbol '\\notin\>' contained conceal cchar=∉
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200636 syn match texMathSymbol '\\nprec\>' contained conceal cchar=⊀
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200637 syn match texMathSymbol '\\nsim\>' contained conceal cchar=≁
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200638 syn match texMathSymbol '\\nsucc\>' contained conceal cchar=⊁
639 syn match texMathSymbol '\\ntriangleleft\>' contained conceal cchar=⋪
640 syn match texMathSymbol '\\ntrianglelefteq\>' contained conceal cchar=⋬
641 syn match texMathSymbol '\\ntriangleright\>' contained conceal cchar=⋫
642 syn match texMathSymbol '\\ntrianglerighteq\>' contained conceal cchar=⋭
643 syn match texMathSymbol '\\nvdash\>' contained conceal cchar=⊬
644 syn match texMathSymbol '\\nvDash\>' contained conceal cchar=⊭
645 syn match texMathSymbol '\\nVdash\>' contained conceal cchar=⊮
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200646 syn match texMathSymbol '\\odot\>' contained conceal cchar=⊙
647 syn match texMathSymbol '\\oint\>' contained conceal cchar=∮
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200648 syn match texMathSymbol '\\ominus\>' contained conceal cchar=⊖
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200649 syn match texMathSymbol '\\oplus\>' contained conceal cchar=⊕
650 syn match texMathSymbol '\\oslash\>' contained conceal cchar=⊘
651 syn match texMathSymbol '\\otimes\>' contained conceal cchar=⊗
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200652 syn match texMathSymbol '\\owns\>' contained conceal cchar=∋
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200653 syn match texMathSymbol '\\partial\>' contained conceal cchar=∂
654 syn match texMathSymbol '\\perp\>' contained conceal cchar=⊥
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200655 syn match texMathSymbol '\\pitchfork\>' contained conceal cchar=⋔
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200656 syn match texMathSymbol '\\pm\>' contained conceal cchar=±
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200657 syn match texMathSymbol '\\precapprox\>' contained conceal cchar=⪷
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200658 syn match texMathSymbol '\\prec\>' contained conceal cchar=≺
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200659 syn match texMathSymbol '\\preccurlyeq\>' contained conceal cchar=≼
660 syn match texMathSymbol '\\preceq\>' contained conceal cchar=⪯
661 syn match texMathSymbol '\\precnapprox\>' contained conceal cchar=⪹
662 syn match texMathSymbol '\\precneqq\>' contained conceal cchar=⪵
663 syn match texMathSymbol '\\precsim\>' contained conceal cchar=≾
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200664 syn match texMathSymbol '\\prod\>' contained conceal cchar=∏
665 syn match texMathSymbol '\\propto\>' contained conceal cchar=∝
666 syn match texMathSymbol '\\rceil\>' contained conceal cchar=⌉
667 syn match texMathSymbol '\\Re\>' contained conceal cchar=ℜ
668 syn match texMathSymbol '\\rfloor\>' contained conceal cchar=⌋
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200669 syn match texMathSymbol '\\rightarrow\>' contained conceal cchar=⟶
670 syn match texMathSymbol '\\Rightarrow\>' contained conceal cchar=⟹
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200671 syn match texMathSymbol '\\right)' contained conceal cchar=)
672 syn match texMathSymbol '\\right]' contained conceal cchar=]
673 syn match texMathSymbol '\\right\\}' contained conceal cchar=}
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200674 syn match texMathSymbol '\\rightthreetimes\>' contained conceal cchar=⋌
675 syn match texMathSymbol '\\risingdotseq\>' contained conceal cchar=≓
676 syn match texMathSymbol '\\rtimes\>' contained conceal cchar=⋊
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200677 syn match texMathSymbol '\\setminus\>' contained conceal cchar=∖
678 syn match texMathSymbol '\\sim\>' contained conceal cchar=∼
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200679 syn match texMathSymbol '\\sphericalangle\>' contained conceal cchar=∢
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200680 syn match texMathSymbol '\\sqcap\>' contained conceal cchar=⊓
681 syn match texMathSymbol '\\sqcup\>' contained conceal cchar=⊔
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200682 syn match texMathSymbol '\\sqsubset\>' contained conceal cchar=⊏
683 syn match texMathSymbol '\\sqsubseteq\>' contained conceal cchar=⊑
684 syn match texMathSymbol '\\sqsupset\>' contained conceal cchar=⊐
685 syn match texMathSymbol '\\sqsupseteq\>' contained conceal cchar=⊒
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200686 syn match texMathSymbol '\\subset\>' contained conceal cchar=⊂
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200687 syn match texMathSymbol '\\Subset\>' contained conceal cchar=⋐
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200688 syn match texMathSymbol '\\subseteq\>' contained conceal cchar=⊆
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200689 syn match texMathSymbol '\\subseteqq\>' contained conceal cchar=⫅
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200690 syn match texMathSymbol '\\subsetneq\>' contained conceal cchar=⊊
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200691 syn match texMathSymbol '\\subsetneqq\>' contained conceal cchar=⫋
692 syn match texMathSymbol '\\succapprox\>' contained conceal cchar=⪸
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200693 syn match texMathSymbol '\\succ\>' contained conceal cchar=≻
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200694 syn match texMathSymbol '\\succcurlyeq\>' contained conceal cchar=≽
695 syn match texMathSymbol '\\succeq\>' contained conceal cchar=⪰
696 syn match texMathSymbol '\\succnapprox\>' contained conceal cchar=⪺
697 syn match texMathSymbol '\\succneqq\>' contained conceal cchar=⪶
698 syn match texMathSymbol '\\succsim\>' contained conceal cchar=≿
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200699 syn match texMathSymbol '\\sum\>' contained conceal cchar=∑
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200700 syn match texMathSymbol '\\Supset\>' contained conceal cchar=⋑
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200701 syn match texMathSymbol '\\supseteq\>' contained conceal cchar=⊇
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200702 syn match texMathSymbol '\\supseteqq\>' contained conceal cchar=⫆
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200703 syn match texMathSymbol '\\supsetneq\>' contained conceal cchar=⊋
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200704 syn match texMathSymbol '\\supsetneqq\>' contained conceal cchar=⫌
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200705 syn match texMathSymbol '\\surd\>' contained conceal cchar=√
706 syn match texMathSymbol '\\therefore\>' contained conceal cchar=∴
707 syn match texMathSymbol '\\times\>' contained conceal cchar=×
708 syn match texMathSymbol '\\to\>' contained conceal cchar=→
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200709 syn match texMathSymbol '\\top\>' contained conceal cchar=⊤
710 syn match texMathSymbol '\\triangleleft\>' contained conceal cchar=⊲
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200711 syn match texMathSymbol '\\trianglelefteq\>' contained conceal cchar=⊴
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200712 syn match texMathSymbol '\\triangleq\>' contained conceal cchar=≜
713 syn match texMathSymbol '\\triangleright\>' contained conceal cchar=⊳
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200714 syn match texMathSymbol '\\trianglerighteq\>' contained conceal cchar=⊵
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200715 syn match texMathSymbol '\\varnothing\>' contained conceal cchar=∅
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200716 syn match texMathSymbol '\\vartriangle\>' contained conceal cchar=∆
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200717 syn match texMathSymbol '\\vdash\>' contained conceal cchar=⊢
718 syn match texMathSymbol '\\vDash\>' contained conceal cchar=⊨
719 syn match texMathSymbol '\\Vdash\>' contained conceal cchar=⊩
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200720 syn match texMathSymbol '\\vdots\>' contained conceal cchar=⋮
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200721 syn match texMathSymbol '\\veebar\>' contained conceal cchar=⊻
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200722 syn match texMathSymbol '\\vee\>' contained conceal cchar=∨
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200723 syn match texMathSymbol '\\Vvdash\>' contained conceal cchar=⊪
Bram Moolenaar5aae4192010-08-03 23:00:38 +0200724 syn match texMathSymbol '\\wedge\>' contained conceal cchar=∧
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200725 syn match texMathSymbol '\\wr\>' contained conceal cchar=≀
726
727 if &ambw == "double"
728 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
729 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
730 else
731 syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫
732 syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪
733 endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200734 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200735
736 " Greek {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200737 if s:tex_conceal =~ 'g'
738 fun! s:Greek(group,pat,cchar)
739 exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
740 endfun
741 call s:Greek('texGreek','\\alpha\>' ,'α')
742 call s:Greek('texGreek','\\beta\>' ,'β')
743 call s:Greek('texGreek','\\gamma\>' ,'γ')
744 call s:Greek('texGreek','\\delta\>' ,'δ')
745 call s:Greek('texGreek','\\epsilon\>' ,'ϵ')
746 call s:Greek('texGreek','\\varepsilon\>' ,'ε')
747 call s:Greek('texGreek','\\zeta\>' ,'ζ')
748 call s:Greek('texGreek','\\eta\>' ,'η')
749 call s:Greek('texGreek','\\theta\>' ,'θ')
750 call s:Greek('texGreek','\\vartheta\>' ,'ϑ')
751 call s:Greek('texGreek','\\kappa\>' ,'κ')
752 call s:Greek('texGreek','\\lambda\>' ,'λ')
753 call s:Greek('texGreek','\\mu\>' ,'μ')
754 call s:Greek('texGreek','\\nu\>' ,'ν')
755 call s:Greek('texGreek','\\xi\>' ,'ξ')
756 call s:Greek('texGreek','\\pi\>' ,'π')
757 call s:Greek('texGreek','\\varpi\>' ,'ϖ')
758 call s:Greek('texGreek','\\rho\>' ,'ρ')
759 call s:Greek('texGreek','\\varrho\>' ,'ϱ')
760 call s:Greek('texGreek','\\sigma\>' ,'σ')
761 call s:Greek('texGreek','\\varsigma\>' ,'ς')
762 call s:Greek('texGreek','\\tau\>' ,'τ')
763 call s:Greek('texGreek','\\upsilon\>' ,'υ')
764 call s:Greek('texGreek','\\phi\>' ,'φ')
765 call s:Greek('texGreek','\\varphi\>' ,'ϕ')
766 call s:Greek('texGreek','\\chi\>' ,'χ')
767 call s:Greek('texGreek','\\psi\>' ,'ψ')
768 call s:Greek('texGreek','\\omega\>' ,'ω')
769 call s:Greek('texGreek','\\Gamma\>' ,'Γ')
770 call s:Greek('texGreek','\\Delta\>' ,'Δ')
771 call s:Greek('texGreek','\\Theta\>' ,'Θ')
772 call s:Greek('texGreek','\\Lambda\>' ,'Λ')
773 call s:Greek('texGreek','\\Xi\>' ,'Χ')
774 call s:Greek('texGreek','\\Pi\>' ,'Π')
775 call s:Greek('texGreek','\\Sigma\>' ,'Σ')
776 call s:Greek('texGreek','\\Upsilon\>' ,'Υ')
777 call s:Greek('texGreek','\\Phi\>' ,'Φ')
778 call s:Greek('texGreek','\\Psi\>' ,'Ψ')
779 call s:Greek('texGreek','\\Omega\>' ,'Ω')
780 delfun s:Greek
781 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200782
783 " Superscripts/Subscripts {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200784 if s:tex_conceal =~ 's'
785 syn region texSuperscript matchgroup=Delimiter start='\^{' end='}' contained concealends contains=texSuperscripts,texStatement
786 syn region texSubscript matchgroup=Delimiter start='_{' end='}' contained concealends contains=texSubscripts,texStatement
787 fun! s:SuperSub(group,leader,pat,cchar)
788 exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
789 exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
790 endfun
791 call s:SuperSub('texSuperscript','\^','0','⁰')
792 call s:SuperSub('texSuperscript','\^','1','¹')
793 call s:SuperSub('texSuperscript','\^','2','²')
794 call s:SuperSub('texSuperscript','\^','3','³')
795 call s:SuperSub('texSuperscript','\^','4','⁴')
796 call s:SuperSub('texSuperscript','\^','5','⁵')
797 call s:SuperSub('texSuperscript','\^','6','⁶')
798 call s:SuperSub('texSuperscript','\^','7','⁷')
799 call s:SuperSub('texSuperscript','\^','8','⁸')
800 call s:SuperSub('texSuperscript','\^','9','⁹')
801 call s:SuperSub('texSuperscript','\^','a','ᵃ')
802 call s:SuperSub('texSuperscript','\^','b','ᵇ')
803 call s:SuperSub('texSuperscript','\^','c','ᶜ')
804 call s:SuperSub('texSuperscript','\^','d','ᵈ')
805 call s:SuperSub('texSuperscript','\^','e','ᵉ')
806 call s:SuperSub('texSuperscript','\^','f','ᶠ')
807 call s:SuperSub('texSuperscript','\^','g','ᵍ')
808 call s:SuperSub('texSuperscript','\^','h','ʰ')
809 call s:SuperSub('texSuperscript','\^','i','ⁱ')
810 call s:SuperSub('texSuperscript','\^','j','ʲ')
811 call s:SuperSub('texSuperscript','\^','k','ᵏ')
812 call s:SuperSub('texSuperscript','\^','l','ˡ')
813 call s:SuperSub('texSuperscript','\^','m','ᵐ')
814 call s:SuperSub('texSuperscript','\^','n','ⁿ')
815 call s:SuperSub('texSuperscript','\^','o','ᵒ')
816 call s:SuperSub('texSuperscript','\^','p','ᵖ')
817 call s:SuperSub('texSuperscript','\^','r','ʳ')
818 call s:SuperSub('texSuperscript','\^','s','ˢ')
819 call s:SuperSub('texSuperscript','\^','t','ᵗ')
820 call s:SuperSub('texSuperscript','\^','u','ᵘ')
821 call s:SuperSub('texSuperscript','\^','v','ᵛ')
822 call s:SuperSub('texSuperscript','\^','w','ʷ')
823 call s:SuperSub('texSuperscript','\^','x','ˣ')
824 call s:SuperSub('texSuperscript','\^','y','ʸ')
825 call s:SuperSub('texSuperscript','\^','z','ᶻ')
826 call s:SuperSub('texSuperscript','\^','A','ᴬ')
827 call s:SuperSub('texSuperscript','\^','B','ᴮ')
828 call s:SuperSub('texSuperscript','\^','D','ᴰ')
829 call s:SuperSub('texSuperscript','\^','E','ᴱ')
830 call s:SuperSub('texSuperscript','\^','G','ᴳ')
831 call s:SuperSub('texSuperscript','\^','H','ᴴ')
832 call s:SuperSub('texSuperscript','\^','I','ᴵ')
833 call s:SuperSub('texSuperscript','\^','J','ᴶ')
834 call s:SuperSub('texSuperscript','\^','K','ᴷ')
835 call s:SuperSub('texSuperscript','\^','L','ᴸ')
836 call s:SuperSub('texSuperscript','\^','M','ᴹ')
837 call s:SuperSub('texSuperscript','\^','N','ᴺ')
838 call s:SuperSub('texSuperscript','\^','O','ᴼ')
839 call s:SuperSub('texSuperscript','\^','P','ᴾ')
840 call s:SuperSub('texSuperscript','\^','R','ᴿ')
841 call s:SuperSub('texSuperscript','\^','T','ᵀ')
842 call s:SuperSub('texSuperscript','\^','U','ᵁ')
843 call s:SuperSub('texSuperscript','\^','W','ᵂ')
844 call s:SuperSub('texSuperscript','\^','+','⁺')
845 call s:SuperSub('texSuperscript','\^','-','⁻')
846 call s:SuperSub('texSuperscript','\^','<','˂')
847 call s:SuperSub('texSuperscript','\^','>','˃')
848 call s:SuperSub('texSuperscript','\^','/','ˊ')
849 call s:SuperSub('texSuperscript','\^','(','⁽')
850 call s:SuperSub('texSuperscript','\^',')','⁾')
851 call s:SuperSub('texSuperscript','\^','\.','˙')
852 call s:SuperSub('texSuperscript','\^','=','˭')
853 call s:SuperSub('texSubscript','_','0','₀')
854 call s:SuperSub('texSubscript','_','1','₁')
855 call s:SuperSub('texSubscript','_','2','₂')
856 call s:SuperSub('texSubscript','_','3','₃')
857 call s:SuperSub('texSubscript','_','4','₄')
858 call s:SuperSub('texSubscript','_','5','₅')
859 call s:SuperSub('texSubscript','_','6','₆')
860 call s:SuperSub('texSubscript','_','7','₇')
861 call s:SuperSub('texSubscript','_','8','₈')
862 call s:SuperSub('texSubscript','_','9','₉')
863 call s:SuperSub('texSubscript','_','a','ₐ')
864 call s:SuperSub('texSubscript','_','e','ₑ')
865 call s:SuperSub('texSubscript','_','i','ᵢ')
866 call s:SuperSub('texSubscript','_','o','ₒ')
867 call s:SuperSub('texSubscript','_','u','ᵤ')
868 call s:SuperSub('texSubscript','_','+','₊')
869 call s:SuperSub('texSubscript','_','-','₋')
870 call s:SuperSub('texSubscript','_','/','ˏ')
871 call s:SuperSub('texSubscript','_','(','₍')
872 call s:SuperSub('texSubscript','_',')','₎')
873 call s:SuperSub('texSubscript','_','\.','‸')
874 call s:SuperSub('texSubscript','_','r','ᵣ')
875 call s:SuperSub('texSubscript','_','v','ᵥ')
876 call s:SuperSub('texSubscript','_','x','ₓ')
877 call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
878 call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
879 call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
880 call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
881 call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
882 delfun s:SuperSub
883 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200884
885 " Accented characters: {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200886 if s:tex_conceal =~ 'a'
887 if b:tex_stylish
888 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
889 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
890 else
891 fun! s:Accents(chr,...)
892 let i= 1
893 for accent in ["`","\\'","^",'"','\~',"r","v"]
894 if i > a:0
895 break
896 endif
897 if strlen(a:{i}) == 0
898 let i= i + 1
899 continue
900 endif
901 exe "syn match texAccent '\\\\".accent."{".a:chr."}' conceal cchar=".a:{i}
Bram Moolenaare0021c72010-07-28 17:25:21 +0200902 let i= i + 1
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200903 endfor
904 endfun
905 call s:Accents('a','à','á','â','ä','ã','å','ă')
906 call s:Accents('A','À','Á','Â','Ä','Ã','Å','Ă')
907 call s:Accents('C',"" ,'Ć','Ĉ',"" ,"" ,"" ,'Ć')
908 call s:Accents('e','è','é','ê','ë','ẽ',"" ,'ĕ')
909 call s:Accents('E','È','É','Ê','Ë','Ẽ',"" ,'Ė')
910 call s:Accents('i','ì','í','î','ï','ĩ',"" ,"ĭ")
911 call s:Accents('I','Ì','Í','Î','Ï','Ĩ',"" ,'Ĭ')
912 call s:Accents('o','ò','ó','ô','ö','õ',"" ,'ŏ')
913 call s:Accents('O','Ò','Ó','Ô','Ö','Õ',"" ,'Ŏ')
914 call s:Accents('r',"" ,'ŕ',"" ,"" ,"" ,"" ,'ř')
915 call s:Accents('R',"" ,'Ŕ',"" ,"" ,"" ,"" ,'Ř')
916 call s:Accents('s',"" ,'ś','ŝ',"" ,"" ,"" ,'š')
917 call s:Accents('S',"" ,'Ś','Ŝ',"" ,"" ,"" ,'Š')
918 call s:Accents('u','ù','ú','û','ü','ũ',"" ,'ŭ')
919 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',"" ,'Ŭ')
920 call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',"" ,"" )
921 call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',"" ,"" )
922 delfun s:Accents
923 syn match texAccent '\\aa\>' conceal cchar=å
924 syn match texAccent '\\AA\>' conceal cchar=Å
925 syn match texAccent '\\k{a}' conceal cchar=ą
926 syn match texAccent '\\k{A}' conceal cchar=Ą
927 syn match texAccent '\\c{C}' conceal cchar=Ç
928 syn match texAccent '\\c{c}' conceal cchar=ç
929 syn match texAccent '\\\~{n}' conceal cchar=ñ
930 syn match texAccent '\\\~{N}' conceal cchar=Ñ
931 syn match texAccent '\\o\>' conceal cchar=ø
932 syn match texAccent '\\O\>' conceal cchar=Ø
933 syn match texAccent '\\H{o}' conceal cchar=ő
934 syn match texAccent '\\H{O}' conceal cchar=Ő
935 syn match texAccent '\\c{r}' conceal cchar=ŗ
936 syn match texLigature '\\AE\>' conceal cchar=Æ
937 syn match texLigature '\\ae\>' conceal cchar=æ
938 syn match texLigature '\\oe\>' conceal cchar=œ
939 syn match texLigature '\\OE\>' conceal cchar=Œ
940 syn match texLigature '\\ss\>' conceal cchar=ß
941 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200942 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200943endif
944
945" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000946" LaTeX synchronization: {{{1
947syn sync maxlines=200
948syn sync minlines=50
949
950syn sync match texSyncStop groupthere NONE "%stopzone\>"
951
952" Synchronization: {{{1
953" The $..$ and $$..$$ make for impossible sync patterns
954" (one can't tell if a "$$" starts or stops a math zone by itself)
955" The following grouptheres coupled with minlines above
956" help improve the odds of good syncing.
957if !exists("tex_no_math")
958 syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
959 syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
960 syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
961 syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
962 syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
963 syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
964 syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
965 syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
966endif
967
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200968" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000969" Highlighting: {{{1
970if did_tex_syntax_inits == 1
971 let did_tex_syntax_inits= 2
972 " TeX highlighting groups which should share similar highlighting
973 if !exists("g:tex_no_error")
974 if !exists("tex_no_math")
975 HiLink texBadMath texError
976 HiLink texMathDelimBad texError
977 HiLink texMathError texError
978 if !b:tex_stylish
979 HiLink texOnlyMath texError
980 endif
981 endif
982 HiLink texError Error
983 endif
984
Bram Moolenaarcc016f52005-12-10 20:23:46 +0000985 HiLink texCite texRefZone
Bram Moolenaar071d4272004-06-13 20:20:40 +0000986 HiLink texDefCmd texDef
987 HiLink texDefName texDef
988 HiLink texDocType texCmdName
989 HiLink texDocTypeArgs texCmdArgs
990 HiLink texInputFileOpt texCmdArgs
991 HiLink texInputCurlies texDelimiter
992 HiLink texLigature texSpecialChar
993 if !exists("tex_no_math")
994 HiLink texMathDelimSet1 texMathDelim
995 HiLink texMathDelimSet2 texMathDelim
996 HiLink texMathDelimKey texMathDelim
997 HiLink texMathMatcher texMath
Bram Moolenaar5c736222010-01-06 20:54:52 +0100998 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +0000999 HiLink texMathZoneW texMath
1000 HiLink texMathZoneX texMath
1001 HiLink texMathZoneY texMath
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001002 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001003 HiLink texMathZoneZ texMath
1004 endif
1005 HiLink texSectionMarker texCmdName
1006 HiLink texSectionName texSection
1007 HiLink texSpaceCode texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001008 HiLink texStyleStatement texStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +00001009 HiLink texTypeSize texType
1010 HiLink texTypeStyle texType
1011
1012 " Basic TeX highlighting groups
1013 HiLink texCmdArgs Number
1014 HiLink texCmdName Statement
1015 HiLink texComment Comment
1016 HiLink texDef Statement
1017 HiLink texDefParm Special
1018 HiLink texDelimiter Delimiter
1019 HiLink texInput Special
1020 HiLink texInputFile Special
1021 HiLink texLength Number
1022 HiLink texMath Special
1023 HiLink texMathDelim Statement
1024 HiLink texMathOper Operator
1025 HiLink texNewCmd Statement
1026 HiLink texNewEnv Statement
1027 HiLink texOption Number
1028 HiLink texRefZone Special
1029 HiLink texSection PreCondit
1030 HiLink texSpaceCodeChar Special
1031 HiLink texSpecialChar SpecialChar
1032 HiLink texStatement Statement
1033 HiLink texString String
1034 HiLink texTodo Todo
1035 HiLink texType Type
1036 HiLink texZone PreCondit
1037
1038 delcommand HiLink
1039endif
1040
1041" Current Syntax: {{{1
1042unlet b:extfname
1043let b:current_syntax = "tex"
Bram Moolenaar5aae4192010-08-03 23:00:38 +02001044" vim: ts=8 fdm=marker ambw=double