# Numbering slides within a frame

In trying to answer this question, I encounter the following problem. Consider the example below. I have three slides in Frame 1 which I want to print consecutively on three pages in a handout, and number them 1(a), 1(b), and 1(c). Following Martin Scharrer's comment in this answer, I define a counter slideinframe that has the same value as \beamer@slideinframe, which keeps track of the current slide number within a frame.

The problem is when I use the counter in the body text, it produces the correct number; however, when used in the footline, the number is not correct. What's wrong here?

\documentclass[handout]{beamer}

% Define counter "slideinframe"
\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\makeatother

% Define new template style "frame renumbering"
\defbeamertemplate*{footline}{frame renumbering}
{
\leavevmode%
\hbox{%
\end{beamercolorbox}}%
\vskip0pt%
}

\begin{document}

\begin{frame}{Frame 1}
This is frame \insertframenumber, slide (\alph{slideinframe})
\begin{itemize}
\item<1| handout:1> Handout 1
\item<2| handout:2> Handout 2
\item<3| handout:3> Handout 3
\end{itemize}
\end{frame}

\end{document}


The problem is that beamer steps the counter for 'another frame' before doing the 'decoration':

\long\def\beamer@doseveralframes#1{%
\ifx\beamer@againname\@empty\else%
% Again stuff
\expandafter \gdef\csname beamer@again@\beamer@againname\endcsname{{#1}}%
\fi%
\beamer@slideinframe=1\relax%
\loop%
\beamer@anotherslidefalse%
\def\beamer@doifnotinframe{}%
\def\beamer@doifinframe{\begin{beamer@frameslide}%
#1%
\end{beamer@frameslide}}%
{\beamer@masterdecode{\beamer@whichframes}}%
\beamer@donow%
\ifbeamer@twoscreenstext%
\beamer@dosecondscreennow{#1}% two screen stuff
\fi%
\ifbeamer@anotherslide
\advance\beamer@slideinframe by 1\relax Slide number increased here
\repeat%
\beamer@reseteecodes}


At least with your example moving this fixes the issue

\documentclass[handout]{beamer}

% Define counter "slideinframe"
\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\long\def\beamer@doseveralframes#1{%
\ifx\beamer@againname\@empty\else%
% Again stuff
\expandafter \gdef\csname beamer@again@\beamer@againname\endcsname{{#1}}%
\fi%
\beamer@slideinframe=1\relax%
\loop%
\beamer@anotherslidefalse%
\def\beamer@doifnotinframe{}%
\def\beamer@doifinframe{\begin{beamer@frameslide}%
#1%
\end{beamer@frameslide}}%
{\beamer@masterdecode{\beamer@whichframes}}%
\beamer@donow%
\ifbeamer@twoscreenstext%
\beamer@dosecondscreennow{#1}% two screen stuff
\fi%
\beamer@writeslidentry% Moved this line
\ifbeamer@anotherslide
\repeat%
\beamer@reseteecodes}
\makeatother

% Define new template style "frame renumbering"
\defbeamertemplate*{footline}{frame renumbering}
{
\leavevmode%
\hbox{%
\end{beamercolorbox}}%
\vskip0pt%
}
\begin{document}

\begin{frame}{Frame 1}
This is frame \insertframenumber, slide (\alph{slideinframe})
\begin{itemize}
\item<1| handout:1> Handout 1
\item<2| handout:2> Handout 2
\item<3| handout:3> Handout 3
\end{itemize}
\end{frame}

\end{document}


I need to see if this is a general solution: the line does look misplaced to me.