Footnotes

(1)

The ‘g’ prefix is not used on all systems; see Invoking groff.

(2)

https://www.lunabase.org/~faber/Vault/software/grap/

(3)

Besides groff, neatroff is an exception.

(4)

Unix and related operating systems distinguish standard output and standard error streams because of troff: https://www.tuhs.org/pipermail/tuhs/2013-December/006113.html.

(5)

See Line Layout.

(6)

roff is the language of historical Unix manuals, and of man pages to this day.

(7)

POSIX has not standardized a mechanism for the man command to distinguish pages by numeric category. If ‘man 'groff(7)'’ produces an error, attempt ‘man 7 groff’ or ‘man -s 7 groff’.

(8)

GNU troff does not, however, accept newlines (line feeds) in file names supplied as arguments to requests.

(9)

The mso loads a macro file of any name. See I/O.

(10)

See Device and Font Description Files.

(11)

The remainder of this chapter is based on “Writing Papers with NROFF using -me” by Eric P. Allman, which is distributed with groff as meintro.me.

(12)

While manual pages are older, early ones used macros supplanted by the man package of Seventh Edition Unix (1979). ms shipped with Sixth Edition (1975) and was documented by Mike Lesk in a Bell Labs internal memorandum.

(13)

defined in Footnotes

(14)

Distinguish a document title from “titles”, which are what roff systems call headers and footers collectively.

(15)

This idiosyncrasy arose through feature accretion; for example, the B macro in Sixth Edition Unix ms (1975) accepted only one argument, the text to be set in boldface. By Version 7 (1979) it recognized a second argument; in 1990, groff ms added a “pre” argument, placing it third to avoid breaking support for older documents.

(16)

“Portable Document Format Publishing with GNU Troff”, pdfmark.ms in the groff distribution, uses this technique.

(17)

Unix Version 7 ms, its descendants, and GNU ms prior to groff version 1.23.0

(18)

You could reset it after each call to .1C, .2C, or .MC.

(19)

“Typing Documents on the UNIX System: Using the -ms Macros with Troff and Nroff”, M. E. Lesk, Bell Laboratories, 1978

(20)

Register values are converted to and stored as basic units. See Measurements.

(21)

If you redefine the ms PT macro and desire special treatment of certain page numbers (like ‘1’), you may need to handle a non-Arabic page number format, as groff ms’s PT does; see the macro package source. groff ms aliases the PN register to %.

(22)

The removal beforehand is necessary because groff ms aliases these macros to a diagnostic macro, and you want to redefine the aliased name, not its target.

(23)

See Device and Font Description Files.

(24)

Tabs and leaders also separate words. Escape sequences can function as word characters, word separators, or neither—the last simply have no effect on GNU troff’s idea of whether an input character is within a word. We’ll discuss all of these in due course.

(25)

A well-researched jeremiad appreciated by groff contributors on both sides of the sentence-spacing debate can be found at https://web.archive.org/web/20171217060354/http://www.heracliteanriver.com/?p=324.

(26)

This statement oversimplifies; there are escape sequences whose purpose is precisely to produce glyphs on the output device, and input characters that aren’t part of escape sequences can undergo a great deal of processing before getting to the output.

(27)

The mnemonics for the special characters shown here are “dagger”, “double dagger”, “right (double) quote”, and “closing (single) quote”. See groff_char(7).

(28)

“Text lines” are defined in Requests and Macros.

(29)

“Tab” abbreviates “tabulation”, suggesting a table arrangement mechanism.

(30)

The backspace character is another; see Page Motions.

(31)

The \RET escape sequence can alter how an input line is classified; see Line Continuation.

(32)

Argument handling in macros is more flexible but also more complex. See Calling Macros.

(33)

Some escape sequences undergo interpolation as well.

(34)

GNU troff offers additional ones. See Writing Macros.

(35)

Macro files and packages frequently define registers and strings as well.

(36)

The semantics of certain punctuation code points have gotten stricter with the successive standards, a cause of some frustration among man page writers; see groff_char(7).

(37)

