1

I've got \hyperrefs mostly working, but references to one section — I've noticed two of them so far — insist on taking me to the top of the \section rather than to the desired item below. The source paragraph looks like this:

\section{The Cert workbook:} The Cert workbooks created by the HomeOffice program have the filename “\tit{RunLabel} \tit{manager’s AD ID}.xlsx”, where the \tit{RunLabel} is a string you designate in \hyperref[setRunLabel]{the RunLabel Setting}. Each in-house Cert contains four or five worksheets....

The target area looks like this:

\item[RunLabel:]\label{setRunLabel} The Cert workbooks are created in a folder designated by....

Since most \hyperref links work properly, but the ones pointing to items in this particular section point to the top of the section rather than to the specific item, I suspect I've done something wrong in setting up the chapter or section. But I don't see any problem. Maybe you will:

\appendix
\chapter{Settings in Cert.xlsm}\label{AppSettings}
In Cert.xlsm is a worksheet named Settings....

\section{Description of the Settings worksheet:} The Settings can be listed....

\section{How Settings work:} Settings have different values depending....

\section{Description of the individual settings (in alphabetical order):}

\begin{description}[itemindent=-5mm] \item[ADCooked:]\label{setADCooked} The path and filename of the processed (“cooked”) AD file....

Can anyone see what I'm doing wrong?

1 Answers1

4

hyperlinks jump to a target, an anchor. Such targets are typically created when something is numbered, so e.g. \section has an anchor, and enumerate lists too. If you set a \label a reference to this label will jump to the most recently created target.

So e.g. here the \pageref will not jump to page 2 but to the section on page 1 (as would a \ref) as there is the most recent anchor.

\documentclass{article}
\usepackage{hyperref}

\begin{document} \section{a section}

\newpage HERE\label{here}?

\newpage Jump to page \pageref{here}?? \end{document}

If you want a reference to jump to a place which has no automatically created target, you can create an anchor with \phantomsection, or in a recent LaTeX with \MakeLinkTarget. The second command is also defined if hyperref is removed from the document and it can also be used as a replacement for \hypertarget. It is documented in hyperref-linktarget.pdf

\documentclass{article}
\usepackage{hyperref}

\begin{document} \section{a section}

\newpage HERE\MakeLinkTarget{}\label{here}?

\newpage Jump: \pageref{here}? \end{document}

Ulrike Fischer
  • 327,261