latex

Beamer fragile frames

If you want to include verbatim text, say for some program code, in a frame in beamer, you have to pass the fragile option to the frame, like so:

\begin{frame}[fragile]
\frametitle{a fragile frame}
\begin{verbatim}
some verbatim text here
\end{verbatim}
\end{frame}

Though latex usually doesn’t really care about whitespace at the beginning of a line, in this case it does. If you don’t have your begin and end frame statements at the beginning of a line when you are trying to use the fragile option, your document will not compile. It’s frustrating.

p.s. also note that you can’t use verbatim text with overlays in beamer.