TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do neither \hyperlink nor \hyperref (either explicitly or from the TOC) not go to the page top for Chapter 1, but they both do for Chapter 2 in the below code?




\chapter{Chapter 1}%

Go \hyperlink{chapter1}{directly to chapter 1 via hyperlink}.

Go \hyperref[chapter1]{directly to chapter 1 via hyperref}.


Go directly to \hyperlink{chapter2}{chapter 2 from Chapter 1 via hyperlink}.

Go directly to \hyperref[chapter2]{chapter 2 from Chapter 1 via hyperref}.

\chapter{Chapter 2}%

This is chapter 2.

Go \hyperlink{chapter1}{directly to chapter 1 via hyperlink}.

Go \hyperref[chapter1]{directly to chapter 1 via hyperref}.


Go directly to \hyperlink{chapter2}{chapter 2 from Chapter 2 via hyperlink}.

Go directly to \hyperref[chapter2]{chapter 2 from Chapter 2 via hyperref}.

share|improve this question
Works as expected for me (when compiled with pdflatex and a current hyperref). – Ulrike Fischer Mar 6 '13 at 7:55
I think it's questionable practice to use the same string for the arguments of both \label and \hypertarget. You might get away with it if the commands occur together, but its going to he confusing, to say the least, if they don't. – Mico Mar 6 '13 at 11:19
Ulrike, what does as expected'' mean? Mico, I agree, for documentation purposes, anyway, as it doesn't seem to affect the behavior. Heiko, I understand where the anchors are supposed to be set. I assume your expected behavior'' is \hypertarget pointing to somewhere above the chapter title (but not the top of the page) and \hyperlink pointing to the bottom of whatever line on which the corresponding \hypertarget is. However, as I wrote, I get different behavior for Chapter 1 vs. Chapter 2. I am using an updated version of hyperref. I tested with latex, pdflatex, xelatex, and luatex. I viewe – user27113 Mar 9 '13 at 17:22
It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The StackExchange staff can merge them together for you. – Werner Mar 9 '13 at 18:36
\chapter{Chapter 1}%

\chapter automatically sets an anchor. This anchor is used for:

  • the entry in the table of contents,
  • the bookmarks, and
  • the following \label that is linked via \hyperref[...].

Therefore all these links point to the top of the chapter title.

On the other hand \hypertarget sets a new anchor, where it is called: after the chapter title. Therefore the \hyperlink addresses a location below the chapter title. Since there is not a page break in between the chapter title and \hypertarget, the location is still on the same page.

Quoting Ulrike Fischer: "Works as expected for me" also holds for me, tested with pdflatex, xelatex, latex/dvips/ps2pdf. Do you use a different driver? Package hyperref is uptodate? Perhaps you can test a different PDF viewer (if PDF is the output format)?

Anchor positions

Running pdflatex, the anchor positions (horizontal and vertical positions) of the PDF file:

chapter.1: 106.869 668.127
chapter.2: 106.869 668.127
chapter1:  106.869 488.961
chapter2:  106.869 488.961

Thus the corresponding anchors for the first and second chapter have the exact same positions on the page. If they differ for your PDF file, then put the file somewhere for downloading.

share|improve this answer

Your Answer


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.