Tx · LaTeX & TikZ

How to Number Beamer Frames and Link to Appendix Slides

Published By the 9to5Science editorial team

At a glance

  1. 1. Choose the counter

    Use the frame counter for slides and the page counter for individual PDF pages.

  2. 2. Set the main total

    Load appendixnumberbeamer and place \appendix before backup slides to exclude them from the main total.

  3. 3. Add named targets

    Put a hypertarget on each destination slide and link to it with a Beamer button.

  4. 4. Compile twice

    Rerun LaTeX so the total frame count and PDF links update correctly.

Beamer presentations can show either slide (frame) numbers or PDF page numbers. These are not always the same: a frame with overlays can produce several PDF pages but remains one frame. You can also keep backup slides out of the main presentation’s total and add buttons that jump directly to appendix slides.

Frame numbers and page numbers are different

A Beamer frame is the logical slide declared by a frame environment. A PDF page is one page in the generated file. If a frame reveals items in stages, Beamer may produce several PDF pages for that one frame.

Use \insertframenumber for the current frame number and \inserttotalframenumber for the total number of frames. Use \insertpagenumber when you specifically want the current PDF page number. For a typical presentation footer, frame numbers are less confusing because the number does not change across overlays of the same frame.

Exclude appendix frames from the main total

Load the appendixnumberbeamer package and put \appendix immediately before the appendix or backup slides. The package adjusts the total frame count so the main presentation’s denominator does not include those slides.

The total frame count is written to auxiliary files, so compile the document twice after changing frames or adding the package. The first run may show an outdated or incomplete total.

Give the destination a named anchor with \hypertarget{...}{}. Then use \hyperlink{...}{\beamerbutton{...}} wherever you want the clickable button. Naming the destination explicitly avoids relying on automatically generated frame-anchor names.

Here is a complete example. It shows a button from the main presentation to an appendix slide and a return button from the appendix. It also uses a simple frame-number footer.

\documentclass{beamer}
\usepackage{appendixnumberbeamer}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}{%
  \hfill\insertframenumber/\inserttotalframenumber\hspace{1em}\vspace{0.5em}%
}

\begin{document}

\begin{frame}{Main result}
  \hypertarget{main-slide}{}
  The main presentation goes here.

  \medskip
  \hyperlink{details-slide}{\beamerbutton{Show details}}
\end{frame}

\appendix

\begin{frame}{Additional details}
  \hypertarget{details-slide}{}
  Supporting material goes here.

  \medskip
  \hyperlink{main-slide}{\beamerbutton{Back to main result}}
\end{frame}

\end{document}

The navigation-symbol template is hidden so the custom buttons are the only navigation controls shown. Remove that line if you want Beamer’s standard navigation symbols. The footer displays the current frame over the total; appendixnumberbeamer keeps appendix frames out of that total. If you prefer page numbers, replace \insertframenumber with \insertpagenumber—but remember that overlay pages have distinct page numbers.

Common mistakes

  • Counting overlays as separate frames: overlays can increase the PDF page count without increasing the logical frame count. Choose the counter that matches what you want readers to track.
  • Putting \appendix too early: frames after that command are treated as appendix material for the total. Put it only when the main presentation is finished.
  • Linking to the wrong name: the name in \hyperlink{...} must match the destination’s \hypertarget{...} exactly. Keep names unique.
  • Expecting updated totals on the first run: compile at least twice after changing the document. If the displayed total remains stale, compile again or remove outdated auxiliary files and rerun.
  • Using a frame label as if it were an explicit anchor: Beamer can create link targets from frame labels, but their exact target names may include overlay information. Explicit \hypertarget names make button destinations clear and reliable.

References

  1. The Beamer class user guide
  2. appendixnumberbeamer package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.