Generalhyperref: bad links in TOC (\phantomsection NOT working)

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
bruno321
Posts: 4
Joined: Sat Nov 07, 2009 1:04 am

hyperref: bad links in TOC (\phantomsection NOT working)

Post by bruno321 »

Hi. I'm having a problem which I've seen is fairly common, yet the solution that worked for everybody isn't working for me.

I use hyperref: in the TOC, the page numbers are listed well, yet when I click in any of the last three sections I defined, it links me to wrong pages (when it shows page 117, 118 and 120 it links to 21, 23 and 26). In any of the links before those sections, it works fine. I've looked among the contents there to see if I had used any commands out of the ordinary, but I did nothing weird in those sections.

I've read, in http://www.cs.toronto.edu/~murray/compn ... l#hyperref:
Links go to wrong page? Try putting \clearpage before the references section and \phantomsection before any \addcontentsline commands.
The second suggestion is the one which solves the problem for everybody else I've seen on the net. Yet it doesn't work for me, since I don't have any \addcontentsline in my document. I've put \clearpage before \begin{thebibliography}{99} but it doesn't work either (I've also tried after it, etc., and I've also tried with \cleardoublepage).

I have re-compiled several times. I'm using hyperref like this:
\usepackage[pdftex]{hyperref}
\hypersetup{pdfauthor={me},colorlinks=true, citecolor=blue, urlcolor=Sepia, linkcolor=Sepia}

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

bruno321
Posts: 4
Joined: Sat Nov 07, 2009 1:04 am

Re: hyperref: bad links in TOC (\phantomsection NOT working)

Post by bruno321 »

Ok, I've spotted a probably related error.

The TOC is perfect in its branching (i.e. it structures parts, chapter, sections, etc. as I set it to), however the "TOC shortcut" which appears on the left of some major pdf viewing programs (Adobe Reader, Okular) is bad: it only has one part (in the main TOC it shows two: this is correct), and only two chapters (where there should be a lot: everything else appears as sections of the second chapter...).

I don't understand where does this mess come from, I'm using the sectioning commands as one's supposed to use them.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

hyperref: bad links in TOC (\phantomsection NOT working)

Post by gmedina »

Hi,

can you please a minimal working example that reproduces the preblomem mentioned?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ochampao
Posts: 1
Joined: Fri Jan 21, 2011 4:33 pm

hyperref: bad links in TOC (\phantomsection NOT working)

Post by ochampao »

quoting from {TeX} SE:
Hyperref is just too clever sometimes. Make it dumber, and hence more robust [by adding the option]:

Code: Select all

\usepackage[hypertexnames=false]{hyperref}
Post Reply