KOI8-R code points in the range 0x800x9F are not valid input to GNU troff; see Identifiers. This should be no impediment to practical documents, as these KOI8-R code points do not encode letters, but box-drawing symbols and characters that are better obtained via special character escape sequences; see groff_char(7).

(38)

The DVI output device defaults to using the Computer Modern (CM) fonts; ec.tmac loads the EC fonts instead, which provide Euro ‘\[Eu]’ and per mille ‘\[%0]’ glyphs.

(39)

Emacs: fill-column: 72; Vim: textwidth=72

(40)

groff does not yet support right-to-left scripts.

(41)

groff’s terminal output devices have page offsets of zero.

(42)

Provision is made for interpreting and reporting decimal fractions in certain cases.

(43)

If that’s not enough, see the groff_tmac(5) man page for the 62bit.tmac macro package.

(44)

See Conditionals and Loops.

(45)

Control structure syntax creates an exception to this rule, but is designed to remain useful: recalling our example, ‘.if 1 .Underline this’ would underline only “this”, precisely. See Conditionals and Loops.

(46)

See Diversions.

(47)

Historically, control characters like ASCII STX, ETX, and BEL (Control+B, Control+C, and Control+G) have been observed in roff documents, particularly in macro packages employing them as delimiters with the output comparison operator to try to avoid collisions with the content of arbitrary user-supplied parameters (see Operators in Conditionals). We discourage this expedient; in GNU troff it is unnecessary (outside of compatibility mode) because delimited arguments are parsed at a different input level than the surrounding context. See Implementation Differences.

(48)

Consider what happens when a C1 control 0x800x9F is necessary as a continuation byte in a UTF-8 sequence.

(49)

Recall Identifiers.

(50)

In compatibility mode, a space is not necessary after a request or macro name of two characters’ length. Also, Plan 9 troff allows tabs to separate arguments.

(51)

\~ is fairly portable; see Other Differences.

(52)

Strictly, you can neglect to close the last quoted macro argument, relying on the end of the control line to do so. We consider this lethargic practice poor style.

(53)

The omission of spaces before the comment escape sequences is necessary; see Strings.

(54)

TeX does have such a mechanism.

(55)

See Operators in Conditionals.

(56)

GNU troff accepts ‘|’ as a delimiter in spite of its meaningfulness in numeric expressions because it occasionally sees use in man pages. Future groff releases may deprecate and subsequently withdraw such support.

(57)

This claim may be more aspirational than descriptive.

(58)

See Conditional Blocks.

(59)

Exception: auto-incrementing registers defined outside the ignored region will be modified if interpolated with \n± inside it. See Auto-increment.

(60)

See Page Motions.

(61)

A negative auto-increment can be considered an “auto-decrement”.

(62)

GNU troff dynamically allocates memory for as many registers as required.

(63)

though not necessarily to the output device; see Diversions

(64)

If you’re not sure whether an input line has been productive, you can use the pline request before and after it to see whether it produced any output nodes. See Debugging.

(65)

See Line Continuation.

(66)

The .R register interpolates the largest value that GNU troff can work with. See Built-in Registers.

(67)

Recall Filling and Sentences for the definitions of word and sentence boundaries, respectively.

(68)

See Font Description File Format. This request is incorrectly documented in the AT&T troff manual as using units of 1/36 em.

(69)

Whether a perfect algorithm for this application is even possible is an unsolved problem in computer science: https://tug.org/docs/liang/liang-thesis.pdf.

(70)

\% itself stops marking hyphenation points but still produces no output glyph.

(71)

“Soft” because it appears in output only where a hyphenation break is performed; a “hard” hyphen, as in “long-term”, always appears.

(72)

The mode is a vector of Booleans encoded as an integer. To a programmer, this fact is easily deduced from the exclusive use of powers of two for the configuration parameters; they are computationally easy to “mask off” and compare to zero. To almost everyone else, the arrangement seems recondite and unfriendly.

(73)

Hyphenation is prevented if the next page location trap is closer to the vertical drawing position than the next text baseline would be. See Page Location Traps.

(74)

For more on localization, see the groff_tmac(5) man page.

(75)

