I am editing LaTeX code such as:


Blah blah Blah blah

      \textrm{Symbol} & Explanation
      x & Pronounced ``ex''

Bleh bleh Bleh bleh


The problem seems to be caused by \begin{tabular}{>{$}l<{$}p{4in}}. The purpose of the first dollar sign is to put the processing of column 1 content into math mode. The purpose of the second dollar sign is to exit math mode before proceeding to process column 2 content.

The syntax colour seems to be tripping on the dollar signs in \begin{tabular}{>{$}l<{$}p{4in}} and not recognizing the closing curly braces. As a result, all text coming afterward is highlighted purple (image below). I can't concentrate on my writing.

As per one answer, I tried inserting the %stopzone command to force recognition of the closing of math mode. For some reason, it doesn't seem to have any effect.

  • Can someone reproduce this lack of effect of %stopzone? That might go a long way toward tracking down the problem.

  • Is there anything I can do to correct the interpretation of the dollar signs by syntax highlighting? I am using Cygwin's Gvim 8.2.0486-1.

enter image description here


1 Answer 1


Is there anything I can do to correct the interpretation of the dollar signs by syntax highlighting?

Out of the box, so far as I know: No. However, you can use the special "TeX comment" %stopzone to stop the mathzones. In this particular case, you need multiple comments, so this should work:


This is clearly not perfect, but it does at least partly solve the problem.

Another solution is to install a different syntax plugin for LaTeX. VimTeX is a filetype and syntax plugin, and it has support for this particular kind of TeX syntax. There may also be other plugins available, but I am not aware of any where this particular issue is resolved.

Edit: Answer updated according to suggestions from the comments.

  • Wow, VimTeX can actually cope with that syntax? That's really awesome! I'd actually suggest rephrasing the answer and indicating that installing VimTeX solves this issue (and, in any case, it's a great idea for writing TeX/LaTeX using Vim.) I was thinking of this question and I realized another issue here is that the column itself will not be highlighted in math context... In this example, it's only x, but with more complex expressions that might be an issue too. I guess that's a limitation even VimTeX can't (or currently won't) fix, correct?
    – filbranden
    Commented May 22, 2021 at 17:44
  • 1
    @Karl Yngve Lervåg: Thanks for point out %stopzone. Unfortunately, it doesn't work for me (2nd picture posted at the end of the question). I will carefully mull over VimTeX. Getting spun up on a whole new way of doing things is not something to be taken lightly at this point (in fact, isn't feasible for me at this point). Commented May 23, 2021 at 0:39
  • I found that I can get away with using three separate consecutive lines of %stopzone. Having them on one line like %stopzone %stopzone %stopzone doesn't work. Having a space after the % symbol doesn't work. As you said, it's not ideal, but it will work in a pinch. Can you please update your answer with this detail? Thanks! Commented May 23, 2021 at 18:39
  • 1
    I've rephrased the answer as suggested in the comments. OP: You should know that it is possible to use VimTeX pretty much as a plug-and-play plugin. It should not cost you much time if you don't want to spend time learning the various features. @filbranden Yes, you're right that the columns should preferably be highlighted in math mode, but capturing that seems way too difficult to parse. Commented May 24, 2021 at 8:40
  • @Karl Yngve Lervåg: Thanks. I will keep it in mind. It never hurts to have another Vim capability up one's sleeve. Commented May 24, 2021 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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