2

When in LaTeX2e using the hyperref-package, you can apply the command

\hyperref[⟨referencing-label⟩]{⟨tokens that form the text of the hyperlink⟩}
for turning phrases of text into clickable hyperlinks that navigate to the place of the document denoted by the referencing-label.

How can you turn a complete \item (i.e., both the bullet/item number and the text of the item) that occurs as the first item within an enumerate-environment/itemize-environment into such a clickable hyperlink?

I can provide a minimal example which does not do exactly what I desire:      :-)

\documentclass[a4paper]{article}
\usepackage[colorlinks=true, linkcolor=red]{hyperref}
\begin{document}

\section{A section}\label{Section}

Some text.

\newpage
\enlargethispage{2cm}

% This does work but the bullet is not part of the hyperlink:

\begin{verbatim}
\begin{itemize}
\item\hyperref[Section]{Both the bullet and the text of this item are
                        to be turned into a hyperlink for navigating
                        to the section ``A section''.\\
                        But---as expected with this approach---the 
                        bullet will not be part of the hyperlink.}
\end{itemize}
\end{verbatim}

yields:

\begin{itemize}
\item\hyperref[Section]{Both the bullet and the text of this item are
                        to be turned into a hyperlink for navigating
                        to the section ``A section''.\\
                        But---as expected with this approach---the 
                        bullet will not be part of the hyperlink.}
\end{itemize}

\noindent\hrulefill

% This does work but the item that is to be turned into a hyperlink 
% is not the first item of the environment:

\begin{verbatim}
\begin{itemize}
\item Some dummy item.
\hyperref[Section]{\item Both the bullet and the text of this item are
                         to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This works out while the item that is to be turned 
                         into a hyperlink is not the first item of the
                         environment.}
\end{itemize}
\end{verbatim}

yields:

\begin{itemize}
\item Some dummy item.
\hyperref[Section]{\item Both the bullet and the text of this item are
                         to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This works out while the item that is to be turned 
                         into a hyperlink is not the first item of the
                         environment.}
\end{itemize}

\noindent\hrulefill

% This leads to ! LaTeX Error: Something's wrong--perhaps a missing \item.

\begin{verbatim}
\begin{itemize}
\hyperref[Section]{\item Both the bullet and the text of this item are
                         to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This does not work out while the item that is to 
                         be turned into a hyperlink is the first item
                         of the environment.\\
                         You get \texttt{! LaTeX Error: Something's wrong%
                         \string-\string-perhaps a missing \string\item}.}
\end{itemize}
\end{verbatim}

yields:

%\begin{itemize}
%\hyperref[Section]{\item Both the bullet and the text of this item are
%                         to be turned into a hyperlink for navigating
%                         to the section ``A section''.\\
%                         This does not work out while the item that is to 
%                         be turned into a hyperlink is the first item
%                         of the environment.\\
%                         You get \texttt{! LaTeX Error: Something's wrong%
%                         \string-\string-perhaps a missing \string\item}.}
%\end{itemize}
\begin{verbatim}
! LaTeX Error: Something's wrong--perhaps a missing \item.
\end{verbatim}

\newpage
\enlargethispage{2cm}

% This does work but the bullet is not part of the hyperlink:

\begin{verbatim}
\begin{enumerate}
\item\hyperref[Section]{Both the item-number and the text of this item
                        are to be turned into a hyperlink for navigating
                        to the section ``A section''.\\
                        But---as expected with this approach---the 
                        item-number will not be part of the hyperlink.}
\end{enumerate}
\end{verbatim}

yields:

\begin{enumerate}
\item\hyperref[Section]{Both the item-number and the text of this item
                        are to be turned into a hyperlink for navigating
                        to the section ``A section''.\\
                        But---as expected with this approach---the 
                        item-number will not be part of the hyperlink.}
\end{enumerate}

\noindent\hrulefill

% This does work but the item that is to be turned into a hyperlink 
% is not the first item of the environment:

\begin{verbatim}
\begin{enumerate}
\item Some dummy item.
\hyperref[Section]{\item Both the item-number and the text of this item
                         are to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This works out while the item that is to be turned 
                         into a hyperlink is not the first item of the
                         environment.}
