O'Reilly logo

Unix in a Nutshell, 4th Edition by Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Overview of nroff/troff

This section is condensed from the material on troff from the third edition of this book. It covers features available in all versions of nroff and troff, and focuses on those features necessary for writing manual pages.

Command-Line Invocation

nroff and troff are invoked from the command line as follows:

    nroff  [options]  [files]
    troff  [options]  [files]

Although both formatters support a plethora of options, the following two are the most important for everyday use.

-m name

Prepend a macro file to input files. Historically, one of /usr/lib/tmac/tmac. name or /usr/share/lib/tmac/tmac. name were the locations of the macros for name. Solaris uses /usr/share/lib/tmac/ name. GNU troff uses something like /usr/local/share/groff/ x.y.z /tmac/ name .tmac. The actual location and filename(s) vary among different Unix systems.

-T name

Prepare output designed for printer or typesetter name. For device names, see your specific documentation or a local expert. GNU troff provides both PostScript and TEX DVI output.

Example

Format a manual page for printing using groff:

    $ groff -man /usr/share/man/man1/awk.1 | lpr

Conceptual Overview

This section provides a brief overview of how to prepare input for nroff and troff. It presents the following topics:

  • Requests and macros

  • Common requests

  • Specifying measurements

  • Requests that cause a line break

  • Embedded formatting controls

Requests and macros

Formatting is specified by embedding brief codes (called requests) into the text source file. These ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required