lstlisting
is not using the identifierstyle
font inside of the moredelim
that makes the identifier name red. In the example, the first varname
is in tt font but the second is in roman. I want the second varname
to also be in tt font but red. What am I doing wrong?
\documentclass{article}
\usepackage{listings}
\usepackage{color}
\lstset{
language=C++,
identifierstyle={\texttt},
moredelim=**[is][\color{red}]{@}{@},
}% lstset
\begin{document}
\begin{lstlisting}
varname
@varname@
\end{lstlisting}
\end{document}
moredelim=**[is][\color{red}\tt]{@}{@}
\tt
! Use\ttfamily
.