aar*_*ren 5 vim markdown multimarkdown vim-syntax-highlighting
我正在尝试改进 Markdown 文档中数学的语法突出显示。
Multimarkdown 使用括号\\[ .. \\]和\\( .. \\)分别表示显示和内联数学。我想用 TeX 突出显示这些内容。
这是我到目前为止所得到的:
syntax include @tex syntax/tex.vim
syn region displaymaths matchgroup=mkdMaths start = "\\\\\[" end="\\\\\]" contains=@tex
syn region inlinemaths matchgroup=mkdMaths start = "\\\\(" end="\\\\)" contains=@tex
hi def link mkdMaths SpecialComment
Run Code Online (Sandbox Code Playgroud)
问题是括号内的内容没有被 tex.vim 提取为数学,因为它没有包含在$ .. $. 有没有办法解决这个问题?我认为我想在这里使用的是syntax/tex.vim 中的texMath 组。
有什么方法可以强制将括号的内容解释为 Tex 数学吗?
为:syntax include @tex syntax/tex.vim您提供了一个@tex在包含 Tex 的区域中使用的语法簇,但您实际上想要引用 tex.vim 中存在的特定簇@texMathZoneGroup。
由于没有语法簇的嵌套,因此您可以直接通过 引用它contains=@texMathZoneGroup。