Typing Documents on the UNIX System:
!.br Using the -ms Macros with Troff and Nroff

M. E. Lesk
Text Formatting Phototypesetting

ABSTRACT

This document describes a set of easy-to-use macros for preparing documents on the UNIX system. Documents may be produced on either the phototypesetter or a on a computer terminal, without changing the input.

      The macros provide facilities for paragraphs, sections (optionally with automatic numbering), page titles, footnotes, equations, tables, two-column format, and cover pages for papers.

      This memo includes, as an appendix, the text of the ``Guide to Preparing Documents with -ms'' which contains additional examples of features of -ms.

      This manual is a revision of, and replaces, ``Typing Documents on UNIX,'' dated November 22, 1974.


      Introduction. This memorandum describes a package of commands to produce papers using the troff and nroff formatting programs on the UNIX system. As with other roff-derived programs, text is prepared interspersed with formatting commands. However, this package, which itself is written in troff commands, provides higher-level commands than those provided with the basic troff program. The commands available in this package are listed in Appendix A.

      Text. Type normally, except that instead of indenting for paragraphs, place a line reading ``.PP'' before each paragraph. This will produce indenting and extra space.

Alternatively, the command .LP that was used here will produce a left-aligned (block) paragraph. The paragraph spacing can be changed: see below under ``Registers.''

      Beginning. For a document with a paper-type cover sheet, the input should start as follows:
[optional overall format .RP - see below]
.TL
Title of document (one or more lines)
.AU
Author(s) (may also be several lines)
.AI
Author's institution(s)
.AB
Abstract; to be placed on the cover sheet of a paper.
Line length is 5/6 of normal; use .ll here to change.
.AE (abstract end)
text ... (begins with .PP, which see)
To omit some of the standard headings (e.g. no abstract, or no author's institution) just omit the corresponding fields and command lines. The word ABSTRACT can be suppressed by writing ``.AB no'' for ``.AB''. Several interspersed .AU and .AI lines can be used for multiple authors. The headings are not compulsory: beginning with a .PP command is perfectly OK and will just start printing an ordinary paragraph. Warning: You can't just begin a document with a line of text. Some -ms command must precede any text input. When in doubt, use .LP to get proper initialization, although any of the commands .PP, .LP, .TL, .SH, .NH is good enough. Figure 1 shows the legal arrangement of commands at the start of a document.

      Cover Sheets and First Pages. The first line of a document signals the general format of the first page. In particular, if it is ".RP" a cover sheet with title and abstract is prepared. The default format is useful for scanning drafts.

      In general -ms is arranged so that only one form of a document need be stored, containing all information; the first command gives the format, and unnecessary items for that format are ignored.

      Warning: don't put extraneous material between the .TL and .AE commands. Processing of the titling items is special, and other data placed in them may not behave as you expect. Don't forget that some -ms command must precede any input text.

      Page headings. The -ms macros, by default, will print a page heading containing a page number (if greater than 1). A default page footer is provided only in nroff, where the date is used. The user can make minor adjustments to the page headings/footings by redefining the strings LH, CH, and RH which are the left, center and right portions of the page headings, respectively; and the strings LF, CF, and RF, which are the left, center and right portions of the page footer. For more complex formats, the user can redefine the macros PT and BT, which are invoked respectively at the top and bottom of each page. The margins (taken from registers HM and FM for the top and bottom margin respectively) are normally 1 inch; the page header/footer are in the middle of that space. The user who redefines these macros should be careful not to change parameters such as point size or font without resetting them to default values.

      Multi-column formats. If you place the command ``.2C'' in your document, the document will be printed in double column format beginning at that point. This feature is not too useful in computer terminal output, but is often desirable on the typesetter. The command ``.1C'' will go back to one-column format and also skip to a new page. The ``.2C'' command is actually a special case of the command
.MC [column width [gutter width]]
which makes multiple columns with the specified column and gutter width; as many columns as will fit across the page are used. Thus triple, quadruple, ... column pages can be printed. Whenever the number of columns is changed (except going from full width to some larger number of columns) a new page is started.

      Headings. To produce a special heading, there are two commands. If you type
.NH
type section heading here
may be several lines
you will get automatically numbered section headings (1, 2, 3, ...), in boldface. For example,
.NH
Care and Feeding of Department Heads
produces

Table of Contents