9

When I label an equation and later have a reference to it, then by clicking the corresponding link the pdf I jump to that equation, with the equation being exactly at the top of the page. Same goes for footnotes.

But when I just insert a label in the text (for example near a theorem for the purpose to have a link to that theorem in my text) and later in the text have a reference to it and then click on the corresponding link in the pdf, I don't jump exactly to the place where the label was (meaning it isn't at the top of the page like equations ans footnotes anymore), just to right page - with the place where the label was being somewhere around the middle.

What can I do so that the link will send me to the place where the label was, with it being at the top of the page (like for equations) ?

P.S. I use LxY 2.

2
  • 1
    Have you used \usepackage[all]{hypcap} loaded after hyperref package? Mar 10, 2012 at 11:38
  • Do you still get to exactly the beginning of the theorem? Mar 10, 2012 at 11:48

1 Answer 1

13

Links jump to the last anchor. Normally hyperref inserts such anchors at sensible places, but if you want a specific location you must do it yourself.

\documentclass{article}
\usepackage{hyperref,lipsum}

\begin{document}
\section{ABC}
\lipsum[1]

ANCHOR\label{A}\phantomsection\label{B}

\lipsum[2]
\newpage
A: \ref{A} to section title

B: \ref{B} to ANCHOR
\end{document}

You must log in to answer this question.

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