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.

I'm having a small problem with \pageref{} in LaTeX. I have a quite a large document, and towards the end I point to specific pages in the text. Using hyperref, the link jumps to the correct part of the document, but the actual page number is incorrect.

This is slightly similar (but kind of opposite) to this problem:

LaTeX hyperref link goes to wrong page

I implemented the solution there (\refstepcounter{dummy}), but to no avail. The targets of the \pagerefs are generally text. One such example is:

...these\refstepcounter{dummy}\label{s82:rclass} classifications are....

later referenced by:

\S\ref{s82:richness}, p.\pageref{s82:rclass}

Where the first ref is the section the text lives in. I'm using the following (if this helps), in addition to hyperref:

\documentclass[11pt]{book}

\usepackage[round]{natbib}

I should note that this works correctly towards the start of the document (where I reference forwards rather than backwards, though I'm not sure if that's significant or not). That said, it also does not work when I attempt a reference forwards in the same chapter (document is a thesis)

Many thanks in advance for your help. I would like to include a minimal working example, but the referencing works as expected for the small document I tested. I would be keen to solicit suggestions as to what the problem could be, however.

share|improve this question
2  
I assume you did the obvious checks: (1) there is no "Rerun to get cross references right" in the log file, (2) no warnings about duplicate labels. Do you use \pagenumbering{..}? (It should still work) –  Christian Lindig Apr 16 '11 at 20:36
    
Difficult to call without a minimal example. Maybe some package interferes with the \label, which is very sectioning/caption specific. For links to general text parts the zref package might be better suited. It is from the same author as hyperref and works well with it. –  Martin Scharrer Apr 16 '11 at 20:37
    
@Christian Lindig - ah... strange. After correcting a couple of (unrelated, or so I thought) dupes (2), I got (1) in the log file. Odd. My rendering procedure is: pdflatex ; bibtex ; pdflatex ; pdflatex. How many do I need after bibtex? –  Dave Apr 16 '11 at 21:07
    
@Dave Theoretically it is possible that you never reach a fix point but that is very unlikely. I am not sure, but at most three runs of pdflatex after bibtex should suffice. –  Christian Lindig Apr 16 '11 at 21:24
    
@Christian Lindig - looks like three's the magic number for me. I guess I'll have to drum my fingers on the desk a while longer! Thanks very much for your help. –  Dave Apr 16 '11 at 21:28
show 1 more comment

2 Answers 2

up vote 3 down vote accepted

I assume you did the obvious checks:

  • there is no Rerun to get cross references right in the log file,
  • and no warnings about duplicate labels.

Do you use \pagenumbering{..}? (It should still work). Rerun LaTeX as indicated. Theoretically it is possible that you never reach a fix point but that is very unlikely. I am not sure, but at most three runs of pdflatex after bibtex should suffice.

share|improve this answer
add comment

The standard problem I have found over the years is that people do not understand the scope of the standard latex \label commands and that you must take 2 (or more) runs to get it right. Below is figure that I use to explain the scope to people new to Latex. Maybe something like this can be put in a FAQ or Wiki enter image description here

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.