blob: 0eeff6f5980ff0790d694bbbb8baae2ea4078923 [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 Moolenaard38b0552012-04-25 19:07:41 +02004" Last Change: Apr 24, 2012
5" Version: 73
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 Moolenaar15146672011-10-20 22:22:38 +020040let s:keepcpo= &cpo
41set cpo&vim
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020042scriptencoding utf-8
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
44" Define the default highlighting. {{{1
45" For version 5.7 and earlier: only when not done already
46" For version 5.8 and later: only when an item doesn't have highlighting yet
47if version >= 508 || !exists("did_tex_syntax_inits")
48 let did_tex_syntax_inits = 1
49 if version < 508
50 command -nargs=+ HiLink hi link <args>
51 else
52 command -nargs=+ HiLink hi def link <args>
53 endif
54endif
55if exists("g:tex_tex") && !exists("g:tex_no_error")
56 let g:tex_no_error= 1
57endif
58
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020059" let user determine which classes of concealment will be supported
Bram Moolenaar7fc0c062010-08-10 21:43:35 +020060" a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020061if !exists("g:tex_conceal")
Bram Moolenaard38b0552012-04-25 19:07:41 +020062 let s:tex_conceal= 'abdmgs'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020063else
64 let s:tex_conceal= g:tex_conceal
65endif
66
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000067" Determine whether or not to use "*.sty" mode {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000068" The user may override the normal determination by setting
69" g:tex_stylish to 1 (for "*.sty" mode)
70" or to 0 else (normal "*.tex" mode)
71" or on a buffer-by-buffer basis with b:tex_stylish
Bram Moolenaar81af9252010-12-10 20:35:50 +010072let s:extfname=expand("%:e")
Bram Moolenaar071d4272004-06-13 20:20:40 +000073if exists("g:tex_stylish")
74 let b:tex_stylish= g:tex_stylish
75elseif !exists("b:tex_stylish")
Bram Moolenaar81af9252010-12-10 20:35:50 +010076 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx"
Bram Moolenaar071d4272004-06-13 20:20:40 +000077 let b:tex_stylish= 1
78 else
79 let b:tex_stylish= 0
80 endif
81endif
82
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000083" handle folding {{{1
84if !exists("g:tex_fold_enabled")
85 let g:tex_fold_enabled= 0
86elseif g:tex_fold_enabled && !has("folding")
Bram Moolenaarab194812005-09-14 21:40:12 +000087 let g:tex_fold_enabled= 0
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000088 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support"
89endif
90if g:tex_fold_enabled && &fdm == "manual"
Bram Moolenaar00a927d2010-05-14 23:24:24 +020091 setl fdm=syntax
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000092endif
93
Bram Moolenaaradc21822011-04-01 18:03:16 +020094" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000095" but _ is the only one that causes problems.
Bram Moolenaaradc21822011-04-01 18:03:16 +020096" One may override this iskeyword setting by providing
97" g:tex_isk
98if exists("g:tex_isk")
99 exe "setlocal isk=".g:tex_isk
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100else
Bram Moolenaaradc21822011-04-01 18:03:16 +0200101 setlocal isk=48-57,a-z,A-Z,192-255
102endif
103if b:tex_stylish
104 setlocal isk+=@-@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200106if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell")
107 let g:tex_comment_nospell= 1
108endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109
110" Clusters: {{{1
111" --------
Bram Moolenaard38b0552012-04-25 19:07:41 +0200112syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113if !exists("g:tex_no_error")
114 syn cluster texCmdGroup add=texMathError
115endif
116syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
Bram Moolenaard38b0552012-04-25 19:07:41 +0200117syn 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,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell
118syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell
119syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell
Bram Moolenaard960d762011-09-21 19:22:10 +0200120if !exists("g:tex_nospell") || !g:tex_nospell
121 syn 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
122 syn 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
123else
124 syn 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
125 syn 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,texStyleMatcher
126endif
Bram Moolenaard38b0552012-04-25 19:07:41 +0200127syn cluster texPreambleMatchGroup 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
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000128syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129if !exists("tex_no_math")
130 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
131 syn cluster texMatchGroup add=@texMathZones
132 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
133 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 +0200134 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135 if !exists("g:tex_no_error")
136 syn cluster texMathMatchGroup add=texMathError
137 syn cluster texMathZoneGroup add=texMathError
138 endif
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000139 syn cluster texMathZoneGroup add=@NoSpell
140 " following used in the \part \chapter \section \subsection \subsubsection
141 " \paragraph \subparagraph \author \title highlighting
142 syn cluster texDocGroup contains=texPartZone,@texPartGroup
143 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone
144 syn cluster texChapterGroup contains=texSectionZone,texParaZone
145 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone
146 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone
147 syn cluster texSubSubSectionGroup contains=texParaZone
148 syn cluster texParaGroup contains=texSubParaZone
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200149 if has("conceal") && &enc == 'utf-8'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200150 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
151 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200152 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000153endif
154
155" Try to flag {} and () mismatches: {{{1
156if !exists("g:tex_no_error")
157 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
158 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError
159else
160 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup
161 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup
162endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200163if !exists("g:tex_nospell") || !g:tex_nospell
164 syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell
165else
166 syn region texParen start="(" end=")" contains=@texMatchGroup
167endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000168if !exists("g:tex_no_error")
169 syn match texError "[}\])]"
170endif
171if !exists("tex_no_math")
172 if !exists("g:tex_no_error")
173 syn match texMathError "}" contained
174 endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200175 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000176endif
177
178" TeX/LaTeX keywords: {{{1
179" Instead of trying to be All Knowing, I just match \..alphameric..
180" Note that *.tex files may not have "@" in their \commands
181if exists("g:tex_tex") || b:tex_stylish
182 syn match texStatement "\\[a-zA-Z@]\+"
183else
184 syn match texStatement "\\\a\+"
185 if !exists("g:tex_no_error")
186 syn match texError "\\\a*@[a-zA-Z@]*"
187 endif
188endif
189
190" TeX/LaTeX delimiters: {{{1
191syn match texDelimiter "&"
192syn match texDelimiter "\\\\"
Bram Moolenaard960d762011-09-21 19:22:10 +0200193syn match texDelimiter "[{}]"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194
195" Tex/Latex Options: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200196syn match texOption "[^\\]\zs#\d\+\|^#\d\+"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197
198" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
199if b:tex_stylish
200 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
201 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
202else
203 syn match texAccent "\\[bcdvuH]\A"me=e-1
204 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
205endif
206syn match texAccent "\\[bcdvuH]$"
207syn match texAccent +\\[=^.\~"`']+
208syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
209syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
210
211" \begin{}/\end{} section markers: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200212syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName
213syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment
214syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215
216" \documentclass, \documentstyle, \usepackage: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200217syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs
218syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000220" Preamble syntax-based folding support: {{{1
221if g:tex_fold_enabled && has("folding")
Bram Moolenaard38b0552012-04-25 19:07:41 +0200222 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000223endif
224
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225" TeX input: {{{1
226syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +0100227syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000228syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
229syn match texInputCurlies "[{}]" contained
Bram Moolenaar5c736222010-01-06 20:54:52 +0100230syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231
232" Type Styles (LaTeX 2.09): {{{1
233syn match texTypeStyle "\\rm\>"
234syn match texTypeStyle "\\em\>"
235syn match texTypeStyle "\\bf\>"
236syn match texTypeStyle "\\it\>"
237syn match texTypeStyle "\\sl\>"
238syn match texTypeStyle "\\sf\>"
239syn match texTypeStyle "\\sc\>"
240syn match texTypeStyle "\\tt\>"
241
242" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200243if s:tex_conceal !~ 'b'
244 syn match texTypeStyle "\\textbf\>"
245 syn match texTypeStyle "\\textit\>"
246endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247syn match texTypeStyle "\\textmd\>"
248syn match texTypeStyle "\\textrm\>"
249syn match texTypeStyle "\\textsc\>"
250syn match texTypeStyle "\\textsf\>"
251syn match texTypeStyle "\\textsl\>"
252syn match texTypeStyle "\\texttt\>"
253syn match texTypeStyle "\\textup\>"
254syn match texTypeStyle "\\emph\>"
255
256syn match texTypeStyle "\\mathbb\>"
257syn match texTypeStyle "\\mathbf\>"
258syn match texTypeStyle "\\mathcal\>"
259syn match texTypeStyle "\\mathfrak\>"
260syn match texTypeStyle "\\mathit\>"
261syn match texTypeStyle "\\mathnormal\>"
262syn match texTypeStyle "\\mathrm\>"
263syn match texTypeStyle "\\mathsf\>"
264syn match texTypeStyle "\\mathtt\>"
265
266syn match texTypeStyle "\\rmfamily\>"
267syn match texTypeStyle "\\sffamily\>"
268syn match texTypeStyle "\\ttfamily\>"
269
270syn match texTypeStyle "\\itshape\>"
271syn match texTypeStyle "\\scshape\>"
272syn match texTypeStyle "\\slshape\>"
273syn match texTypeStyle "\\upshape\>"
274
275syn match texTypeStyle "\\bfseries\>"
276syn match texTypeStyle "\\mdseries\>"
277
278" Some type sizes: {{{1
279syn match texTypeSize "\\tiny\>"
280syn match texTypeSize "\\scriptsize\>"
281syn match texTypeSize "\\footnotesize\>"
282syn match texTypeSize "\\small\>"
283syn match texTypeSize "\\normalsize\>"
284syn match texTypeSize "\\large\>"
285syn match texTypeSize "\\Large\>"
286syn match texTypeSize "\\LARGE\>"
287syn match texTypeSize "\\huge\>"
288syn match texTypeSize "\\Huge\>"
289
290" Spacecodes (TeX'isms): {{{1
291" \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x
292syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
293syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
294
295" Sections, subsections, etc: {{{1
Bram Moolenaard960d762011-09-21 19:22:10 +0200296if !exists("g:tex_nospell") || !g:tex_nospell
297 if g:tex_fold_enabled && has("folding")
298 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
299 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell
300 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell
301 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell
302 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
303 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
304 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
305 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
306 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
307 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell
308 else
309 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
310 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
311 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell
312 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell
313 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
314 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
315 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell
316 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell
317 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell
318 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell
319 endif
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000320else
Bram Moolenaard960d762011-09-21 19:22:10 +0200321 if g:tex_fold_enabled && has("folding")
322 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup
323 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup
324 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup
325 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup
326 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup
327 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup
328 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup
329 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup
330 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup
331 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup
332 else
333 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup
334 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup
335 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup
336 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup
337 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup
338 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup
339 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup
340 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup
341 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup
342 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup
343 endif
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000344endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000345
Bram Moolenaard38b0552012-04-25 19:07:41 +0200346" particular support for bold and italic {{{1
347if s:tex_conceal =~ 'b'
348 syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup
349 syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup
350 syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup
351 syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup
352endif
353
Bram Moolenaar071d4272004-06-13 20:20:40 +0000354" Bad Math (mismatched): {{{1
355if !exists("tex_no_math")
Bram Moolenaard960d762011-09-21 19:22:10 +0200356 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000357 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
358 syn match texBadMath "\\[\])]"
359endif
360
361" Math Zones: {{{1
362if !exists("tex_no_math")
Bram Moolenaar488c6512005-08-11 20:09:58 +0000363 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000364 " Starred forms are created if starform is true. Starred
365 " forms have syntax group and synchronization groups with a
366 " "S" appended. Handles: cluster, syntax, sync, and HiLink.
367 fun! TexNewMathZone(sfx,mathzone,starform)
368 let grpname = "texMathZone".a:sfx
369 let syncname = "texSyncMathZone".a:sfx
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000370 if g:tex_fold_enabled
371 let foldcmd= " fold"
372 else
373 let foldcmd= ""
374 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000376 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 +0000377 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
378 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100379 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380 if a:starform
381 let grpname = "texMathZone".a:sfx.'S'
382 let syncname = "texSyncMathZone".a:sfx.'S'
383 exe "syn cluster texMathZones add=".grpname
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000384 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 +0000385 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
386 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
Bram Moolenaar5c736222010-01-06 20:54:52 +0100387 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000388 endif
389 endfun
390
391 " Standard Math Zones: {{{2
392 call TexNewMathZone("A","align",1)
393 call TexNewMathZone("B","alignat",1)
394 call TexNewMathZone("C","displaymath",1)
395 call TexNewMathZone("D","eqnarray",1)
396 call TexNewMathZone("E","equation",1)
397 call TexNewMathZone("F","flalign",1)
398 call TexNewMathZone("G","gather",1)
399 call TexNewMathZone("H","math",1)
400 call TexNewMathZone("I","multline",1)
Bram Moolenaard960d762011-09-21 19:22:10 +0200401 call TexNewMathZone("J","subequations",0)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000402 call TexNewMathZone("K","xalignat",1)
403 call TexNewMathZone("L","xxalignat",0)
404
405 " Inline Math Zones: {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200406 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200407 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
408 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
409 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
410 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
411 else
412 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
413 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
414 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
415 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
416 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200417 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418
419 syn match texMathOper "[_^=]" contained
420
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200421 " Text Inside Math Zones: {{{2
Bram Moolenaard960d762011-09-21 19:22:10 +0200422 if !exists("g:tex_nospell") || !g:tex_nospell
423 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
424 else
425 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup
426 endif
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200427
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428 " \left..something.. and \right..something.. support: {{{2
429 syn match texMathDelimBad contained "\S"
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200430 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
431 syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
432 syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
Bram Moolenaaradc21822011-04-01 18:03:16 +0200433 let s:texMathDelimList=[
434 \ ['<' , '<'] ,
435 \ ['>' , '>'] ,
436 \ ['(' , '('] ,
437 \ [')' , ')'] ,
438 \ ['\[' , '['] ,
439 \ [']' , ']'] ,
440 \ ['\\{' , '{'] ,
441 \ ['\\}' , '}'] ,
442 \ ['|' , '|'] ,
443 \ ['\\|' , '‖'] ,
444 \ ['\\backslash' , '\'] ,
445 \ ['\\downarrow' , '↓'] ,
446 \ ['\\Downarrow' , '⇓'] ,
447 \ ['\\langle' , '<'] ,
448 \ ['\\lbrace' , '['] ,
449 \ ['\\lceil' , '⌈'] ,
450 \ ['\\lfloor' , '⌊'] ,
451 \ ['\\lgroup' , '⌊'] ,
452 \ ['\\lmoustache' , '⎛'] ,
453 \ ['\\rangle' , '>'] ,
454 \ ['\\rbrace' , ']'] ,
455 \ ['\\rceil' , '⌉'] ,
456 \ ['\\rfloor' , '⌋'] ,
457 \ ['\\rgroup' , '⌋'] ,
458 \ ['\\rmoustache' , '⎞'] ,
459 \ ['\\uparrow' , '↑'] ,
460 \ ['\\Uparrow' , '↑'] ,
461 \ ['\\updownarrow', '↕'] ,
462 \ ['\\Updownarrow', '⇕']]
463 syn match texMathDelim '\\[bB]igg\=[lr]' contained nextgroup=texMathDelimBad
464 for texmath in s:texMathDelimList
465 exe "syn match texMathDelim '\\\\[bB]igg\\=[lr]\\=".texmath[0]."' contained conceal cchar=".texmath[1]
466 endfor
467
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200468 else
469 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
Bram Moolenaaradc21822011-04-01 18:03:16 +0200470 syn match texMathDelim contained "\\[bB]igg\=[lr]\=\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
471 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
472 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
473 syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
474 syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
475 syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
476 syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
477 syn keyword texMathDelimKey contained lbrace lvert rfloor
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200478 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
480 syn match texMathDelim contained "\\lefteqn\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481endif
482
483" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
484syn match texSpecialChar "\\[$&%#{}_]"
485if b:tex_stylish
486 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
487else
488 syn match texSpecialChar "\\[SP@]\A"me=e-1
489endif
490syn match texSpecialChar "\\\\"
491if !exists("tex_no_math")
492 syn match texOnlyMath "[_^]"
493endif
494syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
495
496" Comments: {{{1
497" Normal TeX LaTeX : %....
498" Documented TeX Format: ^^A... -and- leading %s (only)
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000499if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
500 syn cluster texCommentGroup contains=texTodo,@Spell
501else
502 syn cluster texCommentGroup contains=texTodo,@NoSpell
503endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504syn case ignore
Bram Moolenaar18144c82006-04-12 21:52:12 +0000505syn keyword texTodo contained combak fixme todo xxx
Bram Moolenaar071d4272004-06-13 20:20:40 +0000506syn case match
Bram Moolenaar81af9252010-12-10 20:35:50 +0100507if s:extfname == "dtx"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508 syn match texComment "\^\^A.*$" contains=@texCommentGroup
509 syn match texComment "^%\+" contains=@texCommentGroup
510else
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000511 if g:tex_fold_enabled
512 " allows syntax-folding of 2 or more contiguous comment lines
513 " single-line comments are not folded
Bram Moolenaard38b0552012-04-25 19:07:41 +0200514 syn match texComment "%.*$" contains=@texCommentGroup
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000515 syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
Bram Moolenaard38b0552012-04-25 19:07:41 +0200516 syn region texNoSpell contained fold matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000517 else
Bram Moolenaard38b0552012-04-25 19:07:41 +0200518 syn match texComment "%.*$" contains=@texCommentGroup
519 syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000520 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000521endif
522
523" Separate lines used for verb` and verb# so that the end conditions {{{1
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200524" will appropriately terminate.
525" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
526if exists("g:tex_verbspell") && g:tex_verbspell
527 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
528 " listings package:
529 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200530 if version < 600
531 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell
532 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell
533 else
534 if b:tex_stylish
535 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell
536 else
537 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell
538 endif
539 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000540else
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200541 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>"
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200542 if version < 600
543 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
544 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
545 else
546 if b:tex_stylish
547 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
548 else
549 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
550 endif
551 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000552endif
553
554" Tex Reference Zones: {{{1
Bram Moolenaard960d762011-09-21 19:22:10 +0200555syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup
556syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup
557syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup
558syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup
559syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
560syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
561syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
562syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
563syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
Bram Moolenaar071d4272004-06-13 20:20:40 +0000564
565" Handle newcommand, newenvironment : {{{1
566syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
567syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
568syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
569syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
570syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
571syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
572syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
573syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
574
575" Definitions/Commands: {{{1
576syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
577if b:tex_stylish
578 syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
579 syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
580else
581 syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
582 syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
583endif
584syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
585syn match texDefParm contained "#\d\+"
586
587" TeX Lengths: {{{1
Bram Moolenaar9964e462007-05-05 17:54:07 +0000588syn 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 +0000589
590" TeX String Delimiters: {{{1
591syn match texString "\(``\|''\|,,\)"
592
Bram Moolenaar5c736222010-01-06 20:54:52 +0100593" makeatletter -- makeatother sections
594if !exists("g:tex_no_error")
595 syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained
596 syn match texStyleStatement "\\[a-zA-Z@]\+" contained
597 syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
598 syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
599endif
600
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200601" Conceal mode support (supports set cole=2) {{{1
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200602if has("conceal") && &enc == 'utf-8'
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200603
604 " Math Symbols {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200605 " (many of these symbols were contributed by Björn Winckler)
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200606 if s:tex_conceal =~ 'm'
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200607 let s:texMathList=[
Bram Moolenaaradc21822011-04-01 18:03:16 +0200608 \ ['|' , '‖'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200609 \ ['aleph' , 'ℵ'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100610 \ ['amalg' , '∐'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200611 \ ['angle' , '∠'],
612 \ ['approx' , '≈'],
613 \ ['ast' , '∗'],
614 \ ['asymp' , '≍'],
615 \ ['backepsilon' , '∍'],
616 \ ['backsimeq' , '≃'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200617 \ ['backslash' , '∖'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200618 \ ['barwedge' , '⊼'],
619 \ ['because' , '∵'],
620 \ ['between' , '≬'],
621 \ ['bigcap' , '∩'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100622 \ ['bigcirc' , '○'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200623 \ ['bigcup' , '∪'],
624 \ ['bigodot' , '⊙'],
625 \ ['bigoplus' , '⊕'],
626 \ ['bigotimes' , '⊗'],
627 \ ['bigsqcup' , '⊔'],
628 \ ['bigtriangledown', '∇'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100629 \ ['bigtriangleup' , '∆'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200630 \ ['bigvee' , '⋁'],
631 \ ['bigwedge' , '⋀'],
632 \ ['blacksquare' , '∎'],
633 \ ['bot' , '⊥'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100634 \ ['bowtie' , '⋈'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200635 \ ['boxdot' , '⊡'],
636 \ ['boxminus' , '⊟'],
637 \ ['boxplus' , '⊞'],
638 \ ['boxtimes' , '⊠'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100639 \ ['bullet' , '•'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200640 \ ['bumpeq' , '≏'],
641 \ ['Bumpeq' , '≎'],
642 \ ['cap' , '∩'],
643 \ ['Cap' , '⋒'],
644 \ ['cdot' , '·'],
645 \ ['cdots' , '⋯'],
646 \ ['circ' , '∘'],
647 \ ['circeq' , '≗'],
648 \ ['circlearrowleft', '↺'],
649 \ ['circlearrowright', '↻'],
650 \ ['circledast' , '⊛'],
651 \ ['circledcirc' , '⊚'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200652 \ ['clubsuit' , '♣'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200653 \ ['complement' , '∁'],
654 \ ['cong' , '≅'],
655 \ ['coprod' , '∐'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200656 \ ['copyright' , '©'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200657 \ ['cup' , '∪'],
658 \ ['Cup' , '⋓'],
659 \ ['curlyeqprec' , '⋞'],
660 \ ['curlyeqsucc' , '⋟'],
661 \ ['curlyvee' , '⋎'],
662 \ ['curlywedge' , '⋏'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100663 \ ['dagger' , '†'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200664 \ ['dashv' , '⊣'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100665 \ ['ddagger' , '‡'],
666 \ ['ddots' , '⋱'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200667 \ ['diamond' , '⋄'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200668 \ ['diamondsuit' , '♢'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200669 \ ['div' , '÷'],
670 \ ['doteq' , '≐'],
671 \ ['doteqdot' , '≑'],
672 \ ['dotplus' , '∔'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100673 \ ['dots' , '…'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200674 \ ['dotsb' , '⋯'],
675 \ ['dotsc' , '…'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200676 \ ['dotsi' , '⋯'],
677 \ ['dotso' , '…'],
678 \ ['doublebarwedge' , '⩞'],
679 \ ['downarrow' , '↓'],
680 \ ['Downarrow' , '⇓'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100681 \ ['ell' , 'ℓ'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200682 \ ['emptyset' , '∅'],
683 \ ['eqcirc' , '≖'],
684 \ ['eqsim' , '≂'],
685 \ ['eqslantgtr' , '⪖'],
686 \ ['eqslantless' , '⪕'],
687 \ ['equiv' , '≡'],
688 \ ['exists' , '∃'],
689 \ ['fallingdotseq' , '≒'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200690 \ ['flat' , '♭'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200691 \ ['forall' , '∀'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100692 \ ['frown' , '⁔'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200693 \ ['ge' , '≥'],
694 \ ['geq' , '≥'],
695 \ ['geqq' , '≧'],
696 \ ['gets' , '←'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100697 \ ['gg' , '⟫'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200698 \ ['gneqq' , '≩'],
699 \ ['gtrdot' , '⋗'],
700 \ ['gtreqless' , '⋛'],
701 \ ['gtrless' , '≷'],
702 \ ['gtrsim' , '≳'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200703 \ ['hbar' , 'ℏ'],
704 \ ['heartsuit' , '♡'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200705 \ ['hookleftarrow' , '↩'],
706 \ ['hookrightarrow' , '↪'],
707 \ ['iiint' , '∭'],
708 \ ['iint' , '∬'],
709 \ ['Im' , 'ℑ'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200710 \ ['imath' , 'ɩ'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200711 \ ['in' , '∈'],
712 \ ['infty' , '∞'],
713 \ ['int' , '∫'],
714 \ ['lceil' , '⌈'],
715 \ ['ldots' , '…'],
716 \ ['le' , '≤'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100717 \ ['leadsto' , '↝'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200718 \ ['left(' , '('],
719 \ ['left\[' , '['],
720 \ ['left\\{' , '{'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100721 \ ['leftarrow' , '⟵'],
722 \ ['Leftarrow' , '⟸'],
723 \ ['leftarrowtail' , '↢'],
724 \ ['leftharpoondown', '↽'],
725 \ ['leftharpoonup' , '↼'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200726 \ ['leftrightarrow' , '⇔'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100727 \ ['Leftrightarrow' , '⇔'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200728 \ ['leftrightsquigarrow', '↭'],
729 \ ['leftthreetimes' , '⋋'],
730 \ ['leq' , '≤'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100731 \ ['leq' , '≤'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200732 \ ['leqq' , '≦'],
733 \ ['lessdot' , '⋖'],
734 \ ['lesseqgtr' , '⋚'],
735 \ ['lesssim' , '≲'],
736 \ ['lfloor' , '⌊'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100737 \ ['ll' , '≪'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200738 \ ['lmoustache' , '╭'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200739 \ ['lneqq' , '≨'],
740 \ ['ltimes' , '⋉'],
741 \ ['mapsto' , '↦'],
742 \ ['measuredangle' , '∡'],
743 \ ['mid' , '∣'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100744 \ ['models' , '╞'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200745 \ ['mp' , '∓'],
746 \ ['nabla' , '∇'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200747 \ ['natural' , '♮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200748 \ ['ncong' , '≇'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200749 \ ['ne' , '≠'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100750 \ ['nearrow' , '↗'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200751 \ ['neg' , '¬'],
752 \ ['neq' , '≠'],
753 \ ['nexists' , '∄'],
754 \ ['ngeq' , '≱'],
755 \ ['ngeqq' , '≱'],
756 \ ['ngtr' , '≯'],
757 \ ['ni' , '∋'],
758 \ ['nleftarrow' , '↚'],
759 \ ['nLeftarrow' , '⇍'],
760 \ ['nLeftrightarrow', '⇎'],
761 \ ['nleq' , '≰'],
762 \ ['nleqq' , '≰'],
763 \ ['nless' , '≮'],
764 \ ['nmid' , '∤'],
765 \ ['notin' , '∉'],
766 \ ['nprec' , '⊀'],
767 \ ['nrightarrow' , '↛'],
768 \ ['nRightarrow' , '⇏'],
769 \ ['nsim' , '≁'],
770 \ ['nsucc' , '⊁'],
771 \ ['ntriangleleft' , '⋪'],
772 \ ['ntrianglelefteq', '⋬'],
773 \ ['ntriangleright' , '⋫'],
774 \ ['ntrianglerighteq', '⋭'],
775 \ ['nvdash' , '⊬'],
776 \ ['nvDash' , '⊭'],
777 \ ['nVdash' , '⊮'],
778 \ ['nwarrow' , '↖'],
779 \ ['odot' , '⊙'],
780 \ ['oint' , '∮'],
781 \ ['ominus' , '⊖'],
782 \ ['oplus' , '⊕'],
783 \ ['oslash' , '⊘'],
784 \ ['otimes' , '⊗'],
785 \ ['owns' , '∋'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200786 \ ['P' , '¶'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100787 \ ['parallel' , '║'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200788 \ ['partial' , '∂'],
789 \ ['perp' , '⊥'],
790 \ ['pitchfork' , '⋔'],
791 \ ['pm' , '±'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200792 \ ['prec' , '≺'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100793 \ ['precapprox' , '⪷'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200794 \ ['preccurlyeq' , '≼'],
795 \ ['preceq' , '⪯'],
796 \ ['precnapprox' , '⪹'],
797 \ ['precneqq' , '⪵'],
798 \ ['precsim' , '≾'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200799 \ ['prime' , '′'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200800 \ ['prod' , '∏'],
801 \ ['propto' , '∝'],
802 \ ['rceil' , '⌉'],
803 \ ['Re' , 'ℜ'],
804 \ ['rfloor' , '⌋'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200805 \ ['right)' , ')'],
806 \ ['right]' , ']'],
807 \ ['right\\}' , '}'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100808 \ ['rightarrow' , '⟶'],
809 \ ['Rightarrow' , '⟹'],
810 \ ['rightarrowtail' , '↣'],
811 \ ['rightleftharpoons', '⇌'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200812 \ ['rightsquigarrow', '↝'],
813 \ ['rightthreetimes', '⋌'],
814 \ ['risingdotseq' , '≓'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200815 \ ['rmoustache' , '╮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200816 \ ['rtimes' , '⋊'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200817 \ ['S' , '§'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200818 \ ['searrow' , '↘'],
819 \ ['setminus' , '∖'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200820 \ ['sharp' , '♯'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200821 \ ['sim' , '∼'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100822 \ ['simeq' , '⋍'],
823 \ ['smile' , '‿'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200824 \ ['spadesuit' , '♠'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200825 \ ['sphericalangle' , '∢'],
826 \ ['sqcap' , '⊓'],
827 \ ['sqcup' , '⊔'],
828 \ ['sqsubset' , '⊏'],
829 \ ['sqsubseteq' , '⊑'],
830 \ ['sqsupset' , '⊐'],
831 \ ['sqsupseteq' , '⊒'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100832 \ ['star' , '✫'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200833 \ ['subset' , '⊂'],
834 \ ['Subset' , '⋐'],
835 \ ['subseteq' , '⊆'],
836 \ ['subseteqq' , '⫅'],
837 \ ['subsetneq' , '⊊'],
838 \ ['subsetneqq' , '⫋'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200839 \ ['succ' , '≻'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100840 \ ['succapprox' , '⪸'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200841 \ ['succcurlyeq' , '≽'],
842 \ ['succeq' , '⪰'],
843 \ ['succnapprox' , '⪺'],
844 \ ['succneqq' , '⪶'],
845 \ ['succsim' , '≿'],
846 \ ['sum' , '∑'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100847 \ ['supset' , '⊃'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200848 \ ['Supset' , '⋑'],
849 \ ['supseteq' , '⊇'],
850 \ ['supseteqq' , '⫆'],
851 \ ['supsetneq' , '⊋'],
852 \ ['supsetneqq' , '⫌'],
853 \ ['surd' , '√'],
854 \ ['swarrow' , '↙'],
855 \ ['therefore' , '∴'],
856 \ ['times' , '×'],
857 \ ['to' , '→'],
858 \ ['top' , '⊤'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200859 \ ['triangle' , '∆'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200860 \ ['triangleleft' , '⊲'],
861 \ ['trianglelefteq' , '⊴'],
862 \ ['triangleq' , '≜'],
863 \ ['triangleright' , '⊳'],
864 \ ['trianglerighteq', '⊵'],
865 \ ['twoheadleftarrow', '↞'],
866 \ ['twoheadrightarrow', '↠'],
867 \ ['uparrow' , '↑'],
868 \ ['Uparrow' , '⇑'],
869 \ ['updownarrow' , '↕'],
870 \ ['Updownarrow' , '⇕'],
871 \ ['varnothing' , '∅'],
872 \ ['vartriangle' , '∆'],
873 \ ['vdash' , '⊢'],
874 \ ['vDash' , '⊨'],
875 \ ['Vdash' , '⊩'],
876 \ ['vdots' , '⋮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200877 \ ['vee' , '∨'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100878 \ ['veebar' , '⊻'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200879 \ ['Vvdash' , '⊪'],
880 \ ['wedge' , '∧'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200881 \ ['wp' , '℘'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200882 \ ['wr' , '≀']]
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100883" \ ['jmath' , 'X']
884" \ ['uminus' , 'X']
885" \ ['uplus' , 'X']
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200886 for texmath in s:texMathList
Bram Moolenaar81af9252010-12-10 20:35:50 +0100887 if texmath[0] =~ '\w$'
888 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
889 else
890 exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
891 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200892 endfor
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200893
894 if &ambw == "double"
895 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
896 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
897 else
898 syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫
899 syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪
900 endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200901
902 syn match texMathSymbol '\\hat{a}' contained conceal cchar=â
903 syn match texMathSymbol '\\hat{A}' contained conceal cchar=Â
904 syn match texMathSymbol '\\hat{c}' contained conceal cchar=ĉ
905 syn match texMathSymbol '\\hat{C}' contained conceal cchar=Ĉ
906 syn match texMathSymbol '\\hat{e}' contained conceal cchar=ê
907 syn match texMathSymbol '\\hat{E}' contained conceal cchar=Ê
908 syn match texMathSymbol '\\hat{g}' contained conceal cchar=ĝ
909 syn match texMathSymbol '\\hat{G}' contained conceal cchar=Ĝ
910 syn match texMathSymbol '\\hat{i}' contained conceal cchar=î
911 syn match texMathSymbol '\\hat{I}' contained conceal cchar=Î
912 syn match texMathSymbol '\\hat{o}' contained conceal cchar=ô
913 syn match texMathSymbol '\\hat{O}' contained conceal cchar=Ô
914 syn match texMathSymbol '\\hat{s}' contained conceal cchar=ŝ
915 syn match texMathSymbol '\\hat{S}' contained conceal cchar=Ŝ
916 syn match texMathSymbol '\\hat{u}' contained conceal cchar=û
917 syn match texMathSymbol '\\hat{U}' contained conceal cchar=Û
918 syn match texMathSymbol '\\hat{w}' contained conceal cchar=ŵ
919 syn match texMathSymbol '\\hat{W}' contained conceal cchar=Ŵ
920 syn match texMathSymbol '\\hat{y}' contained conceal cchar=ŷ
921 syn match texMathSymbol '\\hat{Y}' contained conceal cchar=Ŷ
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200922 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200923
924 " Greek {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200925 if s:tex_conceal =~ 'g'
926 fun! s:Greek(group,pat,cchar)
927 exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
928 endfun
929 call s:Greek('texGreek','\\alpha\>' ,'α')
930 call s:Greek('texGreek','\\beta\>' ,'β')
931 call s:Greek('texGreek','\\gamma\>' ,'γ')
932 call s:Greek('texGreek','\\delta\>' ,'δ')
933 call s:Greek('texGreek','\\epsilon\>' ,'ϵ')
934 call s:Greek('texGreek','\\varepsilon\>' ,'ε')
935 call s:Greek('texGreek','\\zeta\>' ,'ζ')
936 call s:Greek('texGreek','\\eta\>' ,'η')
937 call s:Greek('texGreek','\\theta\>' ,'θ')
938 call s:Greek('texGreek','\\vartheta\>' ,'ϑ')
939 call s:Greek('texGreek','\\kappa\>' ,'κ')
940 call s:Greek('texGreek','\\lambda\>' ,'λ')
941 call s:Greek('texGreek','\\mu\>' ,'μ')
942 call s:Greek('texGreek','\\nu\>' ,'ν')
943 call s:Greek('texGreek','\\xi\>' ,'ξ')
944 call s:Greek('texGreek','\\pi\>' ,'π')
945 call s:Greek('texGreek','\\varpi\>' ,'ϖ')
946 call s:Greek('texGreek','\\rho\>' ,'ρ')
947 call s:Greek('texGreek','\\varrho\>' ,'ϱ')
948 call s:Greek('texGreek','\\sigma\>' ,'σ')
949 call s:Greek('texGreek','\\varsigma\>' ,'ς')
950 call s:Greek('texGreek','\\tau\>' ,'τ')
951 call s:Greek('texGreek','\\upsilon\>' ,'υ')
952 call s:Greek('texGreek','\\phi\>' ,'φ')
953 call s:Greek('texGreek','\\varphi\>' ,'ϕ')
954 call s:Greek('texGreek','\\chi\>' ,'χ')
955 call s:Greek('texGreek','\\psi\>' ,'ψ')
956 call s:Greek('texGreek','\\omega\>' ,'ω')
957 call s:Greek('texGreek','\\Gamma\>' ,'Γ')
958 call s:Greek('texGreek','\\Delta\>' ,'Δ')
959 call s:Greek('texGreek','\\Theta\>' ,'Θ')
960 call s:Greek('texGreek','\\Lambda\>' ,'Λ')
961 call s:Greek('texGreek','\\Xi\>' ,'Χ')
962 call s:Greek('texGreek','\\Pi\>' ,'Π')
963 call s:Greek('texGreek','\\Sigma\>' ,'Σ')
964 call s:Greek('texGreek','\\Upsilon\>' ,'Υ')
965 call s:Greek('texGreek','\\Phi\>' ,'Φ')
966 call s:Greek('texGreek','\\Psi\>' ,'Ψ')
967 call s:Greek('texGreek','\\Omega\>' ,'Ω')
968 delfun s:Greek
969 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200970
971 " Superscripts/Subscripts {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200972 if s:tex_conceal =~ 's'
Bram Moolenaard960d762011-09-21 19:22:10 +0200973 syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
974 syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200975 fun! s:SuperSub(group,leader,pat,cchar)
976 exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
977 exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
978 endfun
979 call s:SuperSub('texSuperscript','\^','0','⁰')
980 call s:SuperSub('texSuperscript','\^','1','¹')
981 call s:SuperSub('texSuperscript','\^','2','²')
982 call s:SuperSub('texSuperscript','\^','3','³')
983 call s:SuperSub('texSuperscript','\^','4','⁴')
984 call s:SuperSub('texSuperscript','\^','5','⁵')
985 call s:SuperSub('texSuperscript','\^','6','⁶')
986 call s:SuperSub('texSuperscript','\^','7','⁷')
987 call s:SuperSub('texSuperscript','\^','8','⁸')
988 call s:SuperSub('texSuperscript','\^','9','⁹')
989 call s:SuperSub('texSuperscript','\^','a','ᵃ')
990 call s:SuperSub('texSuperscript','\^','b','ᵇ')
991 call s:SuperSub('texSuperscript','\^','c','ᶜ')
992 call s:SuperSub('texSuperscript','\^','d','ᵈ')
993 call s:SuperSub('texSuperscript','\^','e','ᵉ')
994 call s:SuperSub('texSuperscript','\^','f','ᶠ')
995 call s:SuperSub('texSuperscript','\^','g','ᵍ')
996 call s:SuperSub('texSuperscript','\^','h','ʰ')
997 call s:SuperSub('texSuperscript','\^','i','ⁱ')
998 call s:SuperSub('texSuperscript','\^','j','ʲ')
999 call s:SuperSub('texSuperscript','\^','k','ᵏ')
1000 call s:SuperSub('texSuperscript','\^','l','ˡ')
1001 call s:SuperSub('texSuperscript','\^','m','ᵐ')
1002 call s:SuperSub('texSuperscript','\^','n','ⁿ')
1003 call s:SuperSub('texSuperscript','\^','o','ᵒ')
1004 call s:SuperSub('texSuperscript','\^','p','ᵖ')
1005 call s:SuperSub('texSuperscript','\^','r','ʳ')
1006 call s:SuperSub('texSuperscript','\^','s','ˢ')
1007 call s:SuperSub('texSuperscript','\^','t','ᵗ')
1008 call s:SuperSub('texSuperscript','\^','u','ᵘ')
1009 call s:SuperSub('texSuperscript','\^','v','ᵛ')
1010 call s:SuperSub('texSuperscript','\^','w','ʷ')
1011 call s:SuperSub('texSuperscript','\^','x','ˣ')
1012 call s:SuperSub('texSuperscript','\^','y','ʸ')
1013 call s:SuperSub('texSuperscript','\^','z','ᶻ')
1014 call s:SuperSub('texSuperscript','\^','A','ᴬ')
1015 call s:SuperSub('texSuperscript','\^','B','ᴮ')
1016 call s:SuperSub('texSuperscript','\^','D','ᴰ')
1017 call s:SuperSub('texSuperscript','\^','E','ᴱ')
1018 call s:SuperSub('texSuperscript','\^','G','ᴳ')
1019 call s:SuperSub('texSuperscript','\^','H','ᴴ')
1020 call s:SuperSub('texSuperscript','\^','I','ᴵ')
1021 call s:SuperSub('texSuperscript','\^','J','ᴶ')
1022 call s:SuperSub('texSuperscript','\^','K','ᴷ')
1023 call s:SuperSub('texSuperscript','\^','L','ᴸ')
1024 call s:SuperSub('texSuperscript','\^','M','ᴹ')
1025 call s:SuperSub('texSuperscript','\^','N','ᴺ')
1026 call s:SuperSub('texSuperscript','\^','O','ᴼ')
1027 call s:SuperSub('texSuperscript','\^','P','ᴾ')
1028 call s:SuperSub('texSuperscript','\^','R','ᴿ')
1029 call s:SuperSub('texSuperscript','\^','T','ᵀ')
1030 call s:SuperSub('texSuperscript','\^','U','ᵁ')
1031 call s:SuperSub('texSuperscript','\^','W','ᵂ')
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001032 call s:SuperSub('texSuperscript','\^',',','︐')
1033 call s:SuperSub('texSuperscript','\^',':','︓')
1034 call s:SuperSub('texSuperscript','\^',';','︔')
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001035 call s:SuperSub('texSuperscript','\^','+','⁺')
1036 call s:SuperSub('texSuperscript','\^','-','⁻')
1037 call s:SuperSub('texSuperscript','\^','<','˂')
1038 call s:SuperSub('texSuperscript','\^','>','˃')
1039 call s:SuperSub('texSuperscript','\^','/','ˊ')
1040 call s:SuperSub('texSuperscript','\^','(','⁽')
1041 call s:SuperSub('texSuperscript','\^',')','⁾')
1042 call s:SuperSub('texSuperscript','\^','\.','˙')
1043 call s:SuperSub('texSuperscript','\^','=','˭')
1044 call s:SuperSub('texSubscript','_','0','₀')
1045 call s:SuperSub('texSubscript','_','1','₁')
1046 call s:SuperSub('texSubscript','_','2','₂')
1047 call s:SuperSub('texSubscript','_','3','₃')
1048 call s:SuperSub('texSubscript','_','4','₄')
1049 call s:SuperSub('texSubscript','_','5','₅')
1050 call s:SuperSub('texSubscript','_','6','₆')
1051 call s:SuperSub('texSubscript','_','7','₇')
1052 call s:SuperSub('texSubscript','_','8','₈')
1053 call s:SuperSub('texSubscript','_','9','₉')
1054 call s:SuperSub('texSubscript','_','a','ₐ')
1055 call s:SuperSub('texSubscript','_','e','ₑ')
1056 call s:SuperSub('texSubscript','_','i','ᵢ')
1057 call s:SuperSub('texSubscript','_','o','ₒ')
1058 call s:SuperSub('texSubscript','_','u','ᵤ')
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001059 call s:SuperSub('texSubscript','_',',','︐')
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001060 call s:SuperSub('texSubscript','_','+','₊')
1061 call s:SuperSub('texSubscript','_','-','₋')
1062 call s:SuperSub('texSubscript','_','/','ˏ')
1063 call s:SuperSub('texSubscript','_','(','₍')
1064 call s:SuperSub('texSubscript','_',')','₎')
1065 call s:SuperSub('texSubscript','_','\.','‸')
1066 call s:SuperSub('texSubscript','_','r','ᵣ')
1067 call s:SuperSub('texSubscript','_','v','ᵥ')
1068 call s:SuperSub('texSubscript','_','x','ₓ')
1069 call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
1070 call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
1071 call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
1072 call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
1073 call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
1074 delfun s:SuperSub
1075 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001076
1077 " Accented characters: {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001078 if s:tex_conceal =~ 'a'
1079 if b:tex_stylish
1080 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
1081 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
1082 else
1083 fun! s:Accents(chr,...)
1084 let i= 1
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001085 for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"]
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001086 if i > a:0
1087 break
1088 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001089 if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001090 let i= i + 1
1091 continue
1092 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001093 if accent =~ '\a'
1094 exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
1095 else
1096 exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
1097 endif
Bram Moolenaare0021c72010-07-28 17:25:21 +02001098 let i= i + 1
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001099 endfor
1100 endfun
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001101 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaard960d762011-09-21 19:22:10 +02001102 call s:Accents('a','à','á','â','ä','ã','ȧ',' ',' ','ą','å','ă','ă')
1103 call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ',' ',' ','Ą','Å','Ă','Ă')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001104 call s:Accents('c',' ','ć','ĉ',' ',' ','ċ','ç',' ',' ',' ',' ','č')
1105 call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ','Ç',' ',' ',' ',' ','Č')
1106 call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
1107 call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
1108 call s:Accents('e','è','é','ê','ë','ẽ','ė','ȩ',' ','ę',' ','ĕ','ě')
1109 call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě')
Bram Moolenaard960d762011-09-21 19:22:10 +02001110 call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ')
1111 call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ')
1112 call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ')
1113 call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001114 call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1115 call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ')
Bram Moolenaard960d762011-09-21 19:22:10 +02001116 call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ')
1117 call s:Accents('k',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ',' ')
1118 call s:Accents('K',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ',' ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001119 call s:Accents('l',' ','ĺ','ľ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
1120 call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
1121 call s:Accents('n',' ','ń',' ',' ','ñ',' ','ņ',' ',' ',' ',' ','ň')
1122 call s:Accents('N',' ','Ń',' ',' ','Ñ',' ','Ņ',' ',' ',' ',' ','Ň')
1123 call s:Accents('o','ò','ó','ô','ö','õ','ȯ',' ','ő','ǫ',' ','ŏ',' ')
1124 call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ',' ','Ő','Ǫ',' ','Ŏ',' ')
1125 call s:Accents('r',' ','ŕ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
1126 call s:Accents('R',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
Bram Moolenaard960d762011-09-21 19:22:10 +02001127 call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ','ȿ',' ',' ','š')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001128 call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
1129 call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
1130 call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
Bram Moolenaard960d762011-09-21 19:22:10 +02001131 call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű','ų','ů','ŭ','ǔ')
1132 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű','Ų','Ů','Ŭ','Ǔ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001133 call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1134 call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1135 call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ')
1136 call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ')
1137 call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ','ž')
1138 call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ','Ž')
1139 call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1140 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001141 delfun s:Accents
1142 syn match texAccent '\\aa\>' conceal cchar=å
1143 syn match texAccent '\\AA\>' conceal cchar=Å
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001144 syn match texAccent '\\o\>' conceal cchar=ø
1145 syn match texAccent '\\O\>' conceal cchar=Ø
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001146 syn match texLigature '\\AE\>' conceal cchar=Æ
1147 syn match texLigature '\\ae\>' conceal cchar=æ
1148 syn match texLigature '\\oe\>' conceal cchar=œ
1149 syn match texLigature '\\OE\>' conceal cchar=Œ
1150 syn match texLigature '\\ss\>' conceal cchar=ß
1151 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001152 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001153endif
1154
1155" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001156" LaTeX synchronization: {{{1
1157syn sync maxlines=200
1158syn sync minlines=50
1159
1160syn sync match texSyncStop groupthere NONE "%stopzone\>"
1161
1162" Synchronization: {{{1
1163" The $..$ and $$..$$ make for impossible sync patterns
1164" (one can't tell if a "$$" starts or stops a math zone by itself)
1165" The following grouptheres coupled with minlines above
1166" help improve the odds of good syncing.
1167if !exists("tex_no_math")
1168 syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
1169 syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
1170 syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
1171 syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
1172 syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
1173 syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
1174 syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
1175 syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
1176endif
1177
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001178" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001179" Highlighting: {{{1
1180if did_tex_syntax_inits == 1
1181 let did_tex_syntax_inits= 2
1182 " TeX highlighting groups which should share similar highlighting
1183 if !exists("g:tex_no_error")
1184 if !exists("tex_no_math")
1185 HiLink texBadMath texError
1186 HiLink texMathDelimBad texError
1187 HiLink texMathError texError
1188 if !b:tex_stylish
1189 HiLink texOnlyMath texError
1190 endif
1191 endif
1192 HiLink texError Error
1193 endif
1194
Bram Moolenaard38b0552012-04-25 19:07:41 +02001195 hi texBoldStyle gui=bold cterm=bold
1196 hi texItalStyle gui=italic cterm=italic
1197 hi texBoldItalStyle gui=bold,italic cterm=bold,italic
1198 hi texItalBoldStyle gui=bold,italic cterm=bold,italic
Bram Moolenaard960d762011-09-21 19:22:10 +02001199 HiLink texCite texRefZone
Bram Moolenaar071d4272004-06-13 20:20:40 +00001200 HiLink texDefCmd texDef
1201 HiLink texDefName texDef
1202 HiLink texDocType texCmdName
1203 HiLink texDocTypeArgs texCmdArgs
1204 HiLink texInputFileOpt texCmdArgs
1205 HiLink texInputCurlies texDelimiter
1206 HiLink texLigature texSpecialChar
1207 if !exists("tex_no_math")
1208 HiLink texMathDelimSet1 texMathDelim
1209 HiLink texMathDelimSet2 texMathDelim
1210 HiLink texMathDelimKey texMathDelim
1211 HiLink texMathMatcher texMath
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001212 HiLink texAccent texStatement
1213 HiLink texGreek texStatement
1214 HiLink texSuperscript texStatement
1215 HiLink texSubscript texStatement
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001216 HiLink texSuperscripts texSuperscript
1217 HiLink texSubscripts texSubscript
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001218 HiLink texMathSymbol texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001219 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001220 HiLink texMathZoneW texMath
1221 HiLink texMathZoneX texMath
1222 HiLink texMathZoneY texMath
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001223 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001224 HiLink texMathZoneZ texMath
1225 endif
Bram Moolenaard38b0552012-04-25 19:07:41 +02001226 HiLink texBeginEnd texCmdName
1227 HiLink texBeginEndName texSection
Bram Moolenaar071d4272004-06-13 20:20:40 +00001228 HiLink texSpaceCode texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001229 HiLink texStyleStatement texStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +00001230 HiLink texTypeSize texType
1231 HiLink texTypeStyle texType
1232
1233 " Basic TeX highlighting groups
1234 HiLink texCmdArgs Number
1235 HiLink texCmdName Statement
1236 HiLink texComment Comment
1237 HiLink texDef Statement
1238 HiLink texDefParm Special
1239 HiLink texDelimiter Delimiter
1240 HiLink texInput Special
1241 HiLink texInputFile Special
1242 HiLink texLength Number
1243 HiLink texMath Special
1244 HiLink texMathDelim Statement
1245 HiLink texMathOper Operator
1246 HiLink texNewCmd Statement
1247 HiLink texNewEnv Statement
1248 HiLink texOption Number
Bram Moolenaard960d762011-09-21 19:22:10 +02001249 HiLink texRefZone Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001250 HiLink texSection PreCondit
1251 HiLink texSpaceCodeChar Special
1252 HiLink texSpecialChar SpecialChar
1253 HiLink texStatement Statement
1254 HiLink texString String
1255 HiLink texTodo Todo
1256 HiLink texType Type
1257 HiLink texZone PreCondit
1258
1259 delcommand HiLink
1260endif
1261
Bram Moolenaar15146672011-10-20 22:22:38 +02001262" Cleanup: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +01001263unlet s:extfname
Bram Moolenaar071d4272004-06-13 20:20:40 +00001264let b:current_syntax = "tex"
Bram Moolenaar15146672011-10-20 22:22:38 +02001265let &cpo = s:keepcpo
1266unlet s:keepcpo
Bram Moolenaare90ee312010-08-05 22:08:47 +02001267" vim: ts=8 fdm=marker