# [pdftex] ambiguous \pdfpageref

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Wed Dec 8 10:20:06 CET 2004

> Thank you, Hans and Rolf, for pointing me to the count1to' package. I
> studied it and worked out the following solution, using the everyshi'
> package together with a LaTeX counter. Do you think this approach is
> robust enough?
>
> \documentclass{book}
> \usepackage{everyshi}
>
> \newcounter{absolutepage}% absolute page number
> \AtBeginDocument{\stepcounter{absolutepage}}% first page 1' not 0'
> \EveryShipout{\stepcounter{absolutepage}}%
>
> \begin{document}
>     \pagenumbering{roman}
>     Page object: \pdfpageref\value{absolutepage}\\
>     \newpage
>     \pagenumbering{arabic}
>     Page object: \pdfpageref\value{absolutepage}\\
> \end{document}

that will work, because you have an explicit page break.

referring to the value of a (different) counter changed at shipout
time is just as unreliable as referring to the value of the page
number, in general.

i don't understand well enough what you're actually trying to achieve
here, but this has all the hallmarks of one of those things that screw
themselves up.

try:

\begin{document}
\pagenumbering{roman}
Page object: \pdfpageref\value{absolutepage}\\
\newpage
\pagenumbering{arabic}
<lots and lots of text so that there's enough that there will be
a page break in it>
Page object: \pdfpageref\value{absolutepage}

new paragraph of stuff...
\end{document}

is the reference right?