[Tex/LaTex] hyperref incorrect links: how to debug

debugginghyperref

Problem Statement. I am writing a large document that is too big to provide here for illustration. For the first hundred pages or so, the hyperlinks are correctly matched to the displayed text. For example, the text might refer to page 55, and the hyperlink would also direct the PDF viewer to that page. But then, at some point, the hyperlinks start pointing to incorrect pages, much earlier in the document. For example, a link might go to page 8, but the displayed text might refer correctly to page 80. (Throughout the document, the displayed references, e.g. page numbers or section numbers, remain correct. It is the hyperlinks that are broken at some point.)

Question. is there a way to debug documents that use the hyperref package, to find out why this sort of thing is happening?

Best Answer

  1. Clean Compile (delete all auxiliary files and do the latex-bibtex-latex-latex, etc dance from scratch)
  2. Remove/turn-off as many packages as you can. Some packages may conflict with others
  3. Reduce your document to the smallest sample showing the problem
  4. Google =)
  5. Grep *.log files and run latex interractevly to see if there are problems.

ps. inserting pdfpages can mess-up page number orderring.