6

I have the following definitions in a .tex file preamble:

\newcommand{\beq}{\begin{eqnarray}}
\newcommand{\eeq}{\end{eqnarray}}

If I then use \beq and \eeq to define an equation array region, spell checking is turned on in this region, where it would not be if I had used \begin{eqnarray} and \end{eqnarray}. I tried to turn off spell-checking in these custom regions using the method presented here, i.e. copy the $VIMRUNTIME/syntax/tex.vim file to ~/.vim/syntax and edit the file. I added a line like

syn region texZone start="\\beq" end="\\eeq\|%stopzone\>" contains=@NoSpell

to the file, but it didn't work. I am very unfamiliar with Vim syntax files, so I don't know how to debug this or take further steps. Any thoughts on how to turn off spell check just in my custom region would be appreciated.

4

By placing that line by itself in ~/.vim/after/syntax/tex.vim instead of adding it to a copy of $VIMRUNTIME/syntax/tex.vim in ~/.vim/syntax/tex.vim, the spell checking behavior was disabled between \beq and \eeq tags as I wanted. Unfortunately, this line doesn't tell Vim it's a math region, so math syntax highlighting is different between these tags than it is between \begin{eqnarray} and \end{eqnarray} tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.