9

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.

3
  • Although this is an old question and you probably found a way around it, have you tried -----------------------? Feb 14, 2015 at 16:49
  • 1
    Did you find a solution here? May 15, 2015 at 16:35
  • 1
    @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, 2015 at 19:51

2 Answers 2

4

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!

2
  • this doesn't work -- \appendix still gets inserted before \end{frame}
    – invictus
    Aug 31, 2020 at 12:55
  • This approach works for me if I put the \end{frame} \appendix \begin{frame}<0| handout:0> directly into the presentation markdown itself, but not if I try to abstract it into a command like you've done here. I'm getting an error for unbalanced groups at line where \appendixworkaround is called (Extra }, or forgotten \endgroup.). I'm guessing that this has to do with some subtleties of TeX expansion that are over my head. Does this command work for you as written here? Any thoughts on what's different for me? (Pandoc 2.9.1.1, pdflatex 3.14159265-2.6-1.40.20) Nov 30, 2020 at 8:49
0

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?

2
  • 1
    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, 2016 at 14:06
  • 2
    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, 2016 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .