%sublisting.tex
\documentclass[draft]{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[allowframebreaks]
\begin{itemize}
\item Here follows the source code of this document.
\item \lstinputlisting{sublisting.tex}
\item And now the same again, one level nested.
\begin{itemize}
\item
\lstinputlisting{sublisting.tex}
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
When compiling this document as a draft
, this yields the error
! LaTeX Error: Something's wrong--perhaps a missing \item.
Compiling without the draft
class option works perfectly fine, as well as just removing the second listing. The first, although exactly similar apart from its itemization nesting depth, always compiles without problems. Passing draft
to the class and final
to the listings
package also produces a valid document, but somewhat defeats the purpose of setting the option to star with.
Just the combination of nested itemization and \lstinputlisting
seems to break. Why is this? Can it be avoided?