Markdown 中的 Vim 语法和 Latex 数学 [英] Vim syntax and Latex math inside markdown
问题描述
我使用 ViM 在 Markdown 中编写文档,我还使用 Latex $$
符号(我使用 pandoc 进行编译)进行数学运算.问题是 ViM 语法不会忽略美元符号内的下划线 _
,这很烦人.例如,如果我写这个:
I write documentation in markdown using ViM and I also put math using the latex $$
symbol (I compile using pandoc). The thing is that ViM syntax wouldn't ignore the underscores _
inside the dollar symbols and it is pretty annoying. For instance if I write this:
$$ a_1 = 0 $$
由于使用了下划线,Vim 会将以下所有文本高亮显示为斜体.
Then Vim will highlight all the following text as italics due to to the underscore used.
我该如何改变?
如果我能用不同的格式突出显示 $
里面的内容就好了.
Also it would be nice if I could highlight what's inside $
with a different format.
推荐答案
我已将这些行放在我的 .vimrc 中.它适用于同一行的内联数学和块模式数学.
I have put these lines in my .vimrc. It works for inline math on the same line and block-mode math.
" This gets rid of the nasty _ italic bug in tpope's vim-markdown
" block $$...$$
syn region math start=/$$/ end=/$$/
" inline math
syn match math '$[^$].{-}$'
" actually highlight the region we defined as "math"
hi link math Statement
我已经写了一篇名为 针对 Markdown、Liquid 和 MathJax 的 Vim 语法高亮显示.
这篇关于Markdown 中的 Vim 语法和 Latex 数学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!