4

I recently reinstalled my Miktex (version 2.9. Windows 10 64 bit).

I am not sure if it is relevant: I found that I can no longer compile my presentation slides written in beamer. So I follow the instruction online and installed beamer and translator package manually using MikTex Package Manager to fix the problem.

Here is the problem: I find out that appendixnumberbeamer package fails to count the correct number of slides before \appendix. For example, I have 35 slides before \appendix and 4 slides after it. However, my slides show that I have only 4 slides and the slide number may show 35/4. The slide numbers after \appendix are correct.

I tried to compile the exact same file on my desktop, which has the same programs and system but MikTex was installed much earlier. The package works fine on my desktop and it gives me the correct number of slides. Does anyone know what might cause this problem?

Here is a mimum compatible code exmaple:

\documentclass[mathserif,10pt]{beamer}

\usetheme{Boadilla}
\usecolortheme{beaver}


\usepackage{appendixnumberbeamer}


%----------------------------------------------
\title[Title]{Title}
\author[Last name, First name] % (optional, for multiple authors)
{First~Last}

\institute[Institute]{Institute} % (optional)


\date[\today] % (optional)
{ \today}


\begin{document}
\frame{\titlepage}
%-------------------------------------

\begin{frame}
\frametitle{Normal slide 1}
\end{frame}

\begin{frame}
\frametitle{Normal slide 2}
\end{frame}

\begin{frame}
\frametitle{Normal slide 3}
\end{frame}


\begin{frame}
\frametitle{Normal slide 4}
\end{frame}
%--------------------------------------------------

\appendix

\begin{frame}
\frametitle{Appendix slide 1}
\end{frame}

\begin{frame}
\frametitle{Appendix slide 2}
\end{frame}

\end{document}

Red Circle shows the wrong slide numbers

Slides numbers in the appendix are correct though.

  • 1
    Welcome to TeX.SX! Please post a MWE (minimal compilable code example). – TeXnician Dec 30 '17 at 16:58
  • Hi TeXnician. Thank you for your reply! I have posted an MWE and two pictures showing the problem that I have when I compile the MWE. Thank you. – shanmu .S Dec 30 '17 at 18:24
  • Not related to your problem, but you should not use the mathserif option, use \usefonttheme[onlymath]{serif} instead. – samcarter_is_at_topanswers.xyz Dec 31 '17 at 14:01
  • @samcarter Sorry for the late reply. I have made the changes based on your suggestion. If it is convenient, can you please tell me why I should not use mathserif option? – shanmu .S Jan 1 '18 at 19:46
  • @shanmu.S mathserif is deprecated. If you use it you should find a warning in the .log file telling you to use \usefonttheme[onlymath]{serif} instead. – samcarter_is_at_topanswers.xyz Jan 1 '18 at 19:49
4

The problem is that in the commit https://github.com/josephwright/beamer/commit/cb9eed469a3e6d730d0fdbd950288c06927708e9#diff-a9851e406d02cf9fb3729ed1045df4d3 the definition of the total frame number was changed to global.

A dirty hack: in order to continue to use the appendixnumberbeamer package you could go back to a previous version of the beamerbasemisc.sty file, e.g. from https://raw.githubusercontent.com/josephwright/beamer/d46c01c35e839704109ae2cf34bd112de970910d/base/beamerbasemisc.sty and place it in the same folder as your .tex file.


Solution without the appendixnumberbeamer package:

\documentclass{beamer}

\usetheme{Boadilla}
\usecolortheme{beaver}

\newcounter{appendixframenumber}
\newcounter{appendixtotalframenumber}

\makeatletter
\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\expandafter\ifblank\expandafter{\beamer@shortinstitute}{}{~~(\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}%
    \ifnum\insertframenumber>\totvalue{documentendframe}
        % appendix frames
        \setcounter{appendixframenumber}{\insertframenumber}%
        \addtocounter{appendixframenumber}{-\totvalue{documentendframe}}%
        \setcounter{appendixtotalframenumber}{\inserttotalframenumber}%
        \addtocounter{appendixtotalframenumber}{-\totvalue{documentendframe}}%
        \theappendixframenumber /\theappendixtotalframenumber%
    \else%
        % frames from main part
        \insertframenumber /\total{documentendframe}%
    \fi%
    \hspace*{2ex} 
  \end{beamercolorbox}}%
  \vskip0pt%
}
\makeatother

\usepackage{totcount}
\newtotcounter{documentendframe}

\makeatletter
\renewcommand<>\appendix{%
  \only#1{\part{\appendixname}%
  \addtocontents{nav}{\protect\headcommand{\protect\beamer@appendixpages{\the\c@page}}}%
  \global\let\appendix\beamer@appendix}%
  \setcounter{documentendframe}{\insertframenumber}
}
\makeatother

\begin{document}
\frame{\titlepage}
%-------------------------------------

\begin{frame}
\frametitle{Normal slide 1}
\end{frame}

\begin{frame}
\frametitle{Normal slide 2}
\end{frame}

\begin{frame}
\frametitle{Normal slide 3}
\end{frame}

\begin{frame}
\frametitle{Normal slide 4}
\end{frame}
%--------------------------------------------------

\appendix

\begin{frame}
\frametitle{Appendix slide 1}
\end{frame}

\begin{frame}
\frametitle{Appendix slide 2}
\end{frame}

\end{document}

Starting with beamer v. 3.49 you can emulate the behaviour of the appendixframenumber package by using \setbeamertemplate{page number in head/foot}[appendixframenumber] after your theme.

\documentclass{beamer}

\usetheme{Boadilla}
\usecolortheme{beaver}

\setbeamertemplate{page number in head/foot}[appendixframenumber]

\begin{document}
\frame{\titlepage}
%-------------------------------------

\begin{frame}
\frametitle{Normal slide 1}
\end{frame}

\begin{frame}
\frametitle{Normal slide 2}
\end{frame}

\begin{frame}
\frametitle{Normal slide 3}
\end{frame}

\begin{frame}
\frametitle{Normal slide 4}
\end{frame}
%--------------------------------------------------

\appendix

\begin{frame}
\frametitle{Appendix slide 1}
\end{frame}

\begin{frame}
\frametitle{Appendix slide 2}
\end{frame}

\end{document}
| improve this answer | |
  • Thank you, @samcarter! Although I do not quite understand how it works, the "dirty hack" you suggested solved my problem. Hopefully, this will not cause any other problems and they will update it and fix the issue. Thanks a lot! – shanmu .S Dec 30 '17 at 21:38
  • @shanmu.S You're welcome! I left a comment in the beamer github repo (github.com/josephwright/beamer/commit/…), let's hear what the beamer maintainers think about this. – samcarter_is_at_topanswers.xyz Dec 30 '17 at 21:45
  • The Beamer sorceress answered again ;-) – user31729 Dec 31 '17 at 15:07
  • 1
    @ChristianHupfer Oh, a new title :) Thank you! Guten Rutsch ins neue Jahr! – samcarter_is_at_topanswers.xyz Dec 31 '17 at 15:28
  • @samcarter: Danke, ebenfalls. Gruss an die anderen von SG-1 ;-) – user31729 Dec 31 '17 at 15:29
3

The appendixnumberbeamer package has just been updated to fix this, see https://github.com/jlelong/appendixnumberbeamer. The new version has also been uploaded to CTAN.

| improve this answer | |
  • Thank you for the update! This information is very helpful and we do not need to worry about this problem anymore. – shanmu .S Mar 31 '18 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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