# Automatic referencing of item number in enumerate environment

Here is what I want:

And here is how I want to achieve this:

Just like you have the \label and \ref commands for automatic section number referencing, I wish to have something similar which will auto-reference the specific item number (1.2.1 in my case) without me having me explicitly write it out every time. This will be part of a big report I'm writing, hence I wish to make my work less cumbersome

Here is the code:

\documentclass[]{article}
\usepackage{enumerate}
%opening
\title{}
\author{}

\begin{document}

\begin{enumerate}
\item 1st item
\begin{enumerate}[{1.}1]
\item 1st nested item
\item 2nd nested item
\begin{enumerate}[{1.2.}1]
\item Useful/Important Information
\end{enumerate}
\end{enumerate}
\item 2nd item
\end{enumerate}

\noindent In this paragraph, I talk a bit about the Useful/Important Information and then reference the item number

\end{document}
-
Same \label and \ref works for this also. – Harish Kumar Nov 15 '12 at 23:00
@egreg, can you help me out again? – Chatterjee Nov 15 '12 at 23:01
@HarishKumar Thanks a lot. I wasn't aware of this. However, there seems to be some formatting issues with the printed label. It is getting displayed as 1(2)1. Why is this happening and how can I get around this? – Chatterjee Nov 15 '12 at 23:04
That isn't the default formatting for an item reference, can you make a complete small document that shows the effect, you are probably loading a package that changes the way item labels are displayed without changing the way they are referenced. – David Carlisle Nov 15 '12 at 23:09
@DavidCarlisle done – Chatterjee Nov 15 '12 at 23:13

I am used to enumitem than enumerate as it is newer and offers much more customizations. As an additional tool, I suggest the use of cleveref for clever referencing as in this code:

\documentclass{article}
\usepackage{enumitem} %% for effortless customization of enumeration
\usepackage{hyperref} %% Just to provide clickable links
\usepackage{cleveref} %% for clever referencing
\crefdefaultlabelformat{(#2#1#3)}
\begin{document}
\begin{enumerate}
\item{First item}
\begin{enumerate}[label=\arabic{enumi}.\arabic*]
\item{First nested item}
\item{Second nested item}
\begin{enumerate}[label=\arabic{enumi}.\arabic{enumii}.\arabic*]
\item{Useful/important information} \label{item:myitem}
\end{enumerate}
\end{enumerate}
\item{Second item item}
\end{enumerate}

\noindent In this paragraph, I talk a bit about the Useful/Important Information and then reference the item number~(\ref{item:myitem}).

In this paragragh, I talk and the point to some information given in~\cref{item:myitem} (Using cref)

\end{document}

-
I'm sure newer is the word you meant to use rather than better. enumerate was one of my first packages don't be too hard on it!) (+1 from me, saves me fixing enumerate:-) – David Carlisle Nov 15 '12 at 23:42
Works like a charm. Thanks a lot! – Chatterjee Nov 15 '12 at 23:47
@DavidCarlisle: Sorry yar, I didn't mean it. I am used to enumitem. Changing the answer immediately. :-) – Harish Kumar Nov 15 '12 at 23:51
Why the {} around the content of the items? – Guido Nov 15 '12 at 23:51
@Guido: Nothing special. I made it a personal preference to make it more readable. That is all. – Harish Kumar Nov 15 '12 at 23:53

enumerate is a very old package and probably as I mentioned in comments it is better to use a newer package these days as they offer more flexibility (enumerate is a lot older than the keyval package for example). So you should probably not unaccept the other answer but for the record...

The easiest way to get this in latex doesn't involve using a package at all, or having to manually modify the item labels with optional arguments. Just declare the label counters to use the full dotted form rather than just the final numbers. (That is use a similar set of definitions as is usually used for sections and subsections)

\documentclass[]{article}
\makeatletter
\renewcommand\theenumi{\arabic{enumi}.}
\renewcommand\theenumii{\theenumi.\arabic{enumii}.}
\let\labelenumii\theenumii
\let\p@enumii\@empty
\renewcommand\theenumiii{\theenumii.\arabic{enumiii}.}
\let\labelenumiii\theenumiii
\let\p@enumiii\@empty
\makeatother

%opening
\title{}
\author{}

\begin{document}

\begin{enumerate}
\item 1st item
\begin{enumerate}
\item 1st nested item
\item 2nd nested item
\begin{enumerate}
\item Useful/Important Information\label{a}
\end{enumerate}
\end{enumerate}
\item 2nd item
\end{enumerate}

\noindent In this paragraph, I talk a bit about the Useful/Important Information and then reference the item number \ref{a}

\end{document}

If you do want to use the enumerate package and the markup you had, you need to make it use the full label as the reference not add a new (different) prefix.

\documentclass[]{article}
\usepackage{enumerate}
%opening
\title{}
\author{}

\makeatletter

\def\thetolabel#1the{#1label}
\let\p@enumi\thetolabel
\let\p@enumii\thetolabel
\let\p@enumiii\thetolabel
\makeatother

\begin{document}

\begin{enumerate}
\item 1st item
\begin{enumerate}[{1.}1.]
\item 1st nested item
\item 2nd nested item
\begin{enumerate}[{1.2.}1.]
\item Useful/Important Information\label{a}
\end{enumerate}
\end{enumerate}
\item 2nd item
\end{enumerate}

\noindent In this paragraph, I talk a bit about the Useful/Important Information and then reference the item number \ref{a}

\end{document}
-