blob: 7649b27be09050347f6bd8e5bf0eb2181f4d0cfd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: TeX
Bram Moolenaar97d62492012-11-15 21:28:22 +01003" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
Bram Moolenaarac7bd632013-03-19 11:35:58 +01004" Last Change: Mar 11, 2013
5" Version: 77
6" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
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
Bram Moolenaarac7bd632013-03-19 11:35:58 +010055if exists("g:tex_no_error") && g:tex_no_error
56 let s:tex_no_error= 1
57endif
58if exists("g:tex_fast") && g:tex_fast
59 let s:tex_no_error= 1
60endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000061if exists("g:tex_tex") && !exists("g:tex_no_error")
Bram Moolenaarac7bd632013-03-19 11:35:58 +010062 let s:tex_no_error= 1
Bram Moolenaar071d4272004-06-13 20:20:40 +000063endif
64
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020065" let user determine which classes of concealment will be supported
Bram Moolenaar7fc0c062010-08-10 21:43:35 +020066" a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020067if !exists("g:tex_conceal")
Bram Moolenaard38b0552012-04-25 19:07:41 +020068 let s:tex_conceal= 'abdmgs'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +020069else
70 let s:tex_conceal= g:tex_conceal
71endif
72
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000073" Determine whether or not to use "*.sty" mode {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000074" The user may override the normal determination by setting
75" g:tex_stylish to 1 (for "*.sty" mode)
76" or to 0 else (normal "*.tex" mode)
77" or on a buffer-by-buffer basis with b:tex_stylish
Bram Moolenaar81af9252010-12-10 20:35:50 +010078let s:extfname=expand("%:e")
Bram Moolenaar071d4272004-06-13 20:20:40 +000079if exists("g:tex_stylish")
80 let b:tex_stylish= g:tex_stylish
81elseif !exists("b:tex_stylish")
Bram Moolenaar81af9252010-12-10 20:35:50 +010082 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx"
Bram Moolenaar071d4272004-06-13 20:20:40 +000083 let b:tex_stylish= 1
84 else
85 let b:tex_stylish= 0
86 endif
87endif
88
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000089" handle folding {{{1
90if !exists("g:tex_fold_enabled")
91 let g:tex_fold_enabled= 0
92elseif g:tex_fold_enabled && !has("folding")
Bram Moolenaarab194812005-09-14 21:40:12 +000093 let g:tex_fold_enabled= 0
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000094 echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support"
95endif
96if g:tex_fold_enabled && &fdm == "manual"
Bram Moolenaar00a927d2010-05-14 23:24:24 +020097 setl fdm=syntax
Bram Moolenaarf1f8bc52005-03-07 23:20:08 +000098endif
99
Bram Moolenaaradc21822011-04-01 18:03:16 +0200100" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101" but _ is the only one that causes problems.
Bram Moolenaaradc21822011-04-01 18:03:16 +0200102" One may override this iskeyword setting by providing
103" g:tex_isk
104if exists("g:tex_isk")
105 exe "setlocal isk=".g:tex_isk
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106else
Bram Moolenaaradc21822011-04-01 18:03:16 +0200107 setlocal isk=48-57,a-z,A-Z,192-255
108endif
109if b:tex_stylish
110 setlocal isk+=@-@
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200112if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell")
113 let g:tex_comment_nospell= 1
114endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000115
116" Clusters: {{{1
117" --------
Bram Moolenaard38b0552012-04-25 19:07:41 +0200118syn 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 Moolenaarac7bd632013-03-19 11:35:58 +0100119if !exists("s:tex_no_error")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000120 syn cluster texCmdGroup add=texMathError
121endif
122syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
Bram Moolenaard38b0552012-04-25 19:07:41 +0200123syn 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
124syn 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
125syn 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 +0200126if !exists("g:tex_nospell") || !g:tex_nospell
127 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
128 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
129else
130 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
131 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
132endif
Bram Moolenaard38b0552012-04-25 19:07:41 +0200133syn 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 +0000134syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000135if !exists("tex_no_math")
136 syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
137 syn cluster texMatchGroup add=@texMathZones
138 syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
139 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 +0200140 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100141 if !exists("s:tex_no_error")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000142 syn cluster texMathMatchGroup add=texMathError
143 syn cluster texMathZoneGroup add=texMathError
144 endif
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000145 syn cluster texMathZoneGroup add=@NoSpell
146 " following used in the \part \chapter \section \subsection \subsubsection
147 " \paragraph \subparagraph \author \title highlighting
148 syn cluster texDocGroup contains=texPartZone,@texPartGroup
149 syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone
150 syn cluster texChapterGroup contains=texSectionZone,texParaZone
151 syn cluster texSectionGroup contains=texSubSectionZone,texParaZone
152 syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone
153 syn cluster texSubSubSectionGroup contains=texParaZone
154 syn cluster texParaGroup contains=texSubParaZone
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200155 if has("conceal") && &enc == 'utf-8'
Bram Moolenaare0021c72010-07-28 17:25:21 +0200156 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
157 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200158 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159endif
160
161" Try to flag {} and () mismatches: {{{1
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100162if !exists("g:tex_fast") || g:tex_fast =~ 'm'
163 if !exists("s:tex_no_error")
164 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
165 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell
166 else
167 syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup
168 syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup
169 endif
170 if !exists("g:tex_nospell") || !g:tex_nospell
171 syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell
172 else
173 syn region texParen start="(" end=")" contains=@texMatchGroup
174 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000175endif
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100176if !exists("s:tex_no_error")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000177 syn match texError "[}\])]"
178endif
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100179if !exists("g:tex_fast") || g:tex_fast =~ 'M'
180 if !exists("tex_no_math")
181 if !exists("s:tex_no_error")
182 syn match texMathError "}" contained
183 endif
184 syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
185 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186endif
187
188" TeX/LaTeX keywords: {{{1
189" Instead of trying to be All Knowing, I just match \..alphameric..
190" Note that *.tex files may not have "@" in their \commands
191if exists("g:tex_tex") || b:tex_stylish
192 syn match texStatement "\\[a-zA-Z@]\+"
193else
194 syn match texStatement "\\\a\+"
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100195 if !exists("s:tex_no_error")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000196 syn match texError "\\\a*@[a-zA-Z@]*"
197 endif
198endif
199
200" TeX/LaTeX delimiters: {{{1
201syn match texDelimiter "&"
202syn match texDelimiter "\\\\"
Bram Moolenaard960d762011-09-21 19:22:10 +0200203syn match texDelimiter "[{}]"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204
205" Tex/Latex Options: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200206syn match texOption "[^\\]\zs#\d\+\|^#\d\+"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207
208" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
209if b:tex_stylish
210 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
211 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
212else
213 syn match texAccent "\\[bcdvuH]\A"me=e-1
214 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
215endif
216syn match texAccent "\\[bcdvuH]$"
217syn match texAccent +\\[=^.\~"`']+
218syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
219syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
220
221" \begin{}/\end{} section markers: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200222syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100223if !exists("g:tex_fast") || g:tex_fast =~ 'm'
224 syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment
225 syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell
226endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000227
228" \documentclass, \documentstyle, \usepackage: {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200229syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100230if !exists("g:tex_fast") || g:tex_fast =~ 'm'
231 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell
232endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000233
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000234" Preamble syntax-based folding support: {{{1
235if g:tex_fold_enabled && has("folding")
Bram Moolenaard38b0552012-04-25 19:07:41 +0200236 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup
Bram Moolenaara9a568c2006-03-14 23:04:27 +0000237endif
238
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239" TeX input: {{{1
240syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +0100241syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
243syn match texInputCurlies "[{}]" contained
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100244if !exists("g:tex_fast") || g:tex_fast =~ 'm'
245 syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
246endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247
248" Type Styles (LaTeX 2.09): {{{1
249syn match texTypeStyle "\\rm\>"
250syn match texTypeStyle "\\em\>"
251syn match texTypeStyle "\\bf\>"
252syn match texTypeStyle "\\it\>"
253syn match texTypeStyle "\\sl\>"
254syn match texTypeStyle "\\sf\>"
255syn match texTypeStyle "\\sc\>"
256syn match texTypeStyle "\\tt\>"
257
258" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
Bram Moolenaard38b0552012-04-25 19:07:41 +0200259if s:tex_conceal !~ 'b'
260 syn match texTypeStyle "\\textbf\>"
261 syn match texTypeStyle "\\textit\>"
262endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000263syn match texTypeStyle "\\textmd\>"
264syn match texTypeStyle "\\textrm\>"
265syn match texTypeStyle "\\textsc\>"
266syn match texTypeStyle "\\textsf\>"
267syn match texTypeStyle "\\textsl\>"
268syn match texTypeStyle "\\texttt\>"
269syn match texTypeStyle "\\textup\>"
270syn match texTypeStyle "\\emph\>"
271
272syn match texTypeStyle "\\mathbb\>"
273syn match texTypeStyle "\\mathbf\>"
274syn match texTypeStyle "\\mathcal\>"
275syn match texTypeStyle "\\mathfrak\>"
276syn match texTypeStyle "\\mathit\>"
277syn match texTypeStyle "\\mathnormal\>"
278syn match texTypeStyle "\\mathrm\>"
279syn match texTypeStyle "\\mathsf\>"
280syn match texTypeStyle "\\mathtt\>"
281
282syn match texTypeStyle "\\rmfamily\>"
283syn match texTypeStyle "\\sffamily\>"
284syn match texTypeStyle "\\ttfamily\>"
285
286syn match texTypeStyle "\\itshape\>"
287syn match texTypeStyle "\\scshape\>"
288syn match texTypeStyle "\\slshape\>"
289syn match texTypeStyle "\\upshape\>"
290
291syn match texTypeStyle "\\bfseries\>"
292syn match texTypeStyle "\\mdseries\>"
293
294" Some type sizes: {{{1
295syn match texTypeSize "\\tiny\>"
296syn match texTypeSize "\\scriptsize\>"
297syn match texTypeSize "\\footnotesize\>"
298syn match texTypeSize "\\small\>"
299syn match texTypeSize "\\normalsize\>"
300syn match texTypeSize "\\large\>"
301syn match texTypeSize "\\Large\>"
302syn match texTypeSize "\\LARGE\>"
303syn match texTypeSize "\\huge\>"
304syn match texTypeSize "\\Huge\>"
305
306" Spacecodes (TeX'isms): {{{1
307" \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x
308syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
309syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
310
311" Sections, subsections, etc: {{{1
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100312if !exists("g:tex_fast") || g:tex_fast =~ 'p'
313 if !exists("g:tex_nospell") || !g:tex_nospell
314 if g:tex_fold_enabled && has("folding")
315 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
316 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell
317 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell
318 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell
319 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
320 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
321 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
322 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
323 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
324 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell
325 else
326 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
327 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
328 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell
329 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell
330 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell
331 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
332 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell
333 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell
334 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell
335 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell
336 endif
337 else
338 if g:tex_fold_enabled && has("folding")
339 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup
340 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup
341 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup
342 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup
343 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup
344 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup
345 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup
346 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup
347 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup
348 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup
349 else
350 syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup
351 syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup
352 syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup
353 syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup
354 syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup
355 syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup
356 syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup
357 syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup
358 syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup
359 syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup
360 endif
361 endif
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000362endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363
Bram Moolenaard38b0552012-04-25 19:07:41 +0200364" particular support for bold and italic {{{1
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100365if !exists("g:tex_fast") || g:tex_fast =~ 'b'
366 if s:tex_conceal =~ 'b'
367 syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup
368 syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup
369 syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup
370 syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup
371 endif
Bram Moolenaard38b0552012-04-25 19:07:41 +0200372endif
373
Bram Moolenaar071d4272004-06-13 20:20:40 +0000374" Bad Math (mismatched): {{{1
375if !exists("tex_no_math")
Bram Moolenaard960d762011-09-21 19:22:10 +0200376 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000377 syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
378 syn match texBadMath "\\[\])]"
379endif
380
381" Math Zones: {{{1
382if !exists("tex_no_math")
Bram Moolenaar488c6512005-08-11 20:09:58 +0000383 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000384 " Starred forms are created if starform is true. Starred
385 " forms have syntax group and synchronization groups with a
386 " "S" appended. Handles: cluster, syntax, sync, and HiLink.
387 fun! TexNewMathZone(sfx,mathzone,starform)
388 let grpname = "texMathZone".a:sfx
389 let syncname = "texSyncMathZone".a:sfx
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000390 if g:tex_fold_enabled
391 let foldcmd= " fold"
392 else
393 let foldcmd= ""
394 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000395 exe "syn cluster texMathZones add=".grpname
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100396 if !exists("g:tex_fast") || g:tex_fast =~ 'M'
397 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
398 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
399 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
400 endif
Bram Moolenaar5c736222010-01-06 20:54:52 +0100401 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000402 if a:starform
403 let grpname = "texMathZone".a:sfx.'S'
404 let syncname = "texSyncMathZone".a:sfx.'S'
405 exe "syn cluster texMathZones add=".grpname
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100406 if !exists("g:tex_fast") || g:tex_fast =~ 'M'
407 exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
408 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
409 exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
410 endif
Bram Moolenaar5c736222010-01-06 20:54:52 +0100411 exe 'hi def link '.grpname.' texMath'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000412 endif
413 endfun
414
415 " Standard Math Zones: {{{2
416 call TexNewMathZone("A","align",1)
417 call TexNewMathZone("B","alignat",1)
418 call TexNewMathZone("C","displaymath",1)
419 call TexNewMathZone("D","eqnarray",1)
420 call TexNewMathZone("E","equation",1)
421 call TexNewMathZone("F","flalign",1)
422 call TexNewMathZone("G","gather",1)
423 call TexNewMathZone("H","math",1)
424 call TexNewMathZone("I","multline",1)
Bram Moolenaard960d762011-09-21 19:22:10 +0200425 call TexNewMathZone("J","subequations",0)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000426 call TexNewMathZone("K","xalignat",1)
427 call TexNewMathZone("L","xxalignat",0)
428
429 " Inline Math Zones: {{{2
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100430 if !exists("g:tex_fast") || g:tex_fast =~ 'M'
431 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
432 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
433 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
434 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
435 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
436 else
437 syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
438 syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
439 syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
440 syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
441 endif
442 syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
Bram Moolenaare0021c72010-07-28 17:25:21 +0200443 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444
445 syn match texMathOper "[_^=]" contained
446
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200447 " Text Inside Math Zones: {{{2
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100448 if !exists("g:tex_fast") || g:tex_fast =~ 'M'
449 if !exists("g:tex_nospell") || !g:tex_nospell
450 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
451 else
452 syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup
453 endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200454 endif
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200455
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456 " \left..something.. and \right..something.. support: {{{2
457 syn match texMathDelimBad contained "\S"
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200458 if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
459 syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
460 syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
Bram Moolenaaradc21822011-04-01 18:03:16 +0200461 let s:texMathDelimList=[
462 \ ['<' , '<'] ,
463 \ ['>' , '>'] ,
464 \ ['(' , '('] ,
465 \ [')' , ')'] ,
466 \ ['\[' , '['] ,
467 \ [']' , ']'] ,
468 \ ['\\{' , '{'] ,
469 \ ['\\}' , '}'] ,
470 \ ['|' , '|'] ,
471 \ ['\\|' , '‖'] ,
472 \ ['\\backslash' , '\'] ,
473 \ ['\\downarrow' , '↓'] ,
474 \ ['\\Downarrow' , '⇓'] ,
475 \ ['\\langle' , '<'] ,
476 \ ['\\lbrace' , '['] ,
477 \ ['\\lceil' , '⌈'] ,
478 \ ['\\lfloor' , '⌊'] ,
479 \ ['\\lgroup' , '⌊'] ,
480 \ ['\\lmoustache' , '⎛'] ,
481 \ ['\\rangle' , '>'] ,
482 \ ['\\rbrace' , ']'] ,
483 \ ['\\rceil' , '⌉'] ,
484 \ ['\\rfloor' , '⌋'] ,
485 \ ['\\rgroup' , '⌋'] ,
486 \ ['\\rmoustache' , '⎞'] ,
487 \ ['\\uparrow' , '↑'] ,
488 \ ['\\Uparrow' , '↑'] ,
489 \ ['\\updownarrow', '↕'] ,
490 \ ['\\Updownarrow', '⇕']]
491 syn match texMathDelim '\\[bB]igg\=[lr]' contained nextgroup=texMathDelimBad
492 for texmath in s:texMathDelimList
493 exe "syn match texMathDelim '\\\\[bB]igg\\=[lr]\\=".texmath[0]."' contained conceal cchar=".texmath[1]
494 endfor
495
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200496 else
497 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
Bram Moolenaaradc21822011-04-01 18:03:16 +0200498 syn match texMathDelim contained "\\[bB]igg\=[lr]\=\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
499 syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
500 syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
501 syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
502 syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
503 syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
504 syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
505 syn keyword texMathDelimKey contained lbrace lvert rfloor
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200506 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
508 syn match texMathDelim contained "\\lefteqn\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000509endif
510
511" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
512syn match texSpecialChar "\\[$&%#{}_]"
513if b:tex_stylish
514 syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
515else
516 syn match texSpecialChar "\\[SP@]\A"me=e-1
517endif
518syn match texSpecialChar "\\\\"
519if !exists("tex_no_math")
520 syn match texOnlyMath "[_^]"
521endif
522syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
523
524" Comments: {{{1
525" Normal TeX LaTeX : %....
526" Documented TeX Format: ^^A... -and- leading %s (only)
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000527if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell
528 syn cluster texCommentGroup contains=texTodo,@Spell
529else
530 syn cluster texCommentGroup contains=texTodo,@NoSpell
531endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000532syn case ignore
Bram Moolenaar18144c82006-04-12 21:52:12 +0000533syn keyword texTodo contained combak fixme todo xxx
Bram Moolenaar071d4272004-06-13 20:20:40 +0000534syn case match
Bram Moolenaar81af9252010-12-10 20:35:50 +0100535if s:extfname == "dtx"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536 syn match texComment "\^\^A.*$" contains=@texCommentGroup
537 syn match texComment "^%\+" contains=@texCommentGroup
538else
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000539 if g:tex_fold_enabled
540 " allows syntax-folding of 2 or more contiguous comment lines
541 " single-line comments are not folded
Bram Moolenaard38b0552012-04-25 19:07:41 +0200542 syn match texComment "%.*$" contains=@texCommentGroup
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100543 if !exists("g:tex_fast") || g:tex_fast =~ 'c'
544 syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
545 syn region texNoSpell contained fold matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
546 endif
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000547 else
Bram Moolenaard38b0552012-04-25 19:07:41 +0200548 syn match texComment "%.*$" contains=@texCommentGroup
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100549 if !exists("g:tex_fast") || g:tex_fast =~ 'c'
550 syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
551 endif
Bram Moolenaarfd2ac762006-03-01 22:09:21 +0000552 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000553endif
554
555" Separate lines used for verb` and verb# so that the end conditions {{{1
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200556" will appropriately terminate.
557" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100558if !exists("g:tex_fast") || g:tex_fast =~ 'v'
559 if exists("g:tex_verbspell") && g:tex_verbspell
560 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
561 " listings package:
562 syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
563 if version < 600
564 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" contains=@Spell
565 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" contains=@Spell
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200566 else
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100567 if b:tex_stylish
568 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell
569 else
570 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" contains=@Spell
571 endif
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200572 endif
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100573 else
574 syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>"
575 if version < 600
576 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
577 syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200578 else
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100579 if b:tex_stylish
580 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
581 else
582 syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
583 endif
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200584 endif
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100585 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000586endif
587
588" Tex Reference Zones: {{{1
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100589if !exists("g:tex_fast") || g:tex_fast =~ 'r'
590 syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup
591 syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup
592 syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup
593 syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup
594 syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
595 syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
596 syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite
597 syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite
598endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200599syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
Bram Moolenaar071d4272004-06-13 20:20:40 +0000600
601" Handle newcommand, newenvironment : {{{1
602syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100603if !exists("g:tex_fast") || g:tex_fast =~ 'V'
604 syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
605 syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
606 syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
607endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000608syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100609if !exists("g:tex_fast") || g:tex_fast =~ 'V'
610 syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
611 syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
612 syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
613endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000614
615" Definitions/Commands: {{{1
616syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
617if b:tex_stylish
618 syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
619 syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
620else
621 syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
622 syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
623endif
624syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
625syn match texDefParm contained "#\d\+"
626
627" TeX Lengths: {{{1
Bram Moolenaar9964e462007-05-05 17:54:07 +0000628syn 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 +0000629
630" TeX String Delimiters: {{{1
631syn match texString "\(``\|''\|,,\)"
632
Bram Moolenaar5c736222010-01-06 20:54:52 +0100633" makeatletter -- makeatother sections
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100634if !exists("s:tex_no_error")
635 if !exists("g:tex_fast") || g:tex_fast =~ 'S'
636 syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained
637 endif
Bram Moolenaar5c736222010-01-06 20:54:52 +0100638 syn match texStyleStatement "\\[a-zA-Z@]\+" contained
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100639 if !exists("g:tex_fast") || g:tex_fast =~ 'S'
640 syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
641 syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
642 endif
Bram Moolenaar5c736222010-01-06 20:54:52 +0100643endif
644
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200645" Conceal mode support (supports set cole=2) {{{1
Bram Moolenaarb2c03502010-07-02 20:20:09 +0200646if has("conceal") && &enc == 'utf-8'
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200647
648 " Math Symbols {{{2
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200649 " (many of these symbols were contributed by Björn Winckler)
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200650 if s:tex_conceal =~ 'm'
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200651 let s:texMathList=[
Bram Moolenaaradc21822011-04-01 18:03:16 +0200652 \ ['|' , '‖'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200653 \ ['aleph' , 'ℵ'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100654 \ ['amalg' , '∐'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200655 \ ['angle' , '∠'],
656 \ ['approx' , '≈'],
657 \ ['ast' , '∗'],
658 \ ['asymp' , '≍'],
659 \ ['backepsilon' , '∍'],
660 \ ['backsimeq' , '≃'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200661 \ ['backslash' , '∖'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200662 \ ['barwedge' , '⊼'],
663 \ ['because' , '∵'],
664 \ ['between' , '≬'],
665 \ ['bigcap' , '∩'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100666 \ ['bigcirc' , '○'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200667 \ ['bigcup' , '∪'],
668 \ ['bigodot' , '⊙'],
669 \ ['bigoplus' , '⊕'],
670 \ ['bigotimes' , '⊗'],
671 \ ['bigsqcup' , '⊔'],
672 \ ['bigtriangledown', '∇'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100673 \ ['bigtriangleup' , '∆'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200674 \ ['bigvee' , '⋁'],
675 \ ['bigwedge' , '⋀'],
676 \ ['blacksquare' , '∎'],
677 \ ['bot' , '⊥'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100678 \ ['bowtie' , '⋈'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200679 \ ['boxdot' , '⊡'],
680 \ ['boxminus' , '⊟'],
681 \ ['boxplus' , '⊞'],
682 \ ['boxtimes' , '⊠'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100683 \ ['bullet' , '•'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200684 \ ['bumpeq' , '≏'],
685 \ ['Bumpeq' , '≎'],
686 \ ['cap' , '∩'],
687 \ ['Cap' , '⋒'],
688 \ ['cdot' , '·'],
689 \ ['cdots' , '⋯'],
690 \ ['circ' , '∘'],
691 \ ['circeq' , '≗'],
692 \ ['circlearrowleft', '↺'],
693 \ ['circlearrowright', '↻'],
694 \ ['circledast' , '⊛'],
695 \ ['circledcirc' , '⊚'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200696 \ ['clubsuit' , '♣'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200697 \ ['complement' , '∁'],
698 \ ['cong' , '≅'],
699 \ ['coprod' , '∐'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200700 \ ['copyright' , '©'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200701 \ ['cup' , '∪'],
702 \ ['Cup' , '⋓'],
703 \ ['curlyeqprec' , '⋞'],
704 \ ['curlyeqsucc' , '⋟'],
705 \ ['curlyvee' , '⋎'],
706 \ ['curlywedge' , '⋏'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100707 \ ['dagger' , '†'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200708 \ ['dashv' , '⊣'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100709 \ ['ddagger' , '‡'],
710 \ ['ddots' , '⋱'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200711 \ ['diamond' , '⋄'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200712 \ ['diamondsuit' , '♢'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200713 \ ['div' , '÷'],
714 \ ['doteq' , '≐'],
715 \ ['doteqdot' , '≑'],
716 \ ['dotplus' , '∔'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100717 \ ['dots' , '…'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200718 \ ['dotsb' , '⋯'],
719 \ ['dotsc' , '…'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200720 \ ['dotsi' , '⋯'],
721 \ ['dotso' , '…'],
722 \ ['doublebarwedge' , '⩞'],
723 \ ['downarrow' , '↓'],
724 \ ['Downarrow' , '⇓'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100725 \ ['ell' , 'ℓ'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200726 \ ['emptyset' , '∅'],
727 \ ['eqcirc' , '≖'],
728 \ ['eqsim' , '≂'],
729 \ ['eqslantgtr' , '⪖'],
730 \ ['eqslantless' , '⪕'],
731 \ ['equiv' , '≡'],
732 \ ['exists' , '∃'],
733 \ ['fallingdotseq' , '≒'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200734 \ ['flat' , '♭'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200735 \ ['forall' , '∀'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100736 \ ['frown' , '⁔'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200737 \ ['ge' , '≥'],
738 \ ['geq' , '≥'],
739 \ ['geqq' , '≧'],
740 \ ['gets' , '←'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100741 \ ['gg' , '⟫'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200742 \ ['gneqq' , '≩'],
743 \ ['gtrdot' , '⋗'],
744 \ ['gtreqless' , '⋛'],
745 \ ['gtrless' , '≷'],
746 \ ['gtrsim' , '≳'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200747 \ ['hbar' , 'ℏ'],
748 \ ['heartsuit' , '♡'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200749 \ ['hookleftarrow' , '↩'],
750 \ ['hookrightarrow' , '↪'],
751 \ ['iiint' , '∭'],
752 \ ['iint' , '∬'],
753 \ ['Im' , 'ℑ'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200754 \ ['imath' , 'ɩ'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200755 \ ['in' , '∈'],
756 \ ['infty' , '∞'],
757 \ ['int' , '∫'],
758 \ ['lceil' , '⌈'],
759 \ ['ldots' , '…'],
760 \ ['le' , '≤'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100761 \ ['leadsto' , '↝'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200762 \ ['left(' , '('],
763 \ ['left\[' , '['],
764 \ ['left\\{' , '{'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100765 \ ['leftarrow' , '⟵'],
766 \ ['Leftarrow' , '⟸'],
767 \ ['leftarrowtail' , '↢'],
768 \ ['leftharpoondown', '↽'],
769 \ ['leftharpoonup' , '↼'],
Bram Moolenaar97d62492012-11-15 21:28:22 +0100770 \ ['leftrightarrow' , '↔'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100771 \ ['Leftrightarrow' , '⇔'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200772 \ ['leftrightsquigarrow', '↭'],
773 \ ['leftthreetimes' , '⋋'],
774 \ ['leq' , '≤'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100775 \ ['leq' , '≤'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200776 \ ['leqq' , '≦'],
777 \ ['lessdot' , '⋖'],
778 \ ['lesseqgtr' , '⋚'],
779 \ ['lesssim' , '≲'],
780 \ ['lfloor' , '⌊'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100781 \ ['ll' , '≪'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200782 \ ['lmoustache' , '╭'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200783 \ ['lneqq' , '≨'],
784 \ ['ltimes' , '⋉'],
785 \ ['mapsto' , '↦'],
786 \ ['measuredangle' , '∡'],
787 \ ['mid' , '∣'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100788 \ ['models' , '╞'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200789 \ ['mp' , '∓'],
790 \ ['nabla' , '∇'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200791 \ ['natural' , '♮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200792 \ ['ncong' , '≇'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200793 \ ['ne' , '≠'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100794 \ ['nearrow' , '↗'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200795 \ ['neg' , '¬'],
796 \ ['neq' , '≠'],
797 \ ['nexists' , '∄'],
798 \ ['ngeq' , '≱'],
799 \ ['ngeqq' , '≱'],
800 \ ['ngtr' , '≯'],
801 \ ['ni' , '∋'],
802 \ ['nleftarrow' , '↚'],
803 \ ['nLeftarrow' , '⇍'],
804 \ ['nLeftrightarrow', '⇎'],
805 \ ['nleq' , '≰'],
806 \ ['nleqq' , '≰'],
807 \ ['nless' , '≮'],
808 \ ['nmid' , '∤'],
809 \ ['notin' , '∉'],
810 \ ['nprec' , '⊀'],
811 \ ['nrightarrow' , '↛'],
812 \ ['nRightarrow' , '⇏'],
813 \ ['nsim' , '≁'],
814 \ ['nsucc' , '⊁'],
815 \ ['ntriangleleft' , '⋪'],
816 \ ['ntrianglelefteq', '⋬'],
817 \ ['ntriangleright' , '⋫'],
818 \ ['ntrianglerighteq', '⋭'],
819 \ ['nvdash' , '⊬'],
820 \ ['nvDash' , '⊭'],
821 \ ['nVdash' , '⊮'],
822 \ ['nwarrow' , '↖'],
823 \ ['odot' , '⊙'],
824 \ ['oint' , '∮'],
825 \ ['ominus' , '⊖'],
826 \ ['oplus' , '⊕'],
827 \ ['oslash' , '⊘'],
828 \ ['otimes' , '⊗'],
829 \ ['owns' , '∋'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200830 \ ['P' , '¶'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100831 \ ['parallel' , '║'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200832 \ ['partial' , '∂'],
833 \ ['perp' , '⊥'],
834 \ ['pitchfork' , '⋔'],
835 \ ['pm' , '±'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200836 \ ['prec' , '≺'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100837 \ ['precapprox' , '⪷'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200838 \ ['preccurlyeq' , '≼'],
839 \ ['preceq' , '⪯'],
840 \ ['precnapprox' , '⪹'],
841 \ ['precneqq' , '⪵'],
842 \ ['precsim' , '≾'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200843 \ ['prime' , '′'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200844 \ ['prod' , '∏'],
845 \ ['propto' , '∝'],
846 \ ['rceil' , '⌉'],
847 \ ['Re' , 'ℜ'],
848 \ ['rfloor' , '⌋'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200849 \ ['right)' , ')'],
850 \ ['right]' , ']'],
851 \ ['right\\}' , '}'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100852 \ ['rightarrow' , '⟶'],
853 \ ['Rightarrow' , '⟹'],
854 \ ['rightarrowtail' , '↣'],
855 \ ['rightleftharpoons', '⇌'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200856 \ ['rightsquigarrow', '↝'],
857 \ ['rightthreetimes', '⋌'],
858 \ ['risingdotseq' , '≓'],
Bram Moolenaaradc21822011-04-01 18:03:16 +0200859 \ ['rmoustache' , '╮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200860 \ ['rtimes' , '⋊'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200861 \ ['S' , '§'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200862 \ ['searrow' , '↘'],
863 \ ['setminus' , '∖'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200864 \ ['sharp' , '♯'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200865 \ ['sim' , '∼'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100866 \ ['simeq' , '⋍'],
867 \ ['smile' , '‿'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200868 \ ['spadesuit' , '♠'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200869 \ ['sphericalangle' , '∢'],
870 \ ['sqcap' , '⊓'],
871 \ ['sqcup' , '⊔'],
872 \ ['sqsubset' , '⊏'],
873 \ ['sqsubseteq' , '⊑'],
874 \ ['sqsupset' , '⊐'],
875 \ ['sqsupseteq' , '⊒'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100876 \ ['star' , '✫'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200877 \ ['subset' , '⊂'],
878 \ ['Subset' , '⋐'],
879 \ ['subseteq' , '⊆'],
880 \ ['subseteqq' , '⫅'],
881 \ ['subsetneq' , '⊊'],
882 \ ['subsetneqq' , '⫋'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200883 \ ['succ' , '≻'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100884 \ ['succapprox' , '⪸'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200885 \ ['succcurlyeq' , '≽'],
886 \ ['succeq' , '⪰'],
887 \ ['succnapprox' , '⪺'],
888 \ ['succneqq' , '⪶'],
889 \ ['succsim' , '≿'],
890 \ ['sum' , '∑'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100891 \ ['supset' , '⊃'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200892 \ ['Supset' , '⋑'],
893 \ ['supseteq' , '⊇'],
894 \ ['supseteqq' , '⫆'],
895 \ ['supsetneq' , '⊋'],
896 \ ['supsetneqq' , '⫌'],
897 \ ['surd' , '√'],
898 \ ['swarrow' , '↙'],
899 \ ['therefore' , '∴'],
900 \ ['times' , '×'],
901 \ ['to' , '→'],
902 \ ['top' , '⊤'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200903 \ ['triangle' , '∆'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200904 \ ['triangleleft' , '⊲'],
905 \ ['trianglelefteq' , '⊴'],
906 \ ['triangleq' , '≜'],
907 \ ['triangleright' , '⊳'],
908 \ ['trianglerighteq', '⊵'],
909 \ ['twoheadleftarrow', '↞'],
910 \ ['twoheadrightarrow', '↠'],
911 \ ['uparrow' , '↑'],
912 \ ['Uparrow' , '⇑'],
913 \ ['updownarrow' , '↕'],
914 \ ['Updownarrow' , '⇕'],
915 \ ['varnothing' , '∅'],
916 \ ['vartriangle' , '∆'],
917 \ ['vdash' , '⊢'],
918 \ ['vDash' , '⊨'],
919 \ ['Vdash' , '⊩'],
920 \ ['vdots' , '⋮'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200921 \ ['vee' , '∨'],
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100922 \ ['veebar' , '⊻'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200923 \ ['Vvdash' , '⊪'],
924 \ ['wedge' , '∧'],
Bram Moolenaard960d762011-09-21 19:22:10 +0200925 \ ['wp' , '℘'],
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200926 \ ['wr' , '≀']]
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100927" \ ['jmath' , 'X']
928" \ ['uminus' , 'X']
929" \ ['uplus' , 'X']
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200930 for texmath in s:texMathList
Bram Moolenaar81af9252010-12-10 20:35:50 +0100931 if texmath[0] =~ '\w$'
932 exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
933 else
934 exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
935 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +0200936 endfor
Bram Moolenaar74cbdf02010-08-04 23:03:17 +0200937
938 if &ambw == "double"
939 syn match texMathSymbol '\\gg\>' contained conceal cchar=≫
940 syn match texMathSymbol '\\ll\>' contained conceal cchar=≪
941 else
942 syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫
943 syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪
944 endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200945
946 syn match texMathSymbol '\\hat{a}' contained conceal cchar=â
947 syn match texMathSymbol '\\hat{A}' contained conceal cchar=Â
948 syn match texMathSymbol '\\hat{c}' contained conceal cchar=ĉ
949 syn match texMathSymbol '\\hat{C}' contained conceal cchar=Ĉ
950 syn match texMathSymbol '\\hat{e}' contained conceal cchar=ê
951 syn match texMathSymbol '\\hat{E}' contained conceal cchar=Ê
952 syn match texMathSymbol '\\hat{g}' contained conceal cchar=ĝ
953 syn match texMathSymbol '\\hat{G}' contained conceal cchar=Ĝ
954 syn match texMathSymbol '\\hat{i}' contained conceal cchar=î
955 syn match texMathSymbol '\\hat{I}' contained conceal cchar=Î
956 syn match texMathSymbol '\\hat{o}' contained conceal cchar=ô
957 syn match texMathSymbol '\\hat{O}' contained conceal cchar=Ô
958 syn match texMathSymbol '\\hat{s}' contained conceal cchar=ŝ
959 syn match texMathSymbol '\\hat{S}' contained conceal cchar=Ŝ
960 syn match texMathSymbol '\\hat{u}' contained conceal cchar=û
961 syn match texMathSymbol '\\hat{U}' contained conceal cchar=Û
962 syn match texMathSymbol '\\hat{w}' contained conceal cchar=ŵ
963 syn match texMathSymbol '\\hat{W}' contained conceal cchar=Ŵ
964 syn match texMathSymbol '\\hat{y}' contained conceal cchar=ŷ
965 syn match texMathSymbol '\\hat{Y}' contained conceal cchar=Ŷ
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200966 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +0200967
968 " Greek {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200969 if s:tex_conceal =~ 'g'
970 fun! s:Greek(group,pat,cchar)
971 exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
972 endfun
973 call s:Greek('texGreek','\\alpha\>' ,'α')
974 call s:Greek('texGreek','\\beta\>' ,'β')
975 call s:Greek('texGreek','\\gamma\>' ,'γ')
976 call s:Greek('texGreek','\\delta\>' ,'δ')
977 call s:Greek('texGreek','\\epsilon\>' ,'ϵ')
978 call s:Greek('texGreek','\\varepsilon\>' ,'ε')
979 call s:Greek('texGreek','\\zeta\>' ,'ζ')
980 call s:Greek('texGreek','\\eta\>' ,'η')
981 call s:Greek('texGreek','\\theta\>' ,'θ')
982 call s:Greek('texGreek','\\vartheta\>' ,'ϑ')
983 call s:Greek('texGreek','\\kappa\>' ,'κ')
984 call s:Greek('texGreek','\\lambda\>' ,'λ')
985 call s:Greek('texGreek','\\mu\>' ,'μ')
986 call s:Greek('texGreek','\\nu\>' ,'ν')
987 call s:Greek('texGreek','\\xi\>' ,'ξ')
988 call s:Greek('texGreek','\\pi\>' ,'π')
989 call s:Greek('texGreek','\\varpi\>' ,'ϖ')
990 call s:Greek('texGreek','\\rho\>' ,'ρ')
991 call s:Greek('texGreek','\\varrho\>' ,'ϱ')
992 call s:Greek('texGreek','\\sigma\>' ,'σ')
993 call s:Greek('texGreek','\\varsigma\>' ,'ς')
994 call s:Greek('texGreek','\\tau\>' ,'τ')
995 call s:Greek('texGreek','\\upsilon\>' ,'υ')
996 call s:Greek('texGreek','\\phi\>' ,'φ')
997 call s:Greek('texGreek','\\varphi\>' ,'ϕ')
998 call s:Greek('texGreek','\\chi\>' ,'χ')
999 call s:Greek('texGreek','\\psi\>' ,'ψ')
1000 call s:Greek('texGreek','\\omega\>' ,'ω')
1001 call s:Greek('texGreek','\\Gamma\>' ,'Γ')
1002 call s:Greek('texGreek','\\Delta\>' ,'Δ')
1003 call s:Greek('texGreek','\\Theta\>' ,'Θ')
1004 call s:Greek('texGreek','\\Lambda\>' ,'Λ')
1005 call s:Greek('texGreek','\\Xi\>' ,'Χ')
1006 call s:Greek('texGreek','\\Pi\>' ,'Π')
1007 call s:Greek('texGreek','\\Sigma\>' ,'Σ')
1008 call s:Greek('texGreek','\\Upsilon\>' ,'Υ')
1009 call s:Greek('texGreek','\\Phi\>' ,'Φ')
1010 call s:Greek('texGreek','\\Psi\>' ,'Ψ')
1011 call s:Greek('texGreek','\\Omega\>' ,'Ω')
1012 delfun s:Greek
1013 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001014
1015 " Superscripts/Subscripts {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001016 if s:tex_conceal =~ 's'
Bram Moolenaarac7bd632013-03-19 11:35:58 +01001017 if !exists("g:tex_fast") || g:tex_fast =~ 's'
1018 syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
1019 syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
1020 endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001021 fun! s:SuperSub(group,leader,pat,cchar)
1022 exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
1023 exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
1024 endfun
1025 call s:SuperSub('texSuperscript','\^','0','⁰')
1026 call s:SuperSub('texSuperscript','\^','1','¹')
1027 call s:SuperSub('texSuperscript','\^','2','²')
1028 call s:SuperSub('texSuperscript','\^','3','³')
1029 call s:SuperSub('texSuperscript','\^','4','⁴')
1030 call s:SuperSub('texSuperscript','\^','5','⁵')
1031 call s:SuperSub('texSuperscript','\^','6','⁶')
1032 call s:SuperSub('texSuperscript','\^','7','⁷')
1033 call s:SuperSub('texSuperscript','\^','8','⁸')
1034 call s:SuperSub('texSuperscript','\^','9','⁹')
1035 call s:SuperSub('texSuperscript','\^','a','ᵃ')
1036 call s:SuperSub('texSuperscript','\^','b','ᵇ')
1037 call s:SuperSub('texSuperscript','\^','c','ᶜ')
1038 call s:SuperSub('texSuperscript','\^','d','ᵈ')
1039 call s:SuperSub('texSuperscript','\^','e','ᵉ')
1040 call s:SuperSub('texSuperscript','\^','f','ᶠ')
1041 call s:SuperSub('texSuperscript','\^','g','ᵍ')
1042 call s:SuperSub('texSuperscript','\^','h','ʰ')
1043 call s:SuperSub('texSuperscript','\^','i','ⁱ')
1044 call s:SuperSub('texSuperscript','\^','j','ʲ')
1045 call s:SuperSub('texSuperscript','\^','k','ᵏ')
1046 call s:SuperSub('texSuperscript','\^','l','ˡ')
1047 call s:SuperSub('texSuperscript','\^','m','ᵐ')
1048 call s:SuperSub('texSuperscript','\^','n','ⁿ')
1049 call s:SuperSub('texSuperscript','\^','o','ᵒ')
1050 call s:SuperSub('texSuperscript','\^','p','ᵖ')
1051 call s:SuperSub('texSuperscript','\^','r','ʳ')
1052 call s:SuperSub('texSuperscript','\^','s','ˢ')
1053 call s:SuperSub('texSuperscript','\^','t','ᵗ')
1054 call s:SuperSub('texSuperscript','\^','u','ᵘ')
1055 call s:SuperSub('texSuperscript','\^','v','ᵛ')
1056 call s:SuperSub('texSuperscript','\^','w','ʷ')
1057 call s:SuperSub('texSuperscript','\^','x','ˣ')
1058 call s:SuperSub('texSuperscript','\^','y','ʸ')
1059 call s:SuperSub('texSuperscript','\^','z','ᶻ')
1060 call s:SuperSub('texSuperscript','\^','A','ᴬ')
1061 call s:SuperSub('texSuperscript','\^','B','ᴮ')
1062 call s:SuperSub('texSuperscript','\^','D','ᴰ')
1063 call s:SuperSub('texSuperscript','\^','E','ᴱ')
1064 call s:SuperSub('texSuperscript','\^','G','ᴳ')
1065 call s:SuperSub('texSuperscript','\^','H','ᴴ')
1066 call s:SuperSub('texSuperscript','\^','I','ᴵ')
1067 call s:SuperSub('texSuperscript','\^','J','ᴶ')
1068 call s:SuperSub('texSuperscript','\^','K','ᴷ')
1069 call s:SuperSub('texSuperscript','\^','L','ᴸ')
1070 call s:SuperSub('texSuperscript','\^','M','ᴹ')
1071 call s:SuperSub('texSuperscript','\^','N','ᴺ')
1072 call s:SuperSub('texSuperscript','\^','O','ᴼ')
1073 call s:SuperSub('texSuperscript','\^','P','ᴾ')
1074 call s:SuperSub('texSuperscript','\^','R','ᴿ')
1075 call s:SuperSub('texSuperscript','\^','T','ᵀ')
1076 call s:SuperSub('texSuperscript','\^','U','ᵁ')
1077 call s:SuperSub('texSuperscript','\^','W','ᵂ')
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001078 call s:SuperSub('texSuperscript','\^',',','︐')
1079 call s:SuperSub('texSuperscript','\^',':','︓')
1080 call s:SuperSub('texSuperscript','\^',';','︔')
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001081 call s:SuperSub('texSuperscript','\^','+','⁺')
1082 call s:SuperSub('texSuperscript','\^','-','⁻')
1083 call s:SuperSub('texSuperscript','\^','<','˂')
1084 call s:SuperSub('texSuperscript','\^','>','˃')
1085 call s:SuperSub('texSuperscript','\^','/','ˊ')
1086 call s:SuperSub('texSuperscript','\^','(','⁽')
1087 call s:SuperSub('texSuperscript','\^',')','⁾')
1088 call s:SuperSub('texSuperscript','\^','\.','˙')
1089 call s:SuperSub('texSuperscript','\^','=','˭')
1090 call s:SuperSub('texSubscript','_','0','₀')
1091 call s:SuperSub('texSubscript','_','1','₁')
1092 call s:SuperSub('texSubscript','_','2','₂')
1093 call s:SuperSub('texSubscript','_','3','₃')
1094 call s:SuperSub('texSubscript','_','4','₄')
1095 call s:SuperSub('texSubscript','_','5','₅')
1096 call s:SuperSub('texSubscript','_','6','₆')
1097 call s:SuperSub('texSubscript','_','7','₇')
1098 call s:SuperSub('texSubscript','_','8','₈')
1099 call s:SuperSub('texSubscript','_','9','₉')
1100 call s:SuperSub('texSubscript','_','a','ₐ')
1101 call s:SuperSub('texSubscript','_','e','ₑ')
1102 call s:SuperSub('texSubscript','_','i','ᵢ')
1103 call s:SuperSub('texSubscript','_','o','ₒ')
1104 call s:SuperSub('texSubscript','_','u','ᵤ')
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001105 call s:SuperSub('texSubscript','_',',','︐')
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001106 call s:SuperSub('texSubscript','_','+','₊')
1107 call s:SuperSub('texSubscript','_','-','₋')
1108 call s:SuperSub('texSubscript','_','/','ˏ')
1109 call s:SuperSub('texSubscript','_','(','₍')
1110 call s:SuperSub('texSubscript','_',')','₎')
1111 call s:SuperSub('texSubscript','_','\.','‸')
1112 call s:SuperSub('texSubscript','_','r','ᵣ')
1113 call s:SuperSub('texSubscript','_','v','ᵥ')
1114 call s:SuperSub('texSubscript','_','x','ₓ')
1115 call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ')
1116 call s:SuperSub('texSubscript','_','\\delta\>','ᵨ')
1117 call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
1118 call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
1119 call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
1120 delfun s:SuperSub
1121 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001122
1123 " Accented characters: {{{2
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001124 if s:tex_conceal =~ 'a'
1125 if b:tex_stylish
1126 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
1127 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
1128 else
1129 fun! s:Accents(chr,...)
1130 let i= 1
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001131 for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"]
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001132 if i > a:0
1133 break
1134 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001135 if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?'
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001136 let i= i + 1
1137 continue
1138 endif
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001139 if accent =~ '\a'
1140 exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
1141 else
1142 exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
1143 endif
Bram Moolenaare0021c72010-07-28 17:25:21 +02001144 let i= i + 1
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001145 endfor
1146 endfun
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001147 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaard960d762011-09-21 19:22:10 +02001148 call s:Accents('a','à','á','â','ä','ã','ȧ',' ',' ','ą','å','ă','ă')
1149 call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ',' ',' ','Ą','Å','Ă','Ă')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001150 call s:Accents('c',' ','ć','ĉ',' ',' ','ċ','ç',' ',' ',' ',' ','č')
1151 call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ','Ç',' ',' ',' ',' ','Č')
1152 call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď')
1153 call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď')
1154 call s:Accents('e','è','é','ê','ë','ẽ','ė','ȩ',' ','ę',' ','ĕ','ě')
1155 call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě')
Bram Moolenaard960d762011-09-21 19:22:10 +02001156 call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ')
1157 call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ')
1158 call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ')
1159 call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001160 call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1161 call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ')
Bram Moolenaard960d762011-09-21 19:22:10 +02001162 call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ')
1163 call s:Accents('k',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ',' ')
1164 call s:Accents('K',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ',' ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001165 call s:Accents('l',' ','ĺ','ľ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ')
1166 call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ')
1167 call s:Accents('n',' ','ń',' ',' ','ñ',' ','ņ',' ',' ',' ',' ','ň')
1168 call s:Accents('N',' ','Ń',' ',' ','Ñ',' ','Ņ',' ',' ',' ',' ','Ň')
1169 call s:Accents('o','ò','ó','ô','ö','õ','ȯ',' ','ő','ǫ',' ','ŏ',' ')
1170 call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ',' ','Ő','Ǫ',' ','Ŏ',' ')
1171 call s:Accents('r',' ','ŕ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř')
1172 call s:Accents('R',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř')
Bram Moolenaard960d762011-09-21 19:22:10 +02001173 call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ','ȿ',' ',' ','š')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001174 call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š')
1175 call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť')
1176 call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť')
Bram Moolenaard960d762011-09-21 19:22:10 +02001177 call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű','ų','ů','ŭ','ǔ')
1178 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű','Ų','Ů','Ŭ','Ǔ')
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001179 call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1180 call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ')
1181 call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ')
1182 call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ')
1183 call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ','ž')
1184 call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ','Ž')
1185 call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ')
1186 " \` \' \^ \" \~ \. \c \H \k \r \u \v
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001187 delfun s:Accents
1188 syn match texAccent '\\aa\>' conceal cchar=å
1189 syn match texAccent '\\AA\>' conceal cchar=Å
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001190 syn match texAccent '\\o\>' conceal cchar=ø
1191 syn match texAccent '\\O\>' conceal cchar=Ø
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02001192 syn match texLigature '\\AE\>' conceal cchar=Æ
1193 syn match texLigature '\\ae\>' conceal cchar=æ
1194 syn match texLigature '\\oe\>' conceal cchar=œ
1195 syn match texLigature '\\OE\>' conceal cchar=Œ
1196 syn match texLigature '\\ss\>' conceal cchar=ß
1197 endif
Bram Moolenaar611df5b2010-07-26 22:51:56 +02001198 endif
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001199endif
1200
1201" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001202" LaTeX synchronization: {{{1
1203syn sync maxlines=200
1204syn sync minlines=50
1205
1206syn sync match texSyncStop groupthere NONE "%stopzone\>"
1207
1208" Synchronization: {{{1
1209" The $..$ and $$..$$ make for impossible sync patterns
1210" (one can't tell if a "$$" starts or stops a math zone by itself)
1211" The following grouptheres coupled with minlines above
1212" help improve the odds of good syncing.
1213if !exists("tex_no_math")
1214 syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
1215 syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
1216 syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
1217 syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
1218 syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
1219 syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
1220 syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
1221 syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
1222endif
1223
Bram Moolenaarb2c03502010-07-02 20:20:09 +02001224" ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +00001225" Highlighting: {{{1
1226if did_tex_syntax_inits == 1
1227 let did_tex_syntax_inits= 2
1228 " TeX highlighting groups which should share similar highlighting
Bram Moolenaarac7bd632013-03-19 11:35:58 +01001229 if !exists("s:tex_no_error")
Bram Moolenaar071d4272004-06-13 20:20:40 +00001230 if !exists("tex_no_math")
1231 HiLink texBadMath texError
1232 HiLink texMathDelimBad texError
1233 HiLink texMathError texError
1234 if !b:tex_stylish
1235 HiLink texOnlyMath texError
1236 endif
1237 endif
1238 HiLink texError Error
1239 endif
1240
Bram Moolenaard38b0552012-04-25 19:07:41 +02001241 hi texBoldStyle gui=bold cterm=bold
1242 hi texItalStyle gui=italic cterm=italic
1243 hi texBoldItalStyle gui=bold,italic cterm=bold,italic
1244 hi texItalBoldStyle gui=bold,italic cterm=bold,italic
Bram Moolenaard960d762011-09-21 19:22:10 +02001245 HiLink texCite texRefZone
Bram Moolenaar071d4272004-06-13 20:20:40 +00001246 HiLink texDefCmd texDef
1247 HiLink texDefName texDef
1248 HiLink texDocType texCmdName
1249 HiLink texDocTypeArgs texCmdArgs
1250 HiLink texInputFileOpt texCmdArgs
1251 HiLink texInputCurlies texDelimiter
1252 HiLink texLigature texSpecialChar
1253 if !exists("tex_no_math")
1254 HiLink texMathDelimSet1 texMathDelim
1255 HiLink texMathDelimSet2 texMathDelim
1256 HiLink texMathDelimKey texMathDelim
1257 HiLink texMathMatcher texMath
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001258 HiLink texAccent texStatement
1259 HiLink texGreek texStatement
1260 HiLink texSuperscript texStatement
1261 HiLink texSubscript texStatement
Bram Moolenaar6be7f872012-01-20 21:08:56 +01001262 HiLink texSuperscripts texSuperscript
1263 HiLink texSubscripts texSubscript
Bram Moolenaar7fc0c062010-08-10 21:43:35 +02001264 HiLink texMathSymbol texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001265 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001266 HiLink texMathZoneW texMath
1267 HiLink texMathZoneX texMath
1268 HiLink texMathZoneY texMath
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001269 HiLink texMathZoneV texMath
Bram Moolenaar071d4272004-06-13 20:20:40 +00001270 HiLink texMathZoneZ texMath
1271 endif
Bram Moolenaard38b0552012-04-25 19:07:41 +02001272 HiLink texBeginEnd texCmdName
1273 HiLink texBeginEndName texSection
Bram Moolenaar071d4272004-06-13 20:20:40 +00001274 HiLink texSpaceCode texStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +01001275 HiLink texStyleStatement texStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +00001276 HiLink texTypeSize texType
1277 HiLink texTypeStyle texType
1278
1279 " Basic TeX highlighting groups
1280 HiLink texCmdArgs Number
1281 HiLink texCmdName Statement
1282 HiLink texComment Comment
1283 HiLink texDef Statement
1284 HiLink texDefParm Special
1285 HiLink texDelimiter Delimiter
1286 HiLink texInput Special
1287 HiLink texInputFile Special
1288 HiLink texLength Number
1289 HiLink texMath Special
1290 HiLink texMathDelim Statement
1291 HiLink texMathOper Operator
1292 HiLink texNewCmd Statement
1293 HiLink texNewEnv Statement
1294 HiLink texOption Number
Bram Moolenaard960d762011-09-21 19:22:10 +02001295 HiLink texRefZone Special
Bram Moolenaar071d4272004-06-13 20:20:40 +00001296 HiLink texSection PreCondit
1297 HiLink texSpaceCodeChar Special
1298 HiLink texSpecialChar SpecialChar
1299 HiLink texStatement Statement
1300 HiLink texString String
1301 HiLink texTodo Todo
1302 HiLink texType Type
1303 HiLink texZone PreCondit
1304
1305 delcommand HiLink
1306endif
1307
Bram Moolenaar15146672011-10-20 22:22:38 +02001308" Cleanup: {{{1
Bram Moolenaar81af9252010-12-10 20:35:50 +01001309unlet s:extfname
Bram Moolenaar071d4272004-06-13 20:20:40 +00001310let b:current_syntax = "tex"
Bram Moolenaar15146672011-10-20 22:22:38 +02001311let &cpo = s:keepcpo
1312unlet s:keepcpo
Bram Moolenaare90ee312010-08-05 22:08:47 +02001313" vim: ts=8 fdm=marker