4

In my previous question I implemented thumbs.sty, a package that allows the creation of Thumbnails of other frames in beamer (if you want to read that one, you'd beter brew some fresh coffee :) ).

However, I still have one bug: if the thumbnails spill across several frames, in some cases hyperref attempts to create a link in the first frame, but the content gets pushed (entirely, it's a single tikzpicture) to the second frame, so the link spans across two "pages", and pdftex crashes with the message (source : this old nabble message):

! pdfTeX error (ext4): \pdfendlink ended up in different nesting level than \pdfstartlink.
\@EveryShipout@Output ...@Org@Shipout \box \@cclv 

l.20 \end{frame}

!  ==> Fatal error occurred, no output PDF file produced!

The MWE:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}[allowframebreaks]
  \pgfmathsetmacro\thumbwidth{0.2*\linewidth}
  \pgfmathsetmacro\thumbheight{\thumbwidth/\paperwidth*\paperheight}
  \begin{center}
    \foreach \thid in {1,...,30} {%
      \hyperlink{page.1}{% Comment this line
        \begin{tikzpicture}[baseline={([yshift={-\ht\strutbox}]current bounding box.north)}]
          \node[draw, inner sep=0pt] (thumb) {
            \begin{minipage}[t][\thumbheight pt]{\thumbwidth pt}\vfill Thumbnail\vfill\end{minipage}
          };
          \node[anchor=north, font=\tiny, inner xsep=0pt, inner ysep=0.1cm, yshift=-0.05cm, text width=\thumbwidth pt, align=center] at (thumb.south) {Frame \thid};
        \end{tikzpicture} % space here
      }% Comment this line
    }
  \end{center}
\end{frame}

\end{document}

If one comments out the two lines marked by % Comment this line, no hyperlink is created, and everything works. The same goes if the \foreach maximum value is changed from 30 to 10.

I think this might be solved by using some tikz overlay hackery, or somehow adding the hyperlinks at the end of the physical frame (using a hook like \setbeamertemplate{background}{Add hyperlinks here for thumbnails that got into the current frame}), or somehow forcing the layout to be fixed before hyperref kicks in.

I'm reclutant to adopt a fixed layout, and change frames manually, since the height and width of the thumbnails is (will be) configurable, and I might use some more complex (non-grid) layouts later (like a table of contents intermixed with thumbnails).

It's 6 AM here, so I post this in the hope that someone more awake than me can find a solution :) and I think this issue ought to be documented on TeX.SX.

1 Answer 1

5

The solution is easy here, just do not include the breakpoint inside the link. In especially, put the space outside the link, because it inserts the break point.

\documentclass{beamer}
\usepackage{tikz}
\begin{document}

\begin{frame}[allowframebreaks]
  \pgfmathsetmacro\thumbwidth{0.2*\linewidth}
  \pgfmathsetmacro\thumbheight{\thumbwidth/\paperwidth*\paperheight}
  \begin{center}
    \foreach \thid in {1,...,30} {%
      \hyperlink{page.1}{%
        \begin{tikzpicture}[baseline={([yshift={-\ht\strutbox}]current bounding box.north)}]
          \node[draw, inner sep=0pt] (thumb) {
            \begin{minipage}[t][\thumbheight pt]{\thumbwidth pt}\vfill Thumbnail\vfill\end{minipage}
          };
          \node[anchor=north, font=\tiny, inner xsep=0pt, inner ysep=0.1cm,
                yshift=-0.05cm, text width=\thumbwidth pt, align=center]
          at (thumb.south) {Frame \thid};
        \end{tikzpicture}%
      } % space here
    }% only one space is removed at paragraph end
  \end{center}
\end{frame}

\end{document}
1
  • I definitely had my head in the wall… I had tried various combinations of minipages to keep the kyperlink contents in a single page, probably forgetting the space's existance altogether. +1 for such a simple solution :) Sep 10, 2012 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .