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 executable68 that sends its output to a device driver (grotty for terminal devices, grops for PostScript, and so on) which interprets this intermediate output format. 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 all output devices. Nevertheless, it is sometimes necessary to make a distinction between terminal and non-terminal devices: GNU troff provides two built-in conditions ‘n’ and ‘t’ for the if, ie, and while requests to decide whether GNU troff shall behave like nroff or like troff.

Request: .troff

Make the ‘t’ built-in condition true (and the ‘n’ built-in condition false) for if, ie, and while conditional requests. This is the default if GNU troff (not groff) is started with the -R switch to avoid loading of the startup files troffrc and troffrc-end. Without -R, GNU troff stays in troff mode if the output device is not a terminal (e.g., ‘ps’).

Request: .nroff

Make the ‘n’ built-in condition true (and the ‘t’ built-in condition false) for if, ie, and while conditional requests. This is the default if GNU troff uses a terminal output device; the code for switching to nroff mode is in the file tty.tmac, which is loaded by the startup file troffrc.

See Conditionals and Loops, for more details on built-in conditions.


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