blob: 365acf496752313d518d822814ce0837f5f68e5b [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 Moolenaaradc21822011-04-01 18:03:16 +02004" Last Change: Dec 07, 2010
5" Version: 64
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 Moolenaaradc21822011-04-01 18:03:16 +020092" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000093" but _ is the only one that causes problems.
Bram Moolenaaradc21822011-04-01 18:03:16 +020094" One may override this iskeyword setting by providing
95" g:tex_isk
96if exists("g:tex_isk")
97 exe "setlocal isk=".g:tex_isk
Bram Moolenaar071d4272004-06-13 20:20:40 +000098else
Bram Moolenaaradc21822011-04-01 18:03:16 +020099 setlocal isk=48-57,a-z,A-Z,192-255
100endif
101if b:tex_stylish
102 setlocal isk+=@-@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000103endif
104
105" Clusters: {{{1
106" --------
107syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
108if !exists("g:tex_no_error")
109 syn cluster texCmdGroup add=texMathError
110endif
111syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
Bram Moolenaar488c6512005-08-11 20:09:58 +0000112syn 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 +0000113syn 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 +0100114syn 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 +0000115syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116if !exists("tex_no_math")
117 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
118 syn cluster texMatchGroup add=@texMathZones
119 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
120 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 +0200121 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
Bram Moolenaar071d4272004-06-13 20:20:40 +0000122 if !exists("g:tex_no_error")
123 syn cluster texMathMatchGroup add=texMathError
124 syn cluster texMathZoneGroup add=texMathError
125 endif
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000126 syn cluster texMathZoneGroup add=@NoSpell
127 " following used in the \part \chapter \section \subsection \subsubsection
128 " \paragraph \subparagraph \author \title highlighting
129 syn cluster texDocGroup contains=texPartZone,@texPartGroup
130 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone
131 syn cluster texChapterGroup contains=texSectionZone,texParaZone
132 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone
133 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone
134 syn cluster texSubSubSectionGroup contains=texParaZone
135 syn cluster texParaGroup contains=texSubParaZone
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200136 if has("conceal") && &enc == 'utf-8'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200137 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
138 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200139 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000140endif
141
142" Try to flag {} and () mismatches: {{{1
143if !exists("g:tex_no_error")
144 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
145 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError
146else
147 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup
148 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup
149endif
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000150syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000151if !exists("g:tex_no_error")
152 syn match texError "[}\])]"
153endif
154if !exists("tex_no_math")
155 if !exists("g:tex_no_error")
156 syn match texMathError "}" contained
157 endif
158 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
159endif
160
161" TeX/LaTeX keywords: {{{1
162" Instead of trying to be All Knowing, I just match \..alphameric..
163" Note that *.tex files may not have "@" in their \commands
164if exists("g:tex_tex") || b:tex_stylish
165 syn match texStatement "\\[a-zA-Z@]\+"
166else
167 syn match texStatement "\\\a\+"
168 if !exists("g:tex_no_error")
169 syn match texError "\\\a*@[a-zA-Z@]*"
170 endif
171endif
172
173" TeX/LaTeX delimiters: {{{1
174syn match texDelimiter "&"
175syn match texDelimiter "\\\\"
176
177" Tex/Latex Options: {{{1
178syn match texOption "[^\\]\zs#\d\+\|^#\d\+"
179
180" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
181if b:tex_stylish
182 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
183 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
184else
185 syn match texAccent "\\[bcdvuH]\A"me=e-1
186 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
187endif
188syn match texAccent "\\[bcdvuH]$"
189syn match texAccent +\\[=^.\~"`']+
190syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
191syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
192
193" \begin{}/\end{} section markers: {{{1
194syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName
Bram Moolenaar5c736222010-01-06 20:54:52 +0100195syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier contains=texComment
196syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197
198" \documentclass, \documentstyle, \usepackage: {{{1
199syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs
Bram Moolenaar5c736222010-01-06 20:54:52 +0100200syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000202" Preamble syntax-based folding support: {{{1
203if g:tex_fold_enabled && has("folding")
Bram Moolenaar5c736222010-01-06 20:54:52 +0100204 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texMatchGroup
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000205endif
206
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207" TeX input: {{{1
208syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +0100209syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
211syn match texInputCurlies "[{}]" contained
Bram Moolenaar5c736222010-01-06 20:54:52 +0100212syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000213
214" Type Styles (LaTeX 2.09): {{{1
215syn match texTypeStyle "\\rm\>"
216syn match texTypeStyle "\\em\>"
217syn match texTypeStyle "\\bf\>"
218syn match texTypeStyle "\\it\>"
219syn match texTypeStyle "\\sl\>"
220syn match texTypeStyle "\\sf\>"
221syn match texTypeStyle "\\sc\>"
222syn match texTypeStyle "\\tt\>"
223
224" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
225syn match texTypeStyle "\\textbf\>"
226syn match texTypeStyle "\\textit\>"
227syn match texTypeStyle "\\textmd\>"
228syn match texTypeStyle "\\textrm\>"
229syn match texTypeStyle "\\textsc\>"
230syn match texTypeStyle "\\textsf\>"
231syn match texTypeStyle "\\textsl\>"
232syn match texTypeStyle "\\texttt\>"
233syn match texTypeStyle "\\textup\>"
234syn match texTypeStyle "\\emph\>"
235
236syn match texTypeStyle "\\mathbb\>"
237syn match texTypeStyle "\\mathbf\>"
238syn match texTypeStyle "\\mathcal\>"
239syn match texTypeStyle "\\mathfrak\>"
240syn match texTypeStyle "\\mathit\>"
241syn match texTypeStyle "\\mathnormal\>"
242syn match texTypeStyle "\\mathrm\>"
243syn match texTypeStyle "\\mathsf\>"
244syn match texTypeStyle "\\mathtt\>"
245
246syn match texTypeStyle "\\rmfamily\>"
247syn match texTypeStyle "\\sffamily\>"
248syn match texTypeStyle "\\ttfamily\>"
249
250syn match texTypeStyle "\\itshape\>"
251syn match texTypeStyle "\\scshape\>"
252syn match texTypeStyle "\\slshape\>"
253syn match texTypeStyle "\\upshape\>"
254
255syn match texTypeStyle "\\bfseries\>"
256syn match texTypeStyle "\\mdseries\>"
257
258" Some type sizes: {{{1
259syn match texTypeSize "\\tiny\>"
260syn match texTypeSize "\\scriptsize\>"
261syn match texTypeSize "\\footnotesize\>"
262syn match texTypeSize "\\small\>"
263syn match texTypeSize "\\normalsize\>"
264syn match texTypeSize "\\large\>"
265syn match texTypeSize "\\Large\>"
266syn match texTypeSize "\\LARGE\>"
267syn match texTypeSize "\\huge\>"
268syn match texTypeSize "\\Huge\>"
269
270" Spacecodes (TeX'isms): {{{1
271" \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x
272syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
273syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
274
275" Sections, subsections, etc: {{{1
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +0000276if g:tex_fold_enabled && has("folding")
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000277 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
278 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell
279 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell
280 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell
281 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
282 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
283 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
284 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
285 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
286 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 +0000287else
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000288 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
289 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
290 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell
291 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell
292 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
293 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
294 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell
295 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell
296 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell
297 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 +0000298endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299
300" Bad Math (mismatched): {{{1
301if !exists("tex_no_math")
Bram Moolenaar81af9252010-12-10 20:35:50 +0100302 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|smallmatrix\|xxalignat\)\s*}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000303 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
304 syn match texBadMath "\\[\])]"
305endif
306
307" Math Zones: {{{1
308if !exists("tex_no_math")
Bram Moolenaar488c6512005-08-11 20:09:58 +0000309 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000310 " Starred forms are created if starform is true. Starred
311 " forms have syntax group and synchronization groups with a
312 " "S" appended. Handles: cluster, syntax, sync, and HiLink.
313 fun! TexNewMathZone(sfx,mathzone,starform)
314 let grpname = "texMathZone".a:sfx
315 let syncname = "texSyncMathZone".a:sfx
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000316 if g:tex_fold_enabled
317 let foldcmd= " fold"
318 else
319 let foldcmd= ""
320 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000322 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 +0000323 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
324 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100325 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000326 if a:starform
327 let grpname = "texMathZone".a:sfx.'S'
328 let syncname = "texSyncMathZone".a:sfx.'S'
329 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000330 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 +0000331 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
332 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100333 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334 endif
335 endfun
336
337 " Standard Math Zones: {{{2
338 call TexNewMathZone("A","align",1)
339 call TexNewMathZone("B","alignat",1)
340 call TexNewMathZone("C","displaymath",1)
341 call TexNewMathZone("D","eqnarray",1)
342 call TexNewMathZone("E","equation",1)
343 call TexNewMathZone("F","flalign",1)
344 call TexNewMathZone("G","gather",1)
345 call TexNewMathZone("H","math",1)
346 call TexNewMathZone("I","multline",1)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000347 call TexNewMathZone("K","xalignat",1)
348 call TexNewMathZone("L","xxalignat",0)
349
350 " Inline Math Zones: {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200351 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200352 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
353 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
354 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
355 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
356 else
357 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
358 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
359 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
360 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
361 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200362 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363
364 syn match texMathOper "[_^=]" contained
365
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200366 " Text Inside Math Zones: {{{2
367 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
368
Bram Moolenaar071d4272004-06-13 20:20:40 +0000369 " \left..something.. and \right..something.. support: {{{2
370 syn match texMathDelimBad contained "\S"
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200371 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
372 syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
373 syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
Bram Moolenaaradc21822011-04-01 18:03:16 +0200374 let s:texMathDelimList=[
375 \ ['<' , '<'] ,
376 \ ['>' , '>'] ,
377 \ ['(' , '('] ,
378 \ [')' , ')'] ,
379 \ ['\[' , '['] ,
380 \ [']' , ']'] ,
381 \ ['\\{' , '{'] ,
382 \ ['\\}' , '}'] ,
383 \ ['|' , '|'] ,
384 \ ['\\|' , '‖'] ,
385 \ ['\\backslash' , '\'] ,
386 \ ['\\downarrow' , '↓'] ,
387 \ ['\\Downarrow' , '⇓'] ,
388 \ ['\\langle' , '<'] ,
389 \ ['\\lbrace' , '['] ,
390 \ ['\\lceil' , '⌈'] ,
391 \ ['\\lfloor' , '⌊'] ,
392 \ ['\\lgroup' , '⌊'] ,
393 \ ['\\lmoustache' , '⎛'] ,
394 \ ['\\rangle' , '>'] ,
395 \ ['\\rbrace' , ']'] ,
396 \ ['\\rceil' , '⌉'] ,
397 \ ['\\rfloor' , '⌋'] ,
398 \ ['\\rgroup' , '⌋'] ,
399 \ ['\\rmoustache' , '⎞'] ,
400 \ ['\\uparrow' , '↑'] ,
401 \ ['\\Uparrow' , '↑'] ,
402 \ ['\\updownarrow', '↕'] ,
403 \ ['\\Updownarrow', '⇕']]
404 syn match texMathDelim '\\[bB]igg\=[lr]' contained nextgroup=texMathDelimBad
405 for texmath in s:texMathDelimList
406 exe "syn match texMathDelim '\\\\[bB]igg\\=[lr]\\=".texmath[0]."' contained conceal cchar=".texmath[1]
407 endfor
408
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200409 else
410 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
Bram Moolenaaradc21822011-04-01 18:03:16 +0200411 syn match texMathDelim contained "\\[bB]igg\=[lr]\=\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
412 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
413 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
414 syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
415 syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
416 syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
417 syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
418 syn keyword texMathDelimKey contained lbrace lvert rfloor
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200419 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000420 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
421 syn match texMathDelim contained "\\lefteqn\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000422endif
423
424" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
425syn match texSpecialChar "\\[$&%#{}_]"
426if b:tex_stylish
427 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
428else
429 syn match texSpecialChar "\\[SP@]\A"me=e-1
430endif
431syn match texSpecialChar "\\\\"
432if !exists("tex_no_math")
433 syn match texOnlyMath "[_^]"
434endif
435syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
436
437" Comments: {{{1
438" Normal TeX LaTeX : %....
439" Documented TeX Format: ^^A... -and- leading %s (only)
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000440if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
441 syn cluster texCommentGroup contains=texTodo,@Spell
442else
443 syn cluster texCommentGroup contains=texTodo,@NoSpell
444endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000445syn case ignore
Bram Moolenaar18144c82006-04-12 21:52:12 +0000446syn keyword texTodo contained combak fixme todo xxx
Bram Moolenaar071d4272004-06-13 20:20:40 +0000447syn case match
Bram Moolenaar81af9252010-12-10 20:35:50 +0100448if s:extfname == "dtx"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000449 syn match texComment "\^\^A.*$" contains=@texCommentGroup
450 syn match texComment "^%\+" contains=@texCommentGroup
451else
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000452 if g:tex_fold_enabled
453 " allows syntax-folding of 2 or more contiguous comment lines
454 " single-line comments are not folded
455 syn match texComment "%.*$" contains=@texCommentGroup
456 syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
457 else
458 syn match texComment "%.*$" contains=@texCommentGroup
459 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000460endif
461
462" Separate lines used for verb` and verb# so that the end conditions {{{1
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200463" will appropriately terminate.
464" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
465if exists("g:tex_verbspell") && g:tex_verbspell
466 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
467 " listings package:
468 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
469 " moreverb package:
470 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
471 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
472 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
473 if version < 600
474 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell
475 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell
476 else
477 if b:tex_stylish
478 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell
479 else
480 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell
481 endif
482 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000483else
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200484 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>"
485 " listings package:
486 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>"
487 " moreverb package:
488 syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>"
489 syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>"
490 syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>"
491 if version < 600
492 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
493 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
494 else
495 if b:tex_stylish
496 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
497 else
498 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
499 endif
500 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000501endif
502
503" Tex Reference Zones: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +0100504syn match texRefZone '\\@samp\>' skipwhite nextgroup=texRefLabel
505syn match texRefZone '\\nocite\>' skipwhite nextgroup=texRefLabel
506syn match texRefZone '\\bibliography\>' skipwhite nextgroup=texRefLabel
507syn match texRefZone '\\label\>' skipwhite nextgroup=texRefLabel
508syn match texRefZone '\\\(page\|eq\)ref\>' skipwhite nextgroup=texRefLabel
509syn match texRefZone '\\v\=ref' skipwhite nextgroup=texRefLabel
510syn match texRefZone '\\cite\%([tp]\*\=\)\=' skipwhite nextgroup=texCiteOption,texCite
511syn region texRefLabel contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup
512syn region texCiteOption contained matchgroup=Delimiter start='\[' end=']' contains=@Spell,@texRefGroup,@texMathZones,texRefZone nextgroup=texCiteOption,texCite
513syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texCite
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514
515" Handle newcommand, newenvironment : {{{1
516syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
517syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
518syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
519syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
520syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
521syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
522syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
523syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
524
525" Definitions/Commands: {{{1
526syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
527if b:tex_stylish
528 syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
529 syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
530else
531 syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
532 syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
533endif
534syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
535syn match texDefParm contained "#\d\+"
536
537" TeX Lengths: {{{1
Bram Moolenaar9964e462007-05-05 17:54:07 +0000538syn 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 +0000539
540" TeX String Delimiters: {{{1
541syn match texString "\(``\|''\|,,\)"
542
Bram Moolenaar5c736222010-01-06 20:54:52 +0100543" makeatletter -- makeatother sections
544if !exists("g:tex_no_error")
545 syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained
546 syn match texStyleStatement "\\[a-zA-Z@]\+" contained
547 syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
548 syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
549endif
550
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200551" Conceal mode support (supports set cole=2) {{{1
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200552if has("conceal") && &enc == 'utf-8'
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200553
554 " Math Symbols {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200555 " (many of these symbols were contributed by Björn Winckler)
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200556 if s:tex_conceal =~ 'm'
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200557 let s:texMathList=[
Bram Moolenaaradc21822011-04-01 18:03:16 +0200558 \ ['|' , '‖'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200559 \ ['angle' , '∠'],
560 \ ['approx' , '≈'],
561 \ ['ast' , '∗'],
562 \ ['asymp' , '≍'],
563 \ ['backepsilon' , '∍'],
564 \ ['backsimeq' , '≃'],
565 \ ['barwedge' , '⊼'],
566 \ ['because' , '∵'],
567 \ ['between' , '≬'],
568 \ ['bigcap' , '∩'],
569 \ ['bigcup' , '∪'],
570 \ ['bigodot' , '⊙'],
571 \ ['bigoplus' , '⊕'],
572 \ ['bigotimes' , '⊗'],
573 \ ['bigsqcup' , '⊔'],
574 \ ['bigtriangledown', '∇'],
575 \ ['bigvee' , '⋁'],
576 \ ['bigwedge' , '⋀'],
577 \ ['blacksquare' , '∎'],
578 \ ['bot' , '⊥'],
579 \ ['boxdot' , '⊡'],
580 \ ['boxminus' , '⊟'],
581 \ ['boxplus' , '⊞'],
582 \ ['boxtimes' , '⊠'],
583 \ ['bumpeq' , '≏'],
584 \ ['Bumpeq' , '≎'],
585 \ ['cap' , '∩'],
586 \ ['Cap' , '⋒'],
587 \ ['cdot' , '·'],
588 \ ['cdots' , '⋯'],
589 \ ['circ' , '∘'],
590 \ ['circeq' , '≗'],
591 \ ['circlearrowleft', '↺'],
592 \ ['circlearrowright', '↻'],
593 \ ['circledast' , '⊛'],
594 \ ['circledcirc' , '⊚'],
595 \ ['complement' , '∁'],
596 \ ['cong' , '≅'],
597 \ ['coprod' , '∐'],
598 \ ['cup' , '∪'],
599 \ ['Cup' , '⋓'],
600 \ ['curlyeqprec' , '⋞'],
601 \ ['curlyeqsucc' , '⋟'],
602 \ ['curlyvee' , '⋎'],
603 \ ['curlywedge' , '⋏'],
604 \ ['dashv' , '⊣'],
605 \ ['diamond' , '⋄'],
606 \ ['div' , '÷'],
607 \ ['doteq' , '≐'],
608 \ ['doteqdot' , '≑'],
609 \ ['dotplus' , '∔'],
610 \ ['dotsb' , '⋯'],
611 \ ['dotsc' , '…'],
612 \ ['dots' , '…'],
613 \ ['dotsi' , '⋯'],
614 \ ['dotso' , '…'],
615 \ ['doublebarwedge' , '⩞'],
616 \ ['downarrow' , '↓'],
617 \ ['Downarrow' , '⇓'],
618 \ ['emptyset' , '∅'],
619 \ ['eqcirc' , '≖'],
620 \ ['eqsim' , '≂'],
621 \ ['eqslantgtr' , '⪖'],
622 \ ['eqslantless' , '⪕'],
623 \ ['equiv' , '≡'],
624 \ ['exists' , '∃'],
625 \ ['fallingdotseq' , '≒'],
626 \ ['forall' , '∀'],
627 \ ['ge' , '≥'],
628 \ ['geq' , '≥'],
629 \ ['geqq' , '≧'],
630 \ ['gets' , '←'],
631 \ ['gneqq' , '≩'],
632 \ ['gtrdot' , '⋗'],
633 \ ['gtreqless' , '⋛'],
634 \ ['gtrless' , '≷'],
635 \ ['gtrsim' , '≳'],
636 \ ['hookleftarrow' , '↩'],
637 \ ['hookrightarrow' , '↪'],
638 \ ['iiint' , '∭'],
639 \ ['iint' , '∬'],
640 \ ['Im' , 'ℑ'],
641 \ ['in' , '∈'],
642 \ ['infty' , '∞'],
643 \ ['int' , '∫'],
644 \ ['lceil' , '⌈'],
645 \ ['ldots' , '…'],
646 \ ['le' , '≤'],
647 \ ['leftarrow' , '⟵'],
648 \ ['Leftarrow' , '⟸'],
649 \ ['leftarrowtail' , '↢'],
650 \ ['left(' , '('],
651 \ ['left\[' , '['],
652 \ ['left\\{' , '{'],
653 \ ['Leftrightarrow' , '⇔'],
654 \ ['leftrightsquigarrow', '↭'],
655 \ ['leftthreetimes' , '⋋'],
656 \ ['leq' , '≤'],
657 \ ['leqq' , '≦'],
658 \ ['lessdot' , '⋖'],
659 \ ['lesseqgtr' , '⋚'],
660 \ ['lesssim' , '≲'],
661 \ ['lfloor' , '⌊'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200662 \ ['lmoustache' , '╭'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200663 \ ['lneqq' , '≨'],
664 \ ['ltimes' , '⋉'],
665 \ ['mapsto' , '↦'],
666 \ ['measuredangle' , '∡'],
667 \ ['mid' , '∣'],
668 \ ['mp' , '∓'],
669 \ ['nabla' , '∇'],
670 \ ['ncong' , '≇'],
671 \ ['nearrow' , '↗'],
672 \ ['ne' , '≠'],
673 \ ['neg' , '¬'],
674 \ ['neq' , '≠'],
675 \ ['nexists' , '∄'],
676 \ ['ngeq' , '≱'],
677 \ ['ngeqq' , '≱'],
678 \ ['ngtr' , '≯'],
679 \ ['ni' , '∋'],
680 \ ['nleftarrow' , '↚'],
681 \ ['nLeftarrow' , '⇍'],
682 \ ['nLeftrightarrow', '⇎'],
683 \ ['nleq' , '≰'],
684 \ ['nleqq' , '≰'],
685 \ ['nless' , '≮'],
686 \ ['nmid' , '∤'],
687 \ ['notin' , '∉'],
688 \ ['nprec' , '⊀'],
689 \ ['nrightarrow' , '↛'],
690 \ ['nRightarrow' , '⇏'],
691 \ ['nsim' , '≁'],
692 \ ['nsucc' , '⊁'],
693 \ ['ntriangleleft' , '⋪'],
694 \ ['ntrianglelefteq', '⋬'],
695 \ ['ntriangleright' , '⋫'],
696 \ ['ntrianglerighteq', '⋭'],
697 \ ['nvdash' , '⊬'],
698 \ ['nvDash' , '⊭'],
699 \ ['nVdash' , '⊮'],
700 \ ['nwarrow' , '↖'],
701 \ ['odot' , '⊙'],
702 \ ['oint' , '∮'],
703 \ ['ominus' , '⊖'],
704 \ ['oplus' , '⊕'],
705 \ ['oslash' , '⊘'],
706 \ ['otimes' , '⊗'],
707 \ ['owns' , '∋'],
708 \ ['partial' , '∂'],
709 \ ['perp' , '⊥'],
710 \ ['pitchfork' , '⋔'],
711 \ ['pm' , '±'],
712 \ ['precapprox' , '⪷'],
713 \ ['prec' , '≺'],
714 \ ['preccurlyeq' , '≼'],
715 \ ['preceq' , '⪯'],
716 \ ['precnapprox' , '⪹'],
717 \ ['precneqq' , '⪵'],
718 \ ['precsim' , '≾'],
719 \ ['prod' , '∏'],
720 \ ['propto' , '∝'],
721 \ ['rceil' , '⌉'],
722 \ ['Re' , 'ℜ'],
723 \ ['rfloor' , '⌋'],
724 \ ['rightarrow' , '⟶'],
725 \ ['Rightarrow' , '⟹'],
726 \ ['rightarrowtail' , '↣'],
727 \ ['right)' , ')'],
728 \ ['right]' , ']'],
729 \ ['right\\}' , '}'],
730 \ ['rightsquigarrow', '↝'],
731 \ ['rightthreetimes', '⋌'],
732 \ ['risingdotseq' , '≓'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200733 \ ['rmoustache' , '╮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200734 \ ['rtimes' , '⋊'],
735 \ ['searrow' , '↘'],
736 \ ['setminus' , '∖'],
737 \ ['sim' , '∼'],
738 \ ['sphericalangle' , '∢'],
739 \ ['sqcap' , '⊓'],
740 \ ['sqcup' , '⊔'],
741 \ ['sqsubset' , '⊏'],
742 \ ['sqsubseteq' , '⊑'],
743 \ ['sqsupset' , '⊐'],
744 \ ['sqsupseteq' , '⊒'],
745 \ ['subset' , '⊂'],
746 \ ['Subset' , '⋐'],
747 \ ['subseteq' , '⊆'],
748 \ ['subseteqq' , '⫅'],
749 \ ['subsetneq' , '⊊'],
750 \ ['subsetneqq' , '⫋'],
751 \ ['succapprox' , '⪸'],
752 \ ['succ' , '≻'],
753 \ ['succcurlyeq' , '≽'],
754 \ ['succeq' , '⪰'],
755 \ ['succnapprox' , '⪺'],
756 \ ['succneqq' , '⪶'],
757 \ ['succsim' , '≿'],
758 \ ['sum' , '∑'],
759 \ ['Supset' , '⋑'],
760 \ ['supseteq' , '⊇'],
761 \ ['supseteqq' , '⫆'],
762 \ ['supsetneq' , '⊋'],
763 \ ['supsetneqq' , '⫌'],
764 \ ['surd' , '√'],
765 \ ['swarrow' , '↙'],
766 \ ['therefore' , '∴'],
767 \ ['times' , '×'],
768 \ ['to' , '→'],
769 \ ['top' , '⊤'],
770 \ ['triangleleft' , '⊲'],
771 \ ['trianglelefteq' , '⊴'],
772 \ ['triangleq' , '≜'],
773 \ ['triangleright' , '⊳'],
774 \ ['trianglerighteq', '⊵'],
775 \ ['twoheadleftarrow', '↞'],
776 \ ['twoheadrightarrow', '↠'],
777 \ ['uparrow' , '↑'],
778 \ ['Uparrow' , '⇑'],
779 \ ['updownarrow' , '↕'],
780 \ ['Updownarrow' , '⇕'],
781 \ ['varnothing' , '∅'],
782 \ ['vartriangle' , '∆'],
783 \ ['vdash' , '⊢'],
784 \ ['vDash' , '⊨'],
785 \ ['Vdash' , '⊩'],
786 \ ['vdots' , '⋮'],
787 \ ['veebar' , '⊻'],
788 \ ['vee' , '∨'],
789 \ ['Vvdash' , '⊪'],
790 \ ['wedge' , '∧'],
791 \ ['wr' , '≀']]
792 for texmath in s:texMathList
Bram Moolenaar81af9252010-12-10 20:35:50 +0100793 if texmath[0] =~ '\w$'
794 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
795 else
796 exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
797 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200798 endfor
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200799
800 if &ambw == "double"
801 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
802 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
803 else
804 syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫
805 syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪
806 endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200807 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200808
809 " Greek {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200810 if s:tex_conceal =~ 'g'
811 fun! s:Greek(group,pat,cchar)
812 exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
813 endfun
814 call s:Greek('texGreek','\\alpha\>' ,'α')
815 call s:Greek('texGreek','\\beta\>' ,'β')
816 call s:Greek('texGreek','\\gamma\>' ,'γ')
817 call s:Greek('texGreek','\\delta\>' ,'δ')
818 call s:Greek('texGreek','\\epsilon\>' ,'ϵ')
819 call s:Greek('texGreek','\\varepsilon\>' ,'ε')
820 call s:Greek('texGreek','\\zeta\>' ,'ζ')
821 call s:Greek('texGreek','\\eta\>' ,'η')
822 call s:Greek('texGreek','\\theta\>' ,'θ')
823 call s:Greek('texGreek','\\vartheta\>' ,'ϑ')
824 call s:Greek('texGreek','\\kappa\>' ,'κ')
825 call s:Greek('texGreek','\\lambda\>' ,'λ')
826 call s:Greek('texGreek','\\mu\>' ,'μ')
827 call s:Greek('texGreek','\\nu\>' ,'ν')
828 call s:Greek('texGreek','\\xi\>' ,'ξ')
829 call s:Greek('texGreek','\\pi\>' ,'π')
830 call s:Greek('texGreek','\\varpi\>' ,'ϖ')
831 call s:Greek('texGreek','\\rho\>' ,'ρ')
832 call s:Greek('texGreek','\\varrho\>' ,'ϱ')
833 call s:Greek('texGreek','\\sigma\>' ,'σ')
834 call s:Greek('texGreek','\\varsigma\>' ,'ς')
835 call s:Greek('texGreek','\\tau\>' ,'τ')
836 call s:Greek('texGreek','\\upsilon\>' ,'υ')
837 call s:Greek('texGreek','\\phi\>' ,'φ')
838 call s:Greek('texGreek','\\varphi\>' ,'ϕ')
839 call s:Greek('texGreek','\\chi\>' ,'χ')
840 call s:Greek('texGreek','\\psi\>' ,'ψ')
841 call s:Greek('texGreek','\\omega\>' ,'ω')
842 call s:Greek('texGreek','\\Gamma\>' ,'Γ')
843 call s:Greek('texGreek','\\Delta\>' ,'Δ')
844 call s:Greek('texGreek','\\Theta\>' ,'Θ')
845 call s:Greek('texGreek','\\Lambda\>' ,'Λ')
846 call s:Greek('texGreek','\\Xi\>' ,'Χ')
847 call s:Greek('texGreek','\\Pi\>' ,'Π')
848 call s:Greek('texGreek','\\Sigma\>' ,'Σ')
849 call s:Greek('texGreek','\\Upsilon\>' ,'Υ')
850 call s:Greek('texGreek','\\Phi\>' ,'Φ')
851 call s:Greek('texGreek','\\Psi\>' ,'Ψ')
852 call s:Greek('texGreek','\\Omega\>' ,'Ω')
853 delfun s:Greek
854 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200855
856 " Superscripts/Subscripts {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200857 if s:tex_conceal =~ 's'
Bram Moolenaar6b6eedf2010-08-13 14:38:12 +0200858 syn region texSuperscript matchgroup=Delimiter start='\^{' end='}' contained concealends contains=texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
859 syn region texSubscript matchgroup=Delimiter start='_{' end='}' contained concealends contains=texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200860 fun! s:SuperSub(group,leader,pat,cchar)
861 exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
862 exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
863 endfun
864 call s:SuperSub('texSuperscript','\^','0','⁰')
865 call s:SuperSub('texSuperscript','\^','1','¹')
866 call s:SuperSub('texSuperscript','\^','2','²')
867 call s:SuperSub('texSuperscript','\^','3','³')
868 call s:SuperSub('texSuperscript','\^','4','⁴')
869 call s:SuperSub('texSuperscript','\^','5','⁵')
870 call s:SuperSub('texSuperscript','\^','6','⁶')
871 call s:SuperSub('texSuperscript','\^','7','⁷')
872 call s:SuperSub('texSuperscript','\^','8','⁸')
873 call s:SuperSub('texSuperscript','\^','9','⁹')
874 call s:SuperSub('texSuperscript','\^','a','ᵃ')
875 call s:SuperSub('texSuperscript','\^','b','ᵇ')
876 call s:SuperSub('texSuperscript','\^','c','ᶜ')
877 call s:SuperSub('texSuperscript','\^','d','ᵈ')
878 call s:SuperSub('texSuperscript','\^','e','ᵉ')
879 call s:SuperSub('texSuperscript','\^','f','ᶠ')
880 call s:SuperSub('texSuperscript','\^','g','ᵍ')
881 call s:SuperSub('texSuperscript','\^','h','ʰ')
882 call s:SuperSub('texSuperscript','\^','i','ⁱ')
883 call s:SuperSub('texSuperscript','\^','j','ʲ')
884 call s:SuperSub('texSuperscript','\^','k','ᵏ')
885 call s:SuperSub('texSuperscript','\^','l','ˡ')
886 call s:SuperSub('texSuperscript','\^','m','ᵐ')
887 call s:SuperSub('texSuperscript','\^','n','ⁿ')
888 call s:SuperSub('texSuperscript','\^','o','ᵒ')
889 call s:SuperSub('texSuperscript','\^','p','ᵖ')
890 call s:SuperSub('texSuperscript','\^','r','ʳ')
891 call s:SuperSub('texSuperscript','\^','s','ˢ')
892 call s:SuperSub('texSuperscript','\^','t','ᵗ')
893 call s:SuperSub('texSuperscript','\^','u','ᵘ')
894 call s:SuperSub('texSuperscript','\^','v','ᵛ')
895 call s:SuperSub('texSuperscript','\^','w','ʷ')
896 call s:SuperSub('texSuperscript','\^','x','ˣ')
897 call s:SuperSub('texSuperscript','\^','y','ʸ')
898 call s:SuperSub('texSuperscript','\^','z','ᶻ')
899 call s:SuperSub('texSuperscript','\^','A','ᴬ')
900 call s:SuperSub('texSuperscript','\^','B','ᴮ')
901 call s:SuperSub('texSuperscript','\^','D','ᴰ')
902 call s:SuperSub('texSuperscript','\^','E','ᴱ')
903 call s:SuperSub('texSuperscript','\^','G','ᴳ')
904 call s:SuperSub('texSuperscript','\^','H','ᴴ')
905 call s:SuperSub('texSuperscript','\^','I','ᴵ')
906 call s:SuperSub('texSuperscript','\^','J','ᴶ')
907 call s:SuperSub('texSuperscript','\^','K','ᴷ')
908 call s:SuperSub('texSuperscript','\^','L','ᴸ')
909 call s:SuperSub('texSuperscript','\^','M','ᴹ')
910 call s:SuperSub('texSuperscript','\^','N','ᴺ')
911 call s:SuperSub('texSuperscript','\^','O','ᴼ')
912 call s:SuperSub('texSuperscript','\^','P','ᴾ')
913 call s:SuperSub('texSuperscript','\^','R','ᴿ')
914 call s:SuperSub('texSuperscript','\^','T','ᵀ')
915 call s:SuperSub('texSuperscript','\^','U','ᵁ')
916 call s:SuperSub('texSuperscript','\^','W','ᵂ')
917 call s:SuperSub('texSuperscript','\^','+','⁺')
918 call s:SuperSub('texSuperscript','\^','-','⁻')
919 call s:SuperSub('texSuperscript','\^','<','˂')
920 call s:SuperSub('texSuperscript','\^','>','˃')
921 call s:SuperSub('texSuperscript','\^','/','ˊ')
922 call s:SuperSub('texSuperscript','\^','(','⁽')
923 call s:SuperSub('texSuperscript','\^',')','⁾')
924 call s:SuperSub('texSuperscript','\^','\.','˙')
925 call s:SuperSub('texSuperscript','\^','=','˭')
926 call s:SuperSub('texSubscript','_','0','₀')
927 call s:SuperSub('texSubscript','_','1','₁')
928 call s:SuperSub('texSubscript','_','2','₂')
929 call s:SuperSub('texSubscript','_','3','₃')
930 call s:SuperSub('texSubscript','_','4','₄')
931 call s:SuperSub('texSubscript','_','5','₅')
932 call s:SuperSub('texSubscript','_','6','₆')
933 call s:SuperSub('texSubscript','_','7','₇')
934 call s:SuperSub('texSubscript','_','8','₈')
935 call s:SuperSub('texSubscript','_','9','₉')
936 call s:SuperSub('texSubscript','_','a','ₐ')
937 call s:SuperSub('texSubscript','_','e','ₑ')
938 call s:SuperSub('texSubscript','_','i','ᵢ')
939 call s:SuperSub('texSubscript','_','o','ₒ')
940 call s:SuperSub('texSubscript','_','u','ᵤ')
941 call s:SuperSub('texSubscript','_','+','₊')
942 call s:SuperSub('texSubscript','_','-','₋')
943 call s:SuperSub('texSubscript','_','/','ˏ')
944 call s:SuperSub('texSubscript','_','(','₍')
945 call s:SuperSub('texSubscript','_',')','₎')
946 call s:SuperSub('texSubscript','_','\.','‸')
947 call s:SuperSub('texSubscript','_','r','ᵣ')
948 call s:SuperSub('texSubscript','_','v','ᵥ')
949 call s:SuperSub('texSubscript','_','x','ₓ')
950 call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
951 call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
952 call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
953 call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
954 call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
955 delfun s:SuperSub
956 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200957
958 " Accented characters: {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200959 if s:tex_conceal =~ 'a'
960 if b:tex_stylish
961 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
962 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
963 else
964 fun! s:Accents(chr,...)
965 let i= 1
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200966 for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"]
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200967 if i > a:0
968 break
969 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200970 if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200971 let i= i + 1
972 continue
973 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200974 if accent =~ '\a'
975 exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
976 else
977 exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
978 endif
Bram Moolenaare0021c72010-07-28 17:25:21 +0200979 let i= i + 1
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200980 endfor
981 endfun
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200982 " \` \' \^ \" \~ \. \c \H \k \r \u \v
983 call s:Accents('a','à','á','â','ä','ã',' ',' ',' ','ą','å','ă','ă')
984 call s:Accents('A','À','Á','Â','Ä','Ã',' ',' ',' ','Ą','Å','Ă','Ă')
985 call s:Accents('c',' ','ć','ĉ',' ',' ','ċ','ç',' ',' ',' ',' ','č')
986 call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ','Ç',' ',' ',' ',' ','Č')
987 call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
988 call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
989 call s:Accents('e','è','é','ê','ë','ẽ','ė','ȩ',' ','ę',' ','ĕ','ě')
990 call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě')
991 call s:Accents('g',' ',' ',' ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ')
992 call s:Accents('G',' ',' ',' ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ')
993 call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
994 call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ')
995 call s:Accents('l',' ','ĺ','ľ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
996 call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
997 call s:Accents('n',' ','ń',' ',' ','ñ',' ','ņ',' ',' ',' ',' ','ň')
998 call s:Accents('N',' ','Ń',' ',' ','Ñ',' ','Ņ',' ',' ',' ',' ','Ň')
999 call s:Accents('o','ò','ó','ô','ö','õ','ȯ',' ','ő','ǫ',' ','ŏ',' ')
1000 call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ',' ','Ő','Ǫ',' ','Ŏ',' ')
1001 call s:Accents('r',' ','ŕ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
1002 call s:Accents('R',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
1003 call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ',' ',' ',' ','š')
1004 call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
1005 call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
1006 call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
1007 call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű',' ','ů','ŭ',' ')
1008 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű',' ','Ů','Ŭ',' ')
1009 call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1010 call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1011 call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ')
1012 call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ')
1013 call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ','ž')
1014 call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ','Ž')
1015 call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1016 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001017 delfun s:Accents
1018 syn match texAccent '\\aa\>' conceal cchar=å
1019 syn match texAccent '\\AA\>' conceal cchar=Å
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001020 syn match texAccent '\\o\>' conceal cchar=ø
1021 syn match texAccent '\\O\>' conceal cchar=Ø
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001022 syn match texLigature '\\AE\>' conceal cchar=Æ
1023 syn match texLigature '\\ae\>' conceal cchar=æ
1024 syn match texLigature '\\oe\>' conceal cchar=œ
1025 syn match texLigature '\\OE\>' conceal cchar=Œ
1026 syn match texLigature '\\ss\>' conceal cchar=ß
1027 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001028 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001029endif
1030
1031" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001032" LaTeX synchronization: {{{1
1033syn sync maxlines=200
1034syn sync minlines=50
1035
1036syn sync match texSyncStop groupthere NONE "%stopzone\>"
1037
1038" Synchronization: {{{1
1039" The $..$ and $$..$$ make for impossible sync patterns
1040" (one can't tell if a "$$" starts or stops a math zone by itself)
1041" The following grouptheres coupled with minlines above
1042" help improve the odds of good syncing.
1043if !exists("tex_no_math")
1044 syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
1045 syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
1046 syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
1047 syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
1048 syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
1049 syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
1050 syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
1051 syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
1052endif
1053
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001054" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055" Highlighting: {{{1
1056if did_tex_syntax_inits == 1
1057 let did_tex_syntax_inits= 2
1058 " TeX highlighting groups which should share similar highlighting
1059 if !exists("g:tex_no_error")
1060 if !exists("tex_no_math")
1061 HiLink texBadMath texError
1062 HiLink texMathDelimBad texError
1063 HiLink texMathError texError
1064 if !b:tex_stylish
1065 HiLink texOnlyMath texError
1066 endif
1067 endif
1068 HiLink texError Error
1069 endif
1070
Bram Moolenaar071d4272004-06-13 20:20:40 +00001071 HiLink texDefCmd texDef
1072 HiLink texDefName texDef
1073 HiLink texDocType texCmdName
1074 HiLink texDocTypeArgs texCmdArgs
1075 HiLink texInputFileOpt texCmdArgs
1076 HiLink texInputCurlies texDelimiter
1077 HiLink texLigature texSpecialChar
1078 if !exists("tex_no_math")
1079 HiLink texMathDelimSet1 texMathDelim
1080 HiLink texMathDelimSet2 texMathDelim
1081 HiLink texMathDelimKey texMathDelim
1082 HiLink texMathMatcher texMath
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001083 HiLink texAccent texStatement
1084 HiLink texGreek texStatement
1085 HiLink texSuperscript texStatement
1086 HiLink texSubscript texStatement
1087 HiLink texMathSymbol texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001088 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001089 HiLink texMathZoneW texMath
1090 HiLink texMathZoneX texMath
1091 HiLink texMathZoneY texMath
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001092 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001093 HiLink texMathZoneZ texMath
1094 endif
Bram Moolenaar81af9252010-12-10 20:35:50 +01001095 HiLink texRefZone Identifier
Bram Moolenaar071d4272004-06-13 20:20:40 +00001096 HiLink texSectionMarker texCmdName
1097 HiLink texSectionName texSection
1098 HiLink texSpaceCode texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001099 HiLink texStyleStatement texStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +00001100 HiLink texTypeSize texType
1101 HiLink texTypeStyle texType
1102
1103 " Basic TeX highlighting groups
Bram Moolenaar81af9252010-12-10 20:35:50 +01001104 HiLink texCite Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001105 HiLink texCmdArgs Number
1106 HiLink texCmdName Statement
1107 HiLink texComment Comment
1108 HiLink texDef Statement
1109 HiLink texDefParm Special
1110 HiLink texDelimiter Delimiter
1111 HiLink texInput Special
1112 HiLink texInputFile Special
1113 HiLink texLength Number
1114 HiLink texMath Special
1115 HiLink texMathDelim Statement
1116 HiLink texMathOper Operator
1117 HiLink texNewCmd Statement
1118 HiLink texNewEnv Statement
1119 HiLink texOption Number
Bram Moolenaar81af9252010-12-10 20:35:50 +01001120 HiLink texRefLabel Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001121 HiLink texSection PreCondit
1122 HiLink texSpaceCodeChar Special
1123 HiLink texSpecialChar SpecialChar
1124 HiLink texStatement Statement
1125 HiLink texString String
1126 HiLink texTodo Todo
1127 HiLink texType Type
1128 HiLink texZone PreCondit
1129
1130 delcommand HiLink
1131endif
1132
1133" Current Syntax: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +01001134unlet s:extfname
Bram Moolenaar071d4272004-06-13 20:20:40 +00001135let b:current_syntax = "tex"
Bram Moolenaare90ee312010-08-05 22:08:47 +02001136" vim: ts=8 fdm=marker