6.1.1.1 Separation

AT&T troff output has strange requirements regarding whitespace. The gtroff output parser, however, is more tolerant, making whitespace maximally optional. Such characters, i.e., the tab, space, and newline, always have a syntactical meaning. They are never printable because spacing within the output is always done by positioning commands.

Any sequence of space or tab characters is treated as a single syntactical space. It separates commands and arguments, but is only required when there would occur a clashing between the command code and the arguments without the space. Most often, this happens when variable-length command names, arguments, argument lists, or command clusters meet. Commands and arguments with a known, fixed length need not be separated by syntactical space.

A line break is a syntactical element, too. Every command argument can be followed by whitespace, a comment, or a newline character. Thus a syntactical line break is defined to consist of optional syntactical space that is optionally followed by a comment, and a newline character.

The normal commands, those for positioning and text, consist of a single letter taking a fixed number of arguments. For historical reasons, the parser allows stacking of such commands on the same line, but fortunately, in gtroff’s intermediate output, every command with at least one argument is followed by a line break, thus providing excellent readability.

The other commands—those for drawing and device controlling—have a more complicated structure; some recognize long command names, and some take a variable number of arguments. So all ‘D’ and ‘x’ commands were designed to request a syntactical line break after their last argument. Only one command, ‘x X, has an argument that can span several input lines; all other commands must have all of their arguments on the same line as the command, i.e., the arguments may not be split by a line break.

Empty lines (these are lines containing only space and/or a comment), can occur everywhere. They are just ignored.