6

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.

2
  • 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, 2014 at 22:40
  • @Mico: I know, but I prefer using itemize in this case.
    – Jeroen
    Feb 14, 2014 at 22:44

1 Answer 1

7

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}
2
  • That looks perfect, thanks! I'm sure it will help other people too.
    – Jeroen
    Feb 14, 2014 at 22:50
  • @Jeroen great, glad it helped :)
    – cmhughes
    Feb 14, 2014 at 22:58

You must log in to answer this question.

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