GROFF_MS(7) | Miscellaneous Information Manual | GROFF_MS(7) |
groff_ms - GNU roff manuscript macro package for formatting documents
groff -ms |
[option ...] [input-file ...] |
groff -m ms |
[option ...] [input-file ...] |
This manual page describes the GNU version of the ms macros, part of the groff typesetting system. The ms macros are mostly compatible with the documented behavior of the 4.3 BSD Unix ms macros (see Differences from troff ms below for details). The ms macros are suitable for reports, letters, books, and technical documentation.
The ms macro package expects files to have a certain amount of structure. The simplest documents can begin with a paragraph macro and consist of text separated by paragraph macros or even blank lines. Longer documents have a structure as follows:
The following table lists the document control number registers. For the sake of consistency, set registers related to margins at the beginning of your document, or just after the RP macro.
Margin settings
Reg. | Definition | Effective | Default |
PO | Page offset (left margin) | next page | 1i |
LL | Line length | next paragraph | 6i |
LT | Header/footer length | next paragraph | 6i |
HM | Top (header) margin | next page | 1i |
FM | Bottom (footer) margin | next page | 1i |
Text settings
Reg. | Definition | Effective | Default |
PS | Point size | next paragraph | 10p |
VS | Line spacing (leading) | next paragraph | 12p |
PSINCR | Point size increment for section headings of increasing importance | next heading | 1p |
GROWPS | Heading level beyond which PSINCR is ignored | next heading | 0 |
Paragraph settings
Reg. | Definition | Effective | Default |
PI | Initial indent | next paragraph | 5n |
PD | Space between paragraphs | next paragraph | 0.3v |
QI | Quoted paragraph indent | next paragraph | 5n |
PORPHANS | Number of initial lines to be kept together | next paragraph | 1 |
HORPHANS | Number of initial lines to be kept with heading | next heading | 1 |
Footnote settings
Reg. | Definition | Effective | Default |
FL | Footnote length | next footnote | \n[LL]*5/6 |
FI | Footnote indent | next footnote | 2n |
FF | Footnote format | next footnote | 0 |
FPS | Point size | next footnote | \n[PS]-2 |
FVS | Vert. spacing | next footnote | \n[FPS]+2 |
FPD | Para. spacing | next footnote | \n[PD]/2 |
Other settings
Reg. | Definition | Effective | Default |
DD | Display, table, eqn, pic spacing | next para. | 0.5v |
MINGW | Minimum width between columns | next page | 2n |
Use the following macros to create a cover page for your document in the order shown.
Use the PP macro to create indented paragraphs, and the LP macro to create paragraphs with no initial indent.
The QP macro indents all text at both left and right margins by the amount of the register QI. The effect is reminiscent of the HTML <BLOCKQUOTE> tag. The next paragraph or heading returns the margins to normal. QP inserts the vertical space specified in register PD as inter-paragraph spacing.
A paragraph bracketed between the macros QS and QE has the same appearance as a paragraph started with QP and a following paragraph started with LP. Both QS and QE insert the inter-paragraph spacing specified in PD and the text is indented on both sides by the amount of register QI. The text between QS and QE can be split into further paragraphs by using .LP or .PP.
The XP macro produces an “exdented” paragraph; that is, one with a hanging indent. The first line of the paragraph begins at the left margin, and subsequent lines are indented (the opposite of PP).
For each of the above paragraph types, and also for any list entry introduced by the IP macro (described later), the document control register PORPHANS, sets the minimum number of lines which must be printed, after the start of the paragraph, and before any page break occurs. If there is insufficient space remaining on the current page to accommodate this number of lines, then a page break is forced before the first line of the paragraph is printed.
Similarly, when a section heading (see subsection “Headings” below) precedes any of these paragraph types, the HORPHANS document control register specifies the minimum number of lines of the paragraph which must be kept on the same page as the heading. If insufficient space remains on the current page to accommodate the heading and this number of lines of paragraph text, then a page break is forced before the heading is printed.
Use headings to create a hierarchical structure for your document. By default, the ms macros print headings in bold using the same font family and point size as the body text. For output devices which support scalable fonts, this behaviour may be modified by defining the document control registers GROWPS and PSINCR.
The following heading macros are available:
.nr PS 10 .nr GROWPS 3 .nr PSINCR 1.5p . .NH 1 Top Level Heading . .NH 2 Second Level Heading . .NH 3 Third Level Heading
.als SN-STYLE SN-DOT
.als SN-STYLE SN-NO-DOT
.als SN SN-NO-DOT
.SH 2 An Unnumbered Subheading
The ms macros provide a variety of methods to highlight or emphasize text:
You may need to indent sections of text. A typical use for indents is to create nested lists and sublists.
Use the RS and RE macros to start and end a section of indented text, respectively. The PI register controls the amount of indent.
You can nest indented sections as deeply as needed by using multiple, nested pairs of RS and RE.
The IP macro handles duties for all lists. Its syntax is as follows:
Use the ta request to set tab stops as needed. Use the TA macro to reset tabs to the default (every 5n). You can redefine the TA macro to create a different set of default tab stops.
Use displays to show text-based examples or figures (such as code listings). Displays turn off filling, so lines of code can be displayed as-is without inserting br requests in between each line. Displays can be kept on a single page, or allowed to break across pages. The following table shows the display types available.
Display macro | Type of display | |
With keep | No keep | |
.DS L | .LD | Left-justified. |
.DS I [indent] | .ID | Indented (default indent in the DI register). |
.DS B | .BD | Block-centered (left-justified, longest line centered). |
.DS C | .CD | Centered. |
.DS R | .RD | Right-justified. |
Use the DE macro to end any display type. The macros Ds and De were formerly provided as aliases for DS and DE, respectively, but they have been removed, and should no longer be used. X11 documents which actually use Ds and De always load a specific macro file from the X11 distribution (macros.t) which provides proper definitions for the two macros.
To keep text together on a page, such as a paragraph that refers to a table (or list, or other item) immediately following, use the KS and KE macros. The KS macro begins a block of text to be kept on a single page, and the KE macro ends the block.
You can specify a floating keep using the KF and KE macros. If the keep cannot fit on the current page, groff holds the contents of the keep and allows text following the keep (in the source file) to fill in the remainder of the current page. When the page breaks, whether by an explicit bp request or by reaching the end of the page, groff prints the floating keep at the top of the new page. This is useful for printing large graphics or tables that do not need to appear exactly where specified.
The macros B1 and B2 can be used to enclose a text within a box; .B1 begins the box, and .B2 ends it. Text in the box is automatically placed in a diversion (keep).
The ms macros support the standard groff preprocessors: tbl, pic, eqn, and refer. Mark text meant for preprocessors by enclosing it in pairs of tags as follows:
The ms macros provide a flexible footnote system. You can specify a numbered footnote by using the \** escape, followed by the text of the footnote enclosed by FS and FE macros.
You can specify symbolic footnotes by placing the mark character (such as \(dg for the dagger character) in the body text, followed by the text of the footnote enclosed by FS \(dg and FE macros.
You can control how groff prints footnote numbers by changing the value of the FF register as follows:
You can use footnotes safely within keeps and displays, but avoid using numbered footnotes within floating keeps. You can set a second \** between a \** and its corresponding .FS; as long as each .FS occurs after the corresponding \** and the occurrences of .FS are in the same order as the corresponding occurrences of \**.
There are three ways to define headers and footers:
You control margins using a set of number registers. The following table lists the register names and defaults:
Reg. | Definition | Effective | Default |
PO | Page offset (left margin) | next page | 1i |
LL | Line length | next paragraph | 6i |
LT | Header/footer length | next paragraph | 6i |
HM | Top (header) margin | next page | 1i |
FM | Bottom (footer) margin | next page | 1i |
Note that there is no right margin setting. The combination of page offset and line length provide the information necessary to derive the right margin.
The ms macros can set text in as many columns as will reasonably fit on the page. The following macros are available. All of them force a page break if a multi-column mode is already set. However, if the current mode is single-column, starting a multi-column mode does not force a page break.
Wrap text that you want to appear in the table of contents in XS and XE macros. Use the TC macro to print the table of contents at the end of the document, resetting the page number to i (Roman numeral 1).
You can manually create a table of contents by specifying a page number as the first argument to XS. Add subsequent entries using the XA macro. For example:
.XS 1 Introduction .XA 2 A Brief History of the Universe .XA 729 Details of Galactic Formation ... .XE
Use the PX macro to print a manually-generated table of contents without resetting the page number.
If you give the argument no to either PX or TC, groff suppresses printing the title specified by the \*[TOC] string.
Traditionally, the ms macros only support integer values for the document's font size and vertical spacing. To overcome this restriction, values larger than or equal to 1000 are taken as fractional values, multiplied by 1000. For example, ‘.nr PS 10250’ sets the font size to 10.25 points.
The following four registers accept fractional point sizes: PS, VS, FPS, and FVS.
Due to backwards compatibility, the value of VS must be smaller than 40000 (this is 40.0 points).
The groff ms macros are a complete re-implementation, using no original AT&T code. Since they take advantage of the extended features in groff, they cannot be used with AT&T troff. Other differences include:
You can redefine the following strings to adapt the groff ms macros to languages other than English:
String | Default Value |
REFERENCES | References |
ABSTRACT | ABSTRACT |
TOC | Table of Contents |
MONTH1 | January |
MONTH2 | February |
MONTH3 | March |
MONTH4 | April |
MONTH5 | May |
MONTH6 | June |
MONTH7 | July |
MONTH8 | August |
MONTH9 | September |
MONTH10 | October |
MONTH11 | November |
MONTH12 | December |
The \*- string produces an em dash—like this.
Use \*Q and \*U to get a left and right typographer's quote, respectively, in troff (and plain quotes in nroff).
The FAM string sets the default font family. If this string is undefined at initialization, it is set to Times.
The point size, vertical spacing, and inter-paragraph spacing for footnotes are controlled by the number registers FPS, FVS, and FPD; at initialization these are set to \n(PS-2, \n[FPS]+2, and \n(PD/2, respectively. If any of these registers are defined before initialization, the initialization macro does not change them.
The hyphenation flags (as set by the hy request) are set from the HY register; the default is 6.
Improved accent marks (as originally defined in Berkeley's ms version) are available by specifying the AM macro at the beginning of your document. You can place an accent over most characters by specifying the string defining the accent directly after the character. For example, n\*~ produces an n with a tilde over it.
The following conventions are used for names of macros, strings, and number registers. External names available to documents that use the groff ms macros contain only uppercase letters and digits.
Internally the macros are divided into modules; naming conventions are as follows:
Thus the groff ms macros reserve the following names:
/usr/share/groff/1.22.4/tmac/ms.tmac (a wrapper file for
s.tmac)
/usr/share/groff/1.22.4/tmac/s.tmac
The GNU version of the ms macro package was written by James Clark and contributors. This document was (re-)written by Larry Kollar.
groff(1), troff(1), tbl(1), pic(1), eqn(1), refer(1)
Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg
19 March 2021 | groff 1.22.4 |