83

I am using the beamer document class in latex to make a presentation. I will have a number of back up slides which are there for offline viewing, reference etc. Beamer has a feature that shows the progress through the presentation as {page#}/{total pages} on each slide. I would really like it if {total pages} was equivalent to my total number of pages w/out counting the back up slides (I don't want to discourage my audience on the first page!). Does anyone know how this can be done?

Brian Rasmussen
  • 114,645
  • 34
  • 221
  • 317
mwlebour
  • 1,001
  • 1
  • 7
  • 7
  • 2
    Here is a helpful link regarding this: http://www.stanford.edu/~dgleich/notebook/2009/05/appendix_slides_in_beamer_cont_1.html –  Jul 17 '12 at 14:59
  • this question is a dublicate to http://tex.stackexchange.com/questions/2541/beamer-frame-numbering-in-appendix – benni Nov 02 '15 at 13:37
  • @user1532178: Link is inactive – vineeshvs Mar 31 '19 at 10:28

9 Answers9

62

This can now be achieved with the following option on all "backup" slides:

\begin{frame}[noframenumbering]{My Title}
\end{frame}

Source

This will cause the final number (e.g. 25/25) to be displayed on such pages.

As always, a matter of taste.

Lenna
  • 1,445
  • 9
  • 21
47

This can be done with the appendixnumberbeamer package. Just add \usepackage{appendixnumberbeamer} to the preamble and use \appendix before the first backup slide.

hplieninger
  • 3,214
  • 27
  • 32
Partha
  • 471
  • 4
  • 2
24

I have defined two commands to do this:

\newcommand{\beginbackup}{
   \newcounter{framenumbervorappendix}
   \setcounter{framenumbervorappendix}{\value{framenumber}}
}
\newcommand{\backupend}{
   \addtocounter{framenumbervorappendix}{-\value{framenumber}}
   \addtocounter{framenumber}{\value{framenumbervorappendix}} 
}

You can then use \beginbackup and \backupend before and after your backup slide to adjust the number of slides.

For my beamer template I also like to add

\setbeamertemplate{footline}{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\insertshorttitle
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
    \insertframenumber{} \hspace*{2ex} % hier hat's sich geändert
  \end{beamercolorbox}}%
  \vskip0pt%
}

in the definition of the \beginbackup command to hide to total page number in the backup slides, otherwise you'll get something like "24/18".

Using all this, your slides will be numbered like "x/Y" for all slides before the backup, where Y is the total number of slides before the first backup slide, and the backup slides will continue the numbering of the previous slides.

fuenfundachtzig
  • 7,952
  • 13
  • 62
  • 87
  • 1
    `\backupend` or `\endbackup`? `\backupend` works for me. In addition, it works after compiling *twice*. – hengxin Jul 20 '14 at 12:57
14

To manually fix the total frame count to a certain number, say 25, you could add the following command

\renewcommand{\inserttotalframenumber}{25}

right after the \begin{document} command.

You can also add the \appendix command right before the beginning of your backup slides, so that the corresponding sections/subsections do not appear in the table of contents/navigation structure.

It should be possible to tweak the renewcommand above so that it automatically uses the last frame number before the appendix, but I don't know how to do it.

Fanfan
  • 1,116
  • 5
  • 7
  • 2
    \renewcommand{...}{25} works great, and you are right, it would be nice if you could set it by using the frame count of the last slide b/f the back up. Just to clarify, adding the \appendix command leaves all subsequent [sub][sub]sections out of the ToC but does put them in the nav structure – mwlebour Apr 09 '09 at 16:36
12

Just insert

\renewcommand{\inserttotalframenumber}{\pageref{lastslide}}

after \begin{document}, and place the marker

\label{lastslide}

on your last slide.

vvns
  • 3,548
  • 3
  • 41
  • 57
aslan
  • 780
  • 1
  • 7
  • 16
  • it works better with `\begin{frame}[label={lastslide}]`, otherwise `\pageref{lastslide}` refers to the PDF page number, not the frame count – Kevin Aug 25 '15 at 11:40
8

You can put all of your backup slides in appendix and use the appendixnumberbeamer package.

\documentclass[12pt]{beamer}
\usepackage{appendixnumberbeamer}
\begin{document}
\begin{frame}{Frames that counts}
\end{frame}
\appendix
\begin{frame}{Backup slides}
\end{frame}
\end{document}
xuhdev
  • 8,018
  • 2
  • 41
  • 69
7

Fanfan, thanks for your answer, your answer steered me to this sty file that one can include in a beamer document class that will automatically count only the number of frames before the appendix, and then restart the a separate count for the appendix slides, pretty neat.

http://www.ensta.fr/~lelong/Latex/appendixnumberbeamer.sty

Thanks also to Jérôme LELONG for having this available online.

mwlebour
  • 1,001
  • 1
  • 7
  • 7
  • 1
    Apparently moved to http://cpbl.econ.ubc.ca/web/software/latex/appendixnumberbeamer.sty – Nikratio Feb 06 '12 at 14:03
  • @fuenfundachtzig I think now we can directly declare `\usepackage{appendixnumberbeamer}` in the preamble. – tvk Nov 11 '16 at 19:09
4

The great command \insertpresentationendpage will take care of your problem. Just place \appendix at the begin of your backup slides.

\documentclass[t]{beamer}

\usepackage[absolute,overlay]{textpos}
\setbeamertemplate{navigation symbols}{}

\def\insertpresentationendframe{\inserttotalframenumber}
\makeatletter
\g@addto@macro{\appendix}{\immediate\write\@auxout{\string\@writefile{nav}{\noexpand\headcommand{\noexpand\def\noexpand\insertpresentationendframe{\the\c@framenumber}}}}}
\makeatother

\setbeamertemplate{footline}{%
    \begin{picture}(54,12.5)(0,0)
    \put(0.9,0.52){%
        \begin{minipage}[b][12.5mm][c]{112.5mm}
        \raggedleft
        \insertframenumber/\insertpresentationendframe
        \end{minipage}
    }
    \end{picture}
}

\begin{document}

    \begin{frame}
        slide in the main part
        \only<2>{blub}
    \end{frame}

    \appendix
    \section*{Backup}

    \begin{frame}
        \frametitle{backup}
        not counting in the total frame number
    \end{frame}

\end{document}

enter image description here

  • This doesn't work if you only have one overlay per frame, otherwise the number of pages won't match the number of frames. – Thom Wiggers Apr 05 '15 at 23:48
1

Another possibility - which was recently added to beamer - is to use the appendixframenumber template:

\documentclass[t]{beamer}

\setbeamertemplate{footline}{
  \hfill%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
  \setbeamertemplate{page number in head/foot}[appendixframenumber]%
  \usebeamertemplate*{page number in head/foot}\kern1em\vskip2pt%
}

\begin{document}

    \begin{frame}
        slide in the main part
        \only<2>{blub}
    \end{frame}

    \appendix
    \section*{Backup}

    \begin{frame}
        \frametitle{backup}
        not counting in the total frame number
    \end{frame}

\end{document}