B.2 | The Structure of the Document

Document structure is a bit simplified with respect to LATEX, since documents consist of only two parts. The preamble starts as soon as HEVEA starts to operate and ends with the `\begin{document}` construct. Then, any input occurring before `\end{document}` is translated to HTML. However, the preamble is processed and the preamble comprises the content of the files given as command line arguments to HEVEA, see section C.1.1.1). As a consequence, command and environment definitions that occur before `\begin{document}` are performed. and they remain valid during all the processing.
In particular one can define a header and a footer, by using the `\htmlhead` and `\htmlfoot` commands in the preamble. Those commands register their argument as the header and the footer of the final HTML document. The header appears first while the footer appears last in (visible) HTML output. This is mostly useful when HEVEA output is later cut into pieces by HACHA, since both header and footer are replicated at the start and end of any file generated by HACHA. For instance, to append a copyright notice at the end of all the HTML pages, it suffices to invoke the `\htmlfoot` command as follows in the document preamble:

    \htmlfoot{\copyright to me}

The `\htmlhead` command cannot be used for changing anything outside of the HTML document body, there are specific commands for doing this. One can change HEVEA default (empty) atribute for the opening `<BODY ...>` tag by redefining `\@bodyargs`. For instance, you get black text on a white background, when the following declaration occurs before `\begin{document}`:

    \renewcommand{\@bodyargs}{TEXT=black BGCOLOR=white}

Similarly, some elements can be inserted into the output file `HEAD` element by redefining the `\@meta` command (Such elements typically are `META`, `LINK`, etc.). As such text is pure HTML, it should be included in a `rawhtml` environment. For instance, you can specify author information as follows:

    \let\oldmeta=\@meta
    \renewcommand{\@meta}{%
    \oldmeta
    \begin{rawhtml}
    <META name="Author" content="Luc Maranget">
    \end{rawhtml}}

Note how `\@meta` is first bound to `\oldmeta` before being redefined and how `\oldmeta` is invoked in the new definition of `\@meta`. Namely, simply overriding the old definition of `\@meta` would imply not outputting default meta-information.