2

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}
4
  • 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
    Commented Jan 17, 2019 at 18:13
  • What's the question here? Loading hyperref helps
    – user31729
    Commented Jan 17, 2019 at 18:13
  • Does \hyperref give a hyperlink? I am not sure
    – wonderich
    Commented Jan 17, 2019 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
    Commented Jan 17, 2019 at 19:28

1 Answer 1

3

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}
4
  • Thanks +1, this is basically what I wanted
    – wonderich
    Commented Jan 17, 2019 at 22:14
  • The key is this "[label=\textcolor{blue}{\arabic*.}, ref=\arabic*]" I do not know this before!
    – wonderich
    Commented Jan 17, 2019 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
    Commented Jan 17, 2019 at 22:33
  • You have comments on this too? tex.stackexchange.com/q/470600/41144 Thank you!
    – wonderich
    Commented Jan 17, 2019 at 23:38

You must log in to answer this question.

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