How to make a real apostrophe or single-quote in LaTeX
Use the upquote
package; even if the package documentation doesn't mention alltt
, it works also with it:
\documentclass{article}
\usepackage{alltt}
\usepackage{upquote}
\usepackage{color}
\usepackage{fullpage}
\begin{document}
\begin{center}
\LARGE hello.py
\end{center}
\begin{alltt}
{\color{red}print} 'hello world'
\end{alltt}
\end{document}
Notice some modifications to the input.