The problem is, when i set the fontfamiliy to \ttfamily with basicstyle = \ttfamily, then the syntax isn't highlighted any more.
This are the settings for the package:
Code: Select all
\usepackage{listings} \lstset{numbers=left, numberstyle=\tiny, numbersep=5pt} \lstset{language=Python}
\lstset{basicstyle = \ttfamily, captionpos=b}
Code: Select all
\begin{lstlisting}[caption=if example]{ifexample}
a = 5
if a == 5:
print a
elif a < 5 :
print a + 1
else:
print a + 2
\end{lstlisting}