# How to set the same slide number for all slides in the allowframebreaks group?

I have [framebreaks] frames in a Beamer presentation. I want to have all generated slides there to have the same slide nubmber, e.g., if I have a listing or some text that spans across two or more slides, but within the same frame I want to prevent slide number increase until I start a new frame. In the MWE below "Slide 1" should be numbered 1/2 for the first 3 PDF slides, whereas "Slide 2" should be 2/2. Using \addtocounter{framenumber}{-1} or \setcounter{framenumber}{x} simply starts counting at current-1 or x. I am aware of this post, but unless I am missing something, I don't see how I can adapt the material there to my problem at this hour.

## MWE

\documentclass{beamer}
\mode<presentation>

\usepackage{lipsum}

\begin{document}

% "Slide 1"
\begin{frame}[allowframebreaks]
\begin{itemize}
\item Foo
\item Bar
\item Baz
\end{itemize}
\lipsum[1-5]
\end{frame}

% "Slide 2"
\begin{frame}
test
\end{frame}

\end{document}
• This appears to be more related it seems with \beamber@slidenumber... how would I use that here? – Serguei Sep 4 '13 at 4:42

This can be a solution.

We use a new counter multipleslide where we save the current value of the counter framenumber

\newcounter{multipleslide}

We also define two new commands \multipleframe and \restoreframe to be inserted, respectively, before and after a frame with allowframebreaks

\makeatletter%
\newcommand{\multipleframe}{%
\stepcounter{multipleslide}
\patchcmd{\beamer@@tmpl@footline}% <cmd>
{\themultipleslide}% <replace>
{}% <success>
{}% <failure>
}
\newcommand{\restoreframe}{%
\patchcmd{\beamer@@tmpl@footline}% <cmd>
{\themultipleslide}% <search>
{}% <success>
{}% <failure>
}
\makeatother%

The first one takes care of numbering all the slides with the same number, the latter restores the normal numbering.

The following MWE explains a bit better how it works:

\documentclass{beamer}
\mode<presentation>

\usepackage{etoolbox}
\usepackage{lipsum}

\newcounter{multipleslide}

\makeatletter%
\newcommand{\multipleframe}{%
\stepcounter{multipleslide}
\patchcmd{\beamer@@tmpl@footline}% <cmd>
{\themultipleslide}% <replace>
{}% <success>
{}% <failure>
}
\newcommand{\restoreframe}{%
\patchcmd{\beamer@@tmpl@footline}% <cmd>
{\themultipleslide}% <search>
{}% <success>
{}% <failure>
}
\makeatother%

\begin{document}

% "Slide 1"
\multipleframe  %<------------------------------------
\begin{frame}[allowframebreaks]
\begin{itemize}
\item Foo
\item Bar
\item Baz
\end{itemize}
\lipsum[1-5]
\end{frame}
\restoreframe  %<------------------------------------

% "Slide 2"
\begin{frame}
test
\end{frame}

\end{document}

This is the output

• Perfect, thanks! Works like a charm. I am unfamiliar with etoolbox... still so many things to learn! – Serguei Sep 4 '13 at 12:50