Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following code:

\documentclass[]{article}

\begin{document}
\begin{itemize}
    \item first item \label{first}

    \item second item
\end{itemize}

In \ref{first} we find the first item.

\end{document}

I'd like to reference to an item in the list, but as their isn't a number, I can't use \label. Is it possible to add something like [1] after the item I'd like to refer to and be able to use \ref in order to get this [1]? The result should be something like:

In [1] we find the first item.

share|improve this question
    
Is using an enumerate-list rather than a itemize-list an option? Items in an enumerated lists are easy to cross-referance. –  Mico Feb 14 at 22:40
    
@Mico: I know, but I prefer using itemize in this case. –  Jeroen Feb 14 at 22:44
add comment

1 Answer 1

up vote 7 down vote accepted

Here's one option

screenshot

The idea is create a counter, and then increment (and \label) it every time you call \bulletlabel.

% arara: pdflatex
\documentclass{article}

% set up a counter for bullets
\newcounter{bullet}

% define a command to increment the bullet counter, and label it in one go
\newcommand{\bulletlabel}[1]{\refstepcounter{bullet}\thebullet\label{#1}}

% put [] around the bullet
\renewcommand{\thebullet}{[\arabic{bullet}]}

\begin{document}
\begin{itemize}
    \item first item \bulletlabel{first}

    \item second item
\end{itemize}

In \ref{first} we find the first item.

\end{document}
share|improve this answer
    
That looks perfect, thanks! I'm sure it will help other people too. –  Jeroen Feb 14 at 22:50
    
@Jeroen great, glad it helped :) –  cmhughes Feb 14 at 22:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.