So on one of my pc's the vim install dos not recognize math environments such as align
and equation
Is there a way to turn this on?
editorsmath-modesyntax highlightingvim
So on one of my pc's the vim install dos not recognize math environments such as align
and equation
Is there a way to turn this on?
Best Answer
Check if the syntax highlighting rules are up to date. Those should be located under
/usr/share/vim/vim80/syntax/tex.vim
. In this file there should be a block nameStandard Math Zones:
. Below that you'll find some lines stating something like:To this block add the environments you find missing. E.g., for
align
use:If there is no starred form of the environment you want to add, use
instead.
But perhaps you shouldn't make those changes system wide but on a per user basis. So create a copy of the file in
/usr/share/...
paste it in a folder in $HOME where vim finds it and make those changes there.If the syntax highlighting is correct on the other machines, maybe copy the files from there to your machine where it fails to highlight correctly.
The default folder for the per-user-basis syntax highlighting would be something like
~/.vim/syntax/
. If it doesn't exist, create it and everything should work.EDIT: Perhaps a better approach is to create a short custom syntax file which sources the system wide one in the beginning and add some stuff there. The setup would then be the following file
~/.vim/syntax/tex.vim
:In the above I've also added
\autoref
to the list of known commands for referencing stuff as an example.I think this should be a better approach since you get bugfixes and new features from updates in your system wide file this way.
Alternatively (but with the same effects) put the file in
~/.vim/after/syntax/
and remove the first line (that's what is suggested in:help latex-syntax
).