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