ms Document Structure (The GNU Troff Manual)

#### 4.6.2 Document Structure

The `ms` macro package expects a certain amount of structure: a well-formed document contains at least one paragraphing or heading macro call. Longer documents have a structure as follows.

Document type

  Calling the `RP` macro at the beginning of your document puts the document description (see below) on a cover page. Otherwise, `ms` places the information (if any) on the first page, followed immediately by the body text. Some document types found in other `ms` implementations are specific to AT&T or Berkeley, and are not supported by `groff` `ms`.

Format and layout

  By setting registers and strings, you can configure your document’s typeface, margins, spacing, headers and footers, and footnote arrangement. See Document Control Settings.

Document description

  A document description consists of any of: a title, one or more authors’ names and affiliated institutions, an abstract, and a date or other identifier. See Document Description Macros.

Body text

  The main matter of your document follows its description (if any). `ms` supports highly structured text consisting of paragraphs interspersed with multi-level headings (chapters, sections, subsections, and so forth) and augmented by lists, footnotes, tables, diagrams, and similar material. See Body Text.

Tables of contents

  Macros enable the collection of entries for a table of contents (or index) as the material they discuss appears in the document. You then call a macro to emit the table of contents at the end of your document. The table of contents must necessarily follow the rest of the text since GNU `troff` is a single-pass formatter; it thus cannot determine the page number of a division of the text until it has been set and output. Since `ms` was designed for the production of hard copy, the traditional procedure was to manually relocate the pages containing the table of contents between the cover page and the body text. Today, page resequencing is more often done in the digital domain. An index works similarly, but because it typically needs to be sorted after collection, its preparation requires separate processing.