How to have straight single quotes in lstlistings
You need to load the textcomp
package and add upquote=true
to your \lstset
command. See §4.7 of the listings
documentation. Alternatively, you can simply load the upquote
package, which will make all verbatim quotes single quotes.
\documentclass{beamer}
\usepackage{listings}
\usepackage{textcomp}
\begin{document}
\lstset{language=Python,upquote=true}
\begin{frame}[fragile]{Code}
\begin{lstlisting}
print 'hi'
\end{lstlisting}
\end{frame}
\end{document}