0

I aim to use

\begin{enumerate}
  \item
...
    \end{enumerate}

Goal: such that the numbering (1,2,3,...) of each item in the list can have a reference and hyperlink /hyperref, so I can refer to them later. How to do it? Thank you in advance.

Presumably, I need to add

\usepackage[colorlinks,citecolor=blue,linkcolor=blue,urlcolor=blue]{hyperref}

How to reference and hyperlink /hyperref the "numbering" of items, presumably with a blue color for each number (1,2,3,...)?

A minimal MWE follows a related post here enumitem: referencing items in enumerate from @Werner is

\documentclass{article}
\usepackage{enumitem,cleveref}% http://ctan.org/pkg/{enumitem,cleveref}
\begin{document}
\begin{enumerate}
  \item
    one \label{one}
  \item
    two \label{two}
\end{enumerate}
This \cref{two} is great.
\begin{enumerate}[ref={observation~\arabic*}]
  \item
    one \label{dog}
  \item
    two \label{cat}
\end{enumerate}
This \ref{cat} is a cat.
\end{document}
  • How to reference them \items? Use \label and then you can \ref later. Oh, that's what you're already doing. So, what's the question? – Werner Jan 17 at 18:13
  • What's the question here? Loading hyperref helps – user31729 Jan 17 at 18:13
  • Does \hyperref give a hyperlink? I am not sure – wonderich Jan 17 at 19:24
  • I want to have the \itme number in blur color, and it can be referred later with a hyperref or hyperlink. – wonderich Jan 17 at 19:28
1

Perhaps you're interested in the following; setting the label to use a colour and using hyperref's linkcolor to make it match:

enter image description here

\documentclass{article}

\usepackage{enumitem,xcolor}
\usepackage{hyperref,cleveref}

\hypersetup{
  colorlinks = true,
  linkcolor = blue
}

\begin{document}

\begin{enumerate}[label=\textcolor{blue}{\arabic*.}, ref=\arabic*]
  \item
    one \label{one}
  \item
    two \label{two}
\end{enumerate}

This \cref{two} is great.

\end{document}
  • Thanks +1, this is basically what I wanted – wonderich Jan 17 at 22:14
  • The key is this "[label=\textcolor{blue}{\arabic*.}, ref=\arabic*]" I do not know this before! – wonderich Jan 17 at 22:14
  • 1
    @wonderich: Indeed. You can specify a separate label and ref key. The former will be used for printing the \item number and the latter will be used if you \ref a \label set in that \item. – Werner Jan 17 at 22:33
  • You have comments on this too? tex.stackexchange.com/q/470600/41144 Thank you! – wonderich Jan 17 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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