next up previous contents
Next: Option processing Up: Commands for class and Previous: Moving options around   Contents


Delaying code

These first two commands are also intended primarily for use within the <code> argument of \DeclareOption or \DeclareOption*.


\AtEndOfClass {<code>}
\AtEndOfPackage {<code>}

These commands declare <code> that is saved away internally and then executed after processing the whole of the current class or package file.

Repeated use of these commands is permitted: the code in the arguments is stored (and later executed) in the order of their declarations.


\AtBeginDocument {<code>}
\AtEndDocument {<code>}

These commands declare <code> to be saved internally and executed while LATEX is executing \begin{document} or \end{document}.

The <code> specified in the argument to \AtBeginDocument is executed near the end of the \begin{document} code, after the font selection tables have been set up. It is therefore a useful place to put code which needs to be executed after everything has been prepared for typesetting and when the normal font for the document is the current font.

The \AtBeginDocument hook should not be used for code that does any typesetting since the typeset result would be unpredictable.

The <code> specified in the argument to \AtEndDocument is executed at the beginning of the \end{document} code, before the final page is finished and before any leftover floating environments are processed. If some of the <code> is to be executed after these two processes, you should include a \clearpage at the appropriate point in <code>.

Repeated use of these commands is permitted: the code in the arguments is stored (and later executed) in the order of their declarations.


\AtBeginDvi {<specials>}

These commands save in a box register things which are written to the .dvi file at the beginning of the `shipout' of the first page of the document.

This should not be used for anything that will add any typeset material to the .dvi file.

Repeated use of this command is permitted.


next up previous contents
Next: Option processing Up: Commands for class and Previous: Moving options around   Contents
Johannes L. Braams 2003-05-18