\AtBeginDocument

Synopsis:

\AtBeginDocument{code}

Save code and execute it when \begin{document} is executed, at the very end of the preamble. The code is executed after the font selection tables have been set up, so the normal font for the document is the current font. However, the code is executed as part of the preamble so you cannot do any typesetting with it.

You can issue this command more than once; the successive code lines will be executed in the order that you gave them.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005cAtBeginDocument.html