How to Reference and Hyperlink Enumerate Items in LaTeX
At a glance
- 1. Place a label
Put \label immediately after the \item you want to reference.
- 2. Reference the item
Use \ref for its number; with hyperref loaded, the number is clickable.
- 3. Set custom references
If enumitem changes the visible label, set its ref option to control what \ref prints.
- 4. Compile again
Compile LaTeX at least twice so references and hyperlinks resolve.
To refer to a particular entry in an enumerate list, place a \label on that entry and use \ref where you want the reference to appear. When the hyperref package is loaded, the number produced by \ref is normally clickable and takes the reader to the list item.
The key detail is label placement: put \label immediately after \item, so it records that item’s counter rather than a previous section or another numbered object. The example below also shows how to keep references consistent when you customize list labels with enumitem.
Minimal working example
\documentclass{article}
\usepackage{enumitem}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\begin{enumerate}
\item\label{item:first} First entry.
\item\label{item:second} Second entry.
\item Third entry.
\end{enumerate}
The result in item~\ref{item:second} is discussed below.
\begin{enumerate}[label=(\alph*), ref=(\alph*)]
\item\label{item:custom-a} A custom-labeled entry.
\item Another custom-labeled entry.
\end{enumerate}
The custom entry is item~\ref{item:custom-a}.
\end{document}
This example uses the enumitem package for list customization and hyperref for hyperlinks. Put hyperref near the end of the package list, as shown. After compiling, the first reference displays the number 2 as a link to the second item. In the customized list, the reference displays (a) and links to the corresponding entry. Compile the document twice (or use a build tool that reruns LaTeX automatically) to resolve references.
How the reference works
Each enumerate level has a counter. For the ordinary list, the counter is displayed as 1, 2, 3, and so on. When LaTeX encounters \item\label{item:second}, it associates the label name item:second with that item’s counter value and hyperlink destination.
Later, \ref{item:second} prints the saved value. Without hyperref, it prints the number but does not make it a link. With hyperref, the reference is linked to the item automatically. You do not need to wrap every \ref in a separate hyperlink command.
The label name is an identifier chosen by you; it does not control the printed number. Names such as item:second or itm:proof-step make it easier to remember what a reference points to. Use a different label name for every labeled object in the document.
Custom labels with enumitem
enumitem lets you change how list labels look. For example, [label=(\alph*)] displays entries as (a), (b), and so forth. The ref option controls the format used by \ref. In the example, ref=(\alph*) makes the reference print (a), matching the visible label.
If you leave out ref, a customized visible label and the reference format may not match. Decide whether you want a reference such as a or (a), then set ref accordingly. For example, use ref=\alph* for a and ref=(\alph*) for (a). You can similarly use other counter formats supported by enumitem.
For nested lists, put a label on the specific inner \item you want to identify. The reference then uses that list level’s counter format. If a reference needs to include the outer and inner numbers together, configure the nested list’s ref format to include both counter representations.
Linking custom text
Use \ref when the printed reference itself should be the link. If you want different link text, hyperref provides \hyperref[label]{text}. For example:
\hyperref[item:second]{the second entry}
This makes the words “the second entry” link to the labeled item. To include the item number in custom link text without creating a link inside a link, use the starred, unlinked form of the reference:
\hyperref[item:second]{item~\ref*{item:second}}
The outer \hyperref makes the whole phrase clickable; \ref* supplies the number without making a second hyperlink.
Common mistakes
- Putting
\labelbefore\item: the label may capture the counter value of a preceding numbered element. Put it just after the intended\item. - Reusing a label name: labels must be unique. Reuse can cause incorrect references or warnings.
- Expecting a reference to update in one run: LaTeX writes reference information to an auxiliary file. Compile again after adding or changing labels.
- Assuming the visible label sets the reference format: with customized lists, specify
refinenumitemwhen you need a particular reference style. - Writing the number by hand: a hard-coded number will not update if you insert, remove, or reorder entries. Use
\refinstead.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.