# How to make AUCTeX ignore syntax highlighting within environment

I have a problem with syntax highlighting in the Emacs editor using AUCTeX. The problem occurs in particular with the Verbatim environment from the fancyvrb package. Consider the following code:

\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\begin{Verbatim}
$USER } \end{Verbatim} \end{document} This produces the following screenshot: The problem seems to be the$ sign in the Verbatim environment, and AUCTeX believes that I have entered some math code that I have not yet terminated with an ending $sign.. Is there a way to tell AUCTeX to ignore syntax highlighting within a particular environment? • You can insert " %$" after \end{Verbatim} to fix the syntax highlight for the rest of the text. But that's not a solution, not even a workaround (because the syntax highlight is still broken in the verbatim environment). – T. Verron Apr 29 '13 at 7:07

Here's what I add to my Preferences.el file (the .emacs equivalent for Aquamacs):

(setq LaTeX-verbatim-environments-local '("Verbatim" "lstlisting"))

This makes Verbatim and lstlisting behave like verbatim

• Is it possible to obtain the same result with what included in \Sexpr{}? – Francesco Sep 20 '13 at 0:32
• @Francesco Sorry, but my knowledge of the Emacs arcana is not so deep. Maybe you can ask a fresh question. – egreg Sep 20 '13 at 8:55
• Is there some similar setting for \verb|\$foo|? – NobbZ Feb 16 '16 at 20:22
• OK, found it myself. The list one has to set is LaTeX-verbatim-macros-with-delims-local – NobbZ Feb 16 '16 at 20:24

M-x font-lock-mode

will disable syntax highlighting