I have written a beamer
presentation and I would like all the frames to have corresponding PDF bookmarks, much like as in this other question on here: Beamer: how to make each frame appear in the PDF toc? . However, it seems that the answer given to that question makes every slide get a bookmark, so frames with \pause
s which have multiple corresponding slides get duplicate bookmarks.
(My understanding is that in beamer
, a frame
is the logical concept defined as everything between the \begin{frame}
and \end{frame}
and may be represented in the output as one or more slide
s.)
I include a minimum illustrative example, based on the previously referenced answer, which I compile with pdflatex
(and my \beamer@version
=3.20
):
\documentclass{beamer}
\usepackage{bookmark}
\usepackage{etoolbox}
\makeatletter
\apptocmd{\beamer@@frametitle}{\bookmark[page=\the\c@page,level=3]{#1}}%
{\message{** patching of \string\beamer@@frametitle succeeded **}}%
{\message{** patching of \string\beamer@@frametitle failed **}}%
\makeatother
\begin{document}
\begin{frame}{Title}
Hello \pause world
\end{frame}
\end{document}
Result: a PDF with one frame but two slides, and two bookmarks, one for each slide. Wanted: a PDF with one frame but two slides, and one bookmark, one for each frame.
I am surprised that the example doesn't work, as I would have thought that \frametitle
(or rather its \@dblarg
helper \beamer@@frametitle
) would get called once per frame instead of (as it appears given the result) once per slide. (Is there any implementation documentation for beamer that might help me with this, as so far I've failed to find it?)
Also, as my presentation is already written, I would like to avoid having to replace \begin{frame}
with \begin{myframe}
everywhere if possible (especially as some of my frames use the \frametitle{Title}
syntax and others the \begin{frame}{Title}
syntax of setting the frame title), and I'm aware that there will be a few difficulties in this approach.
\frametitle
is part of the frame body (using either syntax).