# enumitem: using label for a defined item

Whenever I try to label an item that is defined, it never seems to work. For example, consider the following:

\documentclass{article}
\usepackage{enumitem}
\usepackage[noabbrev]{cleveref}
\begin{document}
\begin{enumerate}
\item[3.1]
\item[6.3]
\label{prob63}
\item
From \cref{prob63}, some statement
\end{enumerate}
\end{document}


I think this may be partly because one can use non-counter-style entries when using the optional argument to \item[<stuff>]. So, in that regard, you can set this manually so that the reference appears as you want:

\documentclass{article}
\usepackage{enumitem}
\usepackage[noabbrev]{cleveref}
\makeatletter
\newcommand{\setcreflabel}[1]{%
\protected@edef\cref@currentlabel{%
[\@tempa][#1][\cref@result]%
#1}}%
\makeatother
\begin{document}
\begin{enumerate}
\item \label{prob1}
\item[6.3] \setcreflabel{6.3}\label{prob63}
\item
From \cref{prob63}, some statement; From \cref{prob1}, some statement.
\end{enumerate}
\end{document}


The motivation here is to update \cref@currentlabel in an analogous way to how \refstepcounter updates \@currentlabel. In that way, when you issue \label, the correct reference content is written to the .aux:

\relax
\newlabel{prob1}{{1}{1}}
\newlabel{prob1@cref}{{[enumi][1][]1}{1}}
\newlabel{prob63}{{1}{1}}
\newlabel{prob63@cref}{{[enumi][6.3][]6.3}{1}}

• I am seeing From ?? 6.3 and the error message is still undefined label. – dustin Sep 27 '14 at 14:38
• @dustin: When you compile my minimal example? – Werner Sep 27 '14 at 15:08
• In my real document where I had this issue. – dustin Sep 27 '14 at 15:13
• @dustin: Are you calling \setcreflabel{<something>}? – Werner Sep 27 '14 at 15:14
• Yes, I placed that before the \label{} as in the example. – dustin Sep 27 '14 at 15:15