# Redefining enumerate counters in beamer

I'd like to do two things with the enumerate environment in beamer.

1. I'd like to reformat it so that it shows up as

(1) An item
a. A subitem
b. Another subitem

2. I'd like to be able to refer to these items with the usual \ref tags. Unfortunately, the only way I've found of getting the display of items inside of the environment right doesn't deliver the correct result for the references.

Here's a minimal working example.

\documentclass{beamer}

\setbeamertemplate{enumerate item}{(\insertenumlabel)}
\setbeamertemplate{enumerate subitem}{\alph{enumii}.}

\begin{document}

\begin{enumerate}
\item Foo\label{item:1}
\begin{enumerate}
\item Bar\label{item:2}
\item Zip\label{item:3}
\end{enumerate}
\end{enumerate}

Reference to Foo'': (\ref{item:1}).

Reference to bar'': (\ref{item:2}).

Reference to zip'': (\ref{item:3}).
\end{document}


Unfortunately, that results in all three references in arabic numbers, i.e., (1), (1), and (2) for the three \ref's, in that order.

The desired output is for (\ref{item:3}) to be rendered as (1b).

-

redefine the begin of an enumerate

\documentclass{beamer}
\setbeamertemplate{itemize/enumerate body begin}
{\renewcommand\theenumii{\theenumi\alph{enumii}}}
\setbeamertemplate{enumerate item}{(\insertenumlabel)}
\setbeamertemplate{enumerate subitem}{\alph{enumii}.}

\begin{document}

\begin{frame}{}
\begin{enumerate}
\item Foo\label{item:1}
\begin{enumerate}
\item Bar\label{item:2}
\item Zip\label{item:3}
\end{enumerate}
\end{enumerate}

Reference to Foo'': (\ref{item:1}).

Reference to bar'': (\ref{item:2}).

Reference to zip'': (\ref{item:3}).
\end{frame}
\end{document}


-

Here is a partial solution:

\documentclass{beamer}

\setbeamertemplate{enumerate item}{(\insertenumlabel)}

\begin{document}

\begin{frame}
\begin{enumerate}
\item Foo\label{item:1}
\begin{enumerate}[a.]
\item Bar\label{item:2}
\item Zip\label{item:3}
\end{enumerate}
\end{enumerate}

Reference to Foo'': \ref{item:1}

Reference to bar'': \ref{item:2}

Reference to zip'': \ref{item:3}
\end{frame}

\end{document}


This fixes the labels in the nested environment to be a. and b.. But the \refs end up the same.

With the same code in an article class with the enumerate package, you would see your second effect, too: the labels for bar and zip are set as 1a and 1b. But to get beamer to do the same thing requires a bit of digging. I'll try to do that digging and see what I can find.

-
The source file to dig in is beamerbaselocalstructure.sty. Can't find where the label is set and why it behaves differently from enumerate.sty (since that package is included in beamer). – Matthew Leingang Feb 6 '12 at 12:10