# Beamer bookmarks with allowframbreaks

Consider the following MWE which uses this answer to generate a bookmark for each frame:

\documentclass{beamer}

\usepackage{etoolbox}
\usepackage{lmodern}
\usepackage{lipsum}

\usepackage{bookmark}
\makeatletter
\apptocmd{\beamer@@frametitle}{%
\only<1>{\bookmark[page=\the\c@page,level=3]{#1}}}%
\makeatother

\begin{document}
\begin{frame}
\frametitle{Foo}
\end{frame}
\begin{frame}[allowframebreaks]
\frametitle{Baz}
\lipsum
\end{frame}
\end{document}


When allowframebreaks option is given this means that a bookmark is generated for each of the new frames created by the mentioned option. I want the bookmarks of these "continuation" frames to either have the proper frametitle (i.e "Baz II" rather than just "Baz") or just to generate a bookmark for the first frame and not for those created by the allowframebreak option.

Insert countinuation count in bookmark

The basic idea behind this approach is to check if the \insertcontinuationcount is greater than 0. In this case the continuation count is added to the bookmark.

\documentclass{beamer}

\usepackage{etoolbox}
\usepackage{lmodern}
\usepackage{lipsum}

\usepackage{bookmark}
\makeatletter
\apptocmd{\beamer@@frametitle}{%
\only<1>{\bookmark[page=\the\c@page,level=3]{#1 \expandafter\ifnum\insertcontinuationcount>0\relax\insertcontinuationcount\fi}}}%
\makeatother

\begin{document}
\begin{frame}
\frametitle{Foo}
\end{frame}
\begin{frame}[allowframebreaks]
\frametitle{Baz}
\lipsum
\end{frame}
\end{document}


Only bookmarks for first frame

This approach is very similar to the one above. But now, a bookmark is only added if the \insertcontinuationcount is smaller than 2, because it is 0 for "normal" frames or 1 for the first frame of a continuation.

\documentclass{beamer}

\usepackage{etoolbox}
\usepackage{lmodern}
\usepackage{lipsum}

\usepackage{bookmark}
\makeatletter
\apptocmd{\beamer@@frametitle}{%
\only<1>{\expandafter\ifnum\insertcontinuationcount<2\relax\bookmark[page=\the\c@page,level=3]{#1}\fi}}%
\makeatother

\begin{document}
\begin{frame}
\frametitle{Foo}
\end{frame}
\begin{frame}[allowframebreaks]
\frametitle{Baz}
\lipsum
\end{frame}
\end{document}


• Excellent! Thank! Do you know how to achieve the other possibility of avoiding bookmarks for "continuation frames"? – petobens Sep 25 '14 at 16:50
• Also when there are no continuation frames is it possible to avoid numbering it as Foo 0? And just name the bookmark as Foo. – petobens Sep 25 '14 at 16:57
• @petobens: see my edited answer to adress your two questions – user36296 Sep 25 '14 at 17:15
• @petobens: does this solve your problem? – user36296 Sep 25 '14 at 17:37
• @petobens: concerning ii) If you would like the Foo I to be unnumbered, simply change the >0 to a >1. – user36296 Sep 29 '14 at 14:34