[tex-live] tikz inserting extrapage when using \AtEndDocument

Heiko Oberdiek heiko.oberdiek at googlemail.com
Wed Mar 6 00:55:37 CET 2013


On 04.03.2013 18:14, Thomas Schwarzgruber wrote:
> When I compile following minimal working example with pdflatex, I get a
> 2 pages document,
> the first page reads:
> Start Document
> and the top of the second page reads:
> End
> But the expected result would be to have single page document reading:
> Start Document End
> Latex code:
> %%%%%%%%%%%%%%%%%%%%%%
> \listfiles
> \documentclass[a4paper,10pt]{report}
> \usepackage[latin1]{inputenc}
> \usepackage{tikz}%
> \AtBeginDocument{
> Start
> }

 From the LaTeX Companion, 2.ed.:

| Note, however that code in the \AtBeginDocument hook is part of
| the preamble. Thus, restrictions limit what can be put there; in
| particular, no typesetting can be done.

> \AtEndDocument{
> End
> }

There are packages that add a `\clearpage' (e.g. package `lastpage')
in `\AtEndDocument' to get past the last page. Package `atveryend'
addresses this issue for those packages by providing better hooks.
Perhaps your `tikz` version does something like this. Then move
`\AtEndDocument' *before* `\usepackage{tikz}'.

Yours sincerely
   Heiko Oberdiek

More information about the tex-live mailing list