# beamer's ignorenonframetext option and \AtEndDocument

The following code example produce an error when compiling it with pdflatex:

\documentclass[ignorenonframetext]{beamer}
\AtEndDocument{\begin{frame}{Last page}Last page\end{frame}}
\begin{document}
\begin{frame}{Test document}Test\end{frame}
\end{document}


Output of pdflatex beamer_test.tex (with Ctrl+C and a x as input to quit the compilation):

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2])
*^C! Interruption.
<*>

? x


On the other hand, if I remove the ignorenonframetext option, everything works fine.

Now the issue is that in my real setting, the option gets produced by pandoc (using pandoc -s -t beamer -o beamer_test.pdf -V theme:mytheme beamer_test.md), and the \AtEndDocument command is in the outer part of my_theme (to mimick a powerpoint based theme with a fixed last page). I haven't found a pandoc option to get rid of the option.

For what is worse, here are a minimal markdown document and beamer theme that trigger the issue with the command line above:

beamerthememytheme.sty

\AtEndDocument{\begin{frame}{Last page}Last page\end{frame}}


beamer_test.md

# Test document

test


Is there a way to make mytheme work with pandoc, without removing -s and providing my own preamble (otherwise, I can as well stick with LaTeX all along)?

To ignore the ignore option, you could try to add \beamer@ignorenonframefalse in your beamerthememytheme.sty or

\makeatletter
\beamer@ignorenonframefalse
\makeatother


in the preamble of your document.

\documentclass[ignorenonframetext]{beamer}

\makeatletter
\beamer@ignorenonframefalse
\makeatother

\AtEndDocument{\begin{frame}{Last page}Last page\end{frame}}
\begin{document}
\begin{frame}{Test document}Test\end{frame}
\end{document}


Just tested with pandoc. A beamerthememytheme.sty with

\beamer@ignorenonframefalse
\AtEndDocument{\begin{frame}{Last page}Last page\end{frame}}


seems to work and produces both the normal frame and the end frame.