home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 12.1 Introduction Chapter 12
Nroff and Troff
Next: 12.3 Using the Requests:  An Overview

12.2 Command-line Invocation

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

/usr/ucb/nroff [ options ] [ files ]

/usr/ucb/troff [ options ] [ files ]

Many of the options are the same for both formatters.

Nroff/troff options

-F dir

Search for font tables in directory dir .


Read standard input after files are processed.

-m name

Prepend a macro file to input files . Troff prepends /usr/lib/tmac/tmac. name . Nroff prepends /usr/share/lib/tmac/tmac. name .

-n N

First output page has page number N .

-o list

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).

-r aN

Set register a to N .

-s N

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

-T name

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

-u N

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


Discard output except messages generated by .tm request.

Nroff-only options


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


Hasten output by replacing 8 horizontal spaces with a tab.


Invoke simultaneous input/output of .rd requests.

Troff-only options


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


Don't stop typesetter when formatting is done.


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 | 



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 &

Previous: 12.1 Introduction UNIX in a Nutshell: System V Edition Next: 12.3 Using the Requests:  An Overview
12.1 Introduction Book Index 12.3 Using the Requests: An Overview

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