As seen in this answer to my previous question “Extra vertical space at end of last column when loading adjustbox (only luatex)”, loading the package pgf causes the following to be added at the end of the document (in pgfutil-latex.def):
\AtBeginDocument{\AtEndDocument{\par\vfil\penalty-10000\relax\the\pgfutil@everybye}}
As shown in the linked question, this can sometimes cause problems.
- Why is
pgfdoing this? - If I don’t know whether
pgfwill be loaded in a given document, how can I get rid of this space? (Without having to modify the document content)
\newpagebefore\end{document}. But ifpgfputs something in the toks register\pgfutil@everybyethis could lead to a second page.” Also, wouldn’t this output whatever is in\pgfutil@everybyetwice? – Socob Nov 10 '18 at 03:02\pgfutil@everybyeand I think it's a bit beyond my understanding. I did wonder whether the\AtEndDocument{...}command could be "beaten" by an\AtVeryEndor something similar. Have you tested the code above? – corporal Nov 11 '18 at 05:54