I have redefined the enumerate counters to include the section number, and this works as expected. However, when I try to cross-reference text in my document, the number on the reference doesn't show correctly.
Update:
Upon request, I have edited in a full MWE here instead of the original sample code.
\documentclass{article}
\renewcommand*{\theenumi}{\thesection.\arabic{enumi}}
\renewcommand*{\theenumii}{\theenumi.\arabic{enumii}}
\renewcommand*{\theenumiii}{\theenumii.\arabic{enumiii}}
\begin{document}
\section{The main stuff}
\begin{enumerate}
\item Some text
\item \textbf{A header}
\begin{enumerate}
\item The first item in a sublist
\item \label{important} This stuff is really cool
\begin{enumerate}
\item Some text here...
\item ...and here
\end{enumerate}
\end{enumerate}
\item The outer list continues
\end{enumerate}
When I reference \lq\lq{}important\rq\rq{}, I get \ref{important}
\end{document}
The last row outputs
When I reference "important", I get 1.21.2.2
where I would have expected the number to be just simply 1.2.2
.
Solution:
The solution to this problem was presented by Geoffrey Jones - simply switching from one suggested way of changing the numbering to the other made it work. Instead of the above \newcommands
, the following works:
\usepackage{enumitem}
\setenumerate[1]{label=\thesection.\arabic*.}
\setenumerate[2]{label*=\arabic*.}
\setenumerate[3]{label*=\arabic*.}
\punkt
and in particular\The
in the code you have provided above (unless these are typos, in which case can you please edit them into shape before we launch into this)?\item The
and\item
respectively).:)
:)