[texhax] pdfpages, geometry, hyperref - no page anchors
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Fri Jun 25 08:27:25 CEST 2010
On Thu, Jun 24, 2010 at 01:47:26PM -0400, Lev Bishop wrote:
> When I run pdflatex on this simple file:
> \documentclass{book}
> \usepackage{pdfpages}
> \usepackage[showframe]{geometry}
> \usepackage{hyperref}
> \begin{document}
> p1\newpage p2\newpage p3\newpage
> \hyperlink{page.1}{1}/\hyperlink{page.2}{2}/\hyperlink{page.3}{3}/
> \end{document}
>
> I get the warnings:
> pdfTeX warning (dest): name{page.3} has been referenced but does not
> exist, replaced by a fixed one
> pdfTeX warning (dest): name{page.2} has been referenced but does not
> exist, replaced by a fixed one
> pdfTeX warning (dest): name{page.1} has been referenced but does not
> exist, replaced by a fixed one
>
> If I remove \usepackage{pdfpages} or \usepackage{geometry} or even
> just the [showframe] option then everything is fine.
The bug is in geometry, if option showframe or showcrop are used.
Then geometry redefines shipout in \AtBeginDocument, but saves
the \shipout at package loading time. Thus each redefining of
\shipout is lost in between.
Workaround:
\documentclass{book}
\usepackage{pdfpages}
\makeatletter
\AtBeginDocument{\let\Gm at shipout\shipout}% right before geometry
\makeatother
\usepackage[showframe]{geometry}
\usepackage{hyperref}
\begin{document}
p1\newpage p2\newpage p3\newpage
\hyperlink{page.1}{1}/\hyperlink{page.2}{2}/\hyperlink{page.3}{3}/
\end{document}
Package geometry should at least move and copy the line
\let\Gm at hipout\shipout
right before each
\renewcommand*{\shipout}{...}%
Also the way geometry redefines \shipout can be improved,
see package atbegshi "2 Method of \shipout overloading".
Yours sincerely
Heiko Oberdiek
More information about the texhax
mailing list