Next: , Previous: , Up: gtroff Reference   [Contents][Index]


5.12 Troff and Nroff Mode

Originally, nroff and troff were two separate programs, the former for TTY output, the latter for everything else. With GNU troff, both programs are merged into one executable, sending its output to a device driver (grotty for TTY devices, grops for POSTSCRIPT, etc.) which interprets the intermediate output of gtroff. For UNIX troff it makes sense to talk about Nroff mode and Troff mode since the differences are hardcoded. For GNU troff, this distinction is not appropriate because gtroff simply takes the information given in the font files for a particular device without handling requests specially if a TTY output device is used.

Usually, a macro package can be used with all output devices. Nevertheless, it is sometimes necessary to make a distinction between TTY and non-TTY devices: gtroff provides two built-in conditions ‘n’ and ‘t’ for the if, ie, and while requests to decide whether gtroff 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 gtroff (not groff) is started with the -R switch to avoid loading of the start-up files troffrc and troffrc-end. Without -R, gtroff stays in troff mode if the output device is not a TTY (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 gtroff uses a TTY output device; the code for switching to nroff mode is in the file tty.tmac, which is loaded by the start-up file troffrc.

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


Next: , Previous: , Up: gtroff Reference   [Contents][Index]