Name
groff_ms - GNU roff manuscript macro package for formatting documents
Synopsis
groff -ms |
[option ...] [file ...] ms [option ...] [file ...] DescriptionThe GNU implementation of the ms macro package is part of the groff document formatting system. The ms package is suitable for the composition of letters, memoranda, reports, and books. These groff macros support cover page and table of contents generation, automatically numbered headings, several paragraph styles, a variety of text styling options, footnotes, and multi-column page layouts. ms supports the tbl(1), eqn(1), pic(1), and refer(1) preprocessors for inclusion of tables, mathematical equations, diagrams, and standardized bibliographic citations. This implementation is mostly compatible with the documented interface and behavior of AT&T Unix Version 7 ms. Many extensions from 4.2BSD (Berkeley) and Tenth Edition Research Unix have been recreated. UsageThe ms
macro package expects a certain amount of structure: a
well-formed document contains at least one paragraphing or
heading macro call. To compose a simple document from
scratch, begin it by calling .LP or .PP.
Longer documents have a structure as follows. Calling the RP macro at the beginning of your document puts the document description (see below) on a cover page. Otherwise, ms places this information 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 in 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 subsection “Document control settings” below. 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 subsection “Document description macros” below. 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. The preponderance of subsections below covers these matters. Table 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 output 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. Document
control settings \*[SN-STYLE] can alternatively be made an alias of \*[SN-NO-DOT] with the als request. For entries marked “special” in the “Effective” column, see the discussion in the applicable section below. The PO, LL, and LT register defaults vary by output device and paper format; the values shown are for typesetters using U.S. letter paper, and then terminals. See section “Paper format” of groff(1). The PD and DD registers use the larger value if the vertical motion quantum of the output device is too coarse for the smaller one; usually, this is the case only for output to terminals and emulators thereof. The “gutter” affected by \n[MINGW] is the gap between columns in multiple-column page arrangements. The TC-MARGIN register and TC-LEADER special character affect the formatting of tables of contents assembled by the XS, XA, and XE macros. Document
description macros Use the “report” (AT&T: “released paper”) format for your document, creating a separate cover page. The default arrangement is to place most of the document description (title, author names and institutions, and abstract, but not the date) at the top of the first page. If the optional no-repeat-info argument is given, ms produces a cover page but does not repeat any of its information on subsequently (but see the DA macro below regarding the date). Normally, .RP sets the page number following the cover page to 1. Specifying the optional no- renumber argument suppresses this alteration. Optional arguments can occur in any order. “no” is recognized as a synonym of no-repeat-info for AT&T compatibility.
.DA [x ...] Typeset the current date, or any arguments x, in the center footer, and, if .RP is also called, left-aligned at the end of the document description on the cover page. .ND [x ...] Typeset the current date, or any arguments x, if .RP is also called, left-aligned at the end of the document description on the cover page. This is groff ms’s default. .AB [no] Begin the abstract. ms collects text on input lines following this call into the abstract until reaching an .AE call. By default, ms places the word “ABSTRACT” centered and in italics above the text of the abstract. The optional argument “no” suppresses this heading.
Text
settings The HY register defines the automatic hyphenation mode used with the hy request. Setting \n[HY] to 0 is equivalent to using the nh request. This is a Tenth Edition Research Unix extension. Typographical
symbols
Paragraphs
The PORPHANS register defines the minimum number of initial lines of any paragraph that must be kept together to avoid isolated lines at the bottom of a page. If a new paragraph is started close to the bottom of a page, and there is insufficient space to accommodate \n[PORPHANS] lines before an automatic page break, then a page break is forced before the start of the paragraph. This is a GNU extension.
.IP [marker [width]] Set a paragraph with a left indentation. The optional marker is not indented and is empty by default. width overrides the indentation amount in \n[PI]; its default unit is “n”. Once specified, width applies to further .IP calls until specified again or a heading or different paragraphing macro is called.
Headings
Set an automatically numbered heading. ms produces a numbered heading in the form a.b.c..., to any level desired, with the numbering of each depth increasing automatically and being reset to zero when a more significant depth is increased. “1” is the most significant or coarsest division of the document. Only non-zero values are output. If depth is omitted, it is taken to be 1. If you specify depth such that an ascending gap occurs relative to the previous NH call—that is, you “skip a depth”, as by “.NH 1” and then “.NH 3”, groff ms emits a warning on the standard error stream. .NH S heading-depth-index ... Alternatively, you can give NH a first argument of “S”, followed by integers to number the heading depths explicitly. Further automatic numbering, if used, resumes using the specified indices as their predecessors. This feature is a Berkeley extension. After .NH is called, the assigned number is made available in the strings SN-DOT (as it appears in a printed heading with default formatting, followed by a terminating period) and SN-NO-DOT (with the terminating period omitted). These are GNU extensions. You can control
the style used to print numbered headings by defining an
appropriate alias for the string SN-STYLE. By
default, \*[SN-STYLE] is aliased to
\*[SN-DOT]. If you prefer to omit the terminating
period from numbers appearing in numbered headings, you may
alias it to \*[SN-NO-DOT]. Any such change in
numbering style becomes effective from the next use of
.NH following redefinition of the alias for
\*[SN-STYLE]. The formatted number of the current
heading is available in \*[SN] (a feature first
documented by Berkeley); this string facilitates its
inclusion in, for example, table captions, equation labels,
and .XS/.XA/.XE table of contents
entries. Set an unnumbered heading. The optional depth argument is a GNU extension indicating the heading depth corresponding to the depth argument of .NH. It matches the type size at which the heading is set to that of a numbered heading at the same depth when the \n[GROWPS] and \n[PSINCR] heading size adjustment mechanism is in effect. The PSINCR register defines an increment in type size to be applied to a heading at a lesser depth than that specified in \n[GROWPS]. The value of \n[PSINCR] should be specified in points with the “p” scaling unit and may include a fractional component. The GROWPS register defines the heading depth above which the type size increment set by \n[PSINCR] becomes effective. For each heading depth less than the value of \n[GROWPS], the type size is increased by \n[PSINCR]. Setting \n[GROWPS] to a value less than 2 disables the incremental heading size feature. In other words, if the value of GROWPS register is greater than the depth argument to a .NH or .SH call, the type size of a heading produced by these macros increases by \n[PSINCR] units over \n[PS] multiplied by the difference of \n[GROWPS] and depth. The \n[HORPHANS] register operates in conjunction with the NH and SH macros to inhibit the printing of isolated headings at the bottom of a page; it specifies the minimum number of lines of the subsequent paragraph that 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, a page break is forced before the heading is printed. Any display macro call or tbl, pic, or eqn region between the heading and the subsequent paragraph suppresses this grouping. Typeface and
decoration Style text in bold, followed by post in the previous font style without intervening space, and preceded by pre similarly. Without arguments, ms styles subsequent text in bold until the next paragraphing, heading, or no-argument typeface macro call. .R [text [post [pre]]] As .B, but use the roman style (upright text of normal weight) instead of bold. Argument recognition is a GNU extension. .I [text [post [pre]]] As .B, but use an italic or oblique style instead of bold. .BI [text [post [pre]]] As .B, but use a bold italic or bold oblique style instead of upright bold. This is a Tenth Edition Research Unix extension. .CW [text [post [pre]]] As .B, but use a constant-width (monospaced) roman typeface instead of bold. This is a Tenth Edition Research Unix extension. .BX [text] Typeset text and draw a box around it. On terminal devices, reverse video is used instead. If you want text to contain space, use unbreakable space or horizontal motion escape sequences (\~, \space, \^, \|, \0, or \h). .UL [text [post]] Typeset text with an underline. post, if present, is set after text with no intervening space.
When pre is used, a hyphenation control escape sequence \% that would ordinarily start text must start pre instead. groff ms also offers strings to begin and end super- and subscripting. These are GNU extensions.
Indented
regions
Keeps, boxed
keeps, and displays You can alternatively specify a floating keep: if a keep cannot fit on the current page, ms holds its contents and allows text following the keep (in the source document) to fill in the remainder of the current page. When the page breaks, whether by reaching the end or bp request, ms puts the floating keep at the beginning of the next page.
As an alternative to the keep mechanism, the ne request forces a page break if there is not at least the amount of vertical space specified in its argument remaining on the page. A boxed keep has a frame drawn around it.
Boxed keep macros cause breaks; if you need to box a word or phrase within a line, see the BX macro in section “Highlighting” above. Box lines are drawn as close as possible to the text they enclose so that they are usable within paragraphs. If you wish to place one or more paragraphs in a boxed keep, you may improve their appearance by calling .B1 after the first paragraphing macro, and by adding a small amount of vertical space before calling .B2. If you want a boxed keep to float, you will need to enclose the .B1 and .B2 calls within a pair of .KF and .KE calls. Displays turn off filling; lines of verse or program code are shown with their lines broken as in the source document without requiring br requests between lines. Displays can be kept on a single page or allowed to break across pages. The DS macro begins a kept display of the layout specified in its first argument; non-kept displays are begun with dedicated macros corresponding to their layout.
.DS [I [indent]]
Begin (DS: kept) display indented by indent if specified, \n[DI] otherwise.
The distance stored in \n[DD] is inserted before and after each pair of display macros; this is a Berkeley extension. In groff ms, this distance replaces any adjacent inter-paragraph distance or subsequent spacing prior to a section heading. The DI register is a GNU extension; its value is an indentation applied to displays created with .DS and .ID without arguments, to “.DS I” without an indentation argument, and to equations set with “.EQ I”. Changes to either register take effect at the next display boundary. Tables,
figures, equations, and references
.EQ [align [label]]
When refer emits collected references (as might be done on a “Works Cited” page), it interpolates the string \*[REFERENCES] as an unnumbered heading (.SH). Attempting to place a multi-page table inside a keep can lead to unpleasant results, particularly if the tbl “allbox” option is used. Footnotes
Enclose the
footnote text in FS and FE macro calls to set
it at the nearest available “foot”, or bottom,
of a text column or page. Begin a footnote. The .FS-MARK hook (see below) is called with any supplied marker argument, which is then also placed at the beginning of the footnote text. If marker is omitted, the next pending automatic number enqueued by interpolation of the * string is used, and if none exists, nothing is prefixed.
groff ms provides a hook macro, FS-MARK, for user-determined operations to be performed when the FS macro is called. It is passed the same arguments as .FS itself. By default, this macro has an empty definition. .FS-MARK is a GNU extension. Footnote text is formatted as paragraphs are, using analogous parameters. The registers FI, FPD, FPS, and FVS correspond to PI, PD, PS, and VS, respectively; FPD, FPS, and FVS are GNU extensions. The FF register controls the formatting of automatically numbered footnote paragraphs, and those for which .FS is given a marker argument, at the bottom of a column or page as follows.
Language and
localization The default for ABSTRACT includes font selection escape sequences to set the word in italics. Headers and
footers Another method
is to call macros that set headers or footers for odd- or
even-numbered pages. Each such macro takes a delimited
argument separating the left, center, and right header or
footer texts from each other. You can replace the neutral
apostrophes (') shown below with any character not appearing
in the header or footer text. These macros are Berkeley
extensions. The OH and EH macros define headers for odd- (recto) and even-numbered (verso) pages, respectively; the OF and EF macros define footers for them. With either method, a percent sign % in header or footer text is replaced by the current page number. By default, ms places no header on a page numbered “1” (regardless of its number format).
For even greater flexibility, ms permits redefinition of the macros called when the page header and footer traps are sprung. PT (“page trap”) is called by ms when the header is to be written, and BT (“bottom trap”) when the footer is to be. The groff page location trap that ms sets up to format the header also calls the (normally undefined) HD macro after .PT; you can define .HD if you need additional processing after setting the header. The HD hook is a Berkeley extension. Any such macros you (re)define must implement any desired specialization for odd-, even-, or first numbered pages. Tab
stops
Margins
Multiple
columns
.MC [column-width [gutter-width]] Arrange page text in multiple columns. If you specify no arguments, it is equivalent to the 2C macro. Otherwise, column-width is the width of each column and gutter-width is the minimum distance between columns. Creating a
table of contents
.PX [no] Switch to single-column layout. Unless “no” is specified, center and interpolate \*[TOC] in bold and two points larger than the body text. Emit the table of contents entries. .TC [no] Set the page number to 1, the page number format to lowercase Roman numerals, and call PX (with a “no” argument, if present). The remaining
features in this subsection are GNU extensions. groff
ms obviates the need to repeat heading text after
.XS calls. Call .XN and .XH after
.NH and .SH, respectively. Text to be appended
to the formatted section heading, but not to appear in the
table of contents entry, can follow these calls. Format heading-text and create a corresponding table of contents entry; the indentation is computed from the depth argument of the preceding NH call. .XH depth heading-text As .XN, but use depth to determine the indentation. groff ms
encourages customization of table of contents entry
production. (Re-)define any of the following macros as
desired. These hook macros implement .XN and .XH, and call XN-INIT and XH-INIT, respectively, then call XH-UPDATE-TOC with the arguments given them. .XH-INIT These hook macros do nothing by default. .XH-UPDATE-TOC depth heading-text Bracket heading-text with XS and XE calls, indenting it by 2 ens per level of depth beyond the first. You can customize the style of the leader that bridges each table of contents entry with its page number; define the TC-LEADER special character by using the char request. A typical leader combines the dot glyph “.” with a horizontal motion escape sequence to spread the dots. The width of the page number field is stored in the TC-MARGIN register. Differences from AT&T msThe groff ms macros are an independent reimplementation, using no AT&T code. Since they take advantage of the extended features of groff, they cannot be used with AT&T troff. groff ms supports features described above as Berkeley and Tenth Edition Research Unix extensions, and adds several of its own.
Unix
Version 7 macros not implemented by groff ms
Legacy featuresgroff ms retains some legacy features solely to support formatting of historical documents; contemporary ones should not use them because they can render poorly. See groff_char(7) instead. AT&T
ms accent mark strings Berkeley
ms accent mark and glyph strings
Naming conventionsThe following conventions are used for names of macros, strings, and 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. Conventions for identifier names are as follows.
Thus the groff ms macros reserve the following names:
Files/usr/share/groff/1.23.0/tmac/s.tmac implements the package. /usr/share/groff/1.23.0/tmac/refer-ms.tmac implements refer(1) support for ms. /usr/share/groff/1.23.0/tmac/ms.tmac is a wrapper enabling the package to be loaded with “groff -m ms”. AuthorsThe GNU version of the ms macro package was written by James Clark and contributors. This document was written by Clark, lkollar [AT] despammed.com">Larry Kollar, and g.branden.robinson [AT] gmail.com">G. Branden Robinson. See alsoA manual is
available in source and rendered form. On your system, it
may be compressed and/or available in additional formats.
“Using groff with the ms Macro Package”; Larry Kollar and G. Branden Robinson. /usr/share/doc/groff-base/msboxes.ms
“Using PDF boxes with groff and the ms macros”; Deri James. BOXSTART and BOXSTOP macros are available via the sboxes extension package, enabling colored, bordered boxes when the pdf output device is used. Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg, is the primary groff manual. You can browse it interactively with “info groff”. |