Document Classes ⇒ Enumeration package: Can \ref print the whole label?
Enumeration package: Can \ref print the whole label?
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Enumeration package: Can \ref print the whole label?
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}Enumeration package: Can \ref print the whole label?
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.