Documented in Volume 1 of the UNIX Programmers Manual.
See /usr/doc/troff and trofftut on 4.2 BSD systems for additional online documentation on this.
% nroff -me filename | lpr
uses me macro package and sends output to printer.
% nroff -man /usr/man/manl/example.l
uses the man macros. The man pages typically use -man.
% nroff -ms usermacros filename > filename.n
uses ms macro package with user-defined macros in file
'usermacros', and redirects output to filename.n
% nroff -me -Tlpr filename
will alleviate the problem of 9 ( ^[9 ) spuriously appearing in
printed output. The '-T' tells nroff what kind of terminal
it is formatting for. If you use -Tlpr, then you will get printer
output from it instead of terminal output.
.ll 40n
forces nroff output to be 40-columns wide.
From David Kijanka:
--- COMMON NROFF COMMANDS ---
.\" comment
.(c begin centered text block
.)c end centered text block
.(z begin floating text block *
.)z end floating text block *
.ad adjust text (left, right, or both)
.bp break page
.br justification break
.ce center
.fi fill
.he header
.hl draw horizontal line *
.hw hyphenated word exception list *
.hy hyphenate (on or off)
.in indent
.ll line length
.na no adjustment of spacing within lines
.ne need x space at bottom of page
.nf no fill (turn .fi off)
.nh no hyphenation (turn .hy off)
.nr set number register *
.pl page length
.pn set page number
.po page offset
.sh section heading
.sp insert blank space (lines)
.sv save space for a paste-in display *
.ta set tab stops
.ti temporary indent
.uh un-numbered section heading
.T& continue table (tbl pre-processor command) *
.TE end table (tbl) *
.TS start table (tbl) *
asterisked commands are not-often-used commands
To create comments in a script, use this:
.ig
This is a block comment in nroff/troff. (That's .ig
for ignore.) See section 20 (miscellaneous) of the
reference manual (``Nroff/Troff User's Manual'', by
Ossanna of Bell). Nothing in here should have any effect
upon the document. Indentation is a matter of personal
preference. Terminate with double-period:
..
or:
.ig EE
You can specify that you want to end the comment
with something other than "..", as in the .EE line below.
(NOTE: if .EE exists as a macro, then the .EE macro
DOES get executed; therefore it's usually better to use
the .. form). Also, note that if "EE" is a string, it
will be interpolated.
.EE
or:
' \" The use of the "'" rather than "." is
' \" discussed in the reference manual, section 1.1.
' \" This is really a case of ignoring an unknown
' \" macro -- the``\"'' comments-out the remainder
' \" of the line, guaranteeing non-recognition.
Also, note that the '.' above MUST appear in column one.
An interesting bug in n/troff regarding comments is that a comment
following a command must be preceeded by spaces and not tabs! That is,
.xx \" comment preceeded by a tab, and may cause n/troff to blow up.
.xx \" comment is preceeded by 5 blanks, and will work ok.
The reason for this is obscure, but the bug was reported and will be fixed
(hopefully) in a future release.
The macro facilities are stored in /usr/lib/tmac/. The macro name
is selected on the basis of the 2nd through nth character of its name.
To illustrate, if you invoke like this:
% nroff -man
then the macro file is sought from the file /usr/lib/tmac/tmac.an, and
% nroff -me
is sought from /usr/lib/tmac/tmac.e
Use
% man 7 ms
for a list of -ms macros.
See /usr/doc/memacros for -me macros documentation.