I want to typeset some LaTeX source code by listings. I've tried this:
\documentclass{article}
\usepackage{listings}
\usepackage{xcolor}
\lstset{
delim = [s][\ttfamily\color{orange}]{$}{$}
}
\begin{document}
\begin{lstlisting}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$E = mc^2$
\end{document}
\end{lstlisting}
\end{document}
The equation turns orange. However, the two dollar signs are also highlighted as orange. If I just want contents in the two dollar signs turns orange, what should I do?