15  Navigating with hyperlinks

During a live slide presentation, it is sometimes necessary to jump several slides back to remind the audience of a formula or a picture. You don’t want to page through 17 slides to go to that particular slide and back through 17 slides to return to where you were.

Hyperlinks in a pdf file enable you to jump from one slide to any other slide with one mouse click.

The following input file defines two slides. (You should imagine that these are among a large number of slides which are not shown here to save space.) One slide is identified by the label=intro tag on its \begin{frame} command. This is our target slide.

The other slide contains the code \hyperlink{intro}{here}. The word “here” will appear in red in the pdf viewer. When you click on “here”, the viewer will jump to the frame labeled intro.

Remark: Actually, what I wrote above is not exactly true. By default, hyperlinks are shown in the normal text color thus are not distinguishable from surrounding text. The red color of hyperlinks is prescribed in the hypersetup command as shown in the sample code below.

Alternatively, a hyperlink may be drawn as a “beamer button”. For instance, to make a button with the text “here” on it, we do: \hyperlink{intro}{\beamerbutton{here}}. Four different button styles are available:

These buttons were made using:

\beamerbutton{here}
\beamergotobutton{here}
\beamerskipbutton{here}
\beamerreturnbutton{here}


They only look different; they all do the same thing. Use the one that best expresses your purpose.

OK, here is a complete LaTeX file that illustrates these concepts. For the explanation of the line \RequirePackage{atbegshi} see the section “Incompatible list can’t be unboxed” further down on this page.

% hyperlink-demo.tex.tex
% \RequirePackage{atbegshi}  % uncomment if necessary
\documentclass{beamer}
\usetheme{default}
\hypersetup{colorlinks=true,linkcolor=red}
\begin{document}

%--- frame --------------------------------------------------%
\begin{frame}[label=intro]{Introduction}

This slide is labeled intro''.

\end{frame}

%--- frame --------------------------------------------------%
\begin{frame}{Some other slide}

If you click \hyperlink{intro}{here}, you will jump to the slide
labeled intro''.

\bigskip

Clicking \hyperlink{intro}{\beamerbutton{here}} will also
take you to the intro'' slide.

\end{frame}

\end{document}


The two slides defined above are shown side-by-side in the figure below. If in the pdf browser you click on the red word “here” or on the blue button, the browser will jump to the first slide labeled intro.

It is difficult to illustrate the dynamic action of hyperlinks with words. I suggest that you cut and paste the code above into a file, compile, and try it yourself.

Returning to the calling page

Now you know how to jump from page N1 to page N2. But how to you return to page N1? Well, you can page through all the intervening pages to get there, but that’s not very professional.

To jump to the page where you came from in a single step, do:

if using the Acrobat Reader:
in Linux and Windows: press Alt-Left Arrow (that is, hold down the Alt key and press the Left Arrow key.)7
in Mac: press Cmd-Left-Arrow (that is, hold down the Cmd key and press the Left Arrow key.)8

if using Xpdf:
press the b key.

Remark: Yet another way to return to the calling page would be by adding another hyperlink that works in the opposite way. Thus you put a hyperlink in page N1 that takes you to page N2, and put a hyperlink in page N2 that takes you to page N1. This trick is somewhat difficult to use in practice. Suppose that you have an important formula on page N1. You want to put links in pages N2 and N3 and N4, each of which takes you to page N1. But once in page N1, it could be confusing as to which of the pages N2 or N3 or N4 you are supposed to return to. The pdf viewer methods described above do not have this problem.

Error: Incompatible list can’t be unboxed

Somewhere between the time of the original version of this document in 2004 and the time of this writing in May 2010, an incompatibility was developed among the packages Beamer, PGF and hyperref.sty. The issue is manifested by the error message

   ! Incompatible list can't be unboxed


when compiling a Beamer document involving hyperlinks.

Here is a workaround. Load the package atbegshi at the top of your source code, before the \documentclass line, as in:

    \RequirePackage{atbegshi}
\documentclass{beamer}
...


Use this hack until a better fix comes along.

7 Of interest to Linux users: The keyboard shortcut for jumping to the previously displayed page was Control-Left Arrow in earlier versions of Acrobat Reader for Linux. Since Acrobat 9.1.0 (perhaps earlier) the binding has been changed to Alt-Left Arrow in conformity with Windows. I am indebted to Cyker Way for pointing this out to me.

8 Thanks to Ewen Gallic for telling me this.