[Tex/LaTex] Insert raw LaTeX between beamer slides, using pandoc markdown

beamerpandoc

I'd like to insert some raw latex (in my case \appendix) between two frames in a beamer presentation. Normally, any latex code in the markdown document is passed through into the final .tex document, but it is placed within the frame.

My input:

First Frame
===========

Some stuff

\appendix

Appendix Frame
==============

More stuff

Output:

\begin{frame}{First Frame}

Some stuff

\appendix

\end{frame}

\begin{frame}{Appendix Frame}

More stuff

\end{frame}

And my desired output is to have the \appendix come after the first \end{frame}. Is there a way to explicitly end the frame environment? Of course adding \end{frame} to the markdown file leaves me with two \end{frame} lines in the tex file.

Best Answer

I found a workaround (Pandoc 3.2.1)

Define the following command...

\newcommand{\appendixworkaround}{
   \end{frame}
   \appendix
   \begin{frame}<0| handout:0>}

...and use it normally

    ## Final frame

    Bye.

    \appendixworkaround

    ## My Appendix

    Hello!

This will generate matching begin-end frame environments and hide the extra frame it creates with <0| handout:0>.

hth!