Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: TeX |
Bram Moolenaar | 488c651 | 2005-08-11 20:09:58 +0000 | [diff] [blame] | 3 | " Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 4 | " Last Change: Aug 03, 2010 |
| 5 | " Version: 54 |
Bram Moolenaar | 488c651 | 2005-08-11 20:09:58 +0000 | [diff] [blame] | 6 | " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 |
| 35 | if version < 600 |
| 36 | syntax clear |
| 37 | elseif exists("b:current_syntax") |
| 38 | finish |
| 39 | endif |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 40 | scriptencoding utf-8 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 41 | |
| 42 | " Define the default highlighting. {{{1 |
| 43 | " For version 5.7 and earlier: only when not done already |
| 44 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 45 | if version >= 508 || !exists("did_tex_syntax_inits") |
| 46 | let did_tex_syntax_inits = 1 |
| 47 | if version < 508 |
| 48 | command -nargs=+ HiLink hi link <args> |
| 49 | else |
| 50 | command -nargs=+ HiLink hi def link <args> |
| 51 | endif |
| 52 | endif |
| 53 | if exists("g:tex_tex") && !exists("g:tex_no_error") |
| 54 | let g:tex_no_error= 1 |
| 55 | endif |
| 56 | |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 57 | " let user determine which classes of concealment will be supported |
| 58 | " a=accents/ligatures m=math symbols g=Greek s=superscripts/subscripts |
| 59 | if !exists("g:tex_conceal") |
| 60 | let s:tex_conceal= 'amgs' |
| 61 | else |
| 62 | let s:tex_conceal= g:tex_conceal |
| 63 | endif |
| 64 | |
Bram Moolenaar | f1f8bc5 | 2005-03-07 23:20:08 +0000 | [diff] [blame] | 65 | " Determine whether or not to use "*.sty" mode {{{1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 66 | " The user may override the normal determination by setting |
| 67 | " g:tex_stylish to 1 (for "*.sty" mode) |
| 68 | " or to 0 else (normal "*.tex" mode) |
| 69 | " or on a buffer-by-buffer basis with b:tex_stylish |
| 70 | let b:extfname=expand("%:e") |
| 71 | if exists("g:tex_stylish") |
| 72 | let b:tex_stylish= g:tex_stylish |
| 73 | elseif !exists("b:tex_stylish") |
| 74 | if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx" |
| 75 | let b:tex_stylish= 1 |
| 76 | else |
| 77 | let b:tex_stylish= 0 |
| 78 | endif |
| 79 | endif |
| 80 | |
Bram Moolenaar | f1f8bc5 | 2005-03-07 23:20:08 +0000 | [diff] [blame] | 81 | " handle folding {{{1 |
| 82 | if !exists("g:tex_fold_enabled") |
| 83 | let g:tex_fold_enabled= 0 |
| 84 | elseif g:tex_fold_enabled && !has("folding") |
Bram Moolenaar | ab19481 | 2005-09-14 21:40:12 +0000 | [diff] [blame] | 85 | let g:tex_fold_enabled= 0 |
Bram Moolenaar | f1f8bc5 | 2005-03-07 23:20:08 +0000 | [diff] [blame] | 86 | echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" |
| 87 | endif |
| 88 | if g:tex_fold_enabled && &fdm == "manual" |
Bram Moolenaar | 00a927d | 2010-05-14 23:24:24 +0200 | [diff] [blame] | 89 | setl fdm=syntax |
Bram Moolenaar | f1f8bc5 | 2005-03-07 23:20:08 +0000 | [diff] [blame] | 90 | endif |
| 91 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 92 | " (La)TeX keywords: only use the letters a-zA-Z {{{1 |
| 93 | " but _ is the only one that causes problems. |
| 94 | if version < 600 |
| 95 | set isk-=_ |
| 96 | if b:tex_stylish |
| 97 | set isk+=@ |
| 98 | endif |
| 99 | else |
| 100 | setlocal isk-=_ |
| 101 | if b:tex_stylish |
| 102 | setlocal isk+=@ |
| 103 | endif |
| 104 | endif |
| 105 | |
| 106 | " Clusters: {{{1 |
| 107 | " -------- |
| 108 | syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle |
| 109 | if !exists("g:tex_no_error") |
| 110 | syn cluster texCmdGroup add=texMathError |
| 111 | endif |
| 112 | syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement |
Bram Moolenaar | 488c651 | 2005-08-11 20:09:58 +0000 | [diff] [blame] | 113 | syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract |
Bram Moolenaar | 5b8d8fd | 2005-08-16 23:01:50 +0000 | [diff] [blame] | 114 | 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 |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 115 | 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 |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 116 | syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 117 | if !exists("tex_no_math") |
| 118 | syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ |
| 119 | syn cluster texMatchGroup add=@texMathZones |
| 120 | syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 |
| 121 | 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 Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 122 | syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 123 | if !exists("g:tex_no_error") |
| 124 | syn cluster texMathMatchGroup add=texMathError |
| 125 | syn cluster texMathZoneGroup add=texMathError |
| 126 | endif |
Bram Moolenaar | 5b8d8fd | 2005-08-16 23:01:50 +0000 | [diff] [blame] | 127 | syn cluster texMathZoneGroup add=@NoSpell |
| 128 | " following used in the \part \chapter \section \subsection \subsubsection |
| 129 | " \paragraph \subparagraph \author \title highlighting |
| 130 | syn cluster texDocGroup contains=texPartZone,@texPartGroup |
| 131 | syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone |
| 132 | syn cluster texChapterGroup contains=texSectionZone,texParaZone |
| 133 | syn cluster texSectionGroup contains=texSubSectionZone,texParaZone |
| 134 | syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone |
| 135 | syn cluster texSubSubSectionGroup contains=texParaZone |
| 136 | syn cluster texParaGroup contains=texSubParaZone |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 137 | if has("conceal") && &enc == 'utf-8' |
Bram Moolenaar | e0021c7 | 2010-07-28 17:25:21 +0200 | [diff] [blame] | 138 | syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol |
| 139 | syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 140 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 141 | endif |
| 142 | |
| 143 | " Try to flag {} and () mismatches: {{{1 |
| 144 | if !exists("g:tex_no_error") |
| 145 | syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError |
| 146 | syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError |
| 147 | else |
| 148 | syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup |
| 149 | syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup |
| 150 | endif |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 151 | syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 152 | if !exists("g:tex_no_error") |
| 153 | syn match texError "[}\])]" |
| 154 | endif |
| 155 | if !exists("tex_no_math") |
| 156 | if !exists("g:tex_no_error") |
| 157 | syn match texMathError "}" contained |
| 158 | endif |
| 159 | syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup |
| 160 | endif |
| 161 | |
| 162 | " TeX/LaTeX keywords: {{{1 |
| 163 | " Instead of trying to be All Knowing, I just match \..alphameric.. |
| 164 | " Note that *.tex files may not have "@" in their \commands |
| 165 | if exists("g:tex_tex") || b:tex_stylish |
| 166 | syn match texStatement "\\[a-zA-Z@]\+" |
| 167 | else |
| 168 | syn match texStatement "\\\a\+" |
| 169 | if !exists("g:tex_no_error") |
| 170 | syn match texError "\\\a*@[a-zA-Z@]*" |
| 171 | endif |
| 172 | endif |
| 173 | |
| 174 | " TeX/LaTeX delimiters: {{{1 |
| 175 | syn match texDelimiter "&" |
| 176 | syn match texDelimiter "\\\\" |
| 177 | |
| 178 | " Tex/Latex Options: {{{1 |
| 179 | syn match texOption "[^\\]\zs#\d\+\|^#\d\+" |
| 180 | |
| 181 | " texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1 |
| 182 | if b:tex_stylish |
| 183 | syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 |
| 184 | syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 |
| 185 | else |
| 186 | syn match texAccent "\\[bcdvuH]\A"me=e-1 |
| 187 | syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1 |
| 188 | endif |
| 189 | syn match texAccent "\\[bcdvuH]$" |
| 190 | syn match texAccent +\\[=^.\~"`']+ |
| 191 | syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+ |
| 192 | syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" |
| 193 | |
| 194 | " \begin{}/\end{} section markers: {{{1 |
| 195 | syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 196 | syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier contains=texComment |
| 197 | syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 198 | |
| 199 | " \documentclass, \documentstyle, \usepackage: {{{1 |
| 200 | syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 201 | syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName contains=texComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 202 | |
Bram Moolenaar | a9a568c | 2006-03-14 23:04:27 +0000 | [diff] [blame] | 203 | " Preamble syntax-based folding support: {{{1 |
| 204 | if g:tex_fold_enabled && has("folding") |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 205 | syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=texStyle,@texMatchGroup |
Bram Moolenaar | a9a568c | 2006-03-14 23:04:27 +0000 | [diff] [blame] | 206 | endif |
| 207 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 208 | " TeX input: {{{1 |
| 209 | syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 210 | syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 211 | syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt |
| 212 | syn match texInputCurlies "[{}]" contained |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 213 | syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 214 | |
| 215 | " Type Styles (LaTeX 2.09): {{{1 |
| 216 | syn match texTypeStyle "\\rm\>" |
| 217 | syn match texTypeStyle "\\em\>" |
| 218 | syn match texTypeStyle "\\bf\>" |
| 219 | syn match texTypeStyle "\\it\>" |
| 220 | syn match texTypeStyle "\\sl\>" |
| 221 | syn match texTypeStyle "\\sf\>" |
| 222 | syn match texTypeStyle "\\sc\>" |
| 223 | syn match texTypeStyle "\\tt\>" |
| 224 | |
| 225 | " Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1 |
| 226 | syn match texTypeStyle "\\textbf\>" |
| 227 | syn match texTypeStyle "\\textit\>" |
| 228 | syn match texTypeStyle "\\textmd\>" |
| 229 | syn match texTypeStyle "\\textrm\>" |
| 230 | syn match texTypeStyle "\\textsc\>" |
| 231 | syn match texTypeStyle "\\textsf\>" |
| 232 | syn match texTypeStyle "\\textsl\>" |
| 233 | syn match texTypeStyle "\\texttt\>" |
| 234 | syn match texTypeStyle "\\textup\>" |
| 235 | syn match texTypeStyle "\\emph\>" |
| 236 | |
| 237 | syn match texTypeStyle "\\mathbb\>" |
| 238 | syn match texTypeStyle "\\mathbf\>" |
| 239 | syn match texTypeStyle "\\mathcal\>" |
| 240 | syn match texTypeStyle "\\mathfrak\>" |
| 241 | syn match texTypeStyle "\\mathit\>" |
| 242 | syn match texTypeStyle "\\mathnormal\>" |
| 243 | syn match texTypeStyle "\\mathrm\>" |
| 244 | syn match texTypeStyle "\\mathsf\>" |
| 245 | syn match texTypeStyle "\\mathtt\>" |
| 246 | |
| 247 | syn match texTypeStyle "\\rmfamily\>" |
| 248 | syn match texTypeStyle "\\sffamily\>" |
| 249 | syn match texTypeStyle "\\ttfamily\>" |
| 250 | |
| 251 | syn match texTypeStyle "\\itshape\>" |
| 252 | syn match texTypeStyle "\\scshape\>" |
| 253 | syn match texTypeStyle "\\slshape\>" |
| 254 | syn match texTypeStyle "\\upshape\>" |
| 255 | |
| 256 | syn match texTypeStyle "\\bfseries\>" |
| 257 | syn match texTypeStyle "\\mdseries\>" |
| 258 | |
| 259 | " Some type sizes: {{{1 |
| 260 | syn match texTypeSize "\\tiny\>" |
| 261 | syn match texTypeSize "\\scriptsize\>" |
| 262 | syn match texTypeSize "\\footnotesize\>" |
| 263 | syn match texTypeSize "\\small\>" |
| 264 | syn match texTypeSize "\\normalsize\>" |
| 265 | syn match texTypeSize "\\large\>" |
| 266 | syn match texTypeSize "\\Large\>" |
| 267 | syn match texTypeSize "\\LARGE\>" |
| 268 | syn match texTypeSize "\\huge\>" |
| 269 | syn match texTypeSize "\\Huge\>" |
| 270 | |
| 271 | " Spacecodes (TeX'isms): {{{1 |
| 272 | " \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x |
| 273 | syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar |
| 274 | syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained |
| 275 | |
| 276 | " Sections, subsections, etc: {{{1 |
Bram Moolenaar | f1f8bc5 | 2005-03-07 23:20:08 +0000 | [diff] [blame] | 277 | if g:tex_fold_enabled && has("folding") |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 278 | syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell |
| 279 | syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell |
| 280 | syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell |
| 281 | syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell |
| 282 | syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell |
| 283 | 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 |
| 284 | 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 |
| 285 | 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 |
| 286 | syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell |
| 287 | syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 288 | else |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 289 | syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell |
| 290 | syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell |
| 291 | syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell |
| 292 | syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell |
| 293 | syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell |
| 294 | syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell |
| 295 | syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell |
| 296 | syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell |
| 297 | syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell |
| 298 | syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell |
Bram Moolenaar | 293ee4d | 2004-12-09 21:34:53 +0000 | [diff] [blame] | 299 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 300 | |
| 301 | " Bad Math (mismatched): {{{1 |
| 302 | if !exists("tex_no_math") |
| 303 | syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" |
| 304 | syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" |
| 305 | syn match texBadMath "\\[\])]" |
| 306 | endif |
| 307 | |
| 308 | " Math Zones: {{{1 |
| 309 | if !exists("tex_no_math") |
Bram Moolenaar | 488c651 | 2005-08-11 20:09:58 +0000 | [diff] [blame] | 310 | " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 311 | " Starred forms are created if starform is true. Starred |
| 312 | " forms have syntax group and synchronization groups with a |
| 313 | " "S" appended. Handles: cluster, syntax, sync, and HiLink. |
| 314 | fun! TexNewMathZone(sfx,mathzone,starform) |
| 315 | let grpname = "texMathZone".a:sfx |
| 316 | let syncname = "texSyncMathZone".a:sfx |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 317 | if g:tex_fold_enabled |
| 318 | let foldcmd= " fold" |
| 319 | else |
| 320 | let foldcmd= "" |
| 321 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 322 | exe "syn cluster texMathZones add=".grpname |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 323 | exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 324 | exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
| 325 | exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 326 | exe 'hi def link '.grpname.' texMath' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 327 | if a:starform |
| 328 | let grpname = "texMathZone".a:sfx.'S' |
| 329 | let syncname = "texSyncMathZone".a:sfx.'S' |
| 330 | exe "syn cluster texMathZones add=".grpname |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 331 | exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 332 | exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
| 333 | exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"' |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 334 | exe 'hi def link '.grpname.' texMath' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 335 | endif |
| 336 | endfun |
| 337 | |
| 338 | " Standard Math Zones: {{{2 |
| 339 | call TexNewMathZone("A","align",1) |
| 340 | call TexNewMathZone("B","alignat",1) |
| 341 | call TexNewMathZone("C","displaymath",1) |
| 342 | call TexNewMathZone("D","eqnarray",1) |
| 343 | call TexNewMathZone("E","equation",1) |
| 344 | call TexNewMathZone("F","flalign",1) |
| 345 | call TexNewMathZone("G","gather",1) |
| 346 | call TexNewMathZone("H","math",1) |
| 347 | call TexNewMathZone("I","multline",1) |
| 348 | call TexNewMathZone("J","subequations",0) |
| 349 | call TexNewMathZone("K","xalignat",1) |
| 350 | call TexNewMathZone("L","xxalignat",0) |
| 351 | |
| 352 | " Inline Math Zones: {{{2 |
Bram Moolenaar | e0021c7 | 2010-07-28 17:25:21 +0200 | [diff] [blame] | 353 | if has("conceal") && &enc == 'utf-8' |
| 354 | syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup |
| 355 | syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup |
| 356 | syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup |
| 357 | syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup |
| 358 | else |
| 359 | syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup |
| 360 | syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup |
| 361 | syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup |
| 362 | syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup |
| 363 | endif |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 364 | syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 365 | |
| 366 | syn match texMathOper "[_^=]" contained |
| 367 | |
| 368 | " \left..something.. and \right..something.. support: {{{2 |
| 369 | syn match texMathDelimBad contained "\S" |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 370 | if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm' |
| 371 | syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={ |
| 372 | syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=} |
| 373 | else |
| 374 | syn match texMathDelim contained "\\\(left\|right\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad |
| 375 | endif |
| 376 | syn match texMathDelim contained "\\\([bB]igg\=[lr]\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 377 | syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>" |
| 378 | syn match texMathDelim contained "\\lefteqn\>" |
| 379 | syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad |
| 380 | syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]" |
| 381 | syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow |
| 382 | syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow |
| 383 | syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow |
| 384 | syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow |
| 385 | syn keyword texMathDelimKey contained lbrace lvert rfloor |
| 386 | endif |
| 387 | |
| 388 | " Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1 |
| 389 | syn match texSpecialChar "\\[$&%#{}_]" |
| 390 | if b:tex_stylish |
| 391 | syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1 |
| 392 | else |
| 393 | syn match texSpecialChar "\\[SP@]\A"me=e-1 |
| 394 | endif |
| 395 | syn match texSpecialChar "\\\\" |
| 396 | if !exists("tex_no_math") |
| 397 | syn match texOnlyMath "[_^]" |
| 398 | endif |
| 399 | syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S" |
| 400 | |
| 401 | " Comments: {{{1 |
| 402 | " Normal TeX LaTeX : %.... |
| 403 | " Documented TeX Format: ^^A... -and- leading %s (only) |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 404 | if !exists("g:tex_comment_nospell") || !g:tex_comment_nospell |
| 405 | syn cluster texCommentGroup contains=texTodo,@Spell |
| 406 | else |
| 407 | syn cluster texCommentGroup contains=texTodo,@NoSpell |
| 408 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 409 | syn case ignore |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 410 | syn keyword texTodo contained combak fixme todo xxx |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 411 | syn case match |
| 412 | if b:extfname == "dtx" |
| 413 | syn match texComment "\^\^A.*$" contains=@texCommentGroup |
| 414 | syn match texComment "^%\+" contains=@texCommentGroup |
| 415 | else |
Bram Moolenaar | fd2ac76 | 2006-03-01 22:09:21 +0000 | [diff] [blame] | 416 | if g:tex_fold_enabled |
| 417 | " allows syntax-folding of 2 or more contiguous comment lines |
| 418 | " single-line comments are not folded |
| 419 | syn match texComment "%.*$" contains=@texCommentGroup |
| 420 | syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold |
| 421 | else |
| 422 | syn match texComment "%.*$" contains=@texCommentGroup |
| 423 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 424 | endif |
| 425 | |
| 426 | " Separate lines used for verb` and verb# so that the end conditions {{{1 |
| 427 | " will appropriately terminate. Ideally vim would let me save a |
| 428 | " character from the start pattern and re-use it in the end-pattern. |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 429 | syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell |
Bram Moolenaar | c1e3790 | 2006-04-18 21:55:01 +0000 | [diff] [blame] | 430 | " listings package: |
| 431 | syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell |
| 432 | " moreverb package: |
| 433 | syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell |
| 434 | syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell |
| 435 | syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 436 | if version < 600 |
| 437 | syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" |
| 438 | syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" |
| 439 | else |
| 440 | if b:tex_stylish |
| 441 | syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" |
| 442 | else |
| 443 | syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>" |
| 444 | endif |
| 445 | endif |
| 446 | |
| 447 | " Tex Reference Zones: {{{1 |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 448 | syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup |
| 449 | syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup |
| 450 | syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 451 | syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup |
| 452 | syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup |
| 453 | syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup |
Bram Moolenaar | cc016f5 | 2005-12-10 20:23:46 +0000 | [diff] [blame] | 454 | syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite |
| 455 | syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup nextgroup=texRefOption,texCite |
| 456 | syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 457 | |
| 458 | " Handle newcommand, newenvironment : {{{1 |
| 459 | syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl |
| 460 | syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl |
| 461 | syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl |
| 462 | syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup |
| 463 | syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl |
| 464 | syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl |
| 465 | syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup |
| 466 | syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup |
| 467 | |
| 468 | " Definitions/Commands: {{{1 |
| 469 | syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl |
| 470 | if b:tex_stylish |
| 471 | syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl |
| 472 | syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl |
| 473 | else |
| 474 | syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl |
| 475 | syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl |
| 476 | endif |
| 477 | syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl |
| 478 | syn match texDefParm contained "#\d\+" |
| 479 | |
| 480 | " TeX Lengths: {{{1 |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 481 | syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 482 | |
| 483 | " TeX String Delimiters: {{{1 |
| 484 | syn match texString "\(``\|''\|,,\)" |
| 485 | |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 486 | " makeatletter -- makeatother sections |
| 487 | if !exists("g:tex_no_error") |
| 488 | syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained |
| 489 | syn match texStyleStatement "\\[a-zA-Z@]\+" contained |
| 490 | syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained |
| 491 | syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained |
| 492 | endif |
| 493 | |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 494 | " Conceal mode support (supports set cole=1) {{{1 |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 495 | if has("conceal") && &enc == 'utf-8' |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 496 | |
| 497 | " Math Symbols {{{2 |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 498 | if s:tex_conceal =~ 'm' |
| 499 | syn match texMathSymbol '\\approx\>' contained conceal cchar=≈ |
| 500 | syn match texMathSymbol '\\ast\>' contained conceal cchar=∗ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 501 | syn match texMathSymbol '\\because\>' contained conceal cchar=∵ |
| 502 | syn match texMathSymbol '\\bigcap\>' contained conceal cchar=∩ |
| 503 | syn match texMathSymbol '\\bigcup\>' contained conceal cchar=∪ |
| 504 | syn match texMathSymbol '\\bigodot\>' contained conceal cchar=⊙ |
| 505 | syn match texMathSymbol '\\bigoplus\>' contained conceal cchar=⊕ |
| 506 | syn match texMathSymbol '\\bigotimes\>' contained conceal cchar=⊗ |
| 507 | syn match texMathSymbol '\\bigsqcup\>' contained conceal cchar=⊔ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 508 | syn match texMathSymbol '\\bigtriangledown\>' contained conceal cchar=∇ |
| 509 | syn match texMathSymbol '\\bigvee\>' contained conceal cchar=⋁ |
| 510 | syn match texMathSymbol '\\bigwedge\>' contained conceal cchar=⋀ |
| 511 | syn match texMathSymbol '\\blacksquare\>' contained conceal cchar=∎ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 512 | syn match texMathSymbol '\\bot\>' contained conceal cchar=⊥ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 513 | syn match texMathSymbol '\\cap\>' contained conceal cchar=∩ |
| 514 | syn match texMathSymbol '\\cdot\>' contained conceal cchar=· |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 515 | syn match texMathSymbol '\\cdots\>' contained conceal cchar=⋯ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 516 | syn match texMathSymbol '\\circ\>' contained conceal cchar=∘ |
| 517 | syn match texMathSymbol '\\circledcirc\>' contained conceal cchar=⊚ |
| 518 | syn match texMathSymbol '\\cong\>' contained conceal cchar=≅ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 519 | syn match texMathSymbol '\\coprod\>' contained conceal cchar=∐ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 520 | syn match texMathSymbol '\\cup\>' contained conceal cchar=∪ |
| 521 | syn match texMathSymbol '\\diamond\>' contained conceal cchar=⋄ |
| 522 | syn match texMathSymbol '\\div\>' contained conceal cchar=÷ |
| 523 | syn match texMathSymbol '\\doteq\>' contained conceal cchar=≐ |
| 524 | syn match texMathSymbol '\\dotsb\>' contained conceal cchar=⋯ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 525 | syn match texMathSymbol '\\dotsc\>' contained conceal cchar=… |
| 526 | syn match texMathSymbol '\\dots\>' contained conceal cchar=… |
| 527 | syn match texMathSymbol '\\dotsi\>' contained conceal cchar=⋯ |
| 528 | syn match texMathSymbol '\\dotso\>' contained conceal cchar=… |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 529 | syn match texMathSymbol '\\emptyset\>' contained conceal cchar=∅ |
| 530 | syn match texMathSymbol '\\equiv\>' contained conceal cchar=≡ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 531 | syn match texMathSymbol '\\exists\>' contained conceal cchar=∃ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 532 | syn match texMathSymbol '\\forall\>' contained conceal cchar=∀ |
| 533 | syn match texMathSymbol '\\geq\>' contained conceal cchar=≥ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 534 | if &ambw == "double" |
| 535 | syn match texMathSymbol '\\gg\>' contained conceal cchar=≫ |
| 536 | else |
| 537 | syn match texMathSymbol '\\gg\>' contained conceal cchar=⟫ |
| 538 | endif |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 539 | syn match texMathSymbol '\\gtreqless\>' contained conceal cchar=⋛ |
| 540 | syn match texMathSymbol '\\gtrless\>' contained conceal cchar=≷ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 541 | syn match texMathSymbol '\\iiint\>' contained conceal cchar=∭ |
| 542 | syn match texMathSymbol '\\iint\>' contained conceal cchar=∬ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 543 | syn match texMathSymbol '\\Im\>' contained conceal cchar=ℑ |
| 544 | syn match texMathSymbol '\\in\>' contained conceal cchar=∈ |
| 545 | syn match texMathSymbol '\\infty\>' contained conceal cchar=∞ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 546 | syn match texMathSymbol '\\int\>' contained conceal cchar=∫ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 547 | syn match texMathSymbol '\\lceil\>' contained conceal cchar=⌈ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 548 | syn match texMathSymbol '\\ldots\>' contained conceal cchar=… |
| 549 | syn match texMathSymbol '\\leftarrow\>' contained conceal cchar=⟵ |
| 550 | syn match texMathSymbol '\\Leftarrow\>' contained conceal cchar=⟸ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 551 | syn match texMathSymbol '\\left(' contained conceal cchar=( |
| 552 | syn match texMathSymbol '\\left\[' contained conceal cchar=[ |
| 553 | syn match texMathSymbol '\\left\\{' contained conceal cchar={ |
| 554 | syn match texMathSymbol '\\leq\>' contained conceal cchar=≤ |
| 555 | syn match texMathSymbol '\\leq\>' contained conceal cchar=≤ |
| 556 | syn match texMathSymbol '\\lesseqgtr\>' contained conceal cchar=⋚ |
| 557 | syn match texMathSymbol '\\lfloor\>' contained conceal cchar=⌊ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 558 | if &ambw == "double" |
| 559 | syn match texMathSymbol '\\ll\>' contained conceal cchar=≪ |
| 560 | else |
| 561 | syn match texMathSymbol '\\ll\>' contained conceal cchar=⟪ |
| 562 | endif |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 563 | syn match texMathSymbol '\\mapsto\>' contained conceal cchar=↦ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 564 | syn match texMathSymbol '\\mid\>' contained conceal cchar=∣ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 565 | syn match texMathSymbol '\\mp\>' contained conceal cchar=∓ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 566 | syn match texMathSymbol '\\nabla\>' contained conceal cchar=∇ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 567 | syn match texMathSymbol '\\neq\>' contained conceal cchar=≠ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 568 | syn match texMathSymbol '\\nexists\>' contained conceal cchar=∄ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 569 | syn match texMathSymbol '\\ngeq\>' contained conceal cchar=≱ |
| 570 | syn match texMathSymbol '\\ngtr\>' contained conceal cchar=≯ |
| 571 | syn match texMathSymbol '\\nleq\>' contained conceal cchar=≰ |
| 572 | syn match texMathSymbol '\\nless\>' contained conceal cchar=≮ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 573 | syn match texMathSymbol '\\nmid\>' contained conceal cchar=∤ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 574 | syn match texMathSymbol '\\notin\>' contained conceal cchar=∉ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 575 | syn match texMathSymbol '\\nsim\>' contained conceal cchar=≁ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 576 | syn match texMathSymbol '\\odot\>' contained conceal cchar=⊙ |
| 577 | syn match texMathSymbol '\\oint\>' contained conceal cchar=∮ |
| 578 | syn match texMathSymbol '\\oplus\>' contained conceal cchar=⊕ |
| 579 | syn match texMathSymbol '\\oslash\>' contained conceal cchar=⊘ |
| 580 | syn match texMathSymbol '\\otimes\>' contained conceal cchar=⊗ |
| 581 | syn match texMathSymbol '\\partial\>' contained conceal cchar=∂ |
| 582 | syn match texMathSymbol '\\perp\>' contained conceal cchar=⊥ |
| 583 | syn match texMathSymbol '\\pm\>' contained conceal cchar=± |
| 584 | syn match texMathSymbol '\\prec\>' contained conceal cchar=≺ |
| 585 | syn match texMathSymbol '\\prod\>' contained conceal cchar=∏ |
| 586 | syn match texMathSymbol '\\propto\>' contained conceal cchar=∝ |
| 587 | syn match texMathSymbol '\\rceil\>' contained conceal cchar=⌉ |
| 588 | syn match texMathSymbol '\\Re\>' contained conceal cchar=ℜ |
| 589 | syn match texMathSymbol '\\rfloor\>' contained conceal cchar=⌋ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 590 | syn match texMathSymbol '\\rightarrow\>' contained conceal cchar=⟶ |
| 591 | syn match texMathSymbol '\\Rightarrow\>' contained conceal cchar=⟹ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 592 | syn match texMathSymbol '\\right)' contained conceal cchar=) |
| 593 | syn match texMathSymbol '\\right]' contained conceal cchar=] |
| 594 | syn match texMathSymbol '\\right\\}' contained conceal cchar=} |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 595 | syn match texMathSymbol '\\setminus\>' contained conceal cchar=∖ |
| 596 | syn match texMathSymbol '\\sim\>' contained conceal cchar=∼ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 597 | syn match texMathSymbol '\\sqcap\>' contained conceal cchar=⊓ |
| 598 | syn match texMathSymbol '\\sqcup\>' contained conceal cchar=⊔ |
| 599 | syn match texMathSymbol '\\subset\>' contained conceal cchar=⊂ |
| 600 | syn match texMathSymbol '\\subseteq\>' contained conceal cchar=⊆ |
| 601 | syn match texMathSymbol '\\subsetneq\>' contained conceal cchar=⊊ |
| 602 | syn match texMathSymbol '\\succ\>' contained conceal cchar=≻ |
| 603 | syn match texMathSymbol '\\sum\>' contained conceal cchar=∑ |
| 604 | syn match texMathSymbol '\\supseteq\>' contained conceal cchar=⊇ |
| 605 | syn match texMathSymbol '\\supsetneq\>' contained conceal cchar=⊋ |
| 606 | syn match texMathSymbol '\\surd\>' contained conceal cchar=√ |
| 607 | syn match texMathSymbol '\\therefore\>' contained conceal cchar=∴ |
| 608 | syn match texMathSymbol '\\times\>' contained conceal cchar=× |
| 609 | syn match texMathSymbol '\\to\>' contained conceal cchar=→ |
| 610 | syn match texMathSymbol '\\trianglelefteq\>' contained conceal cchar=⊴ |
| 611 | syn match texMathSymbol '\\trianglerighteq\>' contained conceal cchar=⊵ |
| 612 | syn match texMathSymbol '\\vartriangle\>' contained conceal cchar=∆ |
| 613 | syn match texMathSymbol '\\vdots\>' contained conceal cchar=⋮ |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 614 | syn match texMathSymbol '\\vee\>' contained conceal cchar=∨ |
| 615 | syn match texMathSymbol '\\wedge\>' contained conceal cchar=∧ |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 616 | endif |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 617 | |
| 618 | " Greek {{{2 |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 619 | if s:tex_conceal =~ 'g' |
| 620 | fun! s:Greek(group,pat,cchar) |
| 621 | exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar |
| 622 | endfun |
| 623 | call s:Greek('texGreek','\\alpha\>' ,'α') |
| 624 | call s:Greek('texGreek','\\beta\>' ,'β') |
| 625 | call s:Greek('texGreek','\\gamma\>' ,'γ') |
| 626 | call s:Greek('texGreek','\\delta\>' ,'δ') |
| 627 | call s:Greek('texGreek','\\epsilon\>' ,'ϵ') |
| 628 | call s:Greek('texGreek','\\varepsilon\>' ,'ε') |
| 629 | call s:Greek('texGreek','\\zeta\>' ,'ζ') |
| 630 | call s:Greek('texGreek','\\eta\>' ,'η') |
| 631 | call s:Greek('texGreek','\\theta\>' ,'θ') |
| 632 | call s:Greek('texGreek','\\vartheta\>' ,'ϑ') |
| 633 | call s:Greek('texGreek','\\kappa\>' ,'κ') |
| 634 | call s:Greek('texGreek','\\lambda\>' ,'λ') |
| 635 | call s:Greek('texGreek','\\mu\>' ,'μ') |
| 636 | call s:Greek('texGreek','\\nu\>' ,'ν') |
| 637 | call s:Greek('texGreek','\\xi\>' ,'ξ') |
| 638 | call s:Greek('texGreek','\\pi\>' ,'π') |
| 639 | call s:Greek('texGreek','\\varpi\>' ,'ϖ') |
| 640 | call s:Greek('texGreek','\\rho\>' ,'ρ') |
| 641 | call s:Greek('texGreek','\\varrho\>' ,'ϱ') |
| 642 | call s:Greek('texGreek','\\sigma\>' ,'σ') |
| 643 | call s:Greek('texGreek','\\varsigma\>' ,'ς') |
| 644 | call s:Greek('texGreek','\\tau\>' ,'τ') |
| 645 | call s:Greek('texGreek','\\upsilon\>' ,'υ') |
| 646 | call s:Greek('texGreek','\\phi\>' ,'φ') |
| 647 | call s:Greek('texGreek','\\varphi\>' ,'ϕ') |
| 648 | call s:Greek('texGreek','\\chi\>' ,'χ') |
| 649 | call s:Greek('texGreek','\\psi\>' ,'ψ') |
| 650 | call s:Greek('texGreek','\\omega\>' ,'ω') |
| 651 | call s:Greek('texGreek','\\Gamma\>' ,'Γ') |
| 652 | call s:Greek('texGreek','\\Delta\>' ,'Δ') |
| 653 | call s:Greek('texGreek','\\Theta\>' ,'Θ') |
| 654 | call s:Greek('texGreek','\\Lambda\>' ,'Λ') |
| 655 | call s:Greek('texGreek','\\Xi\>' ,'Χ') |
| 656 | call s:Greek('texGreek','\\Pi\>' ,'Π') |
| 657 | call s:Greek('texGreek','\\Sigma\>' ,'Σ') |
| 658 | call s:Greek('texGreek','\\Upsilon\>' ,'Υ') |
| 659 | call s:Greek('texGreek','\\Phi\>' ,'Φ') |
| 660 | call s:Greek('texGreek','\\Psi\>' ,'Ψ') |
| 661 | call s:Greek('texGreek','\\Omega\>' ,'Ω') |
| 662 | delfun s:Greek |
| 663 | endif |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 664 | |
| 665 | " Superscripts/Subscripts {{{2 |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 666 | if s:tex_conceal =~ 's' |
| 667 | syn region texSuperscript matchgroup=Delimiter start='\^{' end='}' contained concealends contains=texSuperscripts,texStatement |
| 668 | syn region texSubscript matchgroup=Delimiter start='_{' end='}' contained concealends contains=texSubscripts,texStatement |
| 669 | fun! s:SuperSub(group,leader,pat,cchar) |
| 670 | exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar |
| 671 | exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' |
| 672 | endfun |
| 673 | call s:SuperSub('texSuperscript','\^','0','⁰') |
| 674 | call s:SuperSub('texSuperscript','\^','1','¹') |
| 675 | call s:SuperSub('texSuperscript','\^','2','²') |
| 676 | call s:SuperSub('texSuperscript','\^','3','³') |
| 677 | call s:SuperSub('texSuperscript','\^','4','⁴') |
| 678 | call s:SuperSub('texSuperscript','\^','5','⁵') |
| 679 | call s:SuperSub('texSuperscript','\^','6','⁶') |
| 680 | call s:SuperSub('texSuperscript','\^','7','⁷') |
| 681 | call s:SuperSub('texSuperscript','\^','8','⁸') |
| 682 | call s:SuperSub('texSuperscript','\^','9','⁹') |
| 683 | call s:SuperSub('texSuperscript','\^','a','ᵃ') |
| 684 | call s:SuperSub('texSuperscript','\^','b','ᵇ') |
| 685 | call s:SuperSub('texSuperscript','\^','c','ᶜ') |
| 686 | call s:SuperSub('texSuperscript','\^','d','ᵈ') |
| 687 | call s:SuperSub('texSuperscript','\^','e','ᵉ') |
| 688 | call s:SuperSub('texSuperscript','\^','f','ᶠ') |
| 689 | call s:SuperSub('texSuperscript','\^','g','ᵍ') |
| 690 | call s:SuperSub('texSuperscript','\^','h','ʰ') |
| 691 | call s:SuperSub('texSuperscript','\^','i','ⁱ') |
| 692 | call s:SuperSub('texSuperscript','\^','j','ʲ') |
| 693 | call s:SuperSub('texSuperscript','\^','k','ᵏ') |
| 694 | call s:SuperSub('texSuperscript','\^','l','ˡ') |
| 695 | call s:SuperSub('texSuperscript','\^','m','ᵐ') |
| 696 | call s:SuperSub('texSuperscript','\^','n','ⁿ') |
| 697 | call s:SuperSub('texSuperscript','\^','o','ᵒ') |
| 698 | call s:SuperSub('texSuperscript','\^','p','ᵖ') |
| 699 | call s:SuperSub('texSuperscript','\^','r','ʳ') |
| 700 | call s:SuperSub('texSuperscript','\^','s','ˢ') |
| 701 | call s:SuperSub('texSuperscript','\^','t','ᵗ') |
| 702 | call s:SuperSub('texSuperscript','\^','u','ᵘ') |
| 703 | call s:SuperSub('texSuperscript','\^','v','ᵛ') |
| 704 | call s:SuperSub('texSuperscript','\^','w','ʷ') |
| 705 | call s:SuperSub('texSuperscript','\^','x','ˣ') |
| 706 | call s:SuperSub('texSuperscript','\^','y','ʸ') |
| 707 | call s:SuperSub('texSuperscript','\^','z','ᶻ') |
| 708 | call s:SuperSub('texSuperscript','\^','A','ᴬ') |
| 709 | call s:SuperSub('texSuperscript','\^','B','ᴮ') |
| 710 | call s:SuperSub('texSuperscript','\^','D','ᴰ') |
| 711 | call s:SuperSub('texSuperscript','\^','E','ᴱ') |
| 712 | call s:SuperSub('texSuperscript','\^','G','ᴳ') |
| 713 | call s:SuperSub('texSuperscript','\^','H','ᴴ') |
| 714 | call s:SuperSub('texSuperscript','\^','I','ᴵ') |
| 715 | call s:SuperSub('texSuperscript','\^','J','ᴶ') |
| 716 | call s:SuperSub('texSuperscript','\^','K','ᴷ') |
| 717 | call s:SuperSub('texSuperscript','\^','L','ᴸ') |
| 718 | call s:SuperSub('texSuperscript','\^','M','ᴹ') |
| 719 | call s:SuperSub('texSuperscript','\^','N','ᴺ') |
| 720 | call s:SuperSub('texSuperscript','\^','O','ᴼ') |
| 721 | call s:SuperSub('texSuperscript','\^','P','ᴾ') |
| 722 | call s:SuperSub('texSuperscript','\^','R','ᴿ') |
| 723 | call s:SuperSub('texSuperscript','\^','T','ᵀ') |
| 724 | call s:SuperSub('texSuperscript','\^','U','ᵁ') |
| 725 | call s:SuperSub('texSuperscript','\^','W','ᵂ') |
| 726 | call s:SuperSub('texSuperscript','\^','+','⁺') |
| 727 | call s:SuperSub('texSuperscript','\^','-','⁻') |
| 728 | call s:SuperSub('texSuperscript','\^','<','˂') |
| 729 | call s:SuperSub('texSuperscript','\^','>','˃') |
| 730 | call s:SuperSub('texSuperscript','\^','/','ˊ') |
| 731 | call s:SuperSub('texSuperscript','\^','(','⁽') |
| 732 | call s:SuperSub('texSuperscript','\^',')','⁾') |
| 733 | call s:SuperSub('texSuperscript','\^','\.','˙') |
| 734 | call s:SuperSub('texSuperscript','\^','=','˭') |
| 735 | call s:SuperSub('texSubscript','_','0','₀') |
| 736 | call s:SuperSub('texSubscript','_','1','₁') |
| 737 | call s:SuperSub('texSubscript','_','2','₂') |
| 738 | call s:SuperSub('texSubscript','_','3','₃') |
| 739 | call s:SuperSub('texSubscript','_','4','₄') |
| 740 | call s:SuperSub('texSubscript','_','5','₅') |
| 741 | call s:SuperSub('texSubscript','_','6','₆') |
| 742 | call s:SuperSub('texSubscript','_','7','₇') |
| 743 | call s:SuperSub('texSubscript','_','8','₈') |
| 744 | call s:SuperSub('texSubscript','_','9','₉') |
| 745 | call s:SuperSub('texSubscript','_','a','ₐ') |
| 746 | call s:SuperSub('texSubscript','_','e','ₑ') |
| 747 | call s:SuperSub('texSubscript','_','i','ᵢ') |
| 748 | call s:SuperSub('texSubscript','_','o','ₒ') |
| 749 | call s:SuperSub('texSubscript','_','u','ᵤ') |
| 750 | call s:SuperSub('texSubscript','_','+','₊') |
| 751 | call s:SuperSub('texSubscript','_','-','₋') |
| 752 | call s:SuperSub('texSubscript','_','/','ˏ') |
| 753 | call s:SuperSub('texSubscript','_','(','₍') |
| 754 | call s:SuperSub('texSubscript','_',')','₎') |
| 755 | call s:SuperSub('texSubscript','_','\.','‸') |
| 756 | call s:SuperSub('texSubscript','_','r','ᵣ') |
| 757 | call s:SuperSub('texSubscript','_','v','ᵥ') |
| 758 | call s:SuperSub('texSubscript','_','x','ₓ') |
| 759 | call s:SuperSub('texSubscript','_','\\beta\>' ,'ᵦ') |
| 760 | call s:SuperSub('texSubscript','_','\\delta\>','ᵨ') |
| 761 | call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ') |
| 762 | call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ') |
| 763 | call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ') |
| 764 | delfun s:SuperSub |
| 765 | endif |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 766 | |
| 767 | " Accented characters: {{{2 |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 768 | if s:tex_conceal =~ 'a' |
| 769 | if b:tex_stylish |
| 770 | syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 |
| 771 | syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 |
| 772 | else |
| 773 | fun! s:Accents(chr,...) |
| 774 | let i= 1 |
| 775 | for accent in ["`","\\'","^",'"','\~',"r","v"] |
| 776 | if i > a:0 |
| 777 | break |
| 778 | endif |
| 779 | if strlen(a:{i}) == 0 |
| 780 | let i= i + 1 |
| 781 | continue |
| 782 | endif |
| 783 | exe "syn match texAccent '\\\\".accent."{".a:chr."}' conceal cchar=".a:{i} |
Bram Moolenaar | e0021c7 | 2010-07-28 17:25:21 +0200 | [diff] [blame] | 784 | let i= i + 1 |
Bram Moolenaar | 4b22cdb | 2010-08-02 22:12:46 +0200 | [diff] [blame] | 785 | endfor |
| 786 | endfun |
| 787 | call s:Accents('a','à','á','â','ä','ã','å','ă') |
| 788 | call s:Accents('A','À','Á','Â','Ä','Ã','Å','Ă') |
| 789 | call s:Accents('C',"" ,'Ć','Ĉ',"" ,"" ,"" ,'Ć') |
| 790 | call s:Accents('e','è','é','ê','ë','ẽ',"" ,'ĕ') |
| 791 | call s:Accents('E','È','É','Ê','Ë','Ẽ',"" ,'Ė') |
| 792 | call s:Accents('i','ì','í','î','ï','ĩ',"" ,"ĭ") |
| 793 | call s:Accents('I','Ì','Í','Î','Ï','Ĩ',"" ,'Ĭ') |
| 794 | call s:Accents('o','ò','ó','ô','ö','õ',"" ,'ŏ') |
| 795 | call s:Accents('O','Ò','Ó','Ô','Ö','Õ',"" ,'Ŏ') |
| 796 | call s:Accents('r',"" ,'ŕ',"" ,"" ,"" ,"" ,'ř') |
| 797 | call s:Accents('R',"" ,'Ŕ',"" ,"" ,"" ,"" ,'Ř') |
| 798 | call s:Accents('s',"" ,'ś','ŝ',"" ,"" ,"" ,'š') |
| 799 | call s:Accents('S',"" ,'Ś','Ŝ',"" ,"" ,"" ,'Š') |
| 800 | call s:Accents('u','ù','ú','û','ü','ũ',"" ,'ŭ') |
| 801 | call s:Accents('U','Ù','Ú','Û','Ü','Ũ',"" ,'Ŭ') |
| 802 | call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',"" ,"" ) |
| 803 | call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',"" ,"" ) |
| 804 | delfun s:Accents |
| 805 | syn match texAccent '\\aa\>' conceal cchar=å |
| 806 | syn match texAccent '\\AA\>' conceal cchar=Å |
| 807 | syn match texAccent '\\k{a}' conceal cchar=ą |
| 808 | syn match texAccent '\\k{A}' conceal cchar=Ą |
| 809 | syn match texAccent '\\c{C}' conceal cchar=Ç |
| 810 | syn match texAccent '\\c{c}' conceal cchar=ç |
| 811 | syn match texAccent '\\\~{n}' conceal cchar=ñ |
| 812 | syn match texAccent '\\\~{N}' conceal cchar=Ñ |
| 813 | syn match texAccent '\\o\>' conceal cchar=ø |
| 814 | syn match texAccent '\\O\>' conceal cchar=Ø |
| 815 | syn match texAccent '\\H{o}' conceal cchar=ő |
| 816 | syn match texAccent '\\H{O}' conceal cchar=Ő |
| 817 | syn match texAccent '\\c{r}' conceal cchar=ŗ |
| 818 | syn match texLigature '\\AE\>' conceal cchar=Æ |
| 819 | syn match texLigature '\\ae\>' conceal cchar=æ |
| 820 | syn match texLigature '\\oe\>' conceal cchar=œ |
| 821 | syn match texLigature '\\OE\>' conceal cchar=Œ |
| 822 | syn match texLigature '\\ss\>' conceal cchar=ß |
| 823 | endif |
Bram Moolenaar | 611df5b | 2010-07-26 22:51:56 +0200 | [diff] [blame] | 824 | endif |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 825 | endif |
| 826 | |
| 827 | " --------------------------------------------------------------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 828 | " LaTeX synchronization: {{{1 |
| 829 | syn sync maxlines=200 |
| 830 | syn sync minlines=50 |
| 831 | |
| 832 | syn sync match texSyncStop groupthere NONE "%stopzone\>" |
| 833 | |
| 834 | " Synchronization: {{{1 |
| 835 | " The $..$ and $$..$$ make for impossible sync patterns |
| 836 | " (one can't tell if a "$$" starts or stops a math zone by itself) |
| 837 | " The following grouptheres coupled with minlines above |
| 838 | " help improve the odds of good syncing. |
| 839 | if !exists("tex_no_math") |
| 840 | syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}" |
| 841 | syn sync match texSyncMathZoneA groupthere NONE "\\end{center}" |
| 842 | syn sync match texSyncMathZoneA groupthere NONE "\\end{description}" |
| 843 | syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}" |
| 844 | syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}" |
| 845 | syn sync match texSyncMathZoneA groupthere NONE "\\end{table}" |
| 846 | syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}" |
| 847 | syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>" |
| 848 | endif |
| 849 | |
Bram Moolenaar | b2c0350 | 2010-07-02 20:20:09 +0200 | [diff] [blame] | 850 | " --------------------------------------------------------------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 851 | " Highlighting: {{{1 |
| 852 | if did_tex_syntax_inits == 1 |
| 853 | let did_tex_syntax_inits= 2 |
| 854 | " TeX highlighting groups which should share similar highlighting |
| 855 | if !exists("g:tex_no_error") |
| 856 | if !exists("tex_no_math") |
| 857 | HiLink texBadMath texError |
| 858 | HiLink texMathDelimBad texError |
| 859 | HiLink texMathError texError |
| 860 | if !b:tex_stylish |
| 861 | HiLink texOnlyMath texError |
| 862 | endif |
| 863 | endif |
| 864 | HiLink texError Error |
| 865 | endif |
| 866 | |
Bram Moolenaar | cc016f5 | 2005-12-10 20:23:46 +0000 | [diff] [blame] | 867 | HiLink texCite texRefZone |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 868 | HiLink texDefCmd texDef |
| 869 | HiLink texDefName texDef |
| 870 | HiLink texDocType texCmdName |
| 871 | HiLink texDocTypeArgs texCmdArgs |
| 872 | HiLink texInputFileOpt texCmdArgs |
| 873 | HiLink texInputCurlies texDelimiter |
| 874 | HiLink texLigature texSpecialChar |
| 875 | if !exists("tex_no_math") |
| 876 | HiLink texMathDelimSet1 texMathDelim |
| 877 | HiLink texMathDelimSet2 texMathDelim |
| 878 | HiLink texMathDelimKey texMathDelim |
| 879 | HiLink texMathMatcher texMath |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 880 | HiLink texMathZoneV texMath |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 881 | HiLink texMathZoneW texMath |
| 882 | HiLink texMathZoneX texMath |
| 883 | HiLink texMathZoneY texMath |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 884 | HiLink texMathZoneV texMath |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 885 | HiLink texMathZoneZ texMath |
| 886 | endif |
| 887 | HiLink texSectionMarker texCmdName |
| 888 | HiLink texSectionName texSection |
| 889 | HiLink texSpaceCode texStatement |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 890 | HiLink texStyleStatement texStatement |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 891 | HiLink texTypeSize texType |
| 892 | HiLink texTypeStyle texType |
| 893 | |
| 894 | " Basic TeX highlighting groups |
| 895 | HiLink texCmdArgs Number |
| 896 | HiLink texCmdName Statement |
| 897 | HiLink texComment Comment |
| 898 | HiLink texDef Statement |
| 899 | HiLink texDefParm Special |
| 900 | HiLink texDelimiter Delimiter |
| 901 | HiLink texInput Special |
| 902 | HiLink texInputFile Special |
| 903 | HiLink texLength Number |
| 904 | HiLink texMath Special |
| 905 | HiLink texMathDelim Statement |
| 906 | HiLink texMathOper Operator |
| 907 | HiLink texNewCmd Statement |
| 908 | HiLink texNewEnv Statement |
| 909 | HiLink texOption Number |
| 910 | HiLink texRefZone Special |
| 911 | HiLink texSection PreCondit |
| 912 | HiLink texSpaceCodeChar Special |
| 913 | HiLink texSpecialChar SpecialChar |
| 914 | HiLink texStatement Statement |
| 915 | HiLink texString String |
| 916 | HiLink texTodo Todo |
| 917 | HiLink texType Type |
| 918 | HiLink texZone PreCondit |
| 919 | |
| 920 | delcommand HiLink |
| 921 | endif |
| 922 | |
| 923 | " Current Syntax: {{{1 |
| 924 | unlet b:extfname |
| 925 | let b:current_syntax = "tex" |
Bram Moolenaar | 5aae419 | 2010-08-03 23:00:38 +0200 | [diff] [blame] | 926 | " vim: ts=8 fdm=marker ambw=double |