Hi,
i have a question concerning the enumeration package of David Carlisle and the \ref - command.
I have the following code:
\begin{enumeration}[Step (1)]
\item \label{AA} ...
.
.
.
\end{enumeration}
Then \ref{AA} just prints '1'. Is there a way to change this behaviour such that \ref{AA} prints the whole label and not just the number, i. e. 'Step 1'?
Thank you
Michi
Document Classes ⇒ Enumeration package: Can \ref print the whole label?
NEW: TikZ book now 40% off at Amazon.com for a short time.

Enumeration package: Can \ref print the whole label?
Hi,
to customise the list-like environments I would recommend you to use the enumitem package. Your example:
to customise the list-like environments I would recommend you to use the enumitem package. Your example:
Code: Select all
\documentclass{book}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=Step (\arabic*)]
\item \label{AA}
\item \label{BB}
\end{enumerate}
As can be seen in \ref{AA}...
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Enumeration package: Can \ref print the whole label?
For simple lists, you don't need any package. The enumerate environment can be easily customized, as the following example shows:
For numbered nested lists, you may need to replace enumi by enumii, enumiii or enumiv in the above code. Note that:
Code: Select all
\documentclass{article}
\begin{document}
\begin{enumerate}
\renewcommand{\theenumi}{Step (\arabic{enumi})}
\item\label{AAA} Text.
\item More text.
\end{enumerate}
Here we write a reference to \ref{AAA}.
\begin{enumerate}
\renewcommand{\theenumi}{[\Roman{enumi}]}
\renewcommand{\labelenumi}{\textbf{Level \theenumi}.-}
\item\label{BBB} Text
\item More text
\end{enumerate}
Here we write a reference to level or stage \ref{BBB}.
\end{document}
For numbered nested lists, you may need to replace enumi by enumii, enumiii or enumiv in the above code. Note that:
- \ theenumi controls the way the counter is printed (think in the way you would like to print the counter in a future reference to the corresponding item);
- \ labelenumi indicates how the full label should be printed;
- the redefinition of both commands should be done inside the enumerate environment in order to not change any subsequent list.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.