2

In the following MWE \ref{a} and \ref{aa} show 1 and 2a instead of 1.1 and 1.2.1, respectively. I wonder how this can be fixed.

\documentclass{article}

\usepackage{enumerate}

\renewcommand{\labelenumi}{\thesection.\arabic{enumi}}
\renewcommand{\labelenumii}{\thesection.\arabic{enumi}.\arabic{enumii}}

\begin{document}

\section{Section Title}

Item \ref{a} and Item \ref{aa}.

\begin{enumerate}
\item \label{a} A
\item B

\begin{enumerate}
\item \label{aa} AA
\item BB
\end{enumerate}
\end{enumerate}

\end{document}
1

Here is a version with enumitem and its \setlist command. The figures 1 and 2 refer to the nesting level, 1 is enumi then.

\documentclass{article}

\usepackage{enumitem}

\setlist[enumerate,1]{label={\arabic*}}
\setlist[enumerate,2]{label={\theenumi\alph*}}

\begin{document}

\section{Section Title}

Item \ref{a} and Item \ref{aa}.
\begin{enumerate}
\item \label{a} A
\item B
\begin{enumerate}
\item \label{aa} AA
\item BB
\end{enumerate}
\end{enumerate}
\end{document}

enter image description here

  • Actually, the first \setlist is not necessary, since this is the default ;-) – user31729 Jun 23 '15 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.