1" Vim syntax file 2" Language: TeX 3" Maintainer: Charles E. Campbell <[email protected]> 4" Last Change: Mar 11, 2013 5" Version: 77 6" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX 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_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 61if exists("g:tex_tex") && !exists("g:tex_no_error") 62 let s:tex_no_error= 1 63endif 64 65" let user determine which classes of concealment will be supported 66" a=accents/ligatures d=delimiters m=math symbols g=Greek s=superscripts/subscripts 67if !exists("g:tex_conceal") 68 let s:tex_conceal= 'abdmgs' 69else 70 let s:tex_conceal= g:tex_conceal 71endif 72 73" Determine whether or not to use "*.sty" mode {{{1 74" 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 78let s:extfname=expand("%:e") 79if exists("g:tex_stylish") 80 let b:tex_stylish= g:tex_stylish 81elseif !exists("b:tex_stylish") 82 if s:extfname == "sty" || s:extfname == "cls" || s:extfname == "clo" || s:extfname == "dtx" || s:extfname == "ltx" 83 let b:tex_stylish= 1 84 else 85 let b:tex_stylish= 0 86 endif 87endif 88 89" handle folding {{{1 90if !exists("g:tex_fold_enabled") 91 let g:tex_fold_enabled= 0 92elseif g:tex_fold_enabled && !has("folding") 93 let g:tex_fold_enabled= 0 94 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" 97 setl fdm=syntax 98endif 99 100" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1 101" but _ is the only one that causes problems. 102" One may override this iskeyword setting by providing 103" g:tex_isk 104if exists("g:tex_isk") 105 exe "setlocal isk=".g:tex_isk 106else 107 setlocal isk=48-57,a-z,A-Z,192-255 108endif 109if b:tex_stylish 110 setlocal isk+=@-@ 111endif 112if exists("g:tex_nospell") && g:tex_nospell && !exists("g:tex_comment_nospell") 113 let g:tex_comment_nospell= 1 114endif 115 116" Clusters: {{{1 117" -------- 118syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle 119if !exists("s:tex_no_error") 120 syn cluster texCmdGroup add=texMathError 121endif 122syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement 123syn 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 126if !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 133syn 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 134syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter 135if !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 140 syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle 141 if !exists("s:tex_no_error") 142 syn cluster texMathMatchGroup add=texMathError 143 syn cluster texMathZoneGroup add=texMathError 144 endif 145 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 155 if has("conceal") && &enc == 'utf-8' 156 syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol 157 syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol 158 endif 159endif 160 161" Try to flag {} and () mismatches: {{{1 162if !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 175endif 176if !exists("s:tex_no_error") 177 syn match texError "[}\])]" 178endif 179if !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 186endif 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\+" 195 if !exists("s:tex_no_error") 196 syn match texError "\\\a*@[a-zA-Z@]*" 197 endif 198endif 199 200" TeX/LaTeX delimiters: {{{1 201syn match texDelimiter "&" 202syn match texDelimiter "\\\\" 203syn match texDelimiter "[{}]" 204 205" Tex/Latex Options: {{{1 206syn match texOption "[^\\]\zs#\d\+\|^#\d\+" 207 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 222syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName 223if !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 227 228" \documentclass, \documentstyle, \usepackage: {{{1 229syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs 230if !exists("g:tex_fast") || g:tex_fast =~ 'm' 231 syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell 232endif 233 234" Preamble syntax-based folding support: {{{1 235if g:tex_fold_enabled && has("folding") 236 syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texPreambleMatchGroup 237endif 238 239" TeX input: {{{1 240syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement 241syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt 242syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt 243syn match texInputCurlies "[{}]" contained 244if !exists("g:tex_fast") || g:tex_fast =~ 'm' 245 syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment 246endif 247 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 259if s:tex_conceal !~ 'b' 260 syn match texTypeStyle "\\textbf\>" 261 syn match texTypeStyle "\\textit\>" 262endif 263syn 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 312if !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 362endif 363 364" particular support for bold and italic {{{1 365if !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 372endif 373 374" Bad Math (mismatched): {{{1 375if !exists("tex_no_math") 376 syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" 377 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") 383 " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2 384 " 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 390 if g:tex_fold_enabled 391 let foldcmd= " fold" 392 else 393 let foldcmd= "" 394 endif 395 exe "syn cluster texMathZones add=".grpname 396 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 401 exe 'hi def link '.grpname.' texMath' 402 if a:starform 403 let grpname = "texMathZone".a:sfx.'S' 404 let syncname = "texSyncMathZone".a:sfx.'S' 405 exe "syn cluster texMathZones add=".grpname 406 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 411 exe 'hi def link '.grpname.' texMath' 412 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) 425 call TexNewMathZone("J","subequations",0) 426 call TexNewMathZone("K","xalignat",1) 427 call TexNewMathZone("L","xxalignat",0) 428 429 " Inline Math Zones: {{{2 430 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 443 endif 444 445 syn match texMathOper "[_^=]" contained 446 447 " Text Inside Math Zones: {{{2 448 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 454 endif 455 456 " \left..something.. and \right..something.. support: {{{2 457 syn match texMathDelimBad contained "\S" 458 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=} 461 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 496 else 497 syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad 498 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 506 endif 507 syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>" 508 syn match texMathDelim contained "\\lefteqn\>" 509endif 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) 527if !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 532syn case ignore 533syn keyword texTodo contained combak fixme todo xxx 534syn case match 535if s:extfname == "dtx" 536 syn match texComment "\^\^A.*$" contains=@texCommentGroup 537 syn match texComment "^%\+" contains=@texCommentGroup 538else 539 if g:tex_fold_enabled 540 " allows syntax-folding of 2 or more contiguous comment lines 541 " single-line comments are not folded 542 syn match texComment "%.*$" contains=@texCommentGroup 543 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 547 else 548 syn match texComment "%.*$" contains=@texCommentGroup 549 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 552 endif 553endif 554 555" Separate lines used for verb` and verb# so that the end conditions {{{1 556" will appropriately terminate. 557" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there. 558if !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 566 else 567 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 572 endif 573 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\>" 578 else 579 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 584 endif 585 endif 586endif 587 588" Tex Reference Zones: {{{1 589if !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 599syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite 600 601" Handle newcommand, newenvironment : {{{1 602syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl 603if !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 608syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl 609if !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 614 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 628syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>" 629 630" TeX String Delimiters: {{{1 631syn match texString "\(``\|''\|,,\)" 632 633" makeatletter -- makeatother sections 634if !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 638 syn match texStyleStatement "\\[a-zA-Z@]\+" contained 639 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 643endif 644 645" Conceal mode support (supports set cole=2) {{{1 646if has("conceal") && &enc == 'utf-8' 647 648 " Math Symbols {{{2 649 " (many of these symbols were contributed by Björn Winckler) 650 if s:tex_conceal =~ 'm' 651 let s:texMathList=[ 652 \ ['|' , '‖'], 653 \ ['aleph' , 'ℵ'], 654 \ ['amalg' , '∐'], 655 \ ['angle' , '∠'], 656 \ ['approx' , '≈'], 657 \ ['ast' , '∗'], 658 \ ['asymp' , '≍'], 659 \ ['backepsilon' , '∍'], 660 \ ['backsimeq' , '≃'], 661 \ ['backslash' , '∖'], 662 \ ['barwedge' , '⊼'], 663 \ ['because' , '∵'], 664 \ ['between' , '≬'], 665 \ ['bigcap' , '∩'], 666 \ ['bigcirc' , '○'], 667 \ ['bigcup' , '∪'], 668 \ ['bigodot' , '⊙'], 669 \ ['bigoplus' , '⊕'], 670 \ ['bigotimes' , '⊗'], 671 \ ['bigsqcup' , '⊔'], 672 \ ['bigtriangledown', '∇'], 673 \ ['bigtriangleup' , '∆'], 674 \ ['bigvee' , '⋁'], 675 \ ['bigwedge' , '⋀'], 676 \ ['blacksquare' , '∎'], 677 \ ['bot' , '⊥'], 678 \ ['bowtie' , '⋈'], 679 \ ['boxdot' , '⊡'], 680 \ ['boxminus' , '⊟'], 681 \ ['boxplus' , '⊞'], 682 \ ['boxtimes' , '⊠'], 683 \ ['bullet' , '•'], 684 \ ['bumpeq' , '≏'], 685 \ ['Bumpeq' , '≎'], 686 \ ['cap' , '∩'], 687 \ ['Cap' , '⋒'], 688 \ ['cdot' , '·'], 689 \ ['cdots' , '⋯'], 690 \ ['circ' , '∘'], 691 \ ['circeq' , '≗'], 692 \ ['circlearrowleft', '↺'], 693 \ ['circlearrowright', '↻'], 694 \ ['circledast' , '⊛'], 695 \ ['circledcirc' , '⊚'], 696 \ ['clubsuit' , '♣'], 697 \ ['complement' , '∁'], 698 \ ['cong' , '≅'], 699 \ ['coprod' , '∐'], 700 \ ['copyright' , '©'], 701 \ ['cup' , '∪'], 702 \ ['Cup' , '⋓'], 703 \ ['curlyeqprec' , '⋞'], 704 \ ['curlyeqsucc' , '⋟'], 705 \ ['curlyvee' , '⋎'], 706 \ ['curlywedge' , '⋏'], 707 \ ['dagger' , '†'], 708 \ ['dashv' , '⊣'], 709 \ ['ddagger' , '‡'], 710 \ ['ddots' , '⋱'], 711 \ ['diamond' , '⋄'], 712 \ ['diamondsuit' , '♢'], 713 \ ['div' , '÷'], 714 \ ['doteq' , '≐'], 715 \ ['doteqdot' , '≑'], 716 \ ['dotplus' , '∔'], 717 \ ['dots' , '…'], 718 \ ['dotsb' , '⋯'], 719 \ ['dotsc' , '…'], 720 \ ['dotsi' , '⋯'], 721 \ ['dotso' , '…'], 722 \ ['doublebarwedge' , '⩞'], 723 \ ['downarrow' , '↓'], 724 \ ['Downarrow' , '⇓'], 725 \ ['ell' , 'ℓ'], 726 \ ['emptyset' , '∅'], 727 \ ['eqcirc' , '≖'], 728 \ ['eqsim' , '≂'], 729 \ ['eqslantgtr' , '⪖'], 730 \ ['eqslantless' , '⪕'], 731 \ ['equiv' , '≡'], 732 \ ['exists' , '∃'], 733 \ ['fallingdotseq' , '≒'], 734 \ ['flat' , '♭'], 735 \ ['forall' , '∀'], 736 \ ['frown' , '⁔'], 737 \ ['ge' , '≥'], 738 \ ['geq' , '≥'], 739 \ ['geqq' , '≧'], 740 \ ['gets' , '←'], 741 \ ['gg' , '⟫'], 742 \ ['gneqq' , '≩'], 743 \ ['gtrdot' , '⋗'], 744 \ ['gtreqless' , '⋛'], 745 \ ['gtrless' , '≷'], 746 \ ['gtrsim' , '≳'], 747 \ ['hbar' , 'ℏ'], 748 \ ['heartsuit' , '♡'], 749 \ ['hookleftarrow' , '↩'], 750 \ ['hookrightarrow' , '↪'], 751 \ ['iiint' , '∭'], 752 \ ['iint' , '∬'], 753 \ ['Im' , 'ℑ'], 754 \ ['imath' , 'ɩ'], 755 \ ['in' , '∈'], 756 \ ['infty' , '∞'], 757 \ ['int' , '∫'], 758 \ ['lceil' , '⌈'], 759 \ ['ldots' , '…'], 760 \ ['le' , '≤'], 761 \ ['leadsto' , '↝'], 762 \ ['left(' , '('], 763 \ ['left\[' , '['], 764 \ ['left\\{' , '{'], 765 \ ['leftarrow' , '⟵'], 766 \ ['Leftarrow' , '⟸'], 767 \ ['leftarrowtail' , '↢'], 768 \ ['leftharpoondown', '↽'], 769 \ ['leftharpoonup' , '↼'], 770 \ ['leftrightarrow' , '↔'], 771 \ ['Leftrightarrow' , '⇔'], 772 \ ['leftrightsquigarrow', '↭'], 773 \ ['leftthreetimes' , '⋋'], 774 \ ['leq' , '≤'], 775 \ ['leq' , '≤'], 776 \ ['leqq' , '≦'], 777 \ ['lessdot' , '⋖'], 778 \ ['lesseqgtr' , '⋚'], 779 \ ['lesssim' , '≲'], 780 \ ['lfloor' , '⌊'], 781 \ ['ll' , '≪'], 782 \ ['lmoustache' , '╭'], 783 \ ['lneqq' , '≨'], 784 \ ['ltimes' , '⋉'], 785 \ ['mapsto' , '↦'], 786 \ ['measuredangle' , '∡'], 787 \ ['mid' , '∣'], 788 \ ['models' , '╞'], 789 \ ['mp' , '∓'], 790 \ ['nabla' , '∇'], 791 \ ['natural' , '♮'], 792 \ ['ncong' , '≇'], 793 \ ['ne' , '≠'], 794 \ ['nearrow' , '↗'], 795 \ ['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' , '∋'], 830 \ ['P' , '¶'], 831 \ ['parallel' , '║'], 832 \ ['partial' , '∂'], 833 \ ['perp' , '⊥'], 834 \ ['pitchfork' , '⋔'], 835 \ ['pm' , '±'], 836 \ ['prec' , '≺'], 837 \ ['precapprox' , '⪷'], 838 \ ['preccurlyeq' , '≼'], 839 \ ['preceq' , '⪯'], 840 \ ['precnapprox' , '⪹'], 841 \ ['precneqq' , '⪵'], 842 \ ['precsim' , '≾'], 843 \ ['prime' , '′'], 844 \ ['prod' , '∏'], 845 \ ['propto' , '∝'], 846 \ ['rceil' , '⌉'], 847 \ ['Re' , 'ℜ'], 848 \ ['rfloor' , '⌋'], 849 \ ['right)' , ')'], 850 \ ['right]' , ']'], 851 \ ['right\\}' , '}'], 852 \ ['rightarrow' , '⟶'], 853 \ ['Rightarrow' , '⟹'], 854 \ ['rightarrowtail' , '↣'], 855 \ ['rightleftharpoons', '⇌'], 856 \ ['rightsquigarrow', '↝'], 857 \ ['rightthreetimes', '⋌'], 858 \ ['risingdotseq' , '≓'], 859 \ ['rmoustache' , '╮'], 860 \ ['rtimes' , '⋊'], 861 \ ['S' , '§'], 862 \ ['searrow' , '↘'], 863 \ ['setminus' , '∖'], 864 \ ['sharp' , '♯'], 865 \ ['sim' , '∼'], 866 \ ['simeq' , '⋍'], 867 \ ['smile' , '‿'], 868 \ ['spadesuit' , '♠'], 869 \ ['sphericalangle' , '∢'], 870 \ ['sqcap' , '⊓'], 871 \ ['sqcup' , '⊔'], 872 \ ['sqsubset' , '⊏'], 873 \ ['sqsubseteq' , '⊑'], 874 \ ['sqsupset' , '⊐'], 875 \ ['sqsupseteq' , '⊒'], 876 \ ['star' , '✫'], 877 \ ['subset' , '⊂'], 878 \ ['Subset' , '⋐'], 879 \ ['subseteq' , '⊆'], 880 \ ['subseteqq' , '⫅'], 881 \ ['subsetneq' , '⊊'], 882 \ ['subsetneqq' , '⫋'], 883 \ ['succ' , '≻'], 884 \ ['succapprox' , '⪸'], 885 \ ['succcurlyeq' , '≽'], 886 \ ['succeq' , '⪰'], 887 \ ['succnapprox' , '⪺'], 888 \ ['succneqq' , '⪶'], 889 \ ['succsim' , '≿'], 890 \ ['sum' , '∑'], 891 \ ['supset' , '⊃'], 892 \ ['Supset' , '⋑'], 893 \ ['supseteq' , '⊇'], 894 \ ['supseteqq' , '⫆'], 895 \ ['supsetneq' , '⊋'], 896 \ ['supsetneqq' , '⫌'], 897 \ ['surd' , '√'], 898 \ ['swarrow' , '↙'], 899 \ ['therefore' , '∴'], 900 \ ['times' , '×'], 901 \ ['to' , '→'], 902 \ ['top' , '⊤'], 903 \ ['triangle' , '∆'], 904 \ ['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' , '⋮'], 921 \ ['vee' , '∨'], 922 \ ['veebar' , '⊻'], 923 \ ['Vvdash' , '⊪'], 924 \ ['wedge' , '∧'], 925 \ ['wp' , '℘'], 926 \ ['wr' , '≀']] 927" \ ['jmath' , 'X'] 928" \ ['uminus' , 'X'] 929" \ ['uplus' , 'X'] 930 for texmath in s:texMathList 931 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 936 endfor 937 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 945 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=Ŷ 966 endif 967 968 " Greek {{{2 969 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 1014 1015 " Superscripts/Subscripts {{{2 1016 if s:tex_conceal =~ 's' 1017 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 1021 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','ᵂ') 1078 call s:SuperSub('texSuperscript','\^',',','︐') 1079 call s:SuperSub('texSuperscript','\^',':','︓') 1080 call s:SuperSub('texSuperscript','\^',';','︔') 1081 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','ᵤ') 1105 call s:SuperSub('texSubscript','_',',','︐') 1106 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 1122 1123 " Accented characters: {{{2 1124 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 1131 for accent in ["`","\\'","^",'"','\~','\.',"c","H","k","r","u","v"] 1132 if i > a:0 1133 break 1134 endif 1135 if strlen(a:{i}) == 0 || a:{i} == ' ' || a:{i} == '?' 1136 let i= i + 1 1137 continue 1138 endif 1139 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 1144 let i= i + 1 1145 endfor 1146 endfun 1147 " \` \' \^ \" \~ \. \c \H \k \r \u \v 1148 call s:Accents('a','à','á','â','ä','ã','ȧ',' ',' ','ą','å','ă','ă') 1149 call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ',' ',' ','Ą','Å','Ă','Ă') 1150 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','È','É','Ê','Ë','Ẽ','Ė','Ȩ',' ','Ę',' ','Ĕ','Ě') 1156 call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ','ģ',' ',' ',' ','ğ',' ') 1157 call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ','Ģ',' ',' ',' ','Ğ',' ') 1158 call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ') 1159 call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ') 1160 call s:Accents('i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ','ĭ',' ') 1161 call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ',' ',' ',' ',' ','Ĭ',' ') 1162 call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ') 1163 call s:Accents('k',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ',' ') 1164 call s:Accents('K',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ',' ') 1165 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',' ','Ŕ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř') 1173 call s:Accents('s',' ','ś','ŝ',' ',' ',' ','ş',' ','ȿ',' ',' ','š') 1174 call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ','Ş',' ',' ',' ',' ','Š') 1175 call s:Accents('t',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť') 1176 call s:Accents('T',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť') 1177 call s:Accents('u','ù','ú','û','ü','ũ',' ',' ','ű','ų','ů','ŭ','ǔ') 1178 call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ',' ','Ű','Ų','Ů','Ŭ','Ǔ') 1179 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 1187 delfun s:Accents 1188 syn match texAccent '\\aa\>' conceal cchar=å 1189 syn match texAccent '\\AA\>' conceal cchar=Å 1190 syn match texAccent '\\o\>' conceal cchar=ø 1191 syn match texAccent '\\O\>' conceal cchar=Ø 1192 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 1198 endif 1199endif 1200 1201" --------------------------------------------------------------------- 1202" 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 1224" --------------------------------------------------------------------- 1225" Highlighting: {{{1 1226if did_tex_syntax_inits == 1 1227 let did_tex_syntax_inits= 2 1228 " TeX highlighting groups which should share similar highlighting 1229 if !exists("s:tex_no_error") 1230 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 1241 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 1245 HiLink texCite texRefZone 1246 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 1258 HiLink texAccent texStatement 1259 HiLink texGreek texStatement 1260 HiLink texSuperscript texStatement 1261 HiLink texSubscript texStatement 1262 HiLink texSuperscripts texSuperscript 1263 HiLink texSubscripts texSubscript 1264 HiLink texMathSymbol texStatement 1265 HiLink texMathZoneV texMath 1266 HiLink texMathZoneW texMath 1267 HiLink texMathZoneX texMath 1268 HiLink texMathZoneY texMath 1269 HiLink texMathZoneV texMath 1270 HiLink texMathZoneZ texMath 1271 endif 1272 HiLink texBeginEnd texCmdName 1273 HiLink texBeginEndName texSection 1274 HiLink texSpaceCode texStatement 1275 HiLink texStyleStatement texStatement 1276 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 1295 HiLink texRefZone Special 1296 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 1308" Cleanup: {{{1 1309unlet s:extfname 1310let b:current_syntax = "tex" 1311let &cpo = s:keepcpo 1312unlet s:keepcpo 1313" vim: ts=8 fdm=marker 1314