.im man.im
.NM fmt produce formatted output
.SY fmt [-p] [input-file ...]
.FU
.ital fmt
reads its input a line at a time and writes a neatly formatted version
of the input text to the output, with page headers and footers and with
output lines filled to a uniform right margin.
Input text lines may have interspersed among them command lines
that alter this default mode of formatting.
A command line consists of a leading period, followed by a two letter
code, possibly with optional arguments following the first sequence of
blanks and tabs.
.sp
If the -p argument is given,
.ital fmt
reads the file named 'fmt.fnt' and uses the control characters in that
file to handle special fonts (specified with the .sf command).
.sp
Certain commands cause a "break" in the processing of input text lines,
i.e., any partially filled line is output and a new line is begun.
In the following command summary, the letter
.bold n
stands for an optional numeric argument.
If a numeric argument is preceded by a
.bold +
or
.bold -,
the current value is
.bold changed
by this amount;
otherwise the argument represents the new value.
If no argument is given,
the default value is used.
.sp
.nf
.in 0
.sf 6
      Command      Break?  Default  Function
.sf 0
.sp
      .*           no               comment (no effect on output)
      .bp n        yes     n=+1     begin page numbered n
      .br          yes              cause break
      .ce n        yes     n=1      center next n lines
      .cp n        yes     n=0      conditional page, starts new page
                                    if less than n lines left
      .dm name def no               define macro 'name' with 'defn'
      .fi          yes              start filling
      .fo /l/m/r/  no      empty    footer title (see .sx)
      .hd n        yes              start a level n heading (n=0 to 4)
      .he /l/m/r/  no      empty    header title (see .sx)
      .im file     no               imbed, to read from given file
      .ju          no               start right justify
      .in n        no      n=0      indent n spaces
      .ls n        no      n=1      line spacing is n
      .nf          yes              stop filling
      .nj          yes              stop right justify (but not filling)
      .pl n        no      n=66     set page length to n
      .rm n        no      n=60     set right margin to n
.cp 8
      .sf n        no      n=0      set character font type, as:
                                        n=0  normal
                                        n=1  double strike
                                        n=2  emphasized
                                        n=3  italics
                                        n=4  double width
                                        n=5  compressed
                                        n=6  underline
      .sp n        yes     n=1      space n lines or to bottom of page
.cp 2
      .sx /l/m/r/  yes              output line adjusted on left, middle,
                                    and right (like titles)
      .ti n        yes     n=0      temporary indent of n
      .ul n        no      n=1      underline words from next n lines
.in 4
.fi
.NOTES
A blank input line causes a break and is passed
to the output unchanged.
Similarly, an input line that begins with blanks causes a break
and is written to the output with the leading blanks preserved.
Thus a document formatted in the conventional manner by hand will retain
its original paragraph breaks and indentation.

The following characters are treated special when found on input:

.in +8
.ti -4
\\@-@Backslash. Cancels any special meaning of character
following it.
.ti -4
\@@-@ATsign. Acts as a hidden blank, to keep justify padding
from happening between words. For example, '1)\@example'
becomes '1)@example'.  This is particularly useful with
the .ti function.

.in -8
A very limited macro facility is supported with the .dm command.  The macro
name may be any alphanumeric name, and the definition consists of commands
and text separated by a delimiter character (which is assumed to be the first
non-blank following the name).  The most serious limitations are:
1) macros cannot be longer than 200 characters. 2) macros cannot invoke
other macros. 3) a maximum of 9 arguments may be passed.
An example macro definition is:

\.dm bold /.sf 2/%1 %2 %3 %4 %5 %6 %7 %8 %9/.sf 0/

Once defined, the macro is invoked like any command.  The %n will be replaced
with the corresponding argument.  Undefined arguments become NULL.
Arguments within quotes (either " or ') are taken as a whole to allow
them to contain blanks.
Thus, invoking the above macro as '.bold@very@bold@"of@@@@YOU'
would translate to
.Q1
\.sf 2
very bold of    YOU
\.sf 0
.Q2
The .im command allows you to 'imbed' other files in the current file.
When a .im command is found,
.ital fmt
begins reading input from the given file.  On ENDFILE, it returns
to reading from the current file.  Imbedded files may imbed other
files up to 6 levels deep.

The .hd command creates
level 'n' headings.  It automatically numbers the heading, based on
the level.  It also has default fonts it uses for the heading to
make it stand out.  The font defaults are:

.nf
Level 0  -  Emphasized    Underlined  Unnumbered
Level 1  -  Emphasized    Underlined  x.x
Level 2  -  Double-Strike Underlined  x.x
Level 3  -  Emphasized                x.x.x
Level 4  -  Double-Strike             x.x.x.x
.fi

The .sx, .he, and .fo commands perform automatic left, middle, and right
justification of text.  The left, middle, and right portions are
separated by a delimiter character (which is assumed to be the first
non-blank following the command).
.FUTURE
.nf
Add support for other output devices
A box command (.bx)
An adjust (left margin) command (.ad)
Conditional execution (.if)
Allow .hd format options to be redefined dynamically
Automatically numbered lists
Extra space after a sentence
Allow font definitions to be imbedded in text (like \\1 = .sf 1)
Automatic generation of table of contents
.fi
.BUGS
If the file to be formatted has TABS in it, in 'nofill' mode the
tabs sometimes screw up the format if you are also indenting text.
It is best to file documents in 'notabs' mode if your editor automatically
replaces blanks with tabs.
