1

I am working with the labeling environment and I would like to cross-reference to items by their labels. Here is a sample code:

\documentclass{article}
\usepackage{hyperref}
\usepackage{nameref}
\usepackage{scrextend}
\addtokomafont{labelinglabel}{\sffamily}
\begin{document}
\begin{labeling}{Cookies}
\item[Cookies] chocolate chip
\end{labeling}
\end{document}

And I want to later refer to the item Cookies by its name ``Cookies.'' But the traditional label-ref does not seem to work. Any guidance would be greatly appreciated.

1 Answer 1

2
\documentclass{article}
\usepackage{hyperref}
\usepackage{nameref}
\usepackage{scrextend}
\addtokomafont{labelinglabel}{\sffamily}
\makeatletter
\newcommand\labelitem[2]{%
  \item[#1]\def\@currentlabel{#1}\label{#2}}
\makeatother
\begin{document}
\begin{labeling}{Cookies}
\labelitem{Cookies}{cookie} chocolate chip
\end{labeling}

\ref{cookie}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .