Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Coherent 3.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


nroff                        Command                        nroff




Text processor

nroff [option ...] [file ...]

nroff processes each given file, or the standard input if none is
specified, and  prints the formatted result  on the standard out-
put.  The  input must contain formatting  instructions as well as
the text to be processed.

Basic commands  provide for such  things as setting  line length,
page length, and  page offset, generating vertical and horizontal
motions,  indentation, filling  and adjusting  output  lines, and
centering.  The great flexibility of nroff lies in its acceptance
of user-defined macros to control almost all higher-level format-
ting.   For  example, the  formation  of  paragraphs, header  and
footer areas,  and footnotes must all be  implemented by the user
via macros.

The  following summarizes  the commands and  options that  can be
used  with  nroff.   Four  types  of  commands  and  options  are
described: (1)  command line options; (2)  nroff's basic commands
(also called  primitives); (3) escape sequences  that can be used
with nroff; and  (4) nroff's dedicated number registers, and what
information each one keeps.

***** Command-line Options *****


Command-line options  may be  listed in  any order.  They  are as
follows:

-d   Debugging mode.

-i   Read from the standard input after reading the given files.

-mname
     Include  the  macro  file  /usr/lib/tmac.name in  the  input
     stream.

-nN  Number the first page of output N.

-raN Set number register a to the value N.

***** Primitives *****


The following  lists the basic commands,  or primitives, that are
built into nroff.  These primitives can be assembled into macros,
or can be written directly into the text of your document.

.ad  Enter adjust mode: that is, insert white space between words
     to create right-justified output.




COHERENT Lexicon                                           Page 1



nroff                        Command                        nroff



.af R X
     Assign format  X to number register  R.  The assigned format
     may be one of the following:

     1       Arabic numerals
     i       Lower-case Roman numerals
     I       Upper-case Roman numerals
     a       Lower-case alphabetic characters
     A       Upper-case alphabetic characters


.am XX
     Append the following to macro XX.  Used like .de, below.

.as XX
     Append the following to string XX.  Used like .ds, below.

.bp  Begin a new page.

.br  Break; print  any fraction of a line of  text that is hidden
     in a buffer before beginning formatting of new text.

.ce N
     Center N lines of text; the default is one.

.ch XX N
     Change the location of the  trap for macro XX to location N.
     Used like command .wh, below.

.da X
     Divert and append the following text into macro X.  A diver-
     sion is ended by a .da command that has no argument.

.de X
     Define macro  X.  Macro definition  is ended by  a line that
     contains only two periods ``..''.

.di X
     Divert the following  text into macro X.  Diversion is ended
     by a .da command that has no argument.

.ds X
     Define string X.

.el action
     Executed when  the test in an  .ie command fails; otherwise,
     it is  ignored.  This command must be used  with an .ie com-
     mand.

.ev N
     Change the environment.  When  followed by 0, 1, 2, the com-
     mand pushes that environment; when used without an argument,
     the command pops  the present environment and returns to the
     previous environment.



COHERENT Lexicon                                           Page 2



nroff                        Command                        nroff



.fi  Enter fill mode.

.ft X
     Change to font X.  nroff  recognizes R, B, and I, for Roman,
     bold, and italic, respectively.

.ie condition action
     This command tests to see  if condition is true; if true, it
     then executes action;  otherwise, it performs the action in-
     troduced by an .el  command.  This command must be used with
     an .el command.

.if condition action
     This command tests to see  if condition is true; if so, then
     action is executed;  otherwise, action is ignored.  The com-
     mand .if o  applies if the page number is  odd, and the com-
     mand .if e applies if  the page number is even.  The command
     .if n  applies if  the text is  processed by nroff,  and the
     command .if t applies if the text is processed by troff.

.in NX
     Change the normal indentation to  N units of X scale.  X can
     be u or i, for  machine units or inches, respectively.  If N
     is used without X, nroff assumes the indentation to be given
     in  number of  character-widths (in picas,  or tenths  of an
     inch).  Default indentation is zero.

.ll NX
     Set the line length.  Used like the .in command, above.

.ls X
     Leave spaces;  insert X vertical  spaces after each  line of
     text.  Default is zero.

.lt NX
     Length of title.  Used like the .in command, above.

.na  Enter no-adjust mode.  Line lengths are not changed.

.ne NX
     Confirm that  at least N  portions of X units  of measure of
     vertical  space are  needed before the  next trap.   If this
     amount of space is not  available, then move the text to the
     top of the next page.  X can be i or v, for inches or verti-
     cal spaces,  respectively.  This command is  used in display
     macros and  in paragraph macros  to help prevent  widows and
     orphans.

.nf  Enter no-fill mode; no right justification is performed, al-
     though line lengths  are changed to approximate uniform line
     length.

.nh  Turn off  hyphenation.  nroff hyphenates according to built-
     in algorithms that are correct most of the time, but not al-
     ways.


COHERENT Lexicon                                           Page 3



nroff                        Command                        nroff




.nr X N1 N2
     Set  number register  X  to value  N1; set  its default  in-
     crement/decrement to N2; for  example, .nr X 2 3 sets number
     register X to 2, and sets its default increment to 3.

.pl NX
     Set the page length to N.  The unit of measure X can be V or
     i,  for  vertical  spaces (sixths  of  an  inch) or  inches,
     respectively.   The  default  unit  of measure  is  vertical
     spaces.

.pn N
     Set the page number to N.

.po NX
     Set the default page offset to N.  The unit of measure X can
     be set  to i,  for inches.  The  default unit of  measure is
     number of characters.

.rm XX
     Remove macro or string XX.

