UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 12.3 Conceptual OverviewChapter 12
nroff and troff
Next: 12.5 Group Summary of Requests
 

12.4 Default Operation of Requests

nroff/troff initializes the formatting environment. For example, unless you reset the line length, nroff/troff uses 6.5 inches. Most requests can change the default environment, and those that can are listed in Table 12.1. The second column lists the initial or default value in effect before the request is used. If no initial value applies, a hyphen (-) is used. The third column shows the effect if a request's optional argument is not used. Here, a hyphen is used if the request doesn't accept an argument or if the argument is required.


Table 12.1: Requests That Affect the Default Environment
RequestInitial ValueIf No ArgumentDescription
.adJustifyJustify

Adjust margins.

.afLowercase arabic-

Assign a format to a register.

.am-End call with ..

Append to a macro.

.bdOff-

Embolden font.

.c2''

Set no-break control character.

.cc..

Set control character.

.ceOffCenter one line

Center lines.

.ch-Turn off trap

Change trap position.

.csOff-

Set constant-width spacing.

.cuOffOne line

Continuous underline/italicize.

.da-End the diversion

Divert text and append to a macro.

.de-End macro with ..

Define a macro.

.di-End the diversion

Divert text to a macro.

.dt-Turn off trap

Set a diversion trap.

.ec\\

Set escape character.

.eoOn-

Turn off escape character.

.ev0

Previous environment

Change environment (push down).

.fcOffOff

Set field delimiter and pad character.

.fiFill-

Fill lines.

.fp1=R-

Mount font (on positions 1-4).

 2=I  
 3=B  
 4=S  
.ftRomanPrevious font

Set font.

.hc\%\%

Set hyphenation character.

.hyMode 1Mode 1

Set hyphenation mode.

.ig-End with ..

Suppress (ignore) text in output.

.in0Previous indent

Indent.

.it-Turn off trap

Set a trap for input line counting.

.lc.None

Set leader character.

.lgOff (nroff)On

Ligature mode.

 On (troff)  
.ll6.5 inches

Previous line length

Set line length.

.lsSingle-spacePrevious mode

Set line spacing.

.lt6.5 inches

Previous title length

Set length of title.

.mc-Turn off

Set the margin character.

.mk-Internal

Mark vertical position.

.naAdjust-

Don't adjust margins.

.ne-One vertical line

Keep lines on same page if there's room.

.nfFill-

Don't fill lines.

.nhOn-

Turn off hyphenation.

.nmOffOff

Line-numbering mode.

.nn-One line

Don't number next N lines.

.nsSpace mode-

Enable no-space mode.

.nx-End of file

Go to a file.

.pc%Off

Set page character.

.pl11 inches11 inches

Set page length.

.pnPage 1-

Set page number.

.po

0 (nroff); 26/27 inch (otroff)

Previous offset

Change page offset.

 1 inch (ditroff)  
.ps10

Previous point size

Set point size.

.rd-Ring bell

Read from the terminal.

.rt-Internal

Return to marked vertical place.

.sp-One vertical line

Output blank spacing.

.ss12/36 emIgnored

Set character spacing.

.sv-One vertical line

Save (store) spacing.

.ta

8 en (nroff); 1/2 inch (troff)

-

Define tab settings.

.tc--

Set tab repetition character.

.ti0-Indent next line.
.tm-Newline

Print a message, then continue.

.tr--

Translate pairs of characters on output.

.ufItalicItalic

Set font for underlining.

.ul0One lineUnderline/italicize.
.vs

1/6 inch (nroff); 12 points (troff)

Previous value

Set vertical spacing for lines.

Comments in nroff/troff begin with \". Lines beginning with . that contain an unknown request are ignored. In general, don't put leading whitespace on your text lines. This causes a break, and nroff and troff honors the leading whitespace literally.

Note: the canonical reference for nroff/troff is Bell Labs Computing Science Technical Report #54, Troff User's Manual, by J.F. Ossanna and B.W. Kernighan. It is available in PostScript from http://cm.bell-labs.com/cm/cs/cstr/54.ps.gz. You should read it if you plan to do any serious work in nroff/troff (such as writing or modifying macro packages). This document explains the ideas of diversions, environments, fields, registers, strings, and traps.


Previous: 12.3 Conceptual OverviewUNIX in a Nutshell: System V EditionNext: 12.5 Group Summary of Requests
12.3 Conceptual OverviewBook Index12.5 Group Summary of Requests

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