How to make Vim highlight Latex environments in Markdown

Viewed 571

I use pandoc a lot which means that I write with a mix of markdown and latex a lot. The problem is that I can't make Vim highlight Latex as it should, even though pandoc understands it.

For example, the following snipet

# Header 1

Variable $x_0$ is defined as
\begin{align}
x_0=y_0^2
\end{align}

If I name it test.md Vim only sees markdown and fails to highlight $x_0$ and the align environment. I can make the situation a little bit better if I follow this answer then I can at least make the $ $ highlighted.

As a quick workaround I found that by naming the file with a .Rmd extension I get the $ $ to work, although that isn't strictly correct I guess.

But so far I have not been able to get both Markdown Syntax and Latex syntax simultaneously. Is there a way that can be done?

PS: I'm really trying to avoid installing obscure Vim plugins that need Vundle etc in the name of portability!

1 Answers
Related