In the preamble of my document, I put the following command to allow strings wrapped with < and > printed as italic-styled comment:
\lstset{morecomment=[s]{<}{>},commentstyle=\rmfamily\itshape}
And according to my understanding of the documentation of listings package, if I want to temporarily disable this delimiter, I should use deletecomment=[s]{<}{>} as optional argument of a particular lstlisting environment:
\begin{lstlisting}[deletecomment=[s]{<}{>}]
\lstset{morecomment=[s]{<}{>},commentstyle=\rmfamily\itshape}
\end{lstlisting}
But LaTeX issued an error because of this.
So what is the correct way to disable a comment delimiter?
Here is a MWE:
\documentclass[a4paper]{article}
\usepackage{listings}
\lstset{morecomment=[s]{<}{>},commentstyle=\rmfamily\itshape}
\begin{document}
\begin{lstlisting}[deletecomment=[s]{<}{>}]
<text>
\end{lstlisting}
\end{document}
