start page | rating of books | rating of authors | reviews | copyrights

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 12.1 IntroductionChapter 12
nroff and troff
Next: 12.3 Conceptual Overview
 

12.2 Command-Line Invocation

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

nroff  [options]  [files]

troff  [options]  [files]

Many of the options are the same for both formatters.

12.2.1 nroff/troff Options

-Fdir

Search for font tables in directory dir.

-i

Read standard input after files are processed.

-mname

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. The actual location and filename(s) vary among different Unix systems.

-nN

First output page has page number N.

-olist

Print pages contained only in the comma-separated list. Page ranges can be specified as n-m, -m (first page through m), or n- (n through end of file).

-raN

Set register a to N. The register a is restricted to one-character names.

-sN

Stop every n pages. This allows changing a paper cassette. Resume by pressing Return (in nroff) or by pressing the start button on the typesetter (in troff).

-Tname

Prepare output designed for printer or typesetter name. For device names, see your specific documentation or a local expert.

-uN

The font in position 3 is overstruck N times. Typically used to adjust the weight of the bold font.

-z

Discard output except messages generated by .tm request (otroff only).

12.2.2 nroff-Only Options

-e

When justifying output lines, space words equally (using terminal resolution instead of full space increments).

-h

Hasten output by replacing eight horizontal spaces with a tab.

-q

Invoke simultaneous input/output of .rd requests.

12.2.3 troff-Only Options

-a

Format a printable ASCII approximation. Useful for finding page counts without producing printed output.

-f

Don't stop the typesetter when formatting is done (otroff only).

-N

Run as nroff instead of as troff (recent versions of ditroff only).

12.2.4 Examples

Run chap1 through the tbl preprocessor, then format the result using the mm macros, with register N set to 5 (sets the page-numbering style), etc.:

tbl chap1 | troff -mm -rN5 | spooler &

Format chap2 using the ms macros; the first page is 7, but print only pages 8-10, 15, and 18 through the end of the file:

nroff -ms -n7 -o8-10,15,18- chap2 | col > chap2.txt &


Previous: 12.1 IntroductionUNIX in a Nutshell: System V EditionNext: 12.3 Conceptual Overview
12.1 IntroductionBook Index12.3 Conceptual Overview

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System