groff
request names unrecognized by other troff
implementations will likely be ignored by them; escape sequences that
are groff
extensions are liable to be interpreted as if the
escape character were not present.
For example, the adjustable, non-breaking escape sequence \~
is also supported by Heirloom Doctools troff
050915 (September
2005), mandoc
1.9.5 (2009-09-21), neatroff
(commit
1c6ab0f6e, 2016-09-13), and Plan 9 from User Space troff
(commit 93f8143600, 2022-08-12), but not by Solaris or Documenter’s
Workbench troff
s.
See Manipulating Filling and Adjustment.
GNU troff
does not allow the use of the escape sequences
\|
, \^
, \&
, \{
, \}
,
\SP
, \'
, \`
, \-
, \_
, \!
,
\%
, and \c
in identifiers; AT&T troff
does. The \A
escape sequence (see Identifiers) may be
helpful in avoiding use of these escape sequences in names.
When adjusting to both margins, AT&T troff
at first
adjusts spaces starting from the right; GNU troff
begins from
the left. Both implementations adjust spaces from opposite ends on
alternating output lines in this adjustment mode to prevent “rivers”
in the text.
GNU troff
does not always hyphenate words as AT&T
troff
does. The AT&T implementation uses a set of
hard-coded rules specific to English, while GNU troff
uses
language-specific hyphenation pattern files derived from TeX.
Furthermore, in old versions of troff
there was a limited amount
of space to store hyphenation exceptions (arguments to the hw
request); GNU troff
has no such restriction.
GNU troff
predefines a string .T
containing the argument
given to the -T command-line option, namely the current output
device (for example, ‘pdf’ or ‘utf8’). The existence of this
string is a common feature of post-CSTR #54
troff
s96 but valid values are specific
to each implementation.
The (read-only) register .T
interpolates 1 if GNU
troff
is called with the -T command-line option, and
0 otherwise. This behavior differs from AT&T troff
, which
interpolated 1 only if nroff
was the formatter and was
called with -T.
AT&T troff
and other implementations handle the
lf
request differently. For them, its line argument
changes the line number of the current line.
AT&T troff
had only environments named ‘0’,
‘1’, and ‘2’. In GNU troff
, any number of environments
may exist, using any valid identifiers for their names
(see Identifiers.)
Fractional type sizes cause one noteworthy incompatibility. In
AT&T troff
the ps
request ignores scale
indicators and thus ‘.ps 10u’ sets the type size to
10 points, whereas in GNU troff
it sets the type size to
10 scaled points. See Using Fractional Type Sizes.
The ab
request differs from AT&T troff
:
GNU troff
writes no message to the standard error stream if no
arguments are given, and it exits with a failure status instead of a
successful one.
The bp
request differs from AT&T troff
:
GNU troff
does not accept a scaling indicator on the argument, a
page number; the former (somewhat uselessly) does.
The pm
request differs from AT&T troff
:
GNU troff
reports the sizes of macros, strings, and diversions in
bytes and ignores an argument to report only the sum of the sizes.
Unlike AT&T troff
, GNU troff
does not ignore the
ss
request if the output is a terminal device; instead, the
values of minimal inter-word and additional inter-sentence space are
each rounded down to the nearest multiple of 12.
In GNU troff
there is a fundamental difference between
(unformatted) input characters and (formatted) output glyphs.
Everything that affects how a glyph is output is stored with the glyph
node; once a glyph node has been constructed, it is unaffected by any
subsequent requests that are executed, including bd
, cs
,
tkf
, tr
, or fp
requests. Normally, glyphs are
constructed from input characters immediately before the glyph is added
to the current output line. Macros, diversions, and strings are all, in
fact, the same type of object; they contain lists of input characters
and glyph nodes in any combination. Special characters can be both:
before being added to the output, they act as input entities;
afterward, they denote glyphs. A glyph node does not behave like an
input character for the purposes of macro processing; it does not
inherit any of the special properties that the input character from
which it was constructed might have had. Consider the following
example.
.di x \\\\ .br .di .x
It prints ‘\\’ in GNU troff
; each pair of input backslashes
is turned into one output backslash and the resulting output backslashes
are not interpreted as escape characters when they are reread.
AT&T troff
would interpret them as escape characters
when they were reread and would end up printing one ‘\’.
One correct way to obtain a printable backslash in most documents is to
use the \e
escape sequence; this always prints a single instance
of the current escape character,97 regardless of whether or not it is used in a diversion; it
also works in both GNU troff
and AT&T troff
.
The other correct way, appropriate in contexts independent of the
backslash’s common use as a troff
escape character—perhaps in
discussion of character sets or other programming languages—is
the character escape \(rs
or \[rs]
, for “reverse
solidus”, from its name in the ECMA-6 (ISO/IEC 646)
standard.98
To store an escape sequence in a diversion that is interpreted when the
diversion is reread, either use the traditional \!
transparent
output facility, or, if this is unsuitable, the new \?
escape
sequence. See Diversions and gtroff
Internals.
In the somewhat pathological case where a diversion exists containing a
partially collected line and a partially collected line at the top-level
diversion has never existed, AT&T troff
will output the
partially collected line at the end of input; GNU troff
will not.