[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#445839: texlive-base: using hyperref adds an unwanted end-of-page at AtEndDocument



On Mon, Oct 08, 2007 at 05:53:25PM +0200, Norbert Preining wrote:

> On Mo, 08 Okt 2007, Andreas Beckmann wrote:
> > the following input file produces a two page document in texlive, it
> > didn't do this with teTeX. Looks like hyperref (or something included by
> > hyperref) fills the page at AtEndDocument and my additional text is
> > moved to the next page.
> > 
> > If I don't use hyperref or swap the lines 2 and 3, I get the expected
> > one page document.
> > 
> > Andreas
> > 
> > ##################################
> > minimal input file
> > 
> > \documentclass{article}
> > \usepackage{hyperref}       % line 2
> > \AtEndDocument{The End.}    % line 3
> > \begin{document}
> > Lorem ipsum dolor sit amet.
> > \end{document}
> > 
> > ##################################

This isn't a bug, \AtEndDocument shouldn't contain text.
Many packages must know the end of the document
and are executing
  \AtEndDocument{\clearpage ...}
for their stuff.

As an example, hyperref sets page labels there. Otherwise
two runs would be necessary.

> The important point is that it does NOT happen with latex, but only with
> pdflatex.

page labels are implemented differently. The route via dvips
uses a PostScript header file that is included in the first
page and filled during the document. Then dvips puts this together.

> I checked a bit in the manual but didn't find any mentioning that there
> could be a problem with AtEndDocument.

As already said, \AtEndDocument should not contain text.
\clearpage is ok for output pending floats (source2e).
As workaround \AtEndDocument with text should go before
any package that needs the at *END* document hook.
If there are text or pages after this, the code would
be executed in the *middle* of the document and it would
disturb many other packages (hyperref, lastpage, totpages, ...)

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




Reply to: