This answer provides the indispensable feature to add a list of frames to a beamer presentation.
It containts the the line
\addcontentsline{lbf}{section}{\protect\makebox[2em][l]{%
\protect\usebeamercolor[fg]{structure}\insertframenumber\hfill}%
\insertframetitle\par}%
Recently it stopped working with two issues:
-
if
\par
is included, there is a compilation errorParagraph ended before \addcontentsline was complete. \end{frame}
Extra }, or forgotten \endgroup. \end{frame} -
The frame number is also included at the end of line, or actually at the beginning of the next line
I thought to substitute \par
with \newline
with seems to be a workaround for the first issue, but the second issue persists, leading to this unexpected output:
What changed? What broke?
Thank you very much in advance!
Original MWE
\documentclass{beamer}
\newif\ifframeinlbf
\frameinlbftrue
\makeatletter
\newcommand\listofframes{\@starttoc{lbf}}
\makeatother
\addtobeamertemplate{frametitle}{}{%
\ifframeinlbf
\addcontentsline{lbf}{section}{\protect\makebox[2em][l]{%
\protect\usebeamercolor[fg]{structure}\insertframenumber\hfill}%
\insertframetitle\par}%
\else\fi
}
\begin{document}
\frameinlbffalse
\begin{frame}
\frametitle{List of Frames}
\listofframes
\end{frame}
\frameinlbftrue
\begin{frame}
\frametitle{Test Frame One}
test
\end{frame}
Best Answer
You could use \endgraf instead of \par to avoid the error. But imho it is odd to add it to the \addcontentsline, I would use a special
<type>
and define a suitable\l@<type>
command, which then can also suppress the "page number":