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 Apr 7 '15 at 15:27

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, privacy policy and cookie policy

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