Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Have you used \usepackage[all]{hypcap} loaded after hyperref package? –  Please don't touch Mar 10 '12 at 11:38
    
Do you still get to exactly the beginning of the theorem? –  Andrey Vihrov Mar 10 '12 at 11:48
    
@DamienWalters Didn't work. But the accepted answer did. –  user10324 Mar 16 '12 at 17:46
add comment

1 Answer 1

up vote 10 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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