I have most of the code in Python, which renders very nice with this simple configuration of lstlisting
At a certain point I have to include an XML file, so I switched to language=XML
but it renders ugly with the default charset so I added also basicstyle=\ttfamily
. Now I don't know how to switch back to default style after that.
\documentclass{article}
\usepackage{listings}
\lstset{tabsize=2, language=Python, breaklines=true,
breakatwhitespace=true, xleftmargin=.25in}
\begin{document}
%some python listings here
%XML listing
\lstset{language=XML, basicstyle=\ttfamily}
\begin{lstlisting}
<XML></XML>
\end{lstlisting}
%what do I put here?
%python listings again
\begin{lstlisting}
for i in python:
pass
\end{lstlisting}
\end{document}
Best Answer