See Page Location Traps.

(76)

To shift the text baseline for part of an output line—to set super- or subscripts, for instance–use the \v escape sequence. See Page Motions.

(77)

See Drawing Geometric Objects.

(78)

or geometric objects; see Drawing Geometric Objects

(79)

to the top-level diversion; see Diversions

(80)

Plan 9 troff uses the register .S for this purpose.

(81)

Pronounce “leader” to rhyme with “feeder”; it refers to how the glyphs “lead” the eye across the page to the corresponding page number or other datum.

(82)

A GNU nroff program is available for convenience; it calls GNU troff to perform the formatting; see gnroff(1).

(83)

See Conditionals and Loops, for more on built-in conditions.

(84)

See Copy Mode.

(85)

Historically, the \c escape sequence has proven challenging to characterize. Some sources say it “connects the next input text” (to the input line on which it appears); others describe it as “interrupting” text, on the grounds that a text line is interrupted without breaking, perhaps to inject a request invocation or macro call.

(86)

See Diversions.

(87)

Terminals and some typesetters have fonts that render at only one or two sizes. As examples, take the groff lj4 device’s Lineprinter, and lbp’s Courier and Elite faces.

(88)

Font designers prepare families such that the styles share esthetic properties.

(89)

Historically, the fonts troffs dealt with were not Free Software or, as with the Graphic Systems C/A/T, did not even exist in the digital domain.

(90)

See Font Description File Format.

(91)

See DESC File Format.

(92)

Not all versions of the man program support the -T option; use the subsequent example for an alternative.

(93)

This is “Normalization Form D” as documented in Unicode Standard Annex #15 (https://unicode.org/reports/tr15/).

(94)

See Compatibility Mode.

(95)

Output glyphs have different properties. The only ones known to GNU troff are those in its font’s description file. Recall Using Fonts.

(96)

See gtroff Internals.

(97)

A monospaced font may possess glyphs for ligatures, but they are nevertheless seldom used to set text.

(98)

Opinions of this escape sequence’s best name abound. “Zero-width space” is a popular misnomer: roff formatters do not treat it like a space; when filling, they do not break a line where \& appears. Ossanna called it a “non-printing, zero-width character”, but the character causes output even though it does not “print”. If no output line is pending, the dummy character starts one. Contrast an empty input document with one containing only \&. The former produces no output; the latter, a blank page.

(99)

In text fonts, parentheses are often the tallest glyphs, but a font’s glyphs may not match the nominal type size! In the standard PostScript font families, 10-point Times sets better with 9-point Helvetica and 11-point Courier than if all were used at 10 points. Recall the fzoom request in Selecting Fonts for a remedy.

(100)

Rhyme with “sledding”; mechanical typography used lead metal (Latin plumbum).

(101)

The claim appears to have been true of Ossanna troff for the C/A/T device; Kernighan made device-independent troff more flexible.

(102)

In compatibility mode only, a non-zero n must be in the range 4–39. See Compatibility Mode.

(103)

See Device and Font Description Files.

(104)

These are known vulgarly as “ANSI” colors, after its X3.64 standard, now withdrawn.

(105)

See Copy Mode.

(106)

This refers to vtroff, a translator that would convert the C/A/T output from early-vintage AT&T troff to a form suitable for Versatec and Benson-Varian plotters.

(107)

Strictly, letters not otherwise recognized are treated as output comparison delimiters. For portability, it is wise to avoid using letters not in the list above; for example, Plan 9 troff uses ‘h’ to test a mode it calls htmlroff, and GNU troff may provide additional operators in the future.

(108)

Because formatting of the comparands takes place in a dummy environment, vertical motions within them cannot spring traps.

(109)

All of this is to say that the lists of nodes created by formatting xxx and yyy must be identical. See gtroff Internals.

(110)

This bizarre behavior maintains compatibility with AT&T troff.

(111)

See while.

(112)

See Copy Mode.

(113)

unless you redefine it

(114)

“somewhat less” because things other than macro calls can be on the input stack

(115)

See Copy Mode.

(116)

