troff has a number of features that cause incompatibilities
with documents written with old versions of
Long names cause some incompatibilities. Unix
as defining a string ‘ab’ with contents ‘cd’. Normally, GNU
troff interprets this as a call of a macro named
\n[ as references
to a string or number register called ‘[’. In GNU
however, this is normally interpreted as the start of a long name. In
compatibility mode GNU
troff interprets long names in the
traditional way (which means that they are not recognized as names).
If n is missing or non-zero, turn on compatibility mode; otherwise, turn it off.
The read-only number register
.C is 1 if compatibility mode
is on, 0 otherwise.
Compatibility mode can be also turned on with the -C command-line option.
do request turns off compatibility mode while executing its
arguments as a
gtroff command. However, it does not turn off
compatibility mode while processing the macro itself. To do that, use
de1 request (or manipulate the
.C register manually).
See Writing Macros.
.do fam T
fam request when compatibility mode is enabled.
gtroff restores the previous compatibility setting before
interpreting any files sourced by the cmd.
Two other features are controlled by -C. If not in
compatibility mode, GNU
troff preserves the input level in
.ds xx ' \w'abc\*(xxdef'
In compatibility mode, the string ‘72def'’ is returned; without -C the resulting string is ‘168’ (assuming a TTY output device).
Finally, the escapes
\S are transparent for recognizing the
beginning of a line only in compatibility mode (this is a rather obscure
feature). For example, the code
.de xx Hello! .. \fB.xx\fP
prints ‘Hello!’ in bold face if in compatibility mode, and ‘.xx’ in bold face otherwise.
troff does not allow the use of the escape sequences
\c in names of strings, macros, diversions, number
registers, fonts or environments; Unix
troff does. The
escape sequence (see Identifiers) may be helpful in avoiding use of
these escape sequences in names.
Fractional point sizes cause one noteworthy incompatibility. In
ps request ignores scale indicators and
sets the point size to 10 points, whereas in GNU
sets the point size to 10 scaled points. See Fractional Type Sizes, for more information.
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
fp requests. Normally glyphs are
constructed from input characters at the moment 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. 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. For example,
.di x \\\\ .br .di .x
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.
troff would interpret them as escape characters when they
were reread and would end up printing one ‘\’. The correct way to
obtain a printable backslash is to use the
\e escape sequence:
This always prints a single instance of the current escape character,
regardless of whether or not it is used in a diversion; it also works in
troff and Unix
troff.28 To store, for some
reason, an escape sequence in a diversion that is interpreted when the
diversion is reread, either use the traditional
output facility, or, if this is unsuitable, the new
See Diversions, and Gtroff Internals, for more information.