2

Consider the following MWE.

\documentclass[handout]{beamer}
\newcounter{slidenumber}
\defbeamertemplate*{footline}{infolines theme frame plus slide}{
    \setcounter{slidenumber}{\insertpagenumber}%
    \addtocounter{slidenumber}{-\insertframestartpage}%
    \addtocounter{slidenumber}{1}%
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}%
            \insertframenumber(\alph{slidenumber}{})/ \inserttotalframenumber\hspace*{2ex}
        \end{beamercolorbox}}%
        \vskip0pt%
    }
\setbeamertemplate{footline}[infolines theme frame plus slide]

\begin{document}

\begin{frame}
  \only<handout:1>{Handout 1 of frame 1}
  \only<handout:2>{Handout 2 of frame 1}
\end{frame}

\begin{frame}
  Frame 2
\end{frame}

\end{document}

Frame 1 has two slides, I want to number them as 1(a)/2, 1(b)/2. Frame 2 has only one slide, and is currently numbered as 2(a)/2. However, I want to number it as 2/2.

In general, I want frames with multiple slides numbered as

<frame_num>(<slide_num_in_frame>)/<total_frame_num>

and frames with only one slide numbered as

<frame_num>/<total_frame_num>

How can I achieve this effect?

1 Answer 1

1

Using the ifthen package it is possible. The syntax of its if-clauses is \ifthenelse{⟨test⟩}{⟨then clause⟩}{⟨else clause⟩}.

\documentclass[handout]{beamer}
\usepackage{ifthen}

\newcounter{slidenumber}
\defbeamertemplate*{footline}{infolines theme frame plus slide}{
    \setcounter{slidenumber}{\insertpagenumber}%
    \addtocounter{slidenumber}{-\insertframestartpage}%
    \addtocounter{slidenumber}{1}%
    \leavevmode%
    \hbox{%
        \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}%
          \ifthenelse{\insertframeendpage=\insertframestartpage}{
            \insertframenumber/ \inserttotalframenumber\hspace*{2ex}}{
            \insertframenumber(\alph{slidenumber}{})/\inserttotalframenumber\hspace*{2ex}}
        \end{beamercolorbox}}%
        \vskip0pt%
    }
\setbeamertemplate{footline}[infolines theme frame plus slide]

\begin{document}

\begin{frame}
  \only<handout:1>{Handout 1 of frame 1}
  \only<handout:2>{Handout 2 of frame 1}
\end{frame}

\begin{frame}
  Frame 2
\end{frame}

\end{document}
4
  • Sorry for the late acceptance. I've seen that the ifthen package has been obsolete. So I was researching on alternative ways of implementing the conditional. Turns out that one can simply use LaTeX's \ifnum command: \ifnum\insertframeendpage=\insertframestartpage <true action> \else <false action> \fi. I nevertheless owe you a big thank you for helping me formulate the <test> part of the conditional!
    – Herr K.
    Commented Oct 13, 2013 at 21:19
  • 1
    Hey, that is good. I tried with \ifnum, but was not successful in this short try. Knowing it is obsolete, I try it again and then I add it to the answer. @all: If this has not happened in the future, feel free to contact via a comment 'at'me. Commented Oct 13, 2013 at 23:01
  • Apparently for \ifnum to work, something like { needs to go between <test> and <true action>. The following works for me: \ifnum\insertframeendpage=\insertframestartpage {\insertframenumber <...>} \else <false action> \fi.
    – Herr K.
    Commented Oct 13, 2013 at 23:29
  • It also works if a letter goes between <test> and <true action>. For example, \ifnum\insertframeendpage=\insertframestartpage page \insertframenumber <...> \else <false action> \fi. So my guess is that if the character after <test> is a \ , TeX will mistakenly think that what follows is still a part of the <test>, and so something other than \ , e.g. { or a normal letter, has to be inserted at the end of <test> so that <true action> can be processed correctly.
    – Herr K.
    Commented Oct 13, 2013 at 23:33

You must log in to answer this question.

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