[Tex/LaTex] How to cross-reference items in description lists

cross-referencingdescriptionlists

Every now and then I use the description list environment

\begin{description}
\item[foo]  foo is good
\item[bar]  bar is bad
\end{description}

to create lists with non-numerical labels. Unfortunately the description list does not support the label-reference pair as normal latex: i.e. if I write

\begin{description}
\item[foo] \label{foo} foo is good
....
\end{description}
....
For good things (see, for example \ref{foo})... 

the reference does not point to the item in the list. Instead it points to the closest environment that supports labeling (usually the subsection). So instead of showing the text foo (in boldface), it shows something like 2.2.1 (the subsection corresponding to where the description environment is sitting).

My question: is there a way or a package which allows references to description list items? My current work-around is to just type the text myself in the spot (since I named it myself, and it is not numbered, the formatting is unlikely to change the label =). But one of the good things about the label/reference pairs in latex is the implementation in pdflatex that allows in PDF hyperlinks between references and the objects referred to, this I cannot replicate myself.

Edit: let me rephrase my question. The primary goal is not to display \ref to something other than what LaTeX thinks the \label is. There are many ways to deal with it, some of which outlined in Michael Underwood's helpful answer below. What I am looking at is whether there exists an implementation of a list environment which is like the built-in description environment in that the displayed "title" for the list item is completely customized, while having support for \labels. (The built-in description environment does not support \labels, whereas the built-in enumerate environment does not support customized "title"s.) The enumitem package adds some customizability to the environments, but as far as I can tell it doesn't support exactly what I want.

Best Answer

I don't know of a pre-built package that allows you to do this, but if I correctly understand what you're after then it is achievable by combining a counter with custom commands and the hyperref package. The first step is to create a new counter for the described items, and a pair of new commands to use in place of \item and \ref. In the preamble, put the following:

\newcounter{desccount}
\newcommand{\descitem}[1]{%
  \item[#1] \refstepcounter{desccount}\label{#1}
}
\newcommand{\descref}[1]{\hyperref[#1]{#1}}

The new command \descitem is to be used in place of \item within a description environment. It takes a single argument and creates an item labeled with it. It also increments the new counter, sets it as the current value for the \ref command, and labels the location with the item's descriptor. The new command \descref takes the same argument and makes a hyperlink reference to the label, displaying the argument instead of the counter's value.

The commands work together like this:

\begin{description}
  \descitem{foo} foo is good
  \descitem{bar} bar is bad
\end{description}
...
For good things (see, for example \descref{foo})... 
Related Question