[Tex/LaTex] Appendixify: Move selected slides to appendix in Beamer

appendicesbeamernavigationsectioningwrite

When working with Beamer I often have slides that I initially write in the body of the presentation, then decide they should be consigned to an appendix. This is also useful when reapplying slides from a long talk to a briefer occasion. Effectively, though, this results in an appendix whose sections parallel the body of the talk.

Cutting and pasting a slide from the body TeX loses the cohesion of the sections there. It would be nicer to be able to mark some slides as appendix slides, and let a macro rebuild the section structure in the appendix to parallel.

Thus:

\documentclass{beamer}
\usepackage{appendixify}
\begin{document}

\section{Hello world}
\begin{frame}{1}\end{frame}
\appendixify{\begin{frame}{2}\end{frame}}
\begin{frame}{3}\end{frame}

\section{Farewell world}
\appendixify{\begin{frame}{4}\end{frame}}
\begin{frame}{5}\end{frame}

\appendix
\appendixified
\end{document}

should render as if it were:

\documentclass{beamer}
\begin{document}

\section{Hello world}
\begin{frame}{1}\end{frame}
\begin{frame}{3}\end{frame}

\section{Farewell world}
\begin{frame}{5}\end{frame}

\appendix

\section{Hello world}
\begin{frame}{2}\end{frame}

\section{Farewell world}
\begin{frame}{4}\end{frame}

\end{document}

Ideally, this macro might also generate navigation widgets to flip from a section to the corresponding appendix section, and back again; or flag that there is one or more appendix slide following a particular body slide by providing a link to them, thus allowing the presenter to optionally detour via the appendix deck. (Obviously there will be some side-effects like macro references will reflect the state at the time of appendix, not the place of insertion.)

I have attempted to implement a macro to write marked content to an auxiliary file — or to keep them in memory — then reproduce them in the appendix (not worrying about reproducing the document structure). But – alas! – I am defeated, and would love to see someone else contribute this feature, or give me the building blocks to do so myself. (The chief building block I am missing is writing content verbatim to a file.)

Best Answer

The beamersubframe package provides a convenient way to move frames to the backup without moving the actual code around:

\documentclass{beamer}

\usepackage[append]{beamersubframe}

\begin{document}

\begin{frame}
    abc
\end{frame} 

\begin{subframe}
    moved to appendix
\end{subframe}

\begin{frame}
    abc
\end{frame} 

\appendix

\appendsubframes
\end{document}

For section navigation etc. the one from the parent section will be shown on the "appendixified" frames.

For detailed information on creating convenient navigation to and from the appended frames, please see the package documentation.