3

I have a list of conditions I want to reference, so I use

\begin{enumerate}
   \item \label{foo} ...
   \item \label{bar} ...
\end{enumerate}
We reference the condition \ref{foo}.

This way the conditions are numbered 1, 2, 3… But what if I want a custom “numbering” reflecting some relation between the conditions like 1, 1', 2, 3, …? If I write

\begin{enumerate}
   \item \label{foo} ...
   \item[1'] \label{bar} ...
\end{enumerate}

the referencing does not work, the value 1' is not associated with the label bar.

1

There is no way to associate a label to an \item[] since the relevant counter (enumi in this case) is not used at all -- \item[] is explicitly meant for using a different item label which is perhaps not generated by an enumeration. It could be a letter, another symbol or -- with some effort -- even graphics.

Redefinining \item is possible, but tedious.

The crossreftools package provides \crtcrossreflabel{displayed label value}[labelname] which can be inserted for this.

Please note that \item[{\crtcrossreflabel{1'}[bar]}] must be used, since an optional argument (the one from \crtcrossreflabel) appears in another optional argument (the one from \item).

\documentclass{article}

\usepackage{hyperref}
\usepackage{crossreftools}

\begin{document}

See \ref{bar}

\begin{enumerate}
   \item \label{foo} ...
   \item[{\crtcrossreflabel{1'}[bar]}]  ...
\end{enumerate}

\end{document}

enter image description here

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.