.rn XX YY
     Change the name of a macro or string from XX to YY.

.rr X
     Remove register X.

.so file
     Open file,  read its contents,  and process them.   When the
     end of  file is reached, resume process  the contents of the
     present file.

.sp |NX
     Space down N.   The unit of measure X can  be i, for inches,
     with the  default unit of measure  being vertical spaces, or
     sixths of an  inch.  The optional vertical bar `|' indicates
     that N is an absolute value; for example, .sp |1.5i means to
     move to  1.5 inches below  the top of the  page, whereas .sp
     1.5i means  to move down  1.5 inches from  the present posi-
     tion.

.ta NX ...
     Set the  tab to N.  The  unit of measure X can  be set to i,
     for inches; the default unit of measure is number of charac-
     ters, or  tenths of an  inch.  A tab setting,  of course, is
     for an  absolute, not a  relative, value.  If  more than one
     tab setting is  defined, the first defines the first tabula-
     tion character on a text line, the second defines the second
     tabulation  character, etc.   Any undefined  tabulations are
     thrown away.

.tc X
     Fill  any unused  space within a  tabulation field  with the


COHERENT Lexicon                                           Page 4



nroff                        Command                        nroff



     character X.

.ti NX
     Temporary indent; indent  only the next line.  Used like the
     .in command, above.

.tl 'left'center'right'
     Set a three-part title, with left being set flush left, cen-
     ter being  centered on the  line, and right  being set flush
     right.   Note the  use of  the  apostrophes to  separate the
     fields; the apostrophes for an undefined field must still be
     present, or a syntax error will be generated.

.tm message
     Print message  on the standard error  device.  This is often
     used  with .if  or .ie  commands to  indicate an  error con-
     dition.

.vs Np
     Reset the normal vertical  spacing to N points p.  One point
     equals 1/72 of an inch; the default setting is 12 points, or
     1/6 of an inch.

.wh NX action
     Set  a trap  to perform  action when point  N is  reached on
     every formatted  page.  If N is negative,  it is measured up
     from the bottom of the page.  The unit of measure X may be i
     or v, for  inches or number of vertical lines, respectively;
     the default unit of measure is v.

***** Escape Sequences *****


The following  lists nroff's  escape sequences, or  commands that
suspend or work around the normal operation of nroff.  All escape
sequences are introduced by a backslash character `\'.

\e   Set a backslash character in the output text.

\\   Output  a backslash character.  This can be  used to print a
     literal backslash character  in the output text, or to defer
     the interpretation of a macro  or string from the time it is
     processed to the time that it is called.

\-   Print a minus sign.

\&   Ignore what is normally a command string.

\$N  Call macro argument N.

\''  Introduce a comment within your text.  All text to the right
     of this escape sequence  will be ignored by nroff.  This se-
     quence must read .\'' when used at the beginning of a line.




COHERENT Lexicon                                           Page 5



nroff                        Command                        nroff



\*S  Call string S.

\*(ST
     Call string ST.

\h'NX'
     Move horizontally  by N units of X.  If  N is positive, move
     to the  right; if negative,  move to the left.   The unit of
     measure X may be i,  for inches; the default unit of measure
     is character-widths.

\l'NX'
     Draw  a horizontal  line N  units  of X  long.  The  unit of
     measure X may be i,  for inches; the default unit of measure
     is character-widths.

\L'NX'
     Draw a vertical line; used like \l, above.

\nX  Read the value of number register X.

\n(XY
     Read the value of number register XY.

\v'NX'
     Vertical  motion; move  N units  of X  vertically.  If  N is
     positive,  move down;  if negative,  move  up.  The  unit of
     measure  X may  be i  or  v, for  inches or  vertical spaces
     (sixths  of an  inch),  respectively.  The  default unit  of
     measure is v.

\w'argument'
     Measure the width of argument.  For example
             \w'stuff and nonsense'

     measures the width of the phrase stuff and nonsense; or

             \w'\$1'

     measures the width of  the first argument passed to a macro,
     whatever that  argument might happen to  be.  Therefore, the
     command .in \w'\$1' will indent a line by the width of argu-
     ment 1.

\<newline>
     Ignore this <newline> character.

\{   Begin conditional commands; used  after an .if, an ie, or an
     .el command.

\{\  Begin  conditional commands,  and ignore the  following car-
     riage return.

\}   End conditional commands.



COHERENT Lexicon                                           Page 6



nroff                        Command                        nroff



\fX  Set font to X; this  can be either R, I, B, or P, for Roman,
     italic, bold, or previous font, respectively.

***** Dedicated Number Registers *****

The following  lists the number registers  that are predefined in
nroff.  You can read or reset these registers to suit the need of
any special formats that you wish to devise.

.$  Number of arguments in a call to a macro.

%   Present page number.

dy  Day of the month, as set by COHERENT.

.i  Present level of indentation.

.l  Present line length.

mo  Month, as set by COHERENT.

.o  Present page offset.

.p  Page length.

yr  Year, as set by COHERENT.

***** Miscellaneous *****

The -ms macro package  is kept in file /usr/lib/tmac.s.  The mac-
ros in  this package are  more than sufficient  for most ordinary
text processing.  Beginners  should work through this macro pack-
age rather than trying to deal at once with the basic program.

The  tutorial  to  nroff, which  is  included  with this  manual,
provides a  detailed introduction to nroff, and  lists all of its
error messages.

***** Files *****

/tmp/rof* -- Temporary files
/usr/lib/tmac.* -- Standard macro packages

***** See Also *****

col, commands, deroff, man, ms, troff
nroff, The Text Processing Language, tutorial










COHERENT Lexicon                                           Page 7


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026