summaryrefslogtreecommitdiffstats
path: root/doc/groff.html.node/Other-Differences.html
blob: 6a92cadfbd525d0db282f55f352caf0e5fe55b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.0.3, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- This manual documents GNU troff version 1.23.0.

Copyright � 1994-2023 Free Software Foundation, Inc.

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, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>Other Differences (The GNU Troff Manual)</title>

<meta name="description" content="Other Differences (The GNU Troff Manual)">
<meta name="keywords" content="Other Differences (The GNU Troff Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Request-Index.html" rel="index" title="Request Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Implementation-Differences.html" rel="up" title="Implementation Differences">
<link href="Compatibility-Mode.html" rel="prev" title="Compatibility Mode">
<style type="text/css">
<!--
div.example {margin-left: 3.2em}
kbd.key {font-style: normal}
-->
</style>


</head>

<body lang="en">
<div class="subsection-level-extent" id="Other-Differences">
<div class="nav-panel">
<p>
Previous: <a href="Compatibility-Mode.html" accesskey="p" rel="prev">Compatibility Mode</a>, Up: <a href="Implementation-Differences.html" accesskey="u" rel="up">Implementation Differences</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Other-Differences-1">5.38.3 Other Differences</h4>

<p><code class="code">groff</code> request names unrecognized by other <code class="code">troff</code>
implementations will likely be ignored by them; escape sequences that
are <code class="code">groff</code> extensions are liable to be interpreted as if the
escape character were not present.
<a class="index-entry-id" id="index-_005c_007e_002c-incompatibilities-with-AT_0026T-troff"></a>
For example, the adjustable, non-breaking escape sequence <code class="code">\~</code>
is also supported by Heirloom Doctools <code class="code">troff</code> 050915 (September
2005), <code class="code">mandoc</code> 1.9.5 (2009-09-21), <code class="code">neatroff</code> (commit
1c6ab0f6e, 2016-09-13), and Plan&nbsp;9 from User Space <code class="code">troff</code>
(commit 93f8143600, 2022-08-12), but not by Solaris or Documenter&rsquo;s
Workbench <code class="code">troff</code>s.
See <a class="xref" href="Manipulating-Filling-and-Adjustment.html">Manipulating Filling and Adjustment</a>.
</p>
<a class="index-entry-id" id="index-_005cA_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_007c_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_005e_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0026_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_007b_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_007d_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005cSP_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0027_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0060_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_002d_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_005f_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0021_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0025_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005cc_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>GNU <code class="code">troff</code> does not allow the use of the escape sequences
<code class="code">\|</code>, <code class="code">\^</code>, <code class="code">\&amp;</code>, <code class="code">\{</code>, <code class="code">\}</code>,
<code class="code">\<kbd class="key">SP</kbd></code>, <code class="code">\'</code>, <code class="code">\`</code>, <code class="code">\-</code>, <code class="code">\_</code>, <code class="code">\!</code>,
<code class="code">\%</code>, and <code class="code">\c</code> in identifiers; <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>
does.  The <code class="code">\A</code> escape sequence (see <a class="pxref" href="Identifiers.html">Identifiers</a>) may be
helpful in avoiding use of these escape sequences in names.
</p>
<a class="index-entry-id" id="index-adjustment-to-both-margins_002c-difference-from-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-rivers"></a>
<p>When adjusting to both margins, <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> at first
adjusts spaces starting from the right; GNU <code class="code">troff</code> begins from
the left.  Both implementations adjust spaces from opposite ends on
alternating output lines in this adjustment mode to prevent &ldquo;rivers&rdquo;
in the text.
</p>
<a class="index-entry-id" id="index-hyphenation_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>GNU <code class="code">troff</code> does not always hyphenate words as <abbr class="acronym">AT&amp;T</abbr>
<code class="code">troff</code> does.  The <abbr class="acronym">AT&amp;T</abbr> implementation uses a set of
hard-coded rules specific to English, while GNU <code class="code">troff</code> uses
language-specific hyphenation pattern files derived from TeX.
Furthermore, in old versions of <code class="code">troff</code> there was a limited amount
of space to store hyphenation exceptions (arguments to the <code class="code">hw</code>
request); GNU <code class="code">troff</code> has no such restriction.
</p>
<a class="index-entry-id" id="index-output-device-name-string-_0028_002eT_0029_002c-in-other-implementations"></a>
<p>GNU <code class="code">troff</code> predefines a string <code class="code">.T</code> containing the argument
given to the <samp class="option">-T</samp> command-line option, namely the current output
device (for example, &lsquo;<samp class="samp">pdf</samp>&rsquo; or &lsquo;<samp class="samp">utf8</samp>&rsquo;).  The existence of this
string is a common feature of post-CSTR&nbsp;#54
<code class="code">troff</code>s<a class="footnote" id="DOCF121" href="groff.html_fot.html#FOOT121"><sup>121</sup></a> but valid values are specific
to each implementation.
</p>
<a class="index-entry-id" id="index-removal-of-read_002donly-registers_002c-incompatibility-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-register_002c-read_002donly_002c-removal_002c-incompatibility-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-read_002donly-register-removal_002c-incompatibility-with-AT_0026T-troff"></a>
<p><abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> ignored attempts to remove read-only
registers; GNU <code class="code">troff</code> honors such requests.  See <a class="xref" href="Built_002din-Registers.html">Built-in Registers</a>.
</p>
<a class="index-entry-id" id="index-output-device-usage-register-_0028_002eT_0029_002c-incompatibility-with-AT_0026T-troff"></a>
<p>The (read-only) register <code class="code">.T</code> interpolates&nbsp;1 if GNU
<code class="code">troff</code> is called with the <samp class="option">-T</samp> command-line option, and
0&nbsp;otherwise.  This behavior differs from AT&amp;T <code class="code">troff</code>, which
interpolated&nbsp;1 only if <code class="code">nroff</code> was the formatter and was
called with <samp class="option">-T</samp>.
</p>
<a class="index-entry-id" id="index-lf-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p><abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> and other implementations handle the
<code class="code">lf</code> request differently.  For them, its <var class="var">line</var> argument
changes the line number of the <em class="emph">current</em> line.
</p>
<a class="index-entry-id" id="index-environment-availability-and-naming_002c-incompatibilities-with"></a>
<p><abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> had only environments named &lsquo;<samp class="samp">0</samp>&rsquo;,
&lsquo;<samp class="samp">1</samp>&rsquo;, and &lsquo;<samp class="samp">2</samp>&rsquo;.  In GNU <code class="code">troff</code>, any number of environments
may exist, using any valid identifiers for their names
(see <a class="pxref" href="Identifiers.html">Identifiers</a>.)
</p>
<a class="index-entry-id" id="index-fractional-point-sizes-1"></a>
<a class="index-entry-id" id="index-fractional-type-sizes-1"></a>
<a class="index-entry-id" id="index-point-sizes_002c-fractional-1"></a>
<a class="index-entry-id" id="index-type-sizes_002c-fractional-1"></a>
<a class="index-entry-id" id="index-sizes_002c-fractional"></a>
<a class="index-entry-id" id="index-ps-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>Fractional type sizes cause one noteworthy incompatibility.  In
<abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> the <code class="code">ps</code> request ignores scaling units
and thus &lsquo;<samp class="samp">.ps 10u</samp>&rsquo; sets the type size to 10&nbsp;points, whereas in
GNU <code class="code">troff</code> it sets the type size to 10&nbsp;<em class="emph">scaled</em> points.
See <a class="xref" href="Using-Fractional-Type-Sizes.html">Using Fractional Type Sizes</a>.
</p>
<a class="index-entry-id" id="index-ab-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>The <code class="code">ab</code> request differs from <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>:
GNU <code class="code">troff</code> 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.
</p>
<a class="index-entry-id" id="index-bp-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>The <code class="code">bp</code> request differs from <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>:
GNU <code class="code">troff</code> does not accept a scaling unit on the argument, a page
number; the former (somewhat uselessly) does.
</p>
<a class="index-entry-id" id="index-pm-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>The <code class="code">pm</code> request differs from <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>:
GNU <code class="code">troff</code> reports the sizes of macros, strings, and diversions in
bytes and ignores an argument to report only the sum of the sizes.
</p>
<a class="index-entry-id" id="index-ss-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>Unlike <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>, GNU <code class="code">troff</code> does not ignore the
<code class="code">ss</code> 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&nbsp;12.
</p>
<a class="index-entry-id" id="index-bd-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-cs-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-tr-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-fp-request_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-input-characters-and-output-glyphs_002c-compatibility-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-output-glyphs_002c-and-input-characters_002c-compatibility-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-characters_002c-input_002c-and-output-glyphs_002c-compatibility-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-glyphs_002c-output_002c-and-input-characters_002c-compatibility-with-AT_0026T-troff"></a>
<p>In GNU <code class="code">troff</code> there is a fundamental difference between
(unformatted) characters and (formatted) 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 <code class="code">bd</code>, <code class="code">cs</code>, <code class="code">tkf</code>,
<code class="code">tr</code>, or <code class="code">fp</code> requests.  Normally, glyphs are constructed from
characters immediately before the glyph is added to an output line.
Macros, diversions, and strings are all, in fact, the same type of
object; they contain a sequence of intermixed character and glyph nodes.
Special characters transform from one to the other: before being added
to the output, they behave as characters; afterward, they are glyphs.  A
glyph node does not behave like a character node when it is processed by
a macro: it does not inherit any of the special properties that the
character from which it was constructed might have had.  For example,
the input
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">.di x
\\\\
.br
.di
.x
</pre></div></div>

