TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 \pauses 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 slides.)

I include a minimum illustrative example, based on the previously referenced answer, which I compile with pdflatex (and my \beamer@version=3.20):



{\message{** patching of \string\beamer@@frametitle succeeded **}}%
{\message{** patching of \string\beamer@@frametitle failed **}}%


Hello \pause world

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.

share|improve this question
To answer the part about why this didn't do what I expected, it seems beamer processes the frame body multiple times when there are pauses and/or overlays, and \frametitle is part of the frame body (using either syntax). – cyberSingularity Aug 10 '12 at 7:51
Note to users: the answer to the original question has been extended with an extra patch for handling cases with mode specifications better. – cyberSingularity Oct 5 '13 at 11:50
up vote 5 down vote accepted
{\message{** patching of \string\beamer@@frametitle succeeded **}}%
{\message{** patching of \string\beamer@@frametitle failed **}}%

adds the bookmark just for the first slide in each frame (or at least it seems to work on your MWE)

share|improve this answer
That does indeed work, thanks, and is (embarrassingly) much simpler than anything I was going to think of. This has also led me to the idea of having one bookmark per slide, but with the 'slide in frame' number part of the bookmark caption: replacing the \apptocmd line with \apptocmd{\beamer@@frametitle}{\bookmark[page=\the\c@page,level=3]{#1 (\the\beamer@slideinframe)}}% achieves that. Hope this helps someone else too. (And it seems I can put off learning more about beamer's implementation a little longer...) – cyberSingularity Aug 10 '12 at 7:51
why if I put these lines of code into a .sty file it does not work? – FormlessCloud Mar 21 '14 at 17:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.