groff_ms(7)
π NAME π
okay bestie, welcome to groff_ms(7): groff_ms - GNU roff manuscript macro package for formatting documents. that's the name section, short and iconic. π
π SYNOPSIS π
two ways to summon it, fr fr:
groff -ms [option ...] [file ...]
groff -m ms [option ...] [file ...]
π¦ DESCRIPTION π¦
The 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 consistently formatted bibliographic citations.
groff ms is mostly compatible with the documented interface and behavior of AT&T Unix Version 7 ms. It recreates most extensions from 4.2BSD (Berkeley) and Research Tenth Edition Unix. history bestie, but make it groff. β¨
π 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. To compose a simple document from scratch, begin it by calling LP or PP. Organize longer documents 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 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. not supported, bestie β don't come for groff with those. π
π¨ 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. A macro call at the end of the document emits the collected entries. This material necessarily follows the rest of the text since GNU troff is a single-pass formatter; it 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. single-pass formatter stays single-pass, no cap. π
ποΈ Document control settings ποΈ
The following tables list the document control registers, strings, and special characters. For any parameter whose default is unsatisfactory, define it before calling any ms macro other than RP.
πΈ Margin settings πΈ
\n[PO]β Page offset (left margin); effective: next page; default:1i (0).\n[LL]β Line length; effective: next paragraph; default:6.5i (65n).\n[LT]β Title line length; effective: next paragraph; default:6.5i (65n).\n[HM]β Top (header) margin; effective: next page; default:1i.\n[FM]β Bottom (footer) margin; effective: next page; default:1i.
π Titles (headers, footers) π
\*[LH]β Left header text; effective: next header; default:empty.\*[CH]β Center header text; effective: next header; default:-\n[%]-.\*[RH]β Right header text; effective: next header; default:empty.\*[LF]β Left footer text; effective: next footer; default:empty.\*[CF]β Center footer text; effective: next footer; default:empty.\*[RF]β Right footer text; effective: next footer; default:empty.
β¨ Text settings β¨
\n[PS]β Point (type) size; effective: next paragraph; default:10p.\n[VS]β Vertical spacing (leading); effective: next paragraph; default:12p.\n[HY]β Hyphenation mode; effective: next paragraph; default:6.\*[FAM]β Font family; effective: next paragraph; default:T.
π Paragraph settings π
\n[PI]β Indentation; effective: next paragraph; default:5n.\n[PD]β Paragraph distance (spacing); effective: next paragraph; default:0.3v (1v).\n[QI]β Quotation indentation; effective: next paragraph; default:5n.\n[PORPHANS]β # of initial lines kept; effective: next paragraph; default:1.
π¦ Heading settings π¦
\n[PSINCR]β Point (type) size increment; effective: next heading; default:1p.\n[GROWPS]β Size increase depth limit; effective: next heading; default:0.\n[HORPHANS]β # of following lines kept; effective: next heading; default:1.\*[SN-STYLE]β Numbering style (alias); effective: next heading; default:\*[SN-DOT].
\*[SN-STYLE] can alternatively be made an alias of \*[SN-NO-DOT] with the als request. tiny alias glow-up, iykyk. β¨
π«Ά Footnote settings π«Ά
\n[FI]β Indentation; effective: next footnote; default:2n.\n[FF]β Format; effective: next footnote; default:0.\n[FPS]β Point (type) size; effective: next footnote; default:\n[PS]-2p.\n[FVS]β Vertical spacing (leading); effective: next footnote; default:\n[FPS]+2p.\n[FPD]β Paragraph distance (spacing); effective: next footnote; default:\n[PD]/2.\*[FR]β Line length ratio; effective: special; default:11/12.
π Display settings π
\n[DD]β Display distance (spacing); effective: special; default:0.5v (1v).\n[DI]β Display indentation; effective: special; default:0.5i.
β Other settings β
\n[MINGW]β Minimum gutter width; effective: next page; default:2n.\n[TC-MARGIN]β TOC page number margin width; effective: next PX call; default:\w'000'.\[TC-LEADER]β TOC leader character; effective: next PX call; default:.\h'1m'.
For entries marked βspecialβ in the βEffectiveβ column, peek at the discussion in the matching section below, bestie. 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. 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 β¨
Okay so you define information describing the document by calling the macros below in the order shown; DA or ND can be called to set the document date (or other identifier) at any time before (a) the abstract, if present, or (b) its information is required in a header or footer. Use of these macros is optional, except that TL is mandatory if any of RP, AU, AI, or AB is called, and AE is mandatory if AB is called.
.RP [no-repeat-info] [no-renumber]β 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 optionalno-repeat-infoargument is given,msproduces a cover page but does not repeat any of its information subsequently (but see theDAmacro below regarding the date). Normally,RPsets the page number following the cover page to1. Specifying the optionalno-renumberargument suppresses this alteration. Optional arguments can occur in any order.msrecognizesnoas a synonym ofno-repeat-infoto maintain AT&T compatibility. Options other thannoare GNU extensions..TLβ Specify the document title.mscollects text on input lines following this call into the title until reachingAU,AB, or a heading or paragraphing macro call..AUβ Specify an author's name.mscollects text on input lines following this call into the author's name until reachingAI,AB, anotherAU, or a heading or paragraphing macro call. Call it repeatedly to specify multiple authors..AIβ Specify the preceding author's institutional affiliation. AnAUcall is usefully followed by at most oneAIcall; if there are more, the lastAIcall controls.mscollects text on input lines following this call into the author's institution until reachingAU,AB, or a heading or paragraphing macro call..DA [x ...]β Typeset the current date, or any arguments x, in the center footer, and, ifRPis 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, ifRPis 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.mscollects text on input lines following this call into the abstract until reaching anAEcall. By default,msplaces the word βABSTRACTβ centered and in italics above the text of the abstract. The optional argument βnoβ suppresses this heading..AEβ End the abstract.
π¨ Text settings π
The FAM string, a GNU extension, sets the font family for body text; the default is βTβ. The PS and VS registers set the type size and vertical spacing (distance between text baselines), respectively. The font family and type size are ignored on terminals. Set these parameters before the first call of a heading, paragraphing, or (non-date) document description macro to apply them to headers, footers, and (for FAM) footnotes.
The HY register defines the automatic hyphenation mode used with the hy request. Setting \n[HY] to 0 disables automatic hyphenation. This is a Research Tenth Edition Unix extension.
π£ Typographical symbols β¨
ms provides a few strings to obtain typographical symbols not easily entered with the keyboard. These and many others are available as special character escape sequencesβsee groff_char(7).
\*[-]β Interpolate an em dash.\*[Q],\*[U]β Interpolate typographer's quotation marks where available, and neutral double quotes otherwise.\*[Q]is the left quote and\*[U]the right.
π Paragraphs π¬
Paragraphing macros break, or terminate, any pending output line so that a new paragraph can begin. Several paragraph types are available, differing in how indentation applies to them: to left, right, or both margins; to the first output line of the paragraph, all output lines, or all but the first. These calls insert vertical space in the amount stored in the PD register, except at page or column breaks, or adjacent to displays.
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 starts close to the bottom of a page, and there is insufficient space to accommodate \n[PORPHANS] lines before an automatic page break, groff ms forces a page break before formatting the paragraph. This is a GNU extension.
.LPβ Set a paragraph without any (additional) indentation..PPβ Set a paragraph with a first-line left indentation in the amount stored in thePIregister..IP [mark [width]]β Set a paragraph with a left indentation. The optionalmarkis not indented, is useful in the construction of lists, and is empty by default.widthoverrides the indentation amount in\n[PI]; its default unit is βnβ. Once specified,widthapplies to furtherIPcalls until specified again or a heading or different paragraphing macro is called..QPβ Set a paragraph indented from both left and right margins by\n[QI]..QS,.QEβ Begin (QS) and end (QE) a region where each paragraph is indented from both margins by\n[QI]. The text betweenQSandQEcan be structured further by use of other paragraphing macros..XPβ Set an βexdentedβ paragraphβone with a left indentation of\n[PI]on every line except the first (also known as a hanging indent). This is a Berkeley extension.
π Headings π₯
Use headings to create a hierarchical structure for your document. The ms macros print headings in bold using the same font family and, by default, type size as the body text. Headings are available with and without automatic numbering. Text on input lines following the macro call becomes the heading's title. Call a paragraphing macro to end the heading text and start the section's content.
.NH [depth]β Set an automatically numbered heading.msproduces a numbered heading in the forma.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. Ifdepthis omitted,msassumes β1β. If you specifydepthsuch that an ascending gap occurs relative to the previousNHcallβthat is, you βskip a depthβ, as by.NH 1and then.NH 3,groff msemits a warning on the standard error stream..NH S heading-depth-index ...β Alternatively, you can giveNHa 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, and SN-STYLE, 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.
.SH [depth]β Set an unnumbered heading. The optionaldepthargument is a GNU extension indicating the heading depth corresponding to thedepthargument ofNH. 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 an 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. GROWPS and PSINCR are GNU extensions.
okay so, real talk: in groff ms, the NH and SH macros consult the HORPHANS register to prevent the output 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, groff ms forces a page break before setting the heading. Any display macro call or tbl, pic, or eqn region between the heading and the subsequent paragraph suppresses this grouping. This is a GNU extension, iykyk β¨
β¨ Typeface and decoration β¨
The ms macros provide a variety of ways to style text. Bestie, attend closely to the ordering of arguments labeled pre and post, which is not intuitive π Support for pre arguments is a GNU extension.
.B [text [post [pre]]]β Styletextin bold, followed bypostin the previous font style without intervening space, and preceded bypresimilarly. Without arguments,msstyles subsequent text in bold until the next paragraphing, heading, or no-argument typeface macro call..R [text [post [pre]]]β AsB, but use the roman style (upright text of normal weight) instead of bold. Argument recognition is a GNU extension..I [text [post [pre]]]β AsB, but use an italic or oblique style instead of bold..BI [text [post [pre]]]β AsB, but use a bold italic or bold oblique style instead of upright bold. This is a Research Tenth Edition Unix extension..CW [text [post [pre]]]β AsB, but use a constant-width (monospaced) roman typeface instead of bold. This is a Research Tenth Edition Unix extension..BX [text]β Typesettextand draw a box around it. On terminals, reverse video is used instead. If you wanttextto contain space, use unbreakable space or horizontal motion escape sequences (\~,\space,\^,\|,\0, or\h)..UL [text [post]]β Typesettextwith an underline. On terminals, text is bracketed with underscores (β_β).post, if present, is set aftertextwith no intervening space..LGβ Set subsequent text in larger type (2 points larger than the current size) until the next type size, paragraphing, or heading macro call. Call the macro multiple times to enlarge the type size further..SMβ Set subsequent text in smaller type (2 points smaller than the current size) until the next type size, paragraphing, or heading macro call. Call the macro multiple times to reduce the type size further..NLβ Set subsequent text at the normal type size (\n[PS]).
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.
\*{,\*}β Begin and end superscripting, respectively.\*<,\*>β Begin and end subscripting, respectively.
πΈ Indented regions πΈ
You can indent a region of text while otherwise formatting it normally. Such indented regions can be nested π§
.RSβ Begin a region where headings, paragraphs, and displays are indented (further) by\n[PI]..REβ End the (next) most recent indented region.
π Keeps, boxed keeps, and displays π
On occasion, you may want to keep several lines of text, or a region of a document, together on a single page, preventing an automatic page break within certain boundaries. This can cause a page break to occur earlier than it normally would π
You can alternatively specify a floating keep: if a keep cannot fit on the current page, ms holds it, allowing text following the keep (in the source document) to fill in the remainder of the current page. When the page breaks by reaching its bottom or by bp request, ms puts the floating keep at the beginning of the next page.
.KSβ Begin a keep..KFβ Begin a floating keep..KEβ End (floating) keep.
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.
.B1β Begin a keep with a box drawn around it..B2β End boxed keep.
Boxed keep macros cause breaks; to box words within a line, recall BX in section βHighlightingβ above. ms draws box lines close to the text they enclose so that they are usable within paragraphs. When boxing entire paragraphs thus, you may improve their appearance by calling B1 after the first paragraphing macro, and invoking the sp request before calling B2 π
If you want a boxed keep to float, 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 L,.LDβ Begin (DS: kept) left-aligned display..DS [I [indent]],.ID [indent]β Begin (DS: kept) display indented by indent if specified,\n[DI]otherwise..DS B,.BDβ Begin (DS: kept) block display: the entire display is left-aligned, but indented such that the longest line in the display is centered on the page..DS C,.CDβ Begin (DS: kept) centered display: each line in the display is centered..DS R,.RDβ Begin (DS: kept) right-aligned display. This is a GNU extension..DEβ End any display.
groff ms inserts the distance stored in \n[DD] before and after each pair of display macros; this is a Berkeley extension. 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 π¦
ms often sees use with the tbl, pic, eqn, and refer preprocessors. groff ms applies the \n[DD] distance to regions of the document preprocessed with eqn, pic, and tbl. Mark text meant for preprocessors by enclosing it in pairs of tokens as follows, with nothing between the dot and the macro name. Preprocessors match these tokens only at the start of an input line. The formatter interprets them as macro calls.
.TS [H],.TEβ Demarcate a table to be processed by thetblpreprocessor. The optionalHargument instructsmsto repeat table rows (often column headings) at the top of each new page the table spans, if applicable; calling theTHmacro marks the end of such rows.tbl(1)provides a comprehensive reference to the preprocessor and offers examples of its use..PS h v,.PE,.PFβPSmarks the start of apic(1)preprocessor diagram; either ofPEorPFends it, the latter with βflybackβ to the vertical position at its top.handvare the horizontal and vertical dimensions of the picture;picsupplies them automatically..EQ [align [label]],.ENβ Demarcate mathematics to be processed by theeqnpreprocessor.mscenters the equation by default;aligncan beC,L, orIto (explicitly) center, left-align, or indent it by\n[DI], respectively.msright-aligns anylabel. Seeeqn(1)..[,.]β Demarcate a bibliographic citation to be processed by thereferpreprocessor.refer(1)provides a comprehensive reference to the preprocessor and the format of its bibliographic database.
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. Not cute, bestie π
π Footnotes π
A footnote is typically anchored to a place in the text with a mark, which is a small integer, a symbol, or arbitrary user-specified text.
\**β Place an automatic number, an automatically generated numeric footnote mark, in the text. Each time this string is interpolated, the number it produces increments by one. Automatic numbers start at1. This is a Berkeley extension.
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.
.FS [mark]β Begin a footnote. TheFS-MARKhook (see below) is called with any suppliedmarkargument, which is then also placed at the beginning of the footnote text. Ifmarkis omitted, the next pending automatic number enqueued by interpolation of the*string is used, and if none exists, nothing is prefixed..FEβ End footnote text.
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 mark argument, at the bottom of a column or page as follows.
0β Set an automatic number, or a specifiedFSmarkargument, as a superscript (on typesetters) or surrounded by square brackets (on terminals). The footnote paragraph is indented as withPPif there is anFSargument or an automatic number, and as withLPotherwise. This is the default.1β As0, but setmarkas regular text, and follow an automatic number with a period.2β As1, but without indentation (likeLP).3β As1, but set the footnote paragraph withmarkhanging (likeIP).
π Language and localization
okay so groff ms provides several strings that you can customize for your own purposes, or redefine to adapt the macro package to languages other than English. It is already localized for Czech, German, Spanish, French, Italian, Polish, Russian, and Swedish. Load the desired localization macro package after ms; see groff_tmac(5).
Hereβs the string lineup, bestie β defaults included, no cap:
\*[REFERENCES]βReferences\*[ABSTRACT]β\f[I]ABSTRACT\f[]\*[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 default for \*[ABSTRACT] includes font selection escape sequences to set the word in italics. cute, right? π
π Headers and footers
There are multiple ways to produce headers and footers. One is to define the strings LH, CH, and RH to set the left, center, and right headers, respectively; and LF, CF, and RF to set the left, center, and right footers. This approach suffices for documents that do not distinguish odd- and even-numbered pages.
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.
.OH 'left'center'right'
.OF 'left'center'right'
.EH 'left'center'right'
.EF 'left'center'right'
.OHand.EHβ define headers for odd- (recto) and even-numbered (verso) pages, respectively..OFand.EFβ 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).
.P1β typeset the header even on page 1. To be effective, this macro must be called before the header trap is sprung on any page numbered β1β. This is a Berkeley extension.
For even greater flexibility, ms is designed to permit the redefinition of the macros that are called when formatter traps that ordinarily cause the headers and footers to be output 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
Use the ta request to set tab stops as needed.
.TAβ reset the tab stops to themsdefault (every 5 ens). Redefine this macro to create a different set of default tab stops.
π¦ Margins
Control margins using the registers summarized in the βMarginsβ portion of the table in section βDocument control settingsβ above. There is no setting for the right margin; the combination of page offset \n[PO] and line length \n[LL] determines it.
π Multiple columns
ms can set text in as many columns as reasonably fit on the page. The following macros force a page break if a multi-column layout is active when they are called. \n[MINGW] is the default minimum gutter width; it is a GNU extension. When multiple columns are in use, keeps and the HORPHANS and PORPHANS registers work with respect to column breaks instead of page breaks.
.1Cβ arrange page text in a single column (the default)..2Cβ arrange page text in two columns..MC [column-width [gutter-width]]β arrange page text in multiple columns. If you specify no arguments, it is equivalent to the2Cmacro. Otherwise, column-width is the width of each column and gutter-width is the minimum distance between columns.
π Creating a table of contents
Define an entry to appear in the table of contents by bracketing its text between calls to the XS and XE macros. A typical application is to call them immediately after NH or SH and repeat the heading text within them. The XA macro, used within XS/XE pairs, supplements an entryβfor instance, when it requires multiple output lines, whether because a heading is too long to fit or because style dictates that page numbers not be repeated. You may wish to indent the text thus wrapped to correspond to its heading depth; this can be done in the entry text by prefixing it with tabs or horizontal motion escape sequences, or by providing a second argument to the XA macro. XS and XA automatically associate the page number where they are called with the text following them, but they accept arguments to override this behavior. At the end of the document, call TC or PX to emit the table of contents; TC resets the page number to i (Roman numeral one), and then calls PX. All of these macros are Berkeley extensions.
.XS [page-number],.XA [page-number [indentation]],.XEβ begin, supplement, and end a table of contents entry. Each entry is associated with page-number (otherwise the current page number); a page-number ofnoprevents a leader and page number from being emitted for that entry. Use ofXAwithinXS/XEis optional; it can be repeated. If indentation is present, a supplemental entry is indented by that amount; ens are assumed if no unit is indicated. Text on input lines betweenXSandXEis stored for later recall byPX..PX [no]β switch to single-column layout. Unlessnois 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 to1, the page number format to lowercase Roman numerals, and callPX(with anoargument, 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.
.XN heading-textβ format heading-text and create a corresponding table of contents entry; the indentation is computed from the depth argument of the precedingNHcall..XH depth heading-textβ asXN, 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.
.XN-REPLACEMENT heading-text,.XH-REPLACEMENT depth heading-textβ these hook macros implementXNandXH, and callXN-INITandXH-INIT, respectively, then callXH-UPDATE-TOCwith the arguments given them..XH-INIT,.XN-INITβ these hook macros do nothing by default..XH-UPDATE-TOC depth heading-textβ bracket heading-text withXSandXEcalls, 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 ms π
The 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 Research Tenth Edition Unix extensions, and adds several of its own.
- The internals of
groff msdiffer from those of AT&Tms. Documents that depend upon implementation details of AT&Tmsmay not format properly withgroff ms. Such details include macros whose function was not documented in the AT&Tmsmanual (βTyping Documents on the UNIX System: Using the-msMacros with Troff and Nroffβ, M. E. Lesk, Bell Laboratories, 1978). - The error-handling policy of
groff msis to detect and report errors, rather than to ignore them silently. - Research Tenth Edition Unix supported
P1/P2macros to bracket code examples;groff msdoes not. groff msdoes not work in GNUtroff's AT&T compatibility mode. If loaded when that mode is enabled, it aborts processing with a diagnostic message.- Multiple line spacing is not supported. Use a larger vertical spacing instead.
groff msuses the same header and footer defaults in bothnroffandtroffmodes as AT&Tmsdoes introffmode; AT&T's default innroffmode is to put the date, in U.S. traditional format (e.g., βJanuary 1, 2021β), in the center footer (theCFstring).- Many
groff msmacros, including those for paragraphs, headings, and displays, cause a reset of paragraph rendering parameters, and may change the indentation; they do so not by incrementing or decrementing it, but by setting it absolutely. This can cause problems for documents that define additional macros of their own that manipulate indentation. UseRSandREinstead of theinrequest. - AT&T
msinterpreted the values of the registersPSandVSin points, and did not support the use of scaling units with them.groff msinterprets values of the registersPS,VS,FPS, andFVS, equal to or larger than 1,000 (one thousand) as decimal fractions multiplied by 1,000. (Register values are converted to and stored as basic units. See βMeasurementsβ in thegroffTexinfo manual or ingroff(7)). This threshold makes use of a scaling unit with these parameters practical for high-resolution devices while preserving backward compatibility. It also permits expression of non-integral type sizes. For example,groff -rPS=10.5pat the shell prompt is equivalent to placing.nr PS 10.5pat the beginning of the document. - AT&T
ms'sAUmacro supported arguments whose values were used with somenon-RPdocument types; that ofgroff msdoes not. - Right-aligned displays are available. The AT&T
msmanual observes that βit is tempting to assume that.DS Rwill right adjust lines, but it doesn't workβ. Ingroff ms, it does. - To make
groff msuse the default page offset (which also specifies the left margin), thePOregister must stay undefined until the firstmsmacro is called. This implies that\n[PO]should not be used early in the document, unless it is changed also: accessing an undefined register automatically defines it. groff mssupports thePNregister, but it is not necessary; you can access the page number via the usual%register and invoke theafrequest to assign a different format to it if desired. (If you redefine themsPTmacro and desire special treatment of certain page numbersβlike β1ββyou may need to handle a non-Arabic page number format, asgroff ms'sPTdoes; see the macro package source.groff msaliases thePNregister to%.)- The AT&T
msmanual documents registersCWandGWas setting the default column width and βintercolumn gapβ, respectively, and which applied whenMCwas called with fewer than two arguments.groff msinstead treatsMCwithout arguments as synonymous with2C; there is thus no occasion for a default column width register. Further, theMINGWregister and the second argument toMCspecify a minimum space between columns, not the fixed gutter width of AT&Tms. - The AT&T
msmanual did not document theQIregister; Berkeley andgroff msdo. groff mssets the registerGSto 1; the AT&Tmspackage does not use it. A document can test its value to determine whether it is being formatted withgroff msor another implementation.
π Unix Version 7 macros unimplemented by groff ms π
Several macros described in the Unix Version 7 ms documentation are unimplemented by groff ms because they are specific to the requirements of documents produced internally by Bell Laboratories, some of which also require a glyph for the Bell System logo that groff does not support. These macros implemented several document type formats (EG, IM, MF, MR, TM, TR), were meaningful only in conjunction with the use of certain document types (AT, CS, CT, OK, SG), stored the postal addresses of Bell Labs sites (HO, IH, MH, PY, WH), or lacked a stable definition over time (UX).
π Legacy features π
groff 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 π
AT&T ms defined accent mark strings as follows.
\*[']β Apply acute accent to subsequent glyph.\*[`]β Apply grave accent to subsequent glyph.\*[:]β Apply dieresis (umlaut) to subsequent glyph.\*[^]β Apply circumflex accent to subsequent glyph.\*[~]β Apply tilde accent to subsequent glyph.\*[C]β Apply caron to subsequent glyph.\*[,]β Apply cedilla to subsequent glyph.
π¦ Berkeley ms accent mark and glyph strings π¦
Berkeley ms offered an AM macro; calling it redefined the AT&T accent mark strings (except for \*C), applied them to the preceding glyph, and defined additional strings, some for spacing glyphs.
.AMβ Enable alternative accent mark and glyph-producing strings.\*[']β Apply acute accent to preceding glyph.\*[`]β Apply grave accent to preceding glyph.\*[:]β Apply dieresis (umlaut) to preceding glyph.\*[^]β Apply circumflex accent to preceding glyph.\*[~]β Apply tilde accent to preceding glyph.\*[,]β Apply cedilla to preceding glyph.\*[/]β Apply stroke (slash) to preceding glyph.\*[v]β Apply caron to preceding glyph.\*[_]β Apply macron to preceding glyph.\*[.]β Apply underdot to preceding glyph.\*[o]β Apply ring accent to preceding glyph.
\*[?]β Interpolate inverted question mark.\*[!]β Interpolate inverted exclamation mark.\*[8]β Interpolate small letter sharp s.\*[q]β Interpolate small letter o with hook accent (ogonek).\*[3]β Interpolate small letter yogh.\*[d-]β Interpolate small letter eth.\*[D-]β Interpolate capital letter eth.\*[th]β Interpolate small letter thorn.\*[TH]β Interpolate capital letter thorn.\*[ae]β Interpolate small ae ligature.\*[AE]β Interpolate capital ae ligature.\*[oe]β Interpolate small oe ligature.\*[OE]β Interpolate capital oe ligature.
π§ Naming conventions π§
External names available to documents that use the groff ms macros contain only uppercase letters and digits. The package reserves for internal use the following identifiers:
- those containing the characters
*,@, and:; and - those containing only uppercase letters and digits.
When selecting a name for your document's own macros, strings, and registers, avoid those reserved by groff ms and those defined by GNU troff. See groff(7) for complete lists thereof.
groff ms organizes most of its internal names into modules. The naming convention is as follows.
- Names used only within one module are of the form
module*name. - Names used outside the module in which they are defined are of the form
module@name. - Names associated with a particular environment are of the form
environment:name; these are used only within theparmodule. namedoes not have a module prefix.- Names constructed to implement arrays are of the form
array!index.
π Files π
/usr/share/groff/1.24.2/tmac/s.tmacβ implements the package./usr/share/groff/1.24.2/tmac/refer-ms.tmacβ implementsrefer(1)support forms./usr/share/groff/1.24.2/tmac/ms.tmacβ is a wrapper enabling the package to be loaded with the option-m ms.
π Authors π
The GNU version of the ms macro package was written by James Clark and contributors. This document was written by Clark, Larry Kollar, and G. Branden Robinson.
π See also π
A manual is available in source and rendered form. On your system, it may be compressed and/or available in additional formats.
/usr/share/doc/groff-1.24.2/ms.ms/usr/share/doc/groff-1.24.2/ms.psβ βUsing groff with the ms Macro Packageβ; Larry Kollar and G. Branden Robinson./usr/share/doc/groff-1.24.2/msboxes.ms/usr/share/doc/groff-1.24.2/msboxes.pdfβ βUsing PDF boxes with groff and the ms macrosβ; Deri James.BOXSTARTandBOXSTOPmacros are available via thesboxesextension package, enabling colored, bordered boxes when thepdfoutput 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β.
That's the whole page, bestie β brought to you by groff 1.24.2, dated 2026-10-01, and filed under groff_ms(7). πβ¨
π¦ where this page comes from
- alpine 3.24: groff-doc 1.24.2-r0 Β· GPL-3.0-or-later
- Copyright 1989-2025 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms