# Cross-referencing items in two-level enumerate environment

In LaTeX I have an enumerate environment embedded inside another enumerate environment.

\documentclass{article}
\usepackage{enumerate}
\begin{document}

\begin{enumerate}[(i)]
\item now we have another list\label{lab1}
\begin{enumerate}[(a)]
\item item one of second list
\item item two of second list\label{lab2}
\end{enumerate}
\item or another case
\end{enumerate}

\end{document}


I want to refer to part (i)(b), and have tried using \eqref{lab1}\eqref{lab2}. This produces the result (i)(ib). What is the correct way to obtain (i)(b)?

Note: This question has been migrated here from Stack Overflow.

Use the package enumitem as follows:

\documentclass{article}
\usepackage{enumitem}
\begin{document}

\begin{enumerate}[label=(\roman*)]
\item now we have another list\label{lab1}
\begin{enumerate}[label=(\alph*),ref=\theenumi(\alph*)]
\item item one of second list
\item item two of second list\label{lab2}
\end{enumerate}
\item or another case
\end{enumerate}

References: \ref{lab1} \ref{lab2}

\end{document}

• No need in this case for ref=(\roman*). Also ref=\theenumi(\alph*) produces what the OP wanted to avoid... – karlkoeller Nov 29 '13 at 16:06
• @karlkoeller Yes, I know. I'll remove it. – Alex Nov 29 '13 at 16:09
• N.B. this only works if you explicitly define the type of enumerated sublist. I lost a ton of time trying to make this work because the default sublist was alphabetical, which is what I wanted, but apparently failure to include [label=(\alph*)] when defining the sublist will still lead to the original problem, even though it has no visible effect on the appearance of the sublist. – Rax Adaam Mar 16 '14 at 16:46

The enumerate package doesn't really give you a handle on the reference form. You could use enumitem package instead, but here I'd simply do:

\documentclass{article}

\renewcommand\theenumi{(\roman{enumi})}
\renewcommand\labelenumi{\theenumi}

\renewcommand\theenumii{(\alph{enumii})}
\renewcommand\labelenumii{\theenumii}

\begin{document}

\begin{enumerate}
\item now we have another list\label{lab1}
\begin{enumerate}
\item item one of second list
\item item two of second list\label{lab2}
\end{enumerate}
\item or another case
\end{enumerate}

xxx\ref{lab1}xxxxxx\ref{lab2}xxx

\end{document}

• Too bad the author of enumerate didn't think to this. – egreg Nov 29 '13 at 16:24
• @egreg, actually he did but couldn't think of a way of specifying the formatting in the minimalist enumerate interface. – David Carlisle Nov 29 '13 at 16:38