\end{enumerate}
\end{verbatim}

yields:

\begin{enumerate}
\item Some dummy item.
\hyperref[Section]{\item Both the item-number and the text of this item
                         are to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This works out while the item that is to be turned 
                         into a hyperlink is not the first item of the
                         environment.}
\end{enumerate}

\noindent\hrulefill

% This leads to ! LaTeX Error: Something's wrong--perhaps a missing \item.

\begin{verbatim}
\begin{enumerate}
\hyperref[Section]{\item Both the item-number and the text of this item
                         are to be turned into a hyperlink for navigating
                         to the section ``A section''.\\
                         This does not work out while the item that is to 
                         be turned into a hyperlink is the first item
                         of the environment.\\
                         You get \texttt{! LaTeX Error: Something's wrong%
                         \string-\string-perhaps a missing \string\item}.}
\end{enumerate}
\end{verbatim}

yields:

%\begin{enumerate}
%\hyperref[Section]{\item Both the item-number and the text of this item
%                         are to be turned into a hyperlink for navigating
%                         to the section ``A section''.\\
%                         This does not work out while the item that is to 
%                         be turned into a hyperlink is the first item
%                         of the environment.\\
%                         You get \texttt{! LaTeX Error: Something's wrong%
%                         \string-\string-perhaps a missing \string\item}.}
%\end{enumerate}
\begin{verbatim}
! LaTeX Error: Something's wrong--perhaps a missing \item.
\end{verbatim}

\end{document}

Page 1 - So you have something where hyperlinks navigate:

enter image description here

Page 2 - Tests with itemize-environment:

enter image description here

Page 3 - Tests with enumerate-environment:

enter image description here

In case you need to know about package-versions and the like, here is an excerpt from the .log-file:

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/Debian) (preloaded format=pdflatex 2018.4.29)  28 NOV 2018 17:44
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
[...]
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 12 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
Package: hyperref 2018/02/06 v6.86b Hypertext links for LaTeX
Package: hobsub-hyperref 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
Package: hobsub-generic 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
Package: hobsub 2016/05/16 v1.14 Construct package bundles (HO)
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
Package: intcalc 2016/05/16 v1.2 Expandable calculations with integers (HO)
Package: ifpdf 2017/03/15 v3.2 Provides the ifpdf switch
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
Package: pdftexcmds 2018/01/30 v0.27 Utility functions of pdfTeX for LuaTeX (HO
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
Package: pdfescape 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
Package: bigintcalc 2016/05/16 v1.4 Expandable calculations on big integers (HO
Package: bitset 2016/05/16 v1.2 Handle bit-vector datatype (HO)
Package: uniquecounter 2016/05/16 v1.3 Provide unlimited unique counter (HO)
Package hobsub Info: Skipping package `hobsub' (already loaded).
Package: letltxmacro 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
Package: hopatch 2016/05/16 v1.3 Wrapper for package hooks (HO)
Package: xcolor-patch 2016/05/16 xcolor patch
Package: atveryend 2016/05/16 v1.9 Hooks at the very end of document (HO)
Package atveryend Info: \enddocument detected (standard20110627).
Package: atbegshi 2016/06/09 v1.18 At begin shipout hook (HO)
Package: refcount 2016/05/16 v3.5 Data extraction from label references (HO)
Package: hycolor 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
Package: auxhook 2016/05/16 v1.4 Hooks for auxiliary files (HO)
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
File: pd1enc.def 2018/02/06 v6.86b Hyperref: PDFDocEncoding definition (HO)
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
File: hpdftex.def 2018/02/06 v6.86b Hyperref driver for pdfTeX
Package: rerunfilecheck 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
Package: color 2016/07/10 v1.1e Standard LaTeX Color (DPC)
File: color.cfg 2016/01/02 v1.6 sample color configuration
Package color Info: Driver file: pdftex.def on input line 147.
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
Package: nameref 2016/05/21 v2.44 Cross-referencing by name of section
Package: gettitlestring 2016/05/16 v1.5 Cleanup title references (HO)

Your Answer

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

Browse other questions tagged or ask your own question.