2

I am trying to use a section at the end of a presentation without any frames for it as shown in the following MWE:

\documentclass{beamer}

\begin{document}

\begin{frame}{TOC}
\tableofcontents
\end{frame}

\section{The first section}

\begin{frame}
Some text.
\end{frame}

\section{The second section}

\end{document}

This produces a TOC which only consists of the The first section. I want to get a TOC which additionally shows The second section.

I could use a dummy frame for the second section of course, but is there any way to avoid adding a frame for the second section?

epR8GaYuh
  • 2,432

1 Answers1

4

Based on https://tex.stackexchange.com/a/10297/36296

The problem is that without another page following, the content is not written to the toc file. You can circumvent the problem like this:

\documentclass{beamer}

\makeatletter
\newcommand\immaddtocontents[1]{{%
   \let\protect\@unexpandable@protect
   \immediate\write\@auxout{\noexpand\@writefile{toc}{#1}}%
}}
\makeatother


\begin{document}

\begin{frame}{TOC}
\tableofcontents
\end{frame}

\section{The first section}
\subsection{blub}

\begin{frame}
Some text.
\end{frame}

\section{The first section}
\subsection{blub}

\begin{frame}
Some text.
\end{frame}

\immaddtocontents{\vfill \protect\usebeamercolor[fg]{section in toc} text\par}

\immaddtocontents{\leavevmode\leftskip=1.5em \protect\usebeamercolor[fg]{normal text}text\par}

\end{document}