Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latex syntax highlighting bug #2928

Closed
williamstein opened this issue Nov 13, 2014 · 2 comments
Closed

Latex syntax highlighting bug #2928

williamstein opened this issue Nov 13, 2014 · 2 comments

Comments

@williamstein
Copy link
Contributor

A user (of https://cloud.sagemath.com) reported to me that the syntax highlighting of the following two blocks should be identical in tex mode (text/x-stex), but they are not:

Block 1:

\begin{verbatim}
$foo
\end{verbatim}
blah

Block 2:

\begin{verbatim}
\$foo
\end{verbatim}
blah

It's easy to replicate this problem at http://codemirror.net/mode/stex/index.html

In practice this issue is quite serious because "blah" above could be pages of the rest of the document, and it all turns blue (say), when it shouldn't be.

I tested ACE (which is used by https://www.sharelatex.com) and it has a similar bug...

@marijnh
Copy link
Member

marijnh commented Nov 21, 2014

TeX is a pretty horrible language to write editor modes for, since commands can define their own syntax, and there's no robust way to see, for example, which pieces of text are verbatim, and ignore commands in them. Just special-casing \begin{verbatim} isn't much of a solution (the various listing modules will all have a similar problem).

One kludge would be to disable math mode when a blank line is encountered. It wouldn't fix your example, but at least it'd prevent screwing up the highlighting of the whole remaining file in this situation. Does that sound like it'd help?

@williamstein
Copy link
Contributor Author

Yes - that would be a major improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants