Next: , Previous: , Up: GNU troff Reference   [Contents][Index]


5.14 troff and nroff Modes

Historically, nroff and troff were two separate programs; the former for terminal output, the latter for typesetters. GNU troff merges both functions into one executable152 that sends its output to a device driver (grotty for terminal devices, grops for PostScript, and so on) that interprets its output. When discussing AT&T troff, it makes sense to talk about nroff mode and troff mode since the differences are hard-coded. GNU troff takes information from device and font description files without handling requests specially if a terminal output device is used, so such a strong distinction is unnecessary.

Usually, a macro package can be used with any output device. Nevertheless, it is sometimes necessary to distinguish terminal and non-terminal devices: the formatter provides the conditional expressions153 ‘n’ and ‘t’ to help documents format as desired for these device classes, which have divergent capabilities. AT&T nroff silently ignores requests and escape sequences that change the type size, for example.

GNU troff furthermore offers requests that configure it to behave like nroff or like troff. This feature spares the document author the tedium of guarding changes of type size or font family with ‘if t’ control lines or similar.

Request: .troff

Make the ‘t’ built-in condition true (and the ‘n’ built-in condition false) in conditional expressions. This is the default. However, GNU troff normally reads the startup files troffrc and troffrc-end, which can alter it. Recall -R from Options.

Request: .nroff

Make the ‘n’ built-in condition true (and the ‘t’ built-in condition false) in conditional expressions. The file tty.tmac switches GNU troff to nroff mode; troffrc loads it if the name of the output device matches that of a known “typewriter-like device”; recall Options.


Next: Line Layout, Previous: Character Translations, Up: GNU troff Reference   [Contents][Index]