When global listings
styles have been defined identifiers are coloured differently from numbers even if no language is in effect. How can this be avoided?
\documentclass{minimal} \usepackage{listings} \usepackage{xcolor} \lstset{identifierstyle=\color{purple}} \begin{document} \lstset{language=} \begin{lstlisting} 123 hello world 456 \end{lstlisting} \end{document}
Best Answer
As @jubobs commented, Listings treats language and style separately.
"string in quotation marks"
and//comment after double slashes
.Go back to your question, a stylish setting is permanent unless you issue another stylish setting or the current group terminates. Similarly, a language assignment is permanent unless you assign another language, the current group terminates, or you issue a stylish setting that contains a language assignment.
In conclusion, perhaps the most systematic way to manage both language and style is to define an exhaustive style that contains a language assignment together with its associated stylish setting. (Just like a language-IDE pair.) And now you can switch between
IDEsstyles and the no-style-at-all style.