Cross-Referencing – How to Reference Hardcoded Items in Enumerate Inside a Theorem Environment

#enumeratecross-referencingtheorems

I am trying to reference a hardcoded item in enumerate inside a theorem environment. Instead of getting (c1), I got the label of the theorem. Is there a quick fix?

\documentclass[11pt]{article}
\usepackage{amsmath, cleveref}

\newtheorem{theorem}{Theorem}

\begin{document}
    \begin{theorem}
        Properties
        \begin{enumerate}
            \item[(c1)] a \label{c1}
            \item[(c2)] b
            \item[(k)]  c
            \item[(n1)] d
            \item[(n2)] e
        \end{enumerate}
    \end{theorem}
    \ref{c1}, \cref{c1}
\end{document}

enter image description here

Best Answer

You can adapt the concept of an arbitrary label from How to implement cleveref's \cref@currentlabel correctly for custom cross-references to create "custom theorem-like references" for your theorem lists:

enter image description here

\documentclass{article}

\usepackage{hyperref}
\usepackage{cleveref}

\newtheorem{theorem}{Theorem}

%\usepackage{xparse}

\makeatletter

\NewDocumentCommand{\arblabel}{O{theoremext}m+m}{%
  \begingroup
  \cref@constructprefix{#1}{\cref@result}%
  \protected@edef\@currentlabel{%
    #3}%
  \protected@edef\@currentlabelname{#3}%
  \protected@edef\cref@currentlabel{%
    [#1][][\cref@result]%
    #3%
  }
  \label[#1]{#2}%
  \endgroup  
}

\makeatother

\crefname{theoremext}{theorem}{theorems}% Name of theorem extensions
\Crefname{theoremext}{Theorem}{Theorems}% Name of Theorem extensions

\begin{document}

\begin{theorem}
  Properties
  \begin{itemize}
    \item[(c1)] a \arblabel{c1}{(c1)}% Theorem (c1) (label is c1)
    \item[(c2)] b
    \item[(k)]  c
    \item[(n1)] d
    \item[(n2)] e
  \end{itemize}
\end{theorem}

\cref{c1}, \Cref{c1}

\end{document}