TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
An that compiles with LaTeX? – Peter Grill Oct 1 '11 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 Oct 1 '11 at 22:01

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.

share|improve this answer
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 Oct 1 '11 at 17:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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