In my presentation, I would like to have a listings environment that shows how to make a presentation.
So far I have found that, when using listings
in a presentation, we should pass the option fragile
to the frame we want use the listings
environment in.
I then thought that the following would work (compiling with lualatex):
\documentclass[lualatex]{beamer}
\usepackage{listings}
\lstset{language={[LaTeX]TeX}}
\begin{document}
\begin{frame}[fragile]{Minimum Working Example}
\begin{lstlisting}
\documentclass[lualatex]{beamer}
\begin{document}
\begin{frame}{I am the title of this slide!}
I am some body text.
\end{frame}
\end{document}
\end{lstlisting}
\end{frame}
\end{document}
This gives lua a panic attack:
PANIC: unprotected error in call to Lua API (object in use)
The first few latex errors are:
./test.tex:14: Missing } inserted.
} l.14 \end{frame}./test.tex:14: LaTeX Error: \begin{lstlisting} on input line 2 ended by \end{be amer@framepauses}.
./test.tex:14: Extra }, or forgotten \endgroup.
When commenting out the lines \begin{frame} ... \end{frame}
it compiles fine, as can be seen in the picture below.
Googling this I didn't get very far, mostly ending up on questions that had as answer that we should not forget to pass fragile
to the frame when using listings
.
The difference between those questions and this one is that I am trying to put a frame in a listing, besides having a listing in a frame.
pdflatex
andxelatex
with the same LaTeX error.