# Insert raw LaTeX between beamer slides, using pandoc markdown

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.

• Although this is an old question and you probably found a way around it, have you tried -----------------------? – E_net4 Feb 14 '15 at 16:49
• Did you find a solution here? – Richard Herron May 15 '15 at 16:35
• @Richard, sorry, I never did find a fix. I had this problem in just one line in the document, for the appendix, so I just edited it after converting to tex, before building the pdf. I bet you could do a sed command in a makefile. But for that matter there's probably way to use a pandoc filter. – askewchan May 15 '15 at 19:51

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!

Op's code

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

Some stuff

\appendix

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

More stuff


produces, with pandoc inputfile.MD -t beamer,

\begin{frame}{First Frame}

Some stuff

\appendix

\end{frame}

\begin{frame}{Appendix Frame}

More stuff

\end{frame}


But with the following,

# First Frame

Some stuff

# Appendix Frame {.unnumbered}

More stuff


you get

\begin{frame}{First Frame}

Some stuff

\end{frame}

\begin{frame}{Appendix Frame}

More stuff

\end{frame}


I guess this answer solves only the surface of OP's original question, but without further information, it's hard to tell. Do you need any feature of the appendix environment?

• At first glance, your final output looks the same as what my original code would give if I just left off the \appendix line. I don't see any effect from {.unnumbered} in the tex output. – askewchan Feb 22 '16 at 14:06
• By the way, for context, my goal was to have the appendix slides being appended to the end of the presentation as backup slides, without being visible or included in the toc, outline, navigation, slide count, etc. They should be invisible to the audience unless I proceed past the last slide. – askewchan Feb 22 '16 at 14:10