Graphics, Figures & Tableshyperref, pageref and label

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
vinp
Posts: 12
Joined: Thu Dec 30, 2010 10:25 am

hyperref, pageref and label

Post by vinp »

Hi,

I am using pdflatex and in my document (documentclass{report}) I see that the link generated by hyperref in accordance with ~pageref{label} for a diagram is one less that the actual page number on which the diagram appears. This discrepacny exists in only one chapter of the whole document. In the previous chapter, the page number displayed is correct for the link. I have done a google search without much luck.

Any suggestions on how to resolve this?

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

hyperref, pageref and label

Post by kaiserkarl13 »

In the previous chapter, the page number displayed is correct for the link.
I'm confused: do you mean that you have a cross-reference to the same label that shows up with two different page numbers in different chapters? That isn't possible (though see below for an instance of how it could arise temporarily).

Without an example, I can't be sure, but try the following:
* Make sure the \label command comes right after the command that produces the number. I've had problems with \ref and \pageref pointing to a section number when I wanted them to point to a table caption, for example, but I'd put the \label statement inside the caption command instead of after it.
* Make sure you run LaTeX twice to resolve the page numbers to their final states. If you add text, it will mess up the page numbers in all subsequent cross references until the second LaTeX run.
* If you mean the page number as it appears in the table of contents, then be advised to run LaTeX a THIRD time to catch the cross-references in the table of contents. They'll be wrong until then. If you're ever in doubt, run LaTeX again; it never hurts.

If you suspect hyperref, try commenting it out for a while---it may help you track down the error. Just delete your .aux file first so you don't get "I don't know what \[random hyperref command] is" errors.
eajohnson
Posts: 2
Joined: Tue Jul 05, 2011 6:33 am

Re: hyperref, pageref and label

Post by eajohnson »

Post Reply