xref: /vim-8.2.3635/runtime/syntax/tex.vim (revision 61d35bd0)
1" Vim syntax file
2" Language:	TeX
3" Maintainer:	Dr. Charles E. Campbell, Jr. <[email protected]>
4" Last Change:	Jan 10, 2012
5" Version:	72
6" URL:		http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
7"
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
40let s:keepcpo= &cpo
41set cpo&vim
42scriptencoding utf-8
43
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
59" let user determine which classes of concealment will be supported
60"   a=accents/ligatures d=delimiters m=math symbols  g=Greek  s=superscripts/subscripts
61if !exists("g:tex_conceal")
62 let s:tex_conceal= 'admgs'
63else
64 let s:tex_conceal= g:tex_conceal
65endif
66
67" Determine whether or not to use "*.sty" mode {{{1
68" 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
72let s:extfname=expand("%:e")
73if exists("g:tex_stylish")
74 let b:tex_stylish= g:tex_stylish
75elseif !exists("b:tex_stylish")
76 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx"
77  let b:tex_stylish= 1
78 else
79  let b:tex_stylish= 0
80 endif
81endif
82
83" handle folding {{{1
84if !exists("g:tex_fold_enabled")
85 let g:tex_fold_enabled= 0
86elseif g:tex_fold_enabled && !has("folding")
87 let g:tex_fold_enabled= 0
88 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"
91 setl fdm=syntax
92endif
93
94" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1
95" but _ is the only one that causes problems.
96" One may override this iskeyword setting by providing
97" g:tex_isk
98if exists("g:tex_isk")
99 exe "setlocal isk=".g:tex_isk
100else
101 setlocal isk=48-57,a-z,A-Z,192-255
102endif
103if b:tex_stylish
104  setlocal isk+=@-@
105endif
106if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell")
107 let g:tex_comment_nospell= 1
108endif
109
110" Clusters: {{{1
111" --------
112syn cluster texCmdGroup		contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle
113if !exists("g:tex_no_error")
114 syn cluster texCmdGroup	add=texMathError
115endif
116syn cluster texEnvGroup		contains=texMatcher,texMathDelim,texSpecialChar,texStatement
117syn 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
118if !exists("g:tex_nospell") || !g:tex_nospell
119 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
120 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
121else
122 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
123 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
124endif
125syn cluster texRefGroup		contains=texMatcher,texComment,texDelimiter
126if !exists("tex_no_math")
127 syn cluster texMathZones	contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
128 syn cluster texMatchGroup	add=@texMathZones
129 syn cluster texMathDelimGroup	contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
130 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
131 syn cluster texMathZoneGroup	contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
132 if !exists("g:tex_no_error")
133  syn cluster texMathMatchGroup	add=texMathError
134  syn cluster texMathZoneGroup	add=texMathError
135 endif
136 syn cluster texMathZoneGroup add=@NoSpell
137 " following used in the \part \chapter \section \subsection \subsubsection
138 " \paragraph \subparagraph \author \title highlighting
139 syn cluster texDocGroup		contains=texPartZone,@texPartGroup
140 syn cluster texPartGroup		contains=texChapterZone,texSectionZone,texParaZone
141 syn cluster texChapterGroup		contains=texSectionZone,texParaZone
142 syn cluster texSectionGroup		contains=texSubSectionZone,texParaZone
143 syn cluster texSubSectionGroup		contains=texSubSubSectionZone,texParaZone
144 syn cluster texSubSubSectionGroup	contains=texParaZone
145 syn cluster texParaGroup		contains=texSubParaZone
146 if has("conceal") && &enc == 'utf-8'
147  syn cluster texMathZoneGroup	add=texGreek,texSuperscript,texSubscript,texMathSymbol
148  syn cluster texMathMatchGroup	add=texGreek,texSuperscript,texSubscript,texMathSymbol
149 endif
150endif
151
152" Try to flag {} and () mismatches: {{{1
153if !exists("g:tex_no_error")
154 syn region texMatcher		matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]"	end="}"		contains=@texMatchGroup,texError
155 syn region texMatcher		matchgroup=Delimiter start="\["				end="]"		contains=@texMatchGroup,texError
156else
157 syn region texMatcher		matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]"	end="}"		contains=@texMatchGroup
158 syn region texMatcher		matchgroup=Delimiter start="\["				end="]"		contains=@texMatchGroup
159endif
160if !exists("g:tex_nospell") || !g:tex_nospell
161 syn region texParen		start="("						end=")"		contains=@texMatchGroup,@Spell
162else
163 syn region texParen		start="("						end=")"		contains=@texMatchGroup
164endif
165if !exists("g:tex_no_error")
166 syn match  texError		"[}\])]"
167endif
168if !exists("tex_no_math")
169 if !exists("g:tex_no_error")
170  syn match  texMathError	"}"	contained
171 endif
172 syn region texMathMatcher	matchgroup=Delimiter	start="{"          skip="\\\\\|\\}"     end="}" end="%stopzone\>"	contained contains=@texMathMatchGroup
173" syn region texMathMatcher	matchgroup=Unique	start="[^\\]\zs{"  skip="\\\\\|\\[{}]"  end="}" end="%stopzone\>"	contained contains=@texMathMatchGroup
174endif
175
176" TeX/LaTeX keywords: {{{1
177" Instead of trying to be All Knowing, I just match \..alphameric..
178" Note that *.tex files may not have "@" in their \commands
179if exists("g:tex_tex") || b:tex_stylish
180  syn match texStatement	"\\[a-zA-Z@]\+"
181else
182  syn match texStatement	"\\\a\+"
183  if !exists("g:tex_no_error")
184   syn match texError		"\\\a*@[a-zA-Z@]*"
185  endif
186endif
187
188" TeX/LaTeX delimiters: {{{1
189syn match texDelimiter		"&"
190syn match texDelimiter		"\\\\"
191syn match texDelimiter		"[{}]"
192
193" Tex/Latex Options: {{{1
194syn match texOption	"[^\\]\zs#\d\+\|^#\d\+"
195
196" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
197if b:tex_stylish
198  syn match texAccent		"\\[bcdvuH][^a-zA-Z@]"me=e-1
199  syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
200else
201  syn match texAccent		"\\[bcdvuH]\A"me=e-1
202  syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
203endif
204syn match texAccent		"\\[bcdvuH]$"
205syn match texAccent		+\\[=^.\~"`']+
206syn match texAccent		+\\['=t'.c^ud"vb~Hr]{\a}+
207syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
208
209" \begin{}/\end{} section markers: {{{1
210syn match  texSectionMarker	"\\begin\>\|\\end\>" nextgroup=texSectionName
211syn region texSectionName	matchgroup=Delimiter start="{" end="}"  contained	nextgroup=texSectionModifier	contains=texComment
212syn region texSectionModifier	matchgroup=Delimiter start="\[" end="]" contained	contains=texComment
213
214" \documentclass, \documentstyle, \usepackage: {{{1
215syn match  texDocType		"\\documentclass\>\|\\documentstyle\>\|\\usepackage\>"	nextgroup=texSectionName,texDocTypeArgs
216syn region texDocTypeArgs	matchgroup=Delimiter start="\[" end="]"			contained	nextgroup=texSectionName	contains=texComment
217
218" Preamble syntax-based folding support: {{{1
219if g:tex_fold_enabled && has("folding")
220 syn region texPreamble	transparent fold	start='\zs\\documentclass\>' end='\ze\\begin{document}'	contains=texStyle,@texMatchGroup
221endif
222
223" TeX input: {{{1
224syn match texInput		"\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7				contains=texStatement
225syn match texInputFile		"\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}"	contains=texStatement,texInputCurlies,texInputFileOpt
226syn match texInputFile		"\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}"		contains=texStatement,texInputCurlies,texInputFileOpt
227syn match texInputCurlies	"[{}]"								contained
228syn region texInputFileOpt	matchgroup=Delimiter start="\[" end="\]"			contained	contains=texComment
229
230" Type Styles (LaTeX 2.09): {{{1
231syn match texTypeStyle		"\\rm\>"
232syn match texTypeStyle		"\\em\>"
233syn match texTypeStyle		"\\bf\>"
234syn match texTypeStyle		"\\it\>"
235syn match texTypeStyle		"\\sl\>"
236syn match texTypeStyle		"\\sf\>"
237syn match texTypeStyle		"\\sc\>"
238syn match texTypeStyle		"\\tt\>"
239
240" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
241syn match texTypeStyle		"\\textbf\>"
242syn match texTypeStyle		"\\textit\>"
243syn match texTypeStyle		"\\textmd\>"
244syn match texTypeStyle		"\\textrm\>"
245syn match texTypeStyle		"\\textsc\>"
246syn match texTypeStyle		"\\textsf\>"
247syn match texTypeStyle		"\\textsl\>"
248syn match texTypeStyle		"\\texttt\>"
249syn match texTypeStyle		"\\textup\>"
250syn match texTypeStyle		"\\emph\>"
251
252syn match texTypeStyle		"\\mathbb\>"
253syn match texTypeStyle		"\\mathbf\>"
254syn match texTypeStyle		"\\mathcal\>"
255syn match texTypeStyle		"\\mathfrak\>"
256syn match texTypeStyle		"\\mathit\>"
257syn match texTypeStyle		"\\mathnormal\>"
258syn match texTypeStyle		"\\mathrm\>"
259syn match texTypeStyle		"\\mathsf\>"
260syn match texTypeStyle		"\\mathtt\>"
261
262syn match texTypeStyle		"\\rmfamily\>"
263syn match texTypeStyle		"\\sffamily\>"
264syn match texTypeStyle		"\\ttfamily\>"
265
266syn match texTypeStyle		"\\itshape\>"
267syn match texTypeStyle		"\\scshape\>"
268syn match texTypeStyle		"\\slshape\>"
269syn match texTypeStyle		"\\upshape\>"
270
271syn match texTypeStyle		"\\bfseries\>"
272syn match texTypeStyle		"\\mdseries\>"
273
274" Some type sizes: {{{1
275syn match texTypeSize		"\\tiny\>"
276syn match texTypeSize		"\\scriptsize\>"
277syn match texTypeSize		"\\footnotesize\>"
278syn match texTypeSize		"\\small\>"
279syn match texTypeSize		"\\normalsize\>"
280syn match texTypeSize		"\\large\>"
281syn match texTypeSize		"\\Large\>"
282syn match texTypeSize		"\\LARGE\>"
283syn match texTypeSize		"\\huge\>"
284syn match texTypeSize		"\\Huge\>"
285
286" Spacecodes (TeX'isms): {{{1
287" \mathcode`\^^@="2201  \delcode`\(="028300  \sfcode`\)=0 \uccode`X=`X  \lccode`x=`x
288syn match texSpaceCode		"\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
289syn match texSpaceCodeChar    "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)"	contained
290
291" Sections, subsections, etc: {{{1
292if !exists("g:tex_nospell") || !g:tex_nospell
293 if g:tex_fold_enabled && has("folding")
294  syn region texDocZone			matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}'											fold contains=@texFoldGroup,@texDocGroup,@Spell
295  syn region texPartZone		matchgroup=texSection start='\\part\>'			 end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)'								fold contains=@texFoldGroup,@texPartGroup,@Spell
296  syn region texChapterZone		matchgroup=texSection start='\\chapter\>'		 end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)'							fold contains=@texFoldGroup,@texChapterGroup,@Spell
297  syn region texSectionZone		matchgroup=texSection start='\\section\>'		 end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'					fold contains=@texFoldGroup,@texSectionGroup,@Spell
298  syn region texSubSectionZone		matchgroup=texSection start='\\subsection\>'		 end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
299  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
300  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
301  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
302  syn region texTitle			matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}'													fold contains=@texFoldGroup,@Spell
303  syn region texAbstract		matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}'											fold contains=@texFoldGroup,@Spell
304 else
305  syn region texDocZone			matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}'											contains=@texFoldGroup,@texDocGroup,@Spell
306  syn region texPartZone		matchgroup=texSection start='\\part\>'			 end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)'								contains=@texFoldGroup,@texPartGroup,@Spell
307  syn region texChapterZone		matchgroup=texSection start='\\chapter\>'		 end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)'							contains=@texFoldGroup,@texChapterGroup,@Spell
308  syn region texSectionZone		matchgroup=texSection start='\\section\>'		 end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'					contains=@texFoldGroup,@texSectionGroup,@Spell
309  syn region texSubSectionZone		matchgroup=texSection start='\\subsection\>'		 end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				contains=@texFoldGroup,@texSubSectionGroup,@Spell
310  syn region texSubSubSectionZone	matchgroup=texSection start='\\subsubsection\>'		 end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
311  syn region texParaZone		matchgroup=texSection start='\\paragraph\>'		 end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'			contains=@texFoldGroup,@texParaGroup,@Spell
312  syn region texSubParaZone		matchgroup=texSection start='\\subparagraph\>'		 end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'	contains=@texFoldGroup,@Spell
313  syn region texTitle			matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}'													contains=@texFoldGroup,@Spell
314  syn region texAbstract		matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}'											contains=@texFoldGroup,@Spell
315 endif
316else
317 if g:tex_fold_enabled && has("folding")
318  syn region texDocZone			matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}'											fold contains=@texFoldGroup,@texDocGroup
319  syn region texPartZone		matchgroup=texSection start='\\part\>'			 end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)'								fold contains=@texFoldGroup,@texPartGroup
320  syn region texChapterZone		matchgroup=texSection start='\\chapter\>'		 end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)'							fold contains=@texFoldGroup,@texChapterGroup
321  syn region texSectionZone		matchgroup=texSection start='\\section\>'		 end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'					fold contains=@texFoldGroup,@texSectionGroup
322  syn region texSubSectionZone		matchgroup=texSection start='\\subsection\>'		 end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				fold contains=@texFoldGroup,@texSubSectionGroup
323  syn region texSubSubSectionZone	matchgroup=texSection start='\\subsubsection\>'		 end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				fold contains=@texFoldGroup,@texSubSubSectionGroup
324  syn region texParaZone		matchgroup=texSection start='\\paragraph\>'		 end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'			fold contains=@texFoldGroup,@texParaGroup
325  syn region texSubParaZone		matchgroup=texSection start='\\subparagraph\>'		 end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'	fold contains=@texFoldGroup
326  syn region texTitle			matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}'													fold contains=@texFoldGroup
327  syn region texAbstract		matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}'											fold contains=@texFoldGroup
328 else
329  syn region texDocZone			matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}'											contains=@texFoldGroup,@texDocGroup
330  syn region texPartZone		matchgroup=texSection start='\\part\>'			 end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)'								contains=@texFoldGroup,@texPartGroup
331  syn region texChapterZone		matchgroup=texSection start='\\chapter\>'		 end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)'							contains=@texFoldGroup,@texChapterGroup
332  syn region texSectionZone		matchgroup=texSection start='\\section\>'		 end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'					contains=@texFoldGroup,@texSectionGroup
333  syn region texSubSectionZone		matchgroup=texSection start='\\subsection\>'		 end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				contains=@texFoldGroup,@texSubSectionGroup
334  syn region texSubSubSectionZone	matchgroup=texSection start='\\subsubsection\>'		 end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'				contains=@texFoldGroup,@texSubSubSectionGroup
335  syn region texParaZone		matchgroup=texSection start='\\paragraph\>'		 end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'			contains=@texFoldGroup,@texParaGroup
336  syn region texSubParaZone		matchgroup=texSection start='\\subparagraph\>'		 end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)'	contains=@texFoldGroup
337  syn region texTitle			matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}'													contains=@texFoldGroup
338  syn region texAbstract		matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}'											contains=@texFoldGroup
339 endif
340endif
341
342" Bad Math (mismatched): {{{1
343if !exists("tex_no_math")
344 syn match texBadMath		"\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
345 syn match texBadMath		"\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
346 syn match texBadMath		"\\[\])]"
347endif
348
349" Math Zones: {{{1
350if !exists("tex_no_math")
351 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
352 "                 Starred forms are created if starform is true.  Starred
353 "                 forms have syntax group and synchronization groups with a
354 "                 "S" appended.  Handles: cluster, syntax, sync, and HiLink.
355 fun! TexNewMathZone(sfx,mathzone,starform)
356   let grpname  = "texMathZone".a:sfx
357   let syncname = "texSyncMathZone".a:sfx
358   if g:tex_fold_enabled
359    let foldcmd= " fold"
360   else
361    let foldcmd= ""
362   endif
363   exe "syn cluster texMathZones add=".grpname
364   exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
365   exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
366   exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
367   exe 'hi def link '.grpname.' texMath'
368   if a:starform
369    let grpname  = "texMathZone".a:sfx.'S'
370    let syncname = "texSyncMathZone".a:sfx.'S'
371    exe "syn cluster texMathZones add=".grpname
372    exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
373    exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
374    exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
375    exe 'hi def link '.grpname.' texMath'
376   endif
377 endfun
378
379 " Standard Math Zones: {{{2
380 call TexNewMathZone("A","align",1)
381 call TexNewMathZone("B","alignat",1)
382 call TexNewMathZone("C","displaymath",1)
383 call TexNewMathZone("D","eqnarray",1)
384 call TexNewMathZone("E","equation",1)
385 call TexNewMathZone("F","flalign",1)
386 call TexNewMathZone("G","gather",1)
387 call TexNewMathZone("H","math",1)
388 call TexNewMathZone("I","multline",1)
389 call TexNewMathZone("J","subequations",0)
390 call TexNewMathZone("K","xalignat",1)
391 call TexNewMathZone("L","xxalignat",0)
392
393 " Inline Math Zones: {{{2
394 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
395  syn region texMathZoneV	matchgroup=Delimiter start="\\("			matchgroup=Delimiter end="\\)\|%stopzone\>"	keepend concealends contains=@texMathZoneGroup
396  syn region texMathZoneW	matchgroup=Delimiter start="\\\["			matchgroup=Delimiter end="\\]\|%stopzone\>"	keepend concealends contains=@texMathZoneGroup
397  syn region texMathZoneX	matchgroup=Delimiter start="\$" skip="\\\\\|\\\$"	matchgroup=Delimiter end="\$" end="%stopzone\>"		concealends contains=@texMathZoneGroup
398  syn region texMathZoneY	matchgroup=Delimiter start="\$\$" 			matchgroup=Delimiter end="\$\$" end="%stopzone\>"	concealends keepend		contains=@texMathZoneGroup
399 else
400  syn region texMathZoneV	matchgroup=Delimiter start="\\("			matchgroup=Delimiter end="\\)\|%stopzone\>"	keepend contains=@texMathZoneGroup
401  syn region texMathZoneW	matchgroup=Delimiter start="\\\["			matchgroup=Delimiter end="\\]\|%stopzone\>"	keepend contains=@texMathZoneGroup
402  syn region texMathZoneX	matchgroup=Delimiter start="\$" skip="\\\\\|\\\$"	matchgroup=Delimiter end="\$" end="%stopzone\>"	contains=@texMathZoneGroup
403  syn region texMathZoneY	matchgroup=Delimiter start="\$\$" 			matchgroup=Delimiter end="\$\$" end="%stopzone\>"	keepend		contains=@texMathZoneGroup
404 endif
405 syn region texMathZoneZ	matchgroup=texStatement start="\\ensuremath\s*{"	matchgroup=texStatement end="}" end="%stopzone\>"	contains=@texMathZoneGroup
406
407 syn match texMathOper		"[_^=]" contained
408
409 " Text Inside Math Zones: {{{2
410 if !exists("g:tex_nospell") || !g:tex_nospell
411  syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{'	end='}'	contains=@texFoldGroup,@Spell
412 else
413  syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{'	end='}'	contains=@texFoldGroup
414 endif
415
416 " \left..something.. and \right..something.. support: {{{2
417 syn match   texMathDelimBad	contained		"\S"
418 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
419  syn match   texMathDelim	contained		"\\left\\{\>"	skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
420  syn match   texMathDelim	contained		"\\right\\}\>"	skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
421  let s:texMathDelimList=[
422     \ ['<'            , '<'] ,
423     \ ['>'            , '>'] ,
424     \ ['('            , '('] ,
425     \ [')'            , ')'] ,
426     \ ['\['           , '['] ,
427     \ [']'            , ']'] ,
428     \ ['\\{'          , '{'] ,
429     \ ['\\}'          , '}'] ,
430     \ ['|'            , '|'] ,
431     \ ['\\|'          , '‖'] ,
432     \ ['\\backslash'  , '\'] ,
433     \ ['\\downarrow'  , '↓'] ,
434     \ ['\\Downarrow'  , '⇓'] ,
435     \ ['\\langle'     , '<'] ,
436     \ ['\\lbrace'     , '['] ,
437     \ ['\\lceil'      , '⌈'] ,
438     \ ['\\lfloor'     , '⌊'] ,
439     \ ['\\lgroup'     , '⌊'] ,
440     \ ['\\lmoustache' , '⎛'] ,
441     \ ['\\rangle'     , '>'] ,
442     \ ['\\rbrace'     , ']'] ,
443     \ ['\\rceil'      , '⌉'] ,
444     \ ['\\rfloor'     , '⌋'] ,
445     \ ['\\rgroup'     , '⌋'] ,
446     \ ['\\rmoustache' , '⎞'] ,
447     \ ['\\uparrow'    , '↑'] ,
448     \ ['\\Uparrow'    , '↑'] ,
449     \ ['\\updownarrow', '↕'] ,
450     \ ['\\Updownarrow', '⇕']]
451  syn match texMathDelim	'\\[bB]igg\=[lr]' contained nextgroup=texMathDelimBad
452  for texmath in s:texMathDelimList
453   exe "syn match texMathDelim	'\\\\[bB]igg\\=[lr]\\=".texmath[0]."'	contained conceal cchar=".texmath[1]
454  endfor
455
456 else
457  syn match   texMathDelim	contained		"\\\(left\|right\)\>"	skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
458  syn match   texMathDelim	contained		"\\[bB]igg\=[lr]\=\>"	skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
459  syn match   texMathDelimSet2	contained	"\\"		nextgroup=texMathDelimKey,texMathDelimBad
460  syn match   texMathDelimSet1	contained	"[<>()[\]|/.]\|\\[{}|]"
461  syn keyword texMathDelimKey	contained	backslash       lceil           lVert           rgroup          uparrow
462  syn keyword texMathDelimKey	contained	downarrow       lfloor          rangle          rmoustache      Uparrow
463  syn keyword texMathDelimKey	contained	Downarrow       lgroup          rbrace          rvert           updownarrow
464  syn keyword texMathDelimKey	contained	langle          lmoustache      rceil           rVert           Updownarrow
465  syn keyword texMathDelimKey	contained	lbrace          lvert           rfloor
466 endif
467 syn match   texMathDelim	contained		"\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
468 syn match   texMathDelim	contained		"\\lefteqn\>"
469endif
470
471" Special TeX characters  ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
472syn match texSpecialChar	"\\[$&%#{}_]"
473if b:tex_stylish
474  syn match texSpecialChar	"\\[SP@][^a-zA-Z@]"me=e-1
475else
476  syn match texSpecialChar	"\\[SP@]\A"me=e-1
477endif
478syn match texSpecialChar	"\\\\"
479if !exists("tex_no_math")
480 syn match texOnlyMath		"[_^]"
481endif
482syn match texSpecialChar	"\^\^[0-9a-f]\{2}\|\^\^\S"
483
484" Comments: {{{1
485"    Normal TeX LaTeX     :   %....
486"    Documented TeX Format:  ^^A...	-and-	leading %s (only)
487if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
488 syn cluster texCommentGroup	contains=texTodo,@Spell
489else
490 syn cluster texCommentGroup	contains=texTodo,@NoSpell
491endif
492syn case ignore
493syn keyword texTodo		contained		combak	fixme	todo	xxx
494syn case match
495if s:extfname == "dtx"
496  syn match texComment		"\^\^A.*$"	contains=@texCommentGroup
497  syn match texComment		"^%\+"		contains=@texCommentGroup
498else
499  if g:tex_fold_enabled
500   " allows syntax-folding of 2 or more contiguous comment lines
501   " single-line comments are not folded
502   syn match  texComment	"%.*$"		contains=@texCommentGroup
503   syn region texComment	start="^\zs\s*%.*\_s*%"	skip="^\s*%"	end='^\ze\s*[^%]' fold
504  else
505   syn match texComment		"%.*$"		contains=@texCommentGroup
506  endif
507endif
508
509" Separate lines used for verb` and verb# so that the end conditions {{{1
510" will appropriately terminate.
511" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
512if exists("g:tex_verbspell") && g:tex_verbspell
513 syn region texZone		start="\\begin{[vV]erbatim}"		end="\\end{[vV]erbatim}\|%stopzone\>"	contains=@Spell
514 " listings package:
515 syn region texZone		start="\\begin{lstlisting}"		end="\\end{lstlisting}\|%stopzone\>"	contains=@Spell
516 " moreverb package:
517 syn region texZone		start="\\begin{verbatimtab}"		end="\\end{verbatimtab}\|%stopzone\>"	contains=@Spell
518 syn region texZone		start="\\begin{verbatimwrite}"		end="\\end{verbatimwrite}\|%stopzone\>"	contains=@Spell
519 syn region texZone		start="\\begin{boxedverbatim}"		end="\\end{boxedverbatim}\|%stopzone\>"	contains=@Spell
520 if version < 600
521  syn region texZone		start="\\verb\*\=`"			end="`\|%stopzone\>"			contains=@Spell
522  syn region texZone		start="\\verb\*\=#"			end="#\|%stopzone\>"			contains=@Spell
523 else
524   if b:tex_stylish
525    syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z@]\)"	end="\z1\|%stopzone\>"			contains=@Spell
526   else
527    syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z]\)"	end="\z1\|%stopzone\>"			contains=@Spell
528   endif
529 endif
530else
531 syn region texZone		start="\\begin{[vV]erbatim}"		end="\\end{[vV]erbatim}\|%stopzone\>"
532 " listings package:
533 syn region texZone		start="\\begin{lstlisting}"		end="\\end{lstlisting}\|%stopzone\>"
534 " moreverb package:
535 syn region texZone		start="\\begin{verbatimtab}"		end="\\end{verbatimtab}\|%stopzone\>"
536 syn region texZone		start="\\begin{verbatimwrite}"		end="\\end{verbatimwrite}\|%stopzone\>"
537 syn region texZone		start="\\begin{boxedverbatim}"		end="\\end{boxedverbatim}\|%stopzone\>"
538 if version < 600
539  syn region texZone		start="\\verb\*\=`"			end="`\|%stopzone\>"
540  syn region texZone		start="\\verb\*\=#"			end="#\|%stopzone\>"
541 else
542   if b:tex_stylish
543     syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z@]\)"	end="\z1\|%stopzone\>"
544   else
545     syn region texZone		start="\\verb\*\=\z([^\ta-zA-Z]\)"	end="\z1\|%stopzone\>"
546   endif
547 endif
548endif
549
550" Tex Reference Zones: {{{1
551syn region texZone		matchgroup=texStatement start="@samp{"			end="}\|%stopzone\>"	contains=@texRefGroup
552syn region texRefZone		matchgroup=texStatement start="\\nocite{"		end="}\|%stopzone\>"	contains=@texRefGroup
553syn region texRefZone		matchgroup=texStatement start="\\bibliography{"		end="}\|%stopzone\>"	contains=@texRefGroup
554syn region texRefZone		matchgroup=texStatement start="\\label{"		end="}\|%stopzone\>"	contains=@texRefGroup
555syn region texRefZone		matchgroup=texStatement start="\\\(page\|eq\)ref{"	end="}\|%stopzone\>"	contains=@texRefGroup
556syn region texRefZone		matchgroup=texStatement start="\\v\=ref{"		end="}\|%stopzone\>"	contains=@texRefGroup
557syn match  texRefZone		'\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
558syn region texRefOption	contained	matchgroup=Delimiter start='\[' end=']'		contains=@texRefGroup,texRefZone	nextgroup=texRefOption,texCite
559syn region texCite	contained	matchgroup=Delimiter start='{' end='}'		contains=@texRefGroup,texRefZone,texCite
560
561" Handle newcommand, newenvironment : {{{1
562syn match  texNewCmd				"\\newcommand\>"			nextgroup=texCmdName skipwhite skipnl
563syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
564syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]"		nextgroup=texCmdBody skipwhite skipnl
565syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]"	matchgroup=Delimiter end="}" contains=@texCmdGroup
566syn match  texNewEnv				"\\newenvironment\>"			nextgroup=texEnvName skipwhite skipnl
567syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texEnvBgn skipwhite skipnl
568syn region texEnvBgn  contained matchgroup=Delimiter start="{"rs=s+1  end="}"		nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
569syn region texEnvEnd  contained matchgroup=Delimiter start="{"rs=s+1  end="}"		skipwhite skipnl contains=@texEnvGroup
570
571" Definitions/Commands: {{{1
572syn match texDefCmd				"\\def\>"				nextgroup=texDefName skipwhite skipnl
573if b:tex_stylish
574  syn match texDefName contained		"\\[a-zA-Z@]\+"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
575  syn match texDefName contained		"\\[^a-zA-Z@]"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
576else
577  syn match texDefName contained		"\\\a\+"				nextgroup=texDefParms,texCmdBody skipwhite skipnl
578  syn match texDefName contained		"\\\A"					nextgroup=texDefParms,texCmdBody skipwhite skipnl
579endif
580syn match texDefParms  contained		"#[^{]*"	contains=texDefParm	nextgroup=texCmdBody skipwhite skipnl
581syn match  texDefParm  contained		"#\d\+"
582
583" TeX Lengths: {{{1
584syn match  texLength		"\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>"
585
586" TeX String Delimiters: {{{1
587syn match texString		"\(``\|''\|,,\)"
588
589" makeatletter -- makeatother sections
590if !exists("g:tex_no_error")
591 syn region texStyle			matchgroup=texStatement start='\\makeatletter' end='\\makeatother'	contains=@texStyleGroup contained
592 syn match  texStyleStatement		"\\[a-zA-Z@]\+"	contained
593 syn region texStyleMatcher		matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]"	end="}"		contains=@texStyleGroup,texError	contained
594 syn region texStyleMatcher		matchgroup=Delimiter start="\["				end="]"		contains=@texStyleGroup,texError	contained
595endif
596
597" Conceal mode support (supports set cole=2) {{{1
598if has("conceal") && &enc == 'utf-8'
599
600 " Math Symbols {{{2
601 " (many of these symbols were contributed by Björn Winckler)
602 if s:tex_conceal =~ 'm'
603  let s:texMathList=[
604    \ ['|'		, '‖'],
605    \ ['aleph'		, 'ℵ'],
606    \ ['amalg'		, '∐'],
607    \ ['angle'		, '∠'],
608    \ ['approx'		, '≈'],
609    \ ['ast'		, '∗'],
610    \ ['asymp'		, '≍'],
611    \ ['backepsilon'	, '∍'],
612    \ ['backsimeq'	, '≃'],
613    \ ['backslash'	, '∖'],
614    \ ['barwedge'	, '⊼'],
615    \ ['because'	, '∵'],
616    \ ['between'	, '≬'],
617    \ ['bigcap'		, '∩'],
618    \ ['bigcirc'	, '○'],
619    \ ['bigcup'		, '∪'],
620    \ ['bigodot'	, '⊙'],
621    \ ['bigoplus'	, '⊕'],
622    \ ['bigotimes'	, '⊗'],
623    \ ['bigsqcup'	, '⊔'],
624    \ ['bigtriangledown', '∇'],
625    \ ['bigtriangleup'	, '∆'],
626    \ ['bigvee'		, '⋁'],
627    \ ['bigwedge'	, '⋀'],
628    \ ['blacksquare'	, '∎'],
629    \ ['bot'		, '⊥'],
630    \ ['bowtie'	        , '⋈'],
631    \ ['boxdot'		, '⊡'],
632    \ ['boxminus'	, '⊟'],
633    \ ['boxplus'	, '⊞'],
634    \ ['boxtimes'	, '⊠'],
635    \ ['bullet'	        , '•'],
636    \ ['bumpeq'		, '≏'],
637    \ ['Bumpeq'		, '≎'],
638    \ ['cap'		, '∩'],
639    \ ['Cap'		, '⋒'],
640    \ ['cdot'		, '·'],
641    \ ['cdots'		, '⋯'],
642    \ ['circ'		, '∘'],
643    \ ['circeq'		, '≗'],
644    \ ['circlearrowleft', '↺'],
645    \ ['circlearrowright', '↻'],
646    \ ['circledast'	, '⊛'],
647    \ ['circledcirc'	, '⊚'],
648    \ ['clubsuit'	, '♣'],
649    \ ['complement'	, '∁'],
650    \ ['cong'		, '≅'],
651    \ ['coprod'		, '∐'],
652    \ ['copyright'	, '©'],
653    \ ['cup'		, '∪'],
654    \ ['Cup'		, '⋓'],
655    \ ['curlyeqprec'	, '⋞'],
656    \ ['curlyeqsucc'	, '⋟'],
657    \ ['curlyvee'	, '⋎'],
658    \ ['curlywedge'	, '⋏'],
659    \ ['dagger'	        , '†'],
660    \ ['dashv'		, '⊣'],
661    \ ['ddagger'	, '‡'],
662    \ ['ddots'	        , '⋱'],
663    \ ['diamond'	, '⋄'],
664    \ ['diamondsuit'	, '♢'],
665    \ ['div'		, '÷'],
666    \ ['doteq'		, '≐'],
667    \ ['doteqdot'	, '≑'],
668    \ ['dotplus'	, '∔'],
669    \ ['dots'		, '…'],
670    \ ['dotsb'		, '⋯'],
671    \ ['dotsc'		, '…'],
672    \ ['dotsi'		, '⋯'],
673    \ ['dotso'		, '…'],
674    \ ['doublebarwedge'	, '⩞'],
675    \ ['downarrow'	, '↓'],
676    \ ['Downarrow'	, '⇓'],
677    \ ['ell'		, 'ℓ'],
678    \ ['emptyset'	, '∅'],
679    \ ['eqcirc'		, '≖'],
680    \ ['eqsim'		, '≂'],
681    \ ['eqslantgtr'	, '⪖'],
682    \ ['eqslantless'	, '⪕'],
683    \ ['equiv'		, '≡'],
684    \ ['exists'		, '∃'],
685    \ ['fallingdotseq'	, '≒'],
686    \ ['flat'		, '♭'],
687    \ ['forall'		, '∀'],
688    \ ['frown'		, '⁔'],
689    \ ['ge'		, '≥'],
690    \ ['geq'		, '≥'],
691    \ ['geqq'		, '≧'],
692    \ ['gets'		, '←'],
693    \ ['gg'		, '⟫'],
694    \ ['gneqq'		, '≩'],
695    \ ['gtrdot'		, '⋗'],
696    \ ['gtreqless'	, '⋛'],
697    \ ['gtrless'	, '≷'],
698    \ ['gtrsim'		, '≳'],
699    \ ['hbar'		, 'ℏ'],
700    \ ['heartsuit'	, '♡'],
701    \ ['hookleftarrow'	, '↩'],
702    \ ['hookrightarrow'	, '↪'],
703    \ ['iiint'		, '∭'],
704    \ ['iint'		, '∬'],
705    \ ['Im'		, 'ℑ'],
706    \ ['imath'		, 'ɩ'],
707    \ ['in'		, '∈'],
708    \ ['infty'		, '∞'],
709    \ ['int'		, '∫'],
710    \ ['lceil'		, '⌈'],
711    \ ['ldots'		, '…'],
712    \ ['le'		, '≤'],
713    \ ['leadsto'	, '↝'],
714    \ ['left('		, '('],
715    \ ['left\['		, '['],
716    \ ['left\\{'	, '{'],
717    \ ['leftarrow'	, '⟵'],
718    \ ['Leftarrow'	, '⟸'],
719    \ ['leftarrowtail'	, '↢'],
720    \ ['leftharpoondown', '↽'],
721    \ ['leftharpoonup'	, '↼'],
722    \ ['leftrightarrow'	, '⇔'],
723    \ ['Leftrightarrow'	, '⇔'],
724    \ ['leftrightsquigarrow', '↭'],
725    \ ['leftthreetimes'	, '⋋'],
726    \ ['leq'		, '≤'],
727    \ ['leq'		, '≤'],
728    \ ['leqq'		, '≦'],
729    \ ['lessdot'	, '⋖'],
730    \ ['lesseqgtr'	, '⋚'],
731    \ ['lesssim'	, '≲'],
732    \ ['lfloor'		, '⌊'],
733    \ ['ll'		, '≪'],
734    \ ['lmoustache'     , '╭'],
735    \ ['lneqq'		, '≨'],
736    \ ['ltimes'		, '⋉'],
737    \ ['mapsto'		, '↦'],
738    \ ['measuredangle'	, '∡'],
739    \ ['mid'		, '∣'],
740    \ ['models'		, '╞'],
741    \ ['mp'		, '∓'],
742    \ ['nabla'		, '∇'],
743    \ ['natural'	, '♮'],
744    \ ['ncong'		, '≇'],
745    \ ['ne'		, '≠'],
746    \ ['nearrow'	, '↗'],
747    \ ['neg'		, '¬'],
748    \ ['neq'		, '≠'],
749    \ ['nexists'	, '∄'],
750    \ ['ngeq'		, '≱'],
751    \ ['ngeqq'		, '≱'],
752    \ ['ngtr'		, '≯'],
753    \ ['ni'		, '∋'],
754    \ ['nleftarrow'	, '↚'],
755    \ ['nLeftarrow'	, '⇍'],
756    \ ['nLeftrightarrow', '⇎'],
757    \ ['nleq'		, '≰'],
758    \ ['nleqq'		, '≰'],
759    \ ['nless'		, '≮'],
760    \ ['nmid'		, '∤'],
761    \ ['notin'		, '∉'],
762    \ ['nprec'		, '⊀'],
763    \ ['nrightarrow'	, '↛'],
764    \ ['nRightarrow'	, '⇏'],
765    \ ['nsim'		, '≁'],
766    \ ['nsucc'		, '⊁'],
767    \ ['ntriangleleft'	, '⋪'],
768    \ ['ntrianglelefteq', '⋬'],
769    \ ['ntriangleright'	, '⋫'],
770    \ ['ntrianglerighteq', '⋭'],
771    \ ['nvdash'		, '⊬'],
772    \ ['nvDash'		, '⊭'],
773    \ ['nVdash'		, '⊮'],
774    \ ['nwarrow'	, '↖'],
775    \ ['odot'		, '⊙'],
776    \ ['oint'		, '∮'],
777    \ ['ominus'		, '⊖'],
778    \ ['oplus'		, '⊕'],
779    \ ['oslash'		, '⊘'],
780    \ ['otimes'		, '⊗'],
781    \ ['owns'		, '∋'],
782    \ ['P'	        , '¶'],
783    \ ['parallel'	, '║'],
784    \ ['partial'	, '∂'],
785    \ ['perp'		, '⊥'],
786    \ ['pitchfork'	, '⋔'],
787    \ ['pm'		, '±'],
788    \ ['prec'		, '≺'],
789    \ ['precapprox'	, '⪷'],
790    \ ['preccurlyeq'	, '≼'],
791    \ ['preceq'		, '⪯'],
792    \ ['precnapprox'	, '⪹'],
793    \ ['precneqq'	, '⪵'],
794    \ ['precsim'	, '≾'],
795    \ ['prime'		, '′'],
796    \ ['prod'		, '∏'],
797    \ ['propto'		, '∝'],
798    \ ['rceil'		, '⌉'],
799    \ ['Re'		, 'ℜ'],
800    \ ['rfloor'		, '⌋'],
801    \ ['right)'		, ')'],
802    \ ['right]'		, ']'],
803    \ ['right\\}'	, '}'],
804    \ ['rightarrow'	, '⟶'],
805    \ ['Rightarrow'	, '⟹'],
806    \ ['rightarrowtail'	, '↣'],
807    \ ['rightleftharpoons', '⇌'],
808    \ ['rightsquigarrow', '↝'],
809    \ ['rightthreetimes', '⋌'],
810    \ ['risingdotseq'	, '≓'],
811    \ ['rmoustache'     , '╮'],
812    \ ['rtimes'		, '⋊'],
813    \ ['S'	        , '§'],
814    \ ['searrow'	, '↘'],
815    \ ['setminus'	, '∖'],
816    \ ['sharp'		, '♯'],
817    \ ['sim'		, '∼'],
818    \ ['simeq'		, '⋍'],
819    \ ['smile'		, '‿'],
820    \ ['spadesuit'	, '♠'],
821    \ ['sphericalangle'	, '∢'],
822    \ ['sqcap'		, '⊓'],
823    \ ['sqcup'		, '⊔'],
824    \ ['sqsubset'	, '⊏'],
825    \ ['sqsubseteq'	, '⊑'],
826    \ ['sqsupset'	, '⊐'],
827    \ ['sqsupseteq'	, '⊒'],
828    \ ['star'		, '✫'],
829    \ ['subset'		, '⊂'],
830    \ ['Subset'		, '⋐'],
831    \ ['subseteq'	, '⊆'],
832    \ ['subseteqq'	, '⫅'],
833    \ ['subsetneq'	, '⊊'],
834    \ ['subsetneqq'	, '⫋'],
835    \ ['succ'		, '≻'],
836    \ ['succapprox'	, '⪸'],
837    \ ['succcurlyeq'	, '≽'],
838    \ ['succeq'		, '⪰'],
839    \ ['succnapprox'	, '⪺'],
840    \ ['succneqq'	, '⪶'],
841    \ ['succsim'	, '≿'],
842    \ ['sum'		, '∑'],
843    \ ['supset'		, '⊃'],
844    \ ['Supset'		, '⋑'],
845    \ ['supseteq'	, '⊇'],
846    \ ['supseteqq'	, '⫆'],
847    \ ['supsetneq'	, '⊋'],
848    \ ['supsetneqq'	, '⫌'],
849    \ ['surd'		, '√'],
850    \ ['swarrow'	, '↙'],
851    \ ['therefore'	, '∴'],
852    \ ['times'		, '×'],
853    \ ['to'		, '→'],
854    \ ['top'		, '⊤'],
855    \ ['triangle'	, '∆'],
856    \ ['triangleleft'	, '⊲'],
857    \ ['trianglelefteq'	, '⊴'],
858    \ ['triangleq'	, '≜'],
859    \ ['triangleright'	, '⊳'],
860    \ ['trianglerighteq', '⊵'],
861    \ ['twoheadleftarrow', '↞'],
862    \ ['twoheadrightarrow', '↠'],
863    \ ['uparrow'	, '↑'],
864    \ ['Uparrow'	, '⇑'],
865    \ ['updownarrow'	, '↕'],
866    \ ['Updownarrow'	, '⇕'],
867    \ ['varnothing'	, '∅'],
868    \ ['vartriangle'	, '∆'],
869    \ ['vdash'		, '⊢'],
870    \ ['vDash'		, '⊨'],
871    \ ['Vdash'		, '⊩'],
872    \ ['vdots'		, '⋮'],
873    \ ['vee'		, '∨'],
874    \ ['veebar'		, '⊻'],
875    \ ['Vvdash'		, '⊪'],
876    \ ['wedge'		, '∧'],
877    \ ['wp'		, '℘'],
878    \ ['wr'		, '≀']]
879"    \ ['jmath'		, 'X']
880"    \ ['uminus'	, 'X']
881"    \ ['uplus'		, 'X']
882  for texmath in s:texMathList
883   if texmath[0] =~ '\w$'
884    exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
885   else
886    exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
887   endif
888  endfor
889
890  if &ambw == "double"
891   syn match texMathSymbol '\\gg\>'			contained conceal cchar=≫
892   syn match texMathSymbol '\\ll\>'			contained conceal cchar=≪
893  else
894   syn match texMathSymbol '\\gg\>'			contained conceal cchar=⟫
895   syn match texMathSymbol '\\ll\>'			contained conceal cchar=⟪
896  endif
897
898  syn match texMathSymbol '\\hat{a}' contained conceal cchar=â
899  syn match texMathSymbol '\\hat{A}' contained conceal cchar=Â
900  syn match texMathSymbol '\\hat{c}' contained conceal cchar=ĉ
901  syn match texMathSymbol '\\hat{C}' contained conceal cchar=Ĉ
902  syn match texMathSymbol '\\hat{e}' contained conceal cchar=ê
903  syn match texMathSymbol '\\hat{E}' contained conceal cchar=Ê
904  syn match texMathSymbol '\\hat{g}' contained conceal cchar=ĝ
905  syn match texMathSymbol '\\hat{G}' contained conceal cchar=Ĝ
906  syn match texMathSymbol '\\hat{i}' contained conceal cchar=î
907  syn match texMathSymbol '\\hat{I}' contained conceal cchar=Î
908  syn match texMathSymbol '\\hat{o}' contained conceal cchar=ô
909  syn match texMathSymbol '\\hat{O}' contained conceal cchar=Ô
910  syn match texMathSymbol '\\hat{s}' contained conceal cchar=ŝ
911  syn match texMathSymbol '\\hat{S}' contained conceal cchar=Ŝ
912  syn match texMathSymbol '\\hat{u}' contained conceal cchar=û
913  syn match texMathSymbol '\\hat{U}' contained conceal cchar=Û
914  syn match texMathSymbol '\\hat{w}' contained conceal cchar=ŵ
915  syn match texMathSymbol '\\hat{W}' contained conceal cchar=Ŵ
916  syn match texMathSymbol '\\hat{y}' contained conceal cchar=ŷ
917  syn match texMathSymbol '\\hat{Y}' contained conceal cchar=Ŷ
918 endif
919
920 " Greek {{{2
921 if s:tex_conceal =~ 'g'
922  fun! s:Greek(group,pat,cchar)
923    exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
924  endfun
925  call s:Greek('texGreek','\\alpha\>'		,'α')
926  call s:Greek('texGreek','\\beta\>'		,'β')
927  call s:Greek('texGreek','\\gamma\>'		,'γ')
928  call s:Greek('texGreek','\\delta\>'		,'δ')
929  call s:Greek('texGreek','\\epsilon\>'		,'ϵ')
930  call s:Greek('texGreek','\\varepsilon\>'	,'ε')
931  call s:Greek('texGreek','\\zeta\>'		,'ζ')
932  call s:Greek('texGreek','\\eta\>'		,'η')
933  call s:Greek('texGreek','\\theta\>'		,'θ')
934  call s:Greek('texGreek','\\vartheta\>'		,'ϑ')
935  call s:Greek('texGreek','\\kappa\>'		,'κ')
936  call s:Greek('texGreek','\\lambda\>'		,'λ')
937  call s:Greek('texGreek','\\mu\>'		,'μ')
938  call s:Greek('texGreek','\\nu\>'		,'ν')
939  call s:Greek('texGreek','\\xi\>'		,'ξ')
940  call s:Greek('texGreek','\\pi\>'		,'π')
941  call s:Greek('texGreek','\\varpi\>'		,'ϖ')
942  call s:Greek('texGreek','\\rho\>'		,'ρ')
943  call s:Greek('texGreek','\\varrho\>'		,'ϱ')
944  call s:Greek('texGreek','\\sigma\>'		,'σ')
945  call s:Greek('texGreek','\\varsigma\>'		,'ς')
946  call s:Greek('texGreek','\\tau\>'		,'τ')
947  call s:Greek('texGreek','\\upsilon\>'		,'υ')
948  call s:Greek('texGreek','\\phi\>'		,'φ')
949  call s:Greek('texGreek','\\varphi\>'		,'ϕ')
950  call s:Greek('texGreek','\\chi\>'		,'χ')
951  call s:Greek('texGreek','\\psi\>'		,'ψ')
952  call s:Greek('texGreek','\\omega\>'		,'ω')
953  call s:Greek('texGreek','\\Gamma\>'		,'Γ')
954  call s:Greek('texGreek','\\Delta\>'		,'Δ')
955  call s:Greek('texGreek','\\Theta\>'		,'Θ')
956  call s:Greek('texGreek','\\Lambda\>'		,'Λ')
957  call s:Greek('texGreek','\\Xi\>'		,'Χ')
958  call s:Greek('texGreek','\\Pi\>'		,'Π')
959  call s:Greek('texGreek','\\Sigma\>'		,'Σ')
960  call s:Greek('texGreek','\\Upsilon\>'		,'Υ')
961  call s:Greek('texGreek','\\Phi\>'		,'Φ')
962  call s:Greek('texGreek','\\Psi\>'		,'Ψ')
963  call s:Greek('texGreek','\\Omega\>'		,'Ω')
964  delfun s:Greek
965 endif
966
967 " Superscripts/Subscripts {{{2
968 if s:tex_conceal =~ 's'
969  syn region texSuperscript	matchgroup=Delimiter start='\^{'	skip="\\\\\|\\[{}]" end='}'	contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
970  syn region texSubscript	matchgroup=Delimiter start='_{'		skip="\\\\\|\\[{}]" end='}'	contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
971  fun! s:SuperSub(group,leader,pat,cchar)
972    exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
973    exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
974  endfun
975  call s:SuperSub('texSuperscript','\^','0','⁰')
976  call s:SuperSub('texSuperscript','\^','1','¹')
977  call s:SuperSub('texSuperscript','\^','2','²')
978  call s:SuperSub('texSuperscript','\^','3','³')
979  call s:SuperSub('texSuperscript','\^','4','⁴')
980  call s:SuperSub('texSuperscript','\^','5','⁵')
981  call s:SuperSub('texSuperscript','\^','6','⁶')
982  call s:SuperSub('texSuperscript','\^','7','⁷')
983  call s:SuperSub('texSuperscript','\^','8','⁸')
984  call s:SuperSub('texSuperscript','\^','9','⁹')
985  call s:SuperSub('texSuperscript','\^','a','ᵃ')
986  call s:SuperSub('texSuperscript','\^','b','ᵇ')
987  call s:SuperSub('texSuperscript','\^','c','ᶜ')
988  call s:SuperSub('texSuperscript','\^','d','ᵈ')
989  call s:SuperSub('texSuperscript','\^','e','ᵉ')
990  call s:SuperSub('texSuperscript','\^','f','ᶠ')
991  call s:SuperSub('texSuperscript','\^','g','ᵍ')
992  call s:SuperSub('texSuperscript','\^','h','ʰ')
993  call s:SuperSub('texSuperscript','\^','i','ⁱ')
994  call s:SuperSub('texSuperscript','\^','j','ʲ')
995  call s:SuperSub('texSuperscript','\^','k','ᵏ')
996  call s:SuperSub('texSuperscript','\^','l','ˡ')
997  call s:SuperSub('texSuperscript','\^','m','ᵐ')
998  call s:SuperSub('texSuperscript','\^','n','ⁿ')
999  call s:SuperSub('texSuperscript','\^','o','ᵒ')
1000  call s:SuperSub('texSuperscript','\^','p','ᵖ')
1001  call s:SuperSub('texSuperscript','\^','r','ʳ')
1002  call s:SuperSub('texSuperscript','\^','s','ˢ')
1003  call s:SuperSub('texSuperscript','\^','t','ᵗ')
1004  call s:SuperSub('texSuperscript','\^','u','ᵘ')
1005  call s:SuperSub('texSuperscript','\^','v','ᵛ')
1006  call s:SuperSub('texSuperscript','\^','w','ʷ')
1007  call s:SuperSub('texSuperscript','\^','x','ˣ')
1008  call s:SuperSub('texSuperscript','\^','y','ʸ')
1009  call s:SuperSub('texSuperscript','\^','z','ᶻ')
1010  call s:SuperSub('texSuperscript','\^','A','ᴬ')
1011  call s:SuperSub('texSuperscript','\^','B','ᴮ')
1012  call s:SuperSub('texSuperscript','\^','D','ᴰ')
1013  call s:SuperSub('texSuperscript','\^','E','ᴱ')
1014  call s:SuperSub('texSuperscript','\^','G','ᴳ')
1015  call s:SuperSub('texSuperscript','\^','H','ᴴ')
1016  call s:SuperSub('texSuperscript','\^','I','ᴵ')
1017  call s:SuperSub('texSuperscript','\^','J','ᴶ')
1018  call s:SuperSub('texSuperscript','\^','K','ᴷ')
1019  call s:SuperSub('texSuperscript','\^','L','ᴸ')
1020  call s:SuperSub('texSuperscript','\^','M','ᴹ')
1021  call s:SuperSub('texSuperscript','\^','N','ᴺ')
1022  call s:SuperSub('texSuperscript','\^','O','ᴼ')
1023  call s:SuperSub('texSuperscript','\^','P','ᴾ')
1024  call s:SuperSub('texSuperscript','\^','R','ᴿ')
1025  call s:SuperSub('texSuperscript','\^','T','ᵀ')
1026  call s:SuperSub('texSuperscript','\^','U','ᵁ')
1027  call s:SuperSub('texSuperscript','\^','W','ᵂ')
1028  call s:SuperSub('texSuperscript','\^',',','︐')
1029  call s:SuperSub('texSuperscript','\^',':','︓')
1030  call s:SuperSub('texSuperscript','\^',';','︔')
1031  call s:SuperSub('texSuperscript','\^','+','⁺')
1032  call s:SuperSub('texSuperscript','\^','-','⁻')
1033  call s:SuperSub('texSuperscript','\^','<','˂')
1034  call s:SuperSub('texSuperscript','\^','>','˃')
1035  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('texSubscript','_','0','₀')
1041  call s:SuperSub('texSubscript','_','1','₁')
1042  call s:SuperSub('texSubscript','_','2','₂')
1043  call s:SuperSub('texSubscript','_','3','₃')
1044  call s:SuperSub('texSubscript','_','4','₄')
1045  call s:SuperSub('texSubscript','_','5','₅')
1046  call s:SuperSub('texSubscript','_','6','₆')
1047  call s:SuperSub('texSubscript','_','7','₇')
1048  call s:SuperSub('texSubscript','_','8','₈')
1049  call s:SuperSub('texSubscript','_','9','₉')
1050  call s:SuperSub('texSubscript','_','a','ₐ')
1051  call s:SuperSub('texSubscript','_','e','ₑ')
1052  call s:SuperSub('texSubscript','_','i','ᵢ')
1053  call s:SuperSub('texSubscript','_','o','ₒ')
1054  call s:SuperSub('texSubscript','_','u','ᵤ')
1055  call s:SuperSub('texSubscript','_',',','︐')
1056  call s:SuperSub('texSubscript','_','+','₊')
1057  call s:SuperSub('texSubscript','_','-','₋')
1058  call s:SuperSub('texSubscript','_','/','ˏ')
1059  call s:SuperSub('texSubscript','_','(','₍')
1060  call s:SuperSub('texSubscript','_',')','₎')
1061  call s:SuperSub('texSubscript','_','\.','‸')
1062  call s:SuperSub('texSubscript','_','r','ᵣ')
1063  call s:SuperSub('texSubscript','_','v','ᵥ')
1064  call s:SuperSub('texSubscript','_','x','ₓ')
1065  call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
1066  call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
1067  call s:SuperSub('texSubscript','_','\\phi\>'  ,'ᵩ')
1068  call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
1069  call s:SuperSub('texSubscript','_','\\chi\>'  ,'ᵪ')
1070  delfun s:SuperSub
1071 endif
1072
1073 " Accented characters: {{{2
1074 if s:tex_conceal =~ 'a'
1075  if b:tex_stylish
1076   syn match texAccent		"\\[bcdvuH][^a-zA-Z@]"me=e-1
1077   syn match texLigature		"\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
1078  else
1079   fun! s:Accents(chr,...)
1080     let i= 1
1081     for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"]
1082      if i > a:0
1083       break
1084      endif
1085      if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?'
1086       let i= i + 1
1087       continue
1088      endif
1089      if accent =~ '\a'
1090       exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
1091      else
1092       exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
1093      endif
1094      let i= i + 1
1095     endfor
1096   endfun
1097   "                  \`  \'  \^  \"  \~  \.  \c  \H  \k  \r  \u  \v
1098   call s:Accents('a','à','á','â','ä','ã','ȧ',' ',' ','ą','å','ă','ă')
1099   call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ',' ',' ','Ą','Å','Ă','Ă')
1100   call s:Accents('c',' ','ć','ĉ',' ',' ','ċ','ç',' ',' ',' ',' ','č')
1101   call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ','Ç',' ',' ',' ',' ','Č')
1102   call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
1103   call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
1104   call s:Accents('e','è','é','ê','ë','ẽ','ė','ȩ',' ','ę',' ','ĕ','ě')
1105   call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě')
1106   call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ')
1107   call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ')
1108   call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ')
1109   call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ')
1110   call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1111   call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ')
1112   call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ')
1113   call s:Accents('k',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ',' ')
1114   call s:Accents('K',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ',' ')
1115   call s:Accents('l',' ','ĺ','ľ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
1116   call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
1117   call s:Accents('n',' ','ń',' ',' ','ñ',' ','ņ',' ',' ',' ',' ','ň')
1118   call s:Accents('N',' ','Ń',' ',' ','Ñ',' ','Ņ',' ',' ',' ',' ','Ň')
1119   call s:Accents('o','ò','ó','ô','ö','õ','ȯ',' ','ő','ǫ',' ','ŏ',' ')
1120   call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ',' ','Ő','Ǫ',' ','Ŏ',' ')
1121   call s:Accents('r',' ','ŕ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
1122   call s:Accents('R',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
1123   call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ','ȿ',' ',' ','š')
1124   call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
1125   call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
1126   call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
1127   call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű','ų','ů','ŭ','ǔ')
1128   call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű','Ų','Ů','Ŭ','Ǔ')
1129   call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1130   call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1131   call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ')
1132   call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ')
1133   call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ','ž')
1134   call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ','Ž')
1135   call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1136   "                  \`  \'  \^  \"  \~  \.  \c  \H  \k  \r  \u  \v
1137   delfun s:Accents
1138   syn match texAccent   '\\aa\>'	conceal cchar=å
1139   syn match texAccent   '\\AA\>'	conceal cchar=Å
1140   syn match texAccent	'\\o\>'		conceal cchar=ø
1141   syn match texAccent	'\\O\>'		conceal cchar=Ø
1142   syn match texLigature	'\\AE\>'	conceal cchar=Æ
1143   syn match texLigature	'\\ae\>'	conceal cchar=æ
1144   syn match texLigature	'\\oe\>'	conceal cchar=œ
1145   syn match texLigature	'\\OE\>'	conceal cchar=Œ
1146   syn match texLigature	'\\ss\>'	conceal cchar=ß
1147  endif
1148 endif
1149endif
1150
1151" ---------------------------------------------------------------------
1152" LaTeX synchronization: {{{1
1153syn sync maxlines=200
1154syn sync minlines=50
1155
1156syn  sync match texSyncStop			groupthere NONE		"%stopzone\>"
1157
1158" Synchronization: {{{1
1159" The $..$ and $$..$$ make for impossible sync patterns
1160" (one can't tell if a "$$" starts or stops a math zone by itself)
1161" The following grouptheres coupled with minlines above
1162" help improve the odds of good syncing.
1163if !exists("tex_no_math")
1164 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{abstract}"
1165 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{center}"
1166 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{description}"
1167 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{enumerate}"
1168 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{itemize}"
1169 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{table}"
1170 syn sync match texSyncMathZoneA		groupthere NONE		"\\end{tabular}"
1171 syn sync match texSyncMathZoneA		groupthere NONE		"\\\(sub\)*section\>"
1172endif
1173
1174" ---------------------------------------------------------------------
1175" Highlighting: {{{1
1176if did_tex_syntax_inits == 1
1177 let did_tex_syntax_inits= 2
1178  " TeX highlighting groups which should share similar highlighting
1179  if !exists("g:tex_no_error")
1180   if !exists("tex_no_math")
1181    HiLink texBadMath		texError
1182    HiLink texMathDelimBad	texError
1183    HiLink texMathError		texError
1184    if !b:tex_stylish
1185      HiLink texOnlyMath	texError
1186    endif
1187   endif
1188   HiLink texError		Error
1189  endif
1190
1191  HiLink texCite		texRefZone
1192  HiLink texDefCmd		texDef
1193  HiLink texDefName		texDef
1194  HiLink texDocType		texCmdName
1195  HiLink texDocTypeArgs		texCmdArgs
1196  HiLink texInputFileOpt	texCmdArgs
1197  HiLink texInputCurlies	texDelimiter
1198  HiLink texLigature		texSpecialChar
1199  if !exists("tex_no_math")
1200   HiLink texMathDelimSet1	texMathDelim
1201   HiLink texMathDelimSet2	texMathDelim
1202   HiLink texMathDelimKey	texMathDelim
1203   HiLink texMathMatcher	texMath
1204   HiLink texAccent		texStatement
1205   HiLink texGreek		texStatement
1206   HiLink texSuperscript	texStatement
1207   HiLink texSubscript		texStatement
1208   HiLink texSuperscripts 	texSuperscript
1209   HiLink texSubscripts 	texSubscript
1210   HiLink texMathSymbol		texStatement
1211   HiLink texMathZoneV		texMath
1212   HiLink texMathZoneW		texMath
1213   HiLink texMathZoneX		texMath
1214   HiLink texMathZoneY		texMath
1215   HiLink texMathZoneV		texMath
1216   HiLink texMathZoneZ		texMath
1217  endif
1218  HiLink texSectionMarker	texCmdName
1219  HiLink texSectionName		texSection
1220  HiLink texSpaceCode		texStatement
1221  HiLink texStyleStatement	texStatement
1222  HiLink texTypeSize		texType
1223  HiLink texTypeStyle		texType
1224
1225   " Basic TeX highlighting groups
1226  HiLink texCmdArgs		Number
1227  HiLink texCmdName		Statement
1228  HiLink texComment		Comment
1229  HiLink texDef			Statement
1230  HiLink texDefParm		Special
1231  HiLink texDelimiter		Delimiter
1232  HiLink texInput		Special
1233  HiLink texInputFile		Special
1234  HiLink texLength		Number
1235  HiLink texMath		Special
1236  HiLink texMathDelim		Statement
1237  HiLink texMathOper		Operator
1238  HiLink texNewCmd		Statement
1239  HiLink texNewEnv		Statement
1240  HiLink texOption		Number
1241  HiLink texRefZone		Special
1242  HiLink texSection		PreCondit
1243  HiLink texSpaceCodeChar	Special
1244  HiLink texSpecialChar		SpecialChar
1245  HiLink texStatement		Statement
1246  HiLink texString		String
1247  HiLink texTodo		Todo
1248  HiLink texType		Type
1249  HiLink texZone		PreCondit
1250
1251  delcommand HiLink
1252endif
1253
1254" Cleanup: {{{1
1255unlet s:extfname
1256let   b:current_syntax = "tex"
1257let &cpo               = s:keepcpo
1258unlet s:keepcpo
1259" vim: ts=8 fdm=marker
1260