I have defined an enumerate environment with custom item names: each item should start with a bullet point and then "Type X case", where the X denotes the item number.

Later in the text, I want to refer to an item in the list, but only by its number: for instance, I want to write "we now refer to case X" (where X should include a hyperlink to the relevant list item).

MWE:

\documentclass{report}
\usepackage[shortlabels]{enumitem}
\usepackage{hyperref}
\begin{document}
\begin{enumerate}[label=$\bullet\;$\textit{Type \arabic* case}:]
        \item \label{item:type1case} If blah blah
        \item \label{item:type2case} If instead blah
        \item \label{item:type3case} this blah
\end{enumerate}

We now refer to case \ref*{item:type1case}...
\end{document}

The final result (in the last phrase) is something like "We now refer to case • Type 1 case:..." but I want to have instead "We now refer to case 1:..."

How to do this using enumitem package and (possibly) without having to load other packages?

  • In essence, you want to have a different \ref to what is printed in the label. Possible duplicate: Unbold referenced label – Werner Oct 19 at 20:50
up vote 4 down vote accepted

enumitem knows the ref option to customise the appearance of labels

\documentclass{report}
\usepackage[shortlabels]{enumitem}
\usepackage{hyperref}
\begin{document}
\begin{enumerate}[label=$\bullet\;$\textit{Type \arabic* case}:,ref=case \arabic*:]
        \item \label{item:type1case} If blah blah
        \item \label{item:type2case} If instead blah
        \item \label{item:type3case} this blah
\end{enumerate}

We now refer to case \ref*{item:type1case}...
\end{document}

We now refer to case case 1:...

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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