Previous: , Up: Language Concepts   [Contents][Index]


6.2.1.3 Output Structure

Device-independent troff output is organized into three parts: a header, a body, and a trailer.

The task of the header is to set general device parameters. GNU troff guarantees that its header consists of the following three lines:

x T device
x res n h v
x init

with the parameters n, h, and v set as outlined in Device Control Commands. The parser for the device-independent page description language format is able to interpret additional whitespace and comments as well even in the header.

The body contains the document’s visible content. Once an output driver interprets ‘x init, it prepares to handle commands in general. Processing terminates when a ‘x stop command is encountered; the last line of any GNU troff page description output always contains such a command.

Semantically, the body is page-oriented. The p command starts a new page. Positioning, writing, and drawing commands are performed within a page, so they cannot occur before the first p command. The output driver reckons absolute positioning (by the H and V commands) with respect to the current page’s origin at the top left corner, and all other positioning relative to the drawing position on the page.

The trailer advances the drawing position to the bottom of the page and informs the device that the document (or “job”) has ended.