<p>produces &lsquo;<samp class="samp">\\</samp>&rsquo; in GNU <code class="code">troff</code>.  Each pair of backslashes
becomes one backslash <em class="emph">glyph</em>; the resulting backslashes are thus
not interpreted as escape <em class="emph">characters</em> when they are reread as the
diversion is output.  <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> <em class="emph">would</em> interpret
them as escape characters when rereading them and end up printing one
&lsquo;<samp class="samp">\</samp>&rsquo;.
</p>
<a class="index-entry-id" id="index-printing-backslash-_0028_005c_005c_002c-_005ce_002c-_005cE_002c-_005c_005brs_005d_0029"></a>
<a class="index-entry-id" id="index-backslash_002c-printing-_0028_005c_005c_002c-_005ce_002c-_005cE_002c-_005c_005brs_005d_0029"></a>
<a class="index-entry-id" id="index-_005ce_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-_005c_0021_002c-incompatibilities-with-AT_0026T-troff-1"></a>
<a class="index-entry-id" id="index-_005c_003f_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-transparent-output_002c-incompatibilities-with-AT_0026T-troff"></a>
<a class="index-entry-id" id="index-output_002c-transparent_002c-incompatibilities-with-AT_0026T-troff"></a>
<p>One correct way to obtain a printable backslash in most documents is to
use the <code class="code">\e</code> escape sequence; this always prints a single instance
of the current escape character,<a class="footnote" id="DOCF122" href="groff.html_fot.html#FOOT122"><sup>122</sup></a> regardless of whether or not it is used in a diversion; it
also works in both GNU <code class="code">troff</code> and <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code>.
</p>
<p>The other correct way, appropriate in contexts independent of the
backslash&rsquo;s common use as a <code class="code">troff</code> escape character&mdash;perhaps in
discussion of character sets or other programming languages&mdash;is
the character escape <code class="code">\(rs</code> or <code class="code">\[rs]</code>, for &ldquo;reverse
solidus&rdquo;, from its name in the <abbr class="acronym">ECMA-6</abbr> (<abbr class="acronym">ISO/IEC</abbr> 646)
standard.<a class="footnote" id="DOCF123" href="groff.html_fot.html#FOOT123"><sup>123</sup></a>
</p>
<p>To store an escape sequence in a diversion that is interpreted when the
diversion is reread, either use the traditional <code class="code">\!</code> transparent
output facility, or, if this is unsuitable, the new <code class="code">\?</code> escape
sequence.  See <a class="xref" href="Diversions.html">Diversions</a> and <a class="ref" href="Gtroff-Internals.html"><code class="code">gtroff</code> Internals</a>.
</p>
<p>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, <abbr class="acronym">AT&amp;T</abbr> <code class="code">troff</code> will output the
partially collected line at the end of input; GNU <code class="code">troff</code> will not.
</p>




</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Compatibility-Mode.html">Compatibility Mode</a>, Up: <a href="Implementation-Differences.html">Implementation Differences</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Request-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>