I am using lstlisting to add shell code into my tex document. The shell code contains special character, $. Emacs assumes it as a Math mode mark & all characters that come after dollar symbol are shown in math-mode and latex keywords are n't highlighted in their normal bright green color. It looks like this, enter image description here

I use AUCTeX.

  • Do you have file parsing enabled? In that case you don't have to manually add lstlisting to LaTeX-verbatim-environments manually.
    – giordano
    Commented Apr 7, 2015 at 15:27

1 Answer 1


Add "lstlisting" to LaTeX-verbatim-environments (using M-x customize-variable) and reopen your file.

courtesy: s.overflow

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.