LaTeX, conceal and weird coloring

latex, vim

Solution

As found here, you have to have ` hi Conceal guibg=White guifg=Black` (or similar) in your `~/.vimrc`.

edit 2020-07-19 I've since written a blog post titled "Vim syntax highlighting for Markdown, Liquid and MathJax." It walks through a method to provide Latex and Liquid highlighting for Jekyll. It's pretty easy to adapt for only 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()

Problem

I have vim, and like the Tex conceal option. Specifically, if I have `let g:tex_conceal="sabgm"` in my `~/.vimrc`, whenever I type `$\beta$`, I see β. But, after switching color themes, I get some weird output:

Original source