0

The underscores and carrots are highlighted red which is really an eyesore. How can I change/remove this?

enter image description here

The plugin works fine, so I don't think it's an installation issue.

Update for more details:

Vim 8.1, I doubt I have any conflicting plugins. I have a tex.vim file located at /usr/local/share/vim/vim81/syntax/.

  • Which vim version are you using and do you have any other plugins that could come into conflict with the LaTeX plugin? – Loïc Nov 25 '19 at 23:37
0

If you're running on a Unix-based system, you should have a file called ~/.vim/syntax/tex.vim. (I do not know where to find it on Windows). You can find the math-mode syntax configuration in the Math Zones sections. According to your screenshot the other math environments do not have the same issue. You may be able to fix that by looking for a working environment such as displaymath for example and add similar entries for align.

Another more brutal method is to disable the error highlighting for TeX files. It can be done by adding the following in your .vimrc file:

let g:tex_no_error=1

Here the documentation provided by :h g:tex_no_error:

                                       *tex-error* *g:tex_no_error*
 Tex: Excessive Error Highlighting? ~

The <tex.vim> supports lexical error checking of various sorts.  Thus,
although the error checking is ofttimes very useful, it can indicate
errors where none actually are.  If this proves to be a problem for you,
you may put in your <.vimrc> the following statement: >
        let g:tex_no_error=1
and all error checking by <syntax/tex.vim> will be suppressed.
  • I have no such file, in fact there is not even a syntax folder. I do have such a file in /usr/local/share/vim/vim81/syntax/ (I compile vim from source). However, I see no mention of align in that file. – Peter Mitrano Nov 26 '19 at 0:41
  • You must have it somewhere, otherwise Vim won't be able to do special highlighting for the align environment. Have you tried the second approach I proposed? – Loïc Nov 26 '19 at 9:16
0

Adding the following line fixed the problem:

...
439 call TexNewMathZone("C","equation",1)
440 call TexNewMathZone("D","math",1)
441 call TexNewMathZone("E","align",1) % <---- this is the new line
...

No idea why I had to do this. Seems like it should be part of this by default.

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.