LaTeX、隐藏和奇怪的着色

Sco*_*ott 5 vim latex

我有 vim,并且喜欢 Tex 隐藏选项。具体来说,如果我let g:tex_conceal="sabgm"的 中有~/.vimrc,那么每当我输入 时$\beta$,我都会看到 β。但是,切换颜色主题后,我得到一些奇怪的输出:

不好的突出显示

Sco*_*ott 4

如此处所示,您 hi Conceal guibg=White guifg=Black的~/.vimrc.

良好的突出显示

编辑 2020-07-19我写了一篇题为“ Markdown、Liquid 和 MathJax 的 Vim 语法高亮显示”的博客文章。它介绍了一种为 Jekyll 提供 Latex 和 Liquid 突出显示的方法。仅适用于 Latex 非常容易:

# eg inside .vimrc
function! MathHighlight()
    "" Define certain regions
    " Block math. Look for "$$[anything]$$"
    syn region math start=/\$\$/ end=/\$\$/
    " inline math. Look for "$[not $][anything]$"
    syn match math_block '\$[^$].\{-}\$'

    "" Actually highlight those regions.
    hi link math Statement
    hi link liquid Statement
    hi link highlight_block Function
    hi link math_block Function
endfunction

" Call everytime we open a Markdown file
autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathHighlight()
Run Code Online (Sandbox Code Playgroud)