I'm using the following command in a LaTeX file to explicitly call a style file:


Unfortunately emacs detects this as me entering math mode, but the latex interpreter doesn't complain because it understands the context.

This is more of an annoyance than anything since it turns my entire base tex file a single color defeating the purpose of color syntax highlighting.

Does anyone know a piece of elisp i could use to either alter latex mode or my .emacs file? Alternatively does anyone know of a way to "escape" the behavior of the $ symbol yet still get the interpreter to understand that this is an env variable?

  • An that compiles with LaTeX? Commented Oct 1, 2011 at 2:34
  • @AlexE.: Emacs highlights $...$ groups by means of syntactic fontification and, therefore, treats them in the same way as comments and strings. You can turn off syntactic fontification as a whole by setting font-lock-keywords-only to t, but this is normally not a good option.
    – mhp
    Commented Oct 1, 2011 at 22:01

1 Answer 1


According to www.gnu.org/software/auctex/manual/auctex/Known-problems.html, this “color bleed” can be remedied by inserting a commented dollar sign (%$) at the next suitable end of line.

  • 2
    We discourage answers that simply link to another website. Could you edit this to include the details of the remedy. Namely this: "you can insert a commented dollar sign (%$) at the next suitable end of line as a quick workaround. "
    – Seamus
    Commented Oct 1, 2011 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .