'\" e .TH groff_diff 7 "2026-03-15" "groff 1.24.1" .SH Name groff_diff \- differences between GNU .I roff and AT&T .I troff . . .\" ==================================================================== .\" Legal Terms .\" ==================================================================== .\" .\" Copyright 1989-2024 Free Software Foundation, Inc. .\" 2019-2025 G. Branden Robinson .\" .\" This file is part of groff, the GNU roff typesetting system. .\" .\" Permission is granted to copy, distribute and/or modify this .\" document under the terms of the GNU Free Documentation License, .\" Version 1.3 or any later version published by the Free Software .\" Foundation; with no Invariant Sections, with no Front-Cover Texts, .\" and with no Back-Cover Texts. .\" .\" A copy of the Free Documentation License is included as a file .\" called FDL in the main directory of the groff source package. . . .\" Save and disable compatibility mode (for, e.g., Solaris 10/11). .do nr *groff_groff_diff_7_man_C \n[.cp] .cp 0 . .\" Define fallback for groff 1.23's MR macro if the system lacks it. .nr do-fallback 0 .if !\n(.f .nr do-fallback 1 \" mandoc .if \n(.g .if !d MR .nr do-fallback 1 \" older groff .if !\n(.g .nr do-fallback 1 \" non-groff *roff .if \n[do-fallback] \{\ . de MR . ie \\n(.$=1 \ . I \%\\$1 . el \ . IR \%\\$1 (\\$2)\\$3 . . .\} .rr do-fallback . . .\" ==================================================================== .\" Local definitions .\" ==================================================================== . .\" define a string tx for the TeX logo .ie t .ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X .el .ds tx TeX . . .\" from old groff_out.man .ie \n(.g \ . ds ic \/ .el \ . ds ic \^ . . .\" ==================================================================== .SH Description .\" ==================================================================== . The GNU .I roff text processing system, .IR groff , is a reimplementation and extension of AT&T .IR troff , \" AT&T the typesetting system originating in Unix systems of the 1970s. . .I groff removes many arbitrary limitations and adds features, both to the input language and to the page description language output by the .I troff \" generic formatter. . We also note here differences arising from .IR groff 's implementation of AT&T .I troff \" AT&T features. . The following discussion assumes familiarity with those features; see .MR roff 7 for background. . GNU .I troff \" GNU can operate in a manner that increases support for documents written for AT&T .IR troff ; \" AT&T see section \[lq]Compatibility mode\[rq] below. . . .\" ==================================================================== .SH Language .\" ==================================================================== . GNU .I troff \" GNU features identifiers of arbitrary length; supports color output, non-integral type sizes, user-defined characters, and automatic hyphenation in languages other than English; adds more conditional expression operators; recognizes additional scaling units and arithmetic operators; enables general file I/O (in \[lq]unsafe mode\[rq] only); and exposes more formatter state. . . .\" ==================================================================== .SS "Long names" .\" ==================================================================== . GNU .I troff \" GNU introduces many new requests; with three exceptions .RB ( cp , .BR do , .BR rj ), they have names longer than two characters. . The names of registers, fonts, strings/\:macros/\:diversions, environments, special characters, character classes, streams, hyphenation language codes, and colors can be of any length. . Anywhere AT&T .I troff \" AT&T supports a parameterized escape sequence that uses an opening parenthesis \[lq](\[rq] to introduce a two-character argument, .I groff supports a square-bracketed form \[lq][]\[rq] where the argument within can be of arbitrary length. . . .\" ==================================================================== .SS "Font families, abstract styles, and translation" .\" ==================================================================== . GNU .I troff \" GNU can group text typefaces into .I families. For example, .I groff ships with support for families containing each of the styles .RB \[lq] R \[rq], .RB \[lq] I \[rq], .RB \[lq] B \[rq], and .RB \[lq] BI \[rq] (roman [upright], bold, italic [slanted], and bold-italic). . So that a document need not be coupled to a specific font family, an output device can associate a style in the abstract sense with a mounting position. . Thus the default family can combine with a style dynamically, producing a .I "resolved font name." . A document can .I translate, or remap, font names with the .B ftr request. . . .P .\" BEGIN Keep parallel with node "Font Families" in our Texinfo manual. Applying the requests .BR cs , .BR bd , .BR tkf , .BR uf , or .B \%fspecial to an abstract style affects the member of the default family corresponding to that style. .\" END Keep parallel with node "Font Families" in our Texinfo manual. . The default family can be set with the .B fam request or .B \-f command-line option. . The .B styles directive in the output device's .I DESC file controls which mounting positions (if any) are initially associated with abstract styles rather than fonts, and the .B sty request can update this association. . . .\" ==================================================================== .SS Colors .\" ==================================================================== . .I groff supports color output with a variety of color spaces and up to 16 bits per channel. . Some devices, particularly terminals, may be more limited. . When color support is enabled, two colors are current at any given time: the .I stroke color, with which glyphs, rules (lines), and geometric figures are drawn, and the .I fill color, which paints the interior of filled geometric figures. . The .BR color , .BR \%defcolor , .BR gcolor , and .B fcolor requests; .B \[rs]m and .B \[rs]M escape sequences; and .BR .color , .BR .m , and .B .M registers exercise color support. . . .\" ==================================================================== .SS Hyphenation .\" ==================================================================== . GNU .I troff \" GNU uses a hyphenation algorithm and language-specific pattern files (based on \*[tx]'s) to decide which words can be hyphenated and where. . AT&T .IR troff 's \" AT&T hyphenation system (\[lq]suftab\[rq]) was specific to English. . . .P New requests permit finer control over hyphenation breaking; hyphenation of a word might be suppressed due to a limit on consecutive hyphenated lines .RB ( hlm ), a minimum line length threshold .RB ( hym ), or because the line can instead be adjusted with additional inter-word space .RB ( hys ). . The .B hla request selects a hyphenation language, whereas .B hpf and .B hpfa respectively load and append to the language's hyphenation patterns. . If no hyphenation language is set or no patterns are loaded, GNU .I troff \" GNU does not perform automatic hyphenation. . . .\" BEGIN Keep (roughly) parallel with groff.texi node "Manipulating .\" Hyphenation". .P For automatic hyphenation to work, the formatter must know which letters are equivalent. . For example, the letter \[lq]E\[rq] behaves like \[lq]e\[rq]; only the latter typically appears in hyphenation pattern files. . GNU .I troff \" GNU expects characters that participate in automatic hyphenation to be assigned .I "hyphenation codes" that define these equivalence classes. . At startup, GNU .I troff \" GNU assigns hyphenation codes to the letters \[lq]a\[rq]\[en]\[lq]z\[rq], applies the same codes to \[lq]A\[rq]\[en]\[lq]Z\[rq] in one-to-one correspondence, and assigns a code of zero to all other characters. . . .br .ne 2v .P The .B hcode request enables application of hyphenation codes to characters outside the Unicode basic Latin set; without doing so, words containing such letters won't hyphenate properly even if the corresponding hyphenation patterns contain them. . Localization files for the input character set and language configure hyphenation codes; see .MR groff_tmac 5 . .\" END Keep (roughly) parallel with groff.texi node "Manipulating .\" Hyphenation". . . .P GNU .IR troff 's \" GNU .B \[rs]: escape sequence works like .B \[rs]% but produces no hyphen if the word breaks at that location. . . .\" ==================================================================== .SS "Fractional type sizes and new scaling units" .\" ==================================================================== . .\" BEGIN Keep (roughly) parallel with groff.texi node "Using Fractional .\" Type Sizes". When configuring the type size, AT&T .I troff \" AT&T ignored scaling units and interpreted all measurements in points. Combined with integer arithmetic, this design choice made it impossible to support, for instance, ten-and-a-half-point type. . In GNU .I troff \" GNU an output device can select a scaling factor that subdivides a point into \[lq]scaled points\[rq]. A type size expressed in scaled points can thus represent a non-integral size in points. . . .P A .I "scaled point," scaling unit .BR s , is equal to .RI 1/ sizescale points, where the device description file, .IR DESC , specifies .I sizescale and otherwise defaults to\~1; see .MR groff_font 5 . . GNU .I troff \" GNU also defines the .I "typographical point," scaling unit .BR z , which explicitly specifies a type size of potentially non-integral measure. The program multiplies typographical points by .I sizescale and converts the value to an integer. . Arguments GNU .I troff \" GNU interprets in .B z units by default comprise those to the escape sequences .B \[rs]H and .BR \[rs]s , .\" Legacy forms of the `\s` escape sequence don't accept numerical .\" expressions--only integers. to the request .BR ps , the third argument to the .B cs request, and the second and fourth arguments to the .B tkf request. . In GNU .IR troff , \" GNU the register .B \[rs]n[.s] interpolates the type size in typographical points .RB ( z ), whereas the register .B \[rs]n[.ps] interpolates it in scaled points .RB ( s ). . .RB \[lq] \[rs]n[.ps]s \[rq], .RB \[lq] \[rs]n[.s]z \[rq], and .RB \[lq] 1m \[rq] are co-equal by definition. . . .P For example, if .I sizescale is\~1000, then a scaled point is one thousandth of a point. . Consequently, .RB \[lq] ".ps 10.5" \[rq] is synonymous with .RB \[lq] ".ps 10.5z" \[rq]; both set the type size to 10,500\~scaled points or 10.5\~typographical points. . . .P It makes no sense to use the .RB \[lq] z \[rq]\~scaling unit in a numeric expression whose default scaling unit is neither .RB \[lq] u \[rq] .RB nor\~\[lq] z \[rq], so GNU .I troff \" GNU disallows this. . Similarly, it is nonsensical to use scaling units other than .RB \[lq] p \[rq], .RB \[lq] s \[rq], .RB \[lq] z \[rq], or .RB \[lq] u \[rq], in a numeric expression whose default scaling unit .RB is\~\[lq] z \[rq], and so GNU .I troff \" GNU disallows those as well. . . .br .ne 2v .P Output devices may be limited in the type sizes they can employ. . The .B .s and .B .ps registers represent the type size selected by the formatter as it understands a device's capability. . the read-only registers .B .psr and (string-valued) .B .sr interpolate the last .I requested in scaled points and in points as a decimal fraction, respectively. . Like the actual current and previous type size, the requested ones are properties of an environment. . . .P For example, if a document requests a type size of 10.95\~points, and the nearest size permitted by a .B sizes request (or by the .B sizes or .B \%sizescale directives in the device's .I DESC file) is 11\~points, .I groff uses the latter value. .\" END Keep (roughly) parallel with groff.texi node "Using Fractional .\" Type Sizes". . . .P A further two new measurement units available in .I groff are .RB \[lq] M \[rq], which indicates hundredths of an em, and .RB \[lq] f \^\[rq], which multiplies by 65,536. . The latter provides convenient fractions for color definitions with the .B \%defcolor request. . For example, 0.5f equals 32768u. . . .\" ==================================================================== .SS "Special fonts" .\" ==================================================================== . .\" BEGIN Keep (roughly) parallel with groff.texi node "Special Fonts". .\" (the second paragraph thereof; the first covers "portable" concepts) GNU .IR troff 's \" GNU .RB \%\[lq] special \[rq] and .B \%fspecial requests permit a document to supplement the set of fonts the device configures for glyph search without having to use the .B fp request to manipulate the list of mounting positions, which can be tedious\[em]by default, GNU .I troff \" GNU mounts 40 fonts at startup when using the .B ps device. .\" END Keep (roughly) parallel with groff.texi node "Special Fonts". . . .\" ==================================================================== .SS "Numeric expressions" .\" ==================================================================== . GNU .I troff \" GNU permits spaces in a numeric expression within parentheses, and offers three new operators. . . .TP 8n \" "e1>?e2" +2n .IB e1 >? e2 Interpolate the greater of expressions .I e1 and .IR e2 . . . .TP .IB e1