While it is possible to define and call a macro ‘.’, you can’t use it as an end macro: during a macro definition, ‘..’ is never handled as calling ‘.’, even if ‘.de name .’ explicitly precedes it.

(117)

Its structure is adapted from, and isomorphic to, part of a solution by Tadziu Hoffman to the problem of reflowing text multiple times to find an optimal configuration for it. https://lists.gnu.org/archive/html/groff/2008-12/msg00006.html

(118)

See Copy Mode.

(119)

If they were not, parameter interpolations would be similar to command-line parameters—fixed for the entire duration of a roff program’s run. The advantage of interpolating \$ escape sequences even in copy mode is that they can interpolate different contents from one call to the next, like function parameters in a procedural language. The additional escape character is the price of this power.

(120)

Compare this to the \def and \edef commands in TeX.

(121)

These are lightly adapted from the groff implementation of the ms macros.

(122)

See Page Location Traps.

(123)

At the grops defaults of 10-point type on 12-point vertical spacing, the difference between half a vee and half an em can be subtle: large spacings like ‘.vs .5i’ make it obvious.

(124)

See Strings, for an explanation of the trailing ‘\"’.

(125)

(hc, vc) is adjusted to the point nearest the perpendicular bisector of the arc’s chord.

(126)

See The Implicit Page Trap.

(127)

A trap planted at ‘20i’ or ‘-30i’ will not be sprung on a page of length ‘11i’.

(128)

It may help to think of each trap location as maintaining a queue; wh operates on the head of the queue, and ch operates on its tail. Only the trap at the head of the queue is visible.

(129)

See Debugging.

(130)

See Diversions.

(131)

While processing an end-of-input macro, the formatter assumes that the next page break must be the last; it goes into “sudden death overtime”.

(132)

Another, taken by the groff man macros, is to intercept ne requests and wrap bp ones.

(133)

Thus, the “water” gets “higher” proceeding down the page.

(134)

We must double the backslash. See Copy Mode.

(135)

See gtroff Output.

(136)

See gtroff Internals.

(137)

See gtroff Output.

(138)

Recall Line Layout.

(139)

Historically, tools named nrchbar and changebar were developed for marking changes with margin characters and could be found in archives of the comp.sources.unix USENET group. Some proprietary Unices also offer(ed) a diffmk program.

(140)

Except the escape sequences \f, \F, \H, \m, \M, \R, \s, and \S, which are processed immediately, updating the environment, if not in copy mode.

(141)

The Graphic Systems C/A/T phototypesetter (the original device target for AT&T troff) supported only a few discrete type sizes in the range 6–36 points, so Ossanna contrived a special case in the parser to do what the user must have meant. Kernighan warned of this in the 1992 revision of CSTR #54 (§2.3), and more recently, McIlroy referred to it as a “living fossil”.

(142)

Thus,

.ll 10n
\%antidisestablishmen\%tarianism
.br
\&\%antidisestablishmen\%tarianism
.pl \n(nlu

produces different results with each of the three formatters.

(143)

DWB 3.3, Solaris, Heirloom Doctools, and Plan 9 troffs all support it.

(144)

Naturally, if you’ve changed the escape character, you need to prefix the e with whatever it is—and you’ll likely get something other than a backslash in the output.

(145)

The rs special character identifier was not defined in AT&T troff’s font description files, but is in those of its lineal descendant, Heirloom Doctools troff, as of the latter’s 060716 release (July 2006).

(146)

The parser for device-independent output can be found in the file groff-source-dir/src/libs/libdriver/input.cpp.

(147)

See “A Typesetter-independent TROFF”, Bell Labs CSTR #97, 1982.

(148)

Plan 9 troff has also abandoned the binary format.

(149)

800-point type is not practical for most purposes, but using it enables the quantities in the font description files to be expressed as integers.

(150)

groff requests and escape sequences interpret non-negative integers as mounting positions instead. Further, a font named ‘0’ cannot be automatically mounted by the fonts directive of a DESC file.

(151)

On typesetters, this directive is misnamed since it starts a list of glyphs, not characters.

(152)

that is, any integer parsable by the C standard library’s strtol(3) function