[pdftex] Getting write page number in hyperindex

Heiko Oberdiek oberdiek at ruf.uni-freiburg.de
Tue Mar 12 05:54:19 CET 2002

On Mon, 11 Mar 2002, Joe Riel wrote:

> I'm using the hyperref package to create a hyperlinked index
> and have had to write my own index macros.  Some of the
> hyperlinks point to the page before the page where the
> indexed item winds up.  I assume that this is due
> to the TeX's page breaking technique, that is, the page number
> isn't known at the time the page number is written to the idx file.
> Is there a standard method for fixing this?
> The code that writes the page number to the index file
> looks like
> \def\codeline at wrindex#1{%
>   \if at filesw\protected at write\@indexfile{}{%
>     \string\indexentry{#1{\number\value{page}}}{\number\c at CodelineNo}}%
>   \fi}

"\number\value{page}" is expanded immediately.
Use "\thepage" instead, because it is protected
by \protected at write.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the pdftex mailing list