1GROFF_DIFF(7) Miscellaneous Information Manual GROFF_DIFF(7)
2
3
4
6 groff_diff - differences between GNU troff and classical troff
7
9 This manual page describes the language differences between groff, the
10 GNU roff text processing system and the classical roff formatter of the
11 freely available Unix 7 of the 1970s, documented in the Troff User's
12 Manual by Osanna and Kernighan. This inludes the roff language as well
13 as the intermediate output format (troff output).
14
15 The section SEE ALSO gives pointers to both the classical roff and the
16 modern groff documentation.
17
18 At the moment, this document is the place of the most actual documenta‐
19 tion within the groff system. This might change in the future. Actu‐
20 ally, all novelties of the groff language are first described here and
21 will pervade into the other documents only at a later stage.
22
24 In this section, all additional features of groff compared to the clas‐
25 sical Unix 7 troff are described in detail.
26
27 Long names
28 The names of number registers, fonts, strings/macros/diversions, spe‐
29 cial characters, and colors can be of any length. In escape sequences,
30 additionally to the classical (xx construction for a two character
31 name, you can use [xxx] for a name of arbitrary length, for example in
32
33 \[xxx] Print the special character called xxx.
34
35 \f[xxx] Set font xxx. Additionally, \f[] is a new syntax equal to
36 \fP, i.e., to return to the previous font.
37
38 \*[xxx arg1 arg2 ...]
39 Interpolate string xxx, taking arg1, arg2, ... as arguments.
40
41 \n[xxx] Interpolate number register xxx.
42
43 Fractional pointsizes
44 A scaled point is equal to 1/sizescale points, where sizescale is spec‐
45 ified in the DESC file (1 by default). There is a new scale indicator
46 z that has the effect of multiplying by sizescale. Requests and escape
47 sequences in troff interpret arguments that represent a pointsize as
48 being in units of scaled points, but they evaluate each such argument
49 using a default scale indicator of z. Arguments treated in this way
50 are the argument to the ps request, the third argument to the cs
51 request, the second and fourth arguments to the tkf request, the argu‐
52 ment to the \H escape sequence, and those variants of the \s escape
53 sequence that take a numeric expression as their argument.
54
55 For example, suppose sizescale is 1000; then a scaled point will be
56 equivalent to a millipoint; the call .ps 10.25 is equivalent to
57 .ps 10.25z and so sets the pointsize to 10250 scaled points, which is
58 equal to 10.25 points.
59
60 The number register \n[.s] returns the pointsize in points as decimal
61 fraction. There is also a new number register \n[.ps] that returns the
62 pointsize in scaled points.
63
64 It would make no sense to use the z scale indicator in a numeric
65 expression whose default scale indicator was neither u nor z, and so
66 troff disallows this. Similarly it would make no sense to use a scal‐
67 ing indicator other than z or u in a numeric expression whose default
68 scale indicator was z, and so troff disallows this as well.
69
70 There is also new scale indicator s which multiplies by the number of
71 units in a scaled point. So, for example, \n[.ps]s is equal to 1m. Be
72 sure not to confuse the s and z scale indicators.
73
74 Numeric expressions
75 Spaces are permitted in a number expression within parentheses.
76
77 M indicates a scale of 100ths of an em. f indicates a scale of 65536
78 units, providing fractions for color definitions with the defcolor
79 request. For example, 0.5f = 32768u.
80
81 e1>?e2 The maximum of e1 and e2.
82
83 e1<?e2 The minimum of e1 and e2.
84
85 (c;e) Evaluate e using c as the default scaling indicator. If c is
86 missing, ignore scaling indicators in the evaluation of e.
87
88 New escape sequences
89 \A'anything'
90 This expands to 1 or 0 resp., depending on whether anything is
91 or is not acceptable as the name of a string, macro, diversion,
92 number register, environment, font, or color. It will return 0
93 if anything is empty. This is useful if you want to lookup user
94 input in some sort of associative table.
95
96 \B'anything'
97 This expands to 1 or 0 resp., depending on whether anything is
98 or is not a valid numeric expression. It will return 0 if any‐
99 thing is empty.
100
101 \C'xxx'
102 Typeset character named xxx. Normally it is more convenient to
103 use \[xxx]. But \C has the advantage that it is compatible with
104 recent versions of UNIX and is available in compatibility mode.
105
106 \E This is equivalent to an escape character, but it is not inter‐
107 preted in copy-mode. For example, strings to start and end
108 superscripting could be defined like this
109
110 .ds { \v'-.3m'\s'\En[.s]*6u/10u'
111 .ds } \s0\v'.3m'
112
113 The use of \E ensures that these definitions will work even if
114 \*{ gets interpreted in copy-mode (for example, by being used in
115 a macro argument).
116
117 \Ff
118 \F(fm
119 \F[fam]
120 Change font family. This is the same as the fam request. \F[]
121 switches back to the previous color (note that \FP won't work;
122 it selects font family `P' instead).
123
124 \mx
125 \m(xx
126 \m[xxx]
127 Set drawing color. \m[] switches back to the previous color.
128
129 \Mx
130 \M(xx
131 \M[xxx]
132 Set background color for filled objects drawn with the \D'...'
133 commands. \M[] switches back to the previous color.
134
135 \N'n' Typeset the character with code n in the current font. n can be
136 any integer. Most devices only have characters with codes
137 between 0 and 255. If the current font does not contain a char‐
138 acter with that code, special fonts will not be searched. The
139 \N escape sequence can be conveniently used in conjunction with
140 the char request, for example
141
142 .char \[phone] \f(ZD\N'37'
143
144 The code of each character is given in the fourth column in the
145 font description file after the charset command. It is possible
146 to include unnamed characters in the font description file by
147 using a name of ---; the \N escape sequence is the only way to
148 use these.
149
150 \On
151 \O[n] Suppressing troff output. The escapes \02, \O3, \O4, and \O5
152 are intended for internal use by grohtml.
153
154 \O0 Disable any ditroff glyphs from being emitted to the
155 device driver, provided that the escape occurs at the
156 outer level (see \O3 and \O4).
157
158 \O1 Enable output of glyphs, provided that the escape occurs
159 at the outer level.
160
161 \O0 and \O1 also reset the registers \n[opminx],
162 \n[opminy], \n[opmaxx], and \n[opmaxy] to -1. These four
163 registers mark the top left and bottom right hand corners
164 of a box which encompasses all written glyphs.
165
166 \O2 Provided that the escape occurs at the outer level,
167 enable output of glyphs and also write out to stderr the
168 page number and four registers encompassing the glyphs
169 previously written since the last call to \O.
170
171 \O3 Begin a nesting level. At start-up, troff is at outer
172 level. This is really an internal mechanism for grohtml
173 while producing images. They are generated by running
174 the troff source through troff to the postscript device
175 and ghostscript to produce images in PNG format. The \O3
176 escape will start a new page if the device is not html
177 (to reduce the possibility of images crossing a page
178 boundary).
179
180 \O4 End a nesting level.
181
182 \O5[Pfilename]
183 This escape is grohtml specific. Provided that this
184 escape occurs at the outer nesting level, write filename
185 to stderr. The position of the image, P, must be speci‐
186 fied and must be one of l, r, c, or i (left, right, cen‐
187 tered, inline). filename will be associated with the
188 production of the next inline image.
189
190 \R'name ±n'
191 This has the same effect as
192
193 .nr name ±n
194
195 \s(nn
196 \s±(nn Set the point size to nn points; nn must be exactly two digits.
197
198 \s[±n]
199 \s±[n]
200 \s'±n'
201 \s±'n' Set the point size to n scaled points; n is a numeric expression
202 with a default scale indicator of z.
203
204 \Vx
205 \V(xx
206 \V[xxx]
207 Interpolate the contents of the environment variable xxx, as
208 returned by getenv(3). \V is interpreted in copy-mode.
209
210 \Yx
211 \Y(xx
212 \Y[xxx]
213 This is approximately equivalent to \X'\*[xxx]'. However the
214 contents of the string or macro xxx are not interpreted; also it
215 is permitted for xxx to have been defined as a macro and thus
216 contain newlines (it is not permitted for the argument to \X to
217 contain newlines). The inclusion of newlines requires an exten‐
218 sion to the UNIX troff output format, and will confuse drivers
219 that do not know about this extension.
220
221 \Z'anything'
222 Print anything and then restore the horizontal and vertical
223 position; anything may not contain tabs or leaders.
224
225 \$0 The name by which the current macro was invoked. The als
226 request can make a macro have more than one name.
227
228 \$* In a macro or string, the concatenation of all the arguments
229 separated by spaces.
230
231 \$@ In a macro or string, the concatenation of all the arguments
232 with each surrounded by double quotes, and separated by spaces.
233
234 \$(nn
235 \$[nnn]
236 In a macro or string, this gives the nn-th or nnn-th argument.
237 Macros and strings can have an unlimited number of arguments.
238
239 \?anything\?
240 When used in a diversion, this will transparently embed anything
241 in the diversion. anything is read in copy mode. When the
242 diversion is reread, anything will be interpreted. anything may
243 not contain newlines; use \! if you want to embed newlines in a
244 diversion. The escape sequence \? is also recognised in copy
245 mode and turned into a single internal code; it is this code
246 that terminates anything. Thus
247
248 .nr x 1
249 .nf
250 .di d
251 \?\\?\\\\?\\\\\\\\nx\\\\?\\?\?
252 .di
253 .nr x 2
254 .di e
255 .d
256 .di
257 .nr x 3
258 .di f
259 .e
260 .di
261 .nr x 4
262 .f
263
264 will print 4.
265
266 \/ This increases the width of the preceding character so that the
267 spacing between that character and the following character will
268 be correct if the following character is a roman character. It
269 is a good idea to use this escape sequence whenever an italic
270 character is immediately followed by a roman character without
271 any intervening space.
272
273 \, This modifies the spacing of the following character so that the
274 spacing between that character and the preceding character will
275 correct if the preceding character is a roman character. It is
276 a good idea to use this escape sequence whenever a roman charac‐
277 ter is immediately followed by an italic character without any
278 intervening space.
279
280 \) Like \& except that it behaves like a character declared with
281 the cflags request to be transparent for the purposes of end-of-
282 sentence recognition.
283
284 \~ This produces an unbreakable space that stretches like a normal
285 inter-word space when a line is adjusted.
286
287 \: This causes the insertion of a zero-width break point. It is
288 equal to \% within a word but without insertion of a soft hyphen
289 character.
290
291 \# Everything up to and including the next newline is ignored.
292 This is interpreted in copy mode. It is like \" except that \"
293 does not ignore the terminating newline.
294
295 New requests
296 .aln xx yy
297 Create an alias xx for number register object named yy. The new
298 name and the old name will be exactly equivalent. If yy is
299 undefined, a warning of type reg will be generated, and the
300 request will be ignored.
301
302 .als xx yy
303 Create an alias xx for request, string, macro, or diversion
304 object named yy. The new name and the old name will be exactly
305 equivalent (it is similar to a hard rather than a soft link).
306 If yy is undefined, a warning of type mac will be generated, and
307 the request will be ignored. The de, am, di, da, ds, and as
308 requests only create a new object if the name of the macro,
309 diversion or string diversion is currently undefined or if it is
310 defined to be a request; normally they modify the value of an
311 existing object.
312
313 .ami xx yy
314 Append to macro indirectly. See the dei request below for more
315 information.
316
317 .am1 xx yy
318 Similar to .am, but compatibility mode is switched off during
319 execution. To be more precise, a `compatibility save' token is
320 inserted at the beginning of the macro addition, and a `compati‐
321 bility restore' token at the end. As a consequence, the
322 requests am, am1, de, and de1 can be intermixed freely since the
323 compatibility save/restore tokens only affect the macro parts
324 defined by .am1 and .ds1.
325
326 .asciify xx
327 This request `unformats' the diversion xx in such a way that
328 ASCII and space characters (and some escape sequences) that were
329 formatted and diverted into xx will be treated like ordinary
330 input characters when xx is reread. Useful for diversions in
331 conjunction with the .writem request. It can be also used for
332 gross hacks; for example, this
333
334 .tr @.
335 .di x
336 @nr n 1
337 .br
338 .di
339 .tr @@
340 .asciify x
341 .x
342
343 will set register n to 1. Note that glyph information (font,
344 font size, etc.) is not preserved; use .unformat instead.
345
346 .as1 xx yy
347 Similar to .as, but compatibility mode is switched off during
348 expansion. To be more precise, a `compatibility save' token is
349 inserted at the beginning of the string, and a `compatibility
350 restore' token at the end. As a consequence, the requests as,
351 as1, ds, and ds1 can be intermixed freely since the compatibil‐
352 ity save/restore tokens only affect the (sub)strings defined by
353 as1 and ds1.
354
355 .backtrace
356 Print a backtrace of the input stack on stderr.
357
358 .blm xx
359 Set the blank line macro to xx. If there is a blank line macro,
360 it will be invoked when a blank line is encountered instead of
361 the usual troff behaviour.
362
363 .box xx
364 .boxa xx
365 These requests are similar to the di and da requests with the
366 exception that a partially filled line will not become part of
367 the diversion (i.e., the diversion always starts with a new
368 line) but restored after ending the diversion, discarding the
369 partially filled line which possibly comes from the diversion.
370
371 .break Break out of a while loop. See also the while and continue
372 requests. Be sure not to confuse this with the br request.
373
374 .brp This is the same as \p.
375
376 .cflags n c1 c2...
377 Characters c1, c2,... have properties determined by n, which is
378 ORed from the following:
379
380 1 The character ends sentences (initially characters .?!
381 have this property).
382
383 2 Lines can be broken before the character (initially no
384 characters have this property); a line will not be broken
385 at a character with this property unless the characters
386 on each side both have non-zero hyphenation codes.
387
388 4 Lines can be broken after the character (initially char‐
389 acters -\(hy\(em have this property); a line will not be
390 broken at a character with this property unless the char‐
391 acters on each side both have non-zero hyphenation codes.
392
393 8 The character overlaps horizontally (initially characters
394 \(ul\(rn\(ru have this property).
395
396 16 The character overlaps vertically (initially character
397 \(br has this property).
398
399 32 An end-of-sentence character followed by any number of
400 characters with this property will be treated as the end
401 of a sentence if followed by a newline or two spaces; in
402 other words the character is transparent for the purposes
403 of end-of-sentence recognition; this is the same as hav‐
404 ing a zero space factor in TeX (initially characters
405 "')]*\(dg\(rq have this property).
406
407 .char c string
408 Define character c to be string. Every time character c needs
409 to be printed, string will be processed in a temporary environ‐
410 ment and the result will be wrapped up into a single object.
411 Compatibility mode will be turned off and the escape character
412 will be set to \ while string is being processed. Any embolden‐
413 ing, constant spacing or track kerning will be applied to this
414 object rather than to individual characters in string.
415
416 A character defined by this request can be used just like a nor‐
417 mal character provided by the output device. In particular
418 other characters can be translated to it with the tr request; it
419 can be made the leader character by the lc request; repeated
420 patterns can be drawn with the character using the \l and \L
421 escape sequences; words containing the character can be hyphen‐
422 ated correctly, if the hcode request is used to give the charac‐
423 ter a hyphenation code.
424
425 There is a special anti-recursion feature: use of character
426 within the character's definition will be handled like normal
427 characters not defined with char.
428
429 A character definition can be removed with the rchar request.
430
431 .chop xx
432 Chop the last character off macro, string, or diversion xx.
433 This is useful for removing the newline from the end of diver‐
434 sions that are to be interpolated as strings.
435
436 .close stream
437 Close the stream named stream; stream will no longer be an
438 acceptable argument to the write request. See the open request.
439
440 .continue
441 Finish the current iteration of a while loop. See also the
442 while and break requests.
443
444 .color n
445 If n is non-zero or missing, enable colors (this is the
446 default), otherwise disable them.
447
448 .cp n If n is non-zero or missing, enable compatibility mode, other‐
449 wise disable it. In compatibility mode, long names are not
450 recognised, and the incompatibilities caused by long names do
451 not arise.
452
453 .defcolor xxx scheme color_components
454 Define color. scheme can be one of the following values: rgb
455 (three components), cym (three components), cmyk (four compo‐
456 nents), and gray or grey (one component). Color components can
457 be given either as a hexadecimal string or as positive decimal
458 integers in the range 0-65535. A hexadecimal string contains
459 all color components concatenated; it must start with either #
460 or ##. The former specifies hex values in the range 0-255
461 (which are internally multiplied by 257), the latter in the
462 range 0-65535. Examples: #FFC0CB (pink), ##ffff0000ffff
463 (magenta). A new scaling indicator f has been introduced which
464 multiplies its value by 65536; this makes it convenient to spec‐
465 ify color components as fractions in the range 0 to 1. Example:
466
467 .defcolor darkgreen rgb 0.1f 0.5f 0.2f
468
469 Note that f is the default scaling indicator for the defcolor
470 request, thus the above statement is equivalent to
471
472 .defcolor darkgreen rgb 0.1 0.5 0.2
473
474 The color named default (which is device-specific) can't be
475 redefined. It is possible that the default color for \M and \m
476 is not the same.
477
478 .dei xx yy
479 Define macro indirectly. The following example
480
481 .ds xx aa
482 .ds yy bb
483 .dei xx yy
484
485 is equivalent to
486
487 .de aa bb
488
489 .de1 xx yy
490 Similar to .de, but compatibility mode is switched off during
491 execution. On entry, the current compatibility mode is saved
492 and restored at exit.
493
494 .do xxx
495 Interpret .xxx with compatibility mode disabled. For example,
496
497 .do fam T
498
499 would have the same effect as
500
501 .fam T
502
503 except that it would work even if compatibility mode had been
504 enabled. Note that the previous compatibility mode is restored
505 before any files sourced by xxx are interpreted.
506
507 .ds1 xx yy
508 Similar to .ds, but compatibility mode is switched off during
509 expansion. To be more precise, a `compatibility save' token is
510 inserted at the beginning of the string, and a `compatibility
511 restore' token at the end.
512
513 .ecs Save current escape character.
514
515 .ecr Restore escape character saved with ecs. Without a previous
516 call to ecs, `\' will be the new escape character.
517
518 .evc xx
519 Copy the contents of environment xx to the current environment.
520 No pushing or popping of environments will be done.
521
522 .fam xx
523 Set the current font family to xx. The current font family is
524 part of the current environment. If xx is missing, switch back
525 to previous font family. The value at start-up is `T'. See the
526 description of the sty request for more information on font fam‐
527 ilies.
528
529 .fchar c string
530 Define fallback character c to be string. The syntax of this
531 request is the same as the char request; the only difference is
532 that a character defined with char hides the glyph with the same
533 name in the current font, whereas a character defined with fchar
534 is checked only if the particular glyph isn't found in the cur‐
535 rent font. This test happens before checking special fonts.
536
537 .fspecial f s1 s2...
538 When the current font is f, fonts s1, s2,... will be special,
539 that is, they will searched for characters not in the current
540 font. Any fonts specified in the special request will be
541 searched after fonts specified in the fspecial request.
542
543 .ftr f g
544 Translate font f to g. Whenever a font named f is referred to
545 in an \f escape sequence, or in the ft, ul, bd, cs, tkf, spe‐
546 cial, fspecial, fp, or sty requests, font g will be used. If g
547 is missing, or equal to f then font f will not be translated.
548
549 .hcode c1 code1 c2 code2...
550 Set the hyphenation code of character c1 to code1 and that of c2
551 to code2. A hyphenation code must be a single input character
552 (not a special character) other than a digit or a space. Ini‐
553 tially each lower-case letter a-z has a hyphenation code, which
554 is itself, and each upper-case letter A-Z has a hyphenation code
555 which is the lower-case version of itself. See also the hpf
556 request.
557
558 .hla lang
559 Set the current hyphenation language to lang. Hyphenation
560 exceptions specified with the hw request and hyphenation pat‐
561 terns specified with the hpf request are both associated with
562 the current hyphenation language. The hla request is usually
563 invoked by the troffrc file.
564
565 .hlm n Set the maximum number of consecutive hyphenated lines to n. If
566 n is negative, there is no maximum. The default value is -1.
567 This value is associated with the current environment. Only
568 lines output from an environment count towards the maximum asso‐
569 ciated with that environment. Hyphens resulting from \% are
570 counted; explicit hyphens are not.
571
572 .hpf file
573 Read hyphenation patterns from file; this will be searched for
574 in the same way that name.tmac is searched for when the -mname
575 option is specified. It should have the same format as (simple)
576 TeX patterns files. More specifically, the following scanning
577 rules are implemented.
578
579 · A percent sign starts a comment (up to the end of the
580 line) even if preceded by a backslash.
581
582 · No support for `digraphs' like \$.
583
584 · ^^xx (x is 0-9 or a-f) and ^^x (character code of x in
585 the range 0-127) are recognized; other use of ^ causes an
586 error.
587
588 · No macro expansion.
589
590 · hpf checks for the expression \patterns{...} (possibly
591 with whitespace before and after the braces). Everything
592 between the braces is taken as hyphenation patterns.
593 Consequently, { and } are not allowed in patterns.
594
595 · Similarly, \hyphenation{...} gives a list of hyphenation
596 exceptions.
597
598 · \endinput is recognized also.
599
600 · For backwards compatibility, if \patterns is missing, the
601 whole file is treated as a list of hyphenation patterns
602 (only recognizing the % character as the start of a com‐
603 ment).
604
605 Use the hpfcode request to map the encoding used in hyphenation
606 patterns files to groff's input encoding.
607
608 The set of hyphenation patterns is associated with the current
609 language set by the hla request. The hpf request is usually
610 invoked by the troffrc file; a second call replaces the old pat‐
611 terns with the new ones.
612
613 .hpfa file
614 The same as hpf except that the hyphenation patterns from file
615 are appended to the patterns already loaded in the current lan‐
616 guage.
617
618 .hpfcode a b c d ...
619 After reading a hyphenation patterns file with the hpf or hpfa
620 request, convert all characters with character code a in the
621 recently read patterns to character code b, character code c
622 to d, etc. Initially, all character codes map to themselves.
623 The arguments of hpfcode must be integers in the range 0 to 255.
624 Note that it is even possible to use character codes which are
625 invalid in groff otherwise.
626
627 .hym n Set the hyphenation margin to n: when the current adjustment
628 mode is not b, the line will not be hyphenated if the line is no
629 more than n short. The default hyphenation margin is 0. The
630 default scaling indicator for this request is m. The hyphen‐
631 ation margin is associated with the current environment. The
632 current hyphenation margin is available in the \n[.hym] regis‐
633 ter.
634
635 .hys n Set the hyphenation space to n: when the current adjustment mode
636 is b don't hyphenate the line if the line can be justified by
637 adding no more than n extra space to each word space. The
638 default hyphenation space is 0. The default scaling indicator
639 for this request is m. The hyphenation space is associated with
640 the current environment. The current hyphenation space is
641 available in the \n[.hys] register.
642
643 .itc n macro
644 Variant of .it for which a line interrupted with \c counts as
645 one input line.
646
647 .kern n
648 If n is non-zero or missing, enable pairwise kerning, otherwise
649 disable it.
650
651 .length xx string
652 Compute the length of string and return it in the number regis‐
653 ter xx (which is not necessarily defined before).
654
655 .linetabs n
656 If n is non-zero or missing, enable line-tabs mode, otherwise
657 disable it (which is the default). In line-tabs mode, tab dis‐
658 tances are computed relative to the (current) output line. Oth‐
659 erwise they are taken relative to the input line. For example,
660 the following
661
662 .ds x a\t\c
663 .ds y b\t\c
664 .ds z c
665 .ta 1i 3i
666 \*x
667 \*y
668 \*z
669
670 yields
671
672 a b c
673
674 In line-tabs mode, the same code gives
675
676 a b c
677
678 Line-tabs mode is associated with the current environment; the
679 read-only number register \n[.linetabs] is set to 1 if in line-
680 tabs mode, and 0 otherwise.
681
682 .mso file
683 The same as the so request except that file is searched for in
684 the same directories as macro files for the the -m command line
685 option. If the file name to be included has the form name.tmac
686 and it isn't found, mso tries to include tmac.name instead and
687 vice versa.
688
689 .nop anything
690 Execute anything. This is similar to `.if 1'.
691
692 .nroff Make the n built-in condition true and the t built-in condition
693 false. This can be reversed using the troff request.
694
695 .open stream filename
696 Open filename for writing and associate the stream named stream
697 with it. See also the close and write requests.
698
699 .opena stream filename
700 Like open, but if filename exists, append to it instead of trun‐
701 cating it.
702
703 .output string
704 Emit string directly to the intermediate output (subject to
705 copy-mode interpretation); this is similar to \! used at the
706 top level. An initial double quote in string is stripped off to
707 allow initial blanks.
708
709 .pnr Print the names and contents of all currently defined number
710 registers on stderr.
711
712 .psbb filename
713 Get the bounding box of a PostScript image filename. This file
714 must conform to Adobe's Document Structuring Conventions; the
715 command looks for a %%BoundingBox comment to extract the bound‐
716 ing box values. After a successful call, the coordinates (in
717 PostScript units) of the lower left and upper right corner can
718 be found in the registers \n[llx], \n[lly], \n[urx], and
719 \n[ury], respectively. If some error has occurred, the four
720 registers are set to zero.
721
722 .pso command
723 This behaves like the so request except that input comes from
724 the standard output of command.
725
726 .ptr Print the names and positions of all traps (not including input
727 line traps and diversion traps) on stderr. Empty slots in the
728 page trap list are printed as well, because they can affect the
729 priority of subsequently planted traps.
730
731 .pvs ±n
732 Set the post-vertical line space to n; default scale indicator
733 is p. This value will be added to each line after it has been
734 output. With no argument, the post-vertical line space is set
735 to its previous value.
736
737 The total vertical line spacing consists of four components: .vs
738 and \x with a negative value which are applied before the line
739 is output, and .pvs and \x with a positive value which are
740 applied after the line is output.
741
742 .rchar c1 c2...
743 Remove the definitions of characters c1, c2,... This undoes the
744 effect of a char request.
745
746 .return
747 Within a macro, return immediately. No effect otherwise.
748
749 .rj
750 .rj n Right justify the next n input lines. Without an argument right
751 justify the next input line. The number of lines to be right
752 justified is available in the \n[.rj] register. This implicitly
753 does .ce 0. The ce request implicitly does .rj 0.
754
755 .rnn xx yy
756 Rename number register xx to yy.
757
758 .shc c Set the soft hyphen character to c. If c is omitted, the soft
759 hyphen character will be set to the default \(hy. The soft
760 hyphen character is the character which will be inserted when a
761 word is hyphenated at a line break. If the soft hyphen charac‐
762 ter does not exist in the font of the character immediately pre‐
763 ceding a potential break point, then the line will not be broken
764 at that point. Neither definitions (specified with the char
765 request) nor translations (specified with the tr request) are
766 considered when finding the soft hyphen character.
767
768 .shift n
769 In a macro, shift the arguments by n positions: argument i
770 becomes argument i-n; arguments 1 to n will no longer be avail‐
771 able. If n is missing, arguments will be shifted by 1. Shift‐
772 ing by negative amounts is currently undefined.
773
774 .sizes s1 s2...sn [0]
775 This command is similar to the sizes command of a DESC file. It
776 sets the available font sizes for the current font to s1,
777 s2,..., sn scaled points. The list of sizes can be terminated
778 by an optional 0. Each si can also be a range of sizes m-n.
779 Contrary to the font file command, the list can't extend over
780 more than a single line.
781
782 .special s1 s2...
783 Fonts s1, s2, are special and will be searched for characters
784 not in the current font.
785
786 .spreadwarn limit
787 Make troff emit a warning if the additional space inserted for
788 each space between words in an output line is larger or equal to
789 limit. A negative value is changed to zero; no argument toggles
790 the warning on and off without changing limit. The default
791 scaling indicator is m. At startup, spreadwarn is deactivated,
792 and limit is set to 3m. For example, .spreadwarn 0.2m will
793 cause a warning if troff must add 0.2m or more for each inter‐
794 word space in a line. This request is active only if text is
795 justified to both margins (using .ad b).
796
797 .sty n f
798 Associate style f with font position n. A font position can be
799 associated either with a font or with a style. The current font
800 is the index of a font position and so is also either a font or
801 a style. When it is a style, the font that is actually used is
802 the font the name of which is the concatenation of the name of
803 the current family and the name of the current style. For exam‐
804 ple, if the current font is 1 and font position 1 is associated
805 with style R and the current font family is T, then font TR will
806 be used. If the current font is not a style, then the current
807 family is ignored. When the requests cs, bd, tkf, uf, or fspe‐
808 cial are applied to a style, then they will instead be applied
809 to the member of the current family corresponding to that style.
810 The default family can be set with the -f option. The styles
811 command in the DESC file controls which font positions (if any)
812 are initially associated with styles rather than fonts.
813
814 .substring xx n1 [n2]
815 Replace the string named xx with the substring defined by the
816 indices n1 and n2. The first character in the string has
817 index 0. If n2 is omitted, it is taken to be equal to the
818 string's length. If the index value n1 or n2 is negative, it
819 will be counted from the end of the string, going backwards: The
820 last character has index -1, the character before the last char‐
821 acter has index -2, etc.
822
823 .tkf f s1 n1 s2 n2
824 Enable track kerning for font f. When the current font is f the
825 width of every character will be increased by an amount between
826 n1 and n2; when the current point size is less than or equal to
827 s1 the width will be increased by n1; when it is greater than or
828 equal to s2 the width will be increased by n2; when the point
829 size is greater than or equal to s1 and less than or equal to s2
830 the increase in width is a linear function of the point size.
831
832 .tm1 string
833 Similar to the tm request, string is read in copy mode and writ‐
834 ten on the standard error, but an initial double quote in string
835 is stripped off to allow initial blanks.
836
837 .tmc string
838 Similar to tm1 but without writing a final newline.
839
840 .trf filename
841 Transparently output the contents of file filename. Each line
842 is output as if preceded by \!; however, the lines are not sub‐
843 ject to copy-mode interpretation. If the file does not end with
844 a newline, then a newline will be added. For example, you can
845 define a macro x containing the contents of file f, using
846
847 .di x
848 .trf f
849 .di
850
851 Unlike with the cf request, the file cannot contain characters
852 such as NUL that are not legal troff input characters.
853
854 .trin abcd
855 This is the same as the tr request except that the asciify
856 request will use the character code (if any) before the charac‐
857 ter translation. Example:
858
859 .trin ax
860 .di xxx
861 a
862 .br
863 .di
864 .xxx
865 .trin aa
866 .asciify xxx
867 .xxx
868
869 The result is x a. Using tr, the result would be x x.
870
871 .trnt abcd
872 This is the same as the tr request except that the translations
873 do not apply to text that is transparently throughput into a
874 diversion with \!. For example,
875
876 .tr ab
877 .di x
878 \!.tm a
879 .di
880 .x
881
882 will print b; if trnt is used instead of tr it will print a.
883
884 .troff Make the n built-in condition false, and the t built-in condi‐
885 tion true. This undoes the effect of the nroff request.
886
887 .unformat xx
888 This request `unformats' the diversion xx. Contrary to the
889 .asciify request, which tries to convert formatted elements of
890 the diversion back to input tokens as much as possible, .unfor‐
891 mat will only handle tabs and spaces between words (usually
892 caused by spaces or newlines in the input) specially. The for‐
893 mer are treated as if they were input tokens, and the latter are
894 stretchable again. Note that the vertical size of lines is not
895 preserved. Glyph information (font, font size, space width,
896 etc.) is retained. Useful in conjunction with the .box and
897 .boxa requests.
898
899 .vpt n Enable vertical position traps if n is non-zero, disable them
900 otherwise. Vertical position traps are traps set by the wh or
901 dt requests. Traps set by the it request are not vertical posi‐
902 tion traps. The parameter that controls whether vertical posi‐
903 tion traps are enabled is global. Initially vertical position
904 traps are enabled.
905
906 .warn n
907 Control warnings. n is the sum of the numbers associated with
908 each warning that is to be enabled; all other warnings will be
909 disabled. The number associated with each warning is listed in
910 troff(1). For example, .warn 0 will disable all warnings, and
911 .warn 1 will disable all warnings except that about missing
912 characters. If n is not given, all warnings will be enabled.
913
914 .warnscale si
915 Set the scaling indicator used in warnings to si. Valid values
916 for si are u, i, c, p, and P. At startup, it is set to i.
917
918 .while c anything
919 While condition c is true, accept anything as input; c can be
920 any condition acceptable to an if request; anything can comprise
921 multiple lines if the first line starts with \{ and the last
922 line ends with \}. See also the break and continue requests.
923
924 .write stream anything
925 Write anything to the stream named stream. stream must previ‐
926 ously have been the subject of an open request. anything is
927 read in copy mode; a leading " will be stripped.
928
929 .writec stream anything
930 Similar to write but without writing a final newline.
931
932 .writem stream xx
933 Write the contents of the macro or string xx to the stream named
934 stream. stream must previously have been the subject of an open
935 request. xx is read in copy mode.
936
937 Extended requests
938 .cf filename
939 When used in a diversion, this will embed in the diversion an
940 object which, when reread, will cause the contents of filename
941 to be transparently copied through to the output. In UNIX
942 troff, the contents of filename is immediately copied through to
943 the output regardless of whether there is a current diversion;
944 this behaviour is so anomalous that it must be considered a bug.
945
946 .ev xx If xx is not a number, this will switch to a named environment
947 called xx. The environment should be popped with a matching ev
948 request without any arguments, just as for numbered environ‐
949 ments. There is no limit on the number of named environments;
950 they will be created the first time that they are referenced.
951
952 .ss m n
953 When two arguments are given to the ss request, the second argu‐
954 ment gives the sentence space size. If the second argument is
955 not given, the sentence space size will be the same as the word
956 space size. Like the word space size, the sentence space is in
957 units of one twelfth of the spacewidth parameter for the current
958 font. Initially both the word space size and the sentence space
959 size are 12. Contrary to UNIX troff, GNU troff handles this
960 request in nroff mode also; a given value is then rounded down
961 to the nearest multiple of 12. The sentence space size is used
962 in two circumstances. If the end of a sentence occurs at the
963 end of a line in fill mode, then both an inter-word space and a
964 sentence space will be added; if two spaces follow the end of a
965 sentence in the middle of a line, then the second space will be
966 a sentence space. Note that the behaviour of UNIX troff will be
967 exactly that exhibited by GNU troff if a second argument is
968 never given to the ss request. In GNU troff, as in UNIX troff,
969 you should always follow a sentence with either a newline or two
970 spaces.
971
972 .ta n1 n2...nn T r1 r2...rn
973 Set tabs at positions n1, n2,..., nn and then set tabs at nn+r1,
974 nn+r2,..., nn+rn and then at nn+rn+r1, nn+rn+r2,..., nn+rn+rn,
975 and so on. For example,
976
977 .ta T .5i
978
979 will set tabs every half an inch.
980
981 New number registers
982 The following read-only registers are available:
983
984 \n[.C] 1 if compatibility mode is in effect, 0 otherwise.
985
986 \n[.cdp]
987 The depth of the last character added to the current environ‐
988 ment. It is positive if the character extends below the base‐
989 line.
990
991 \n[.ce]
992 The number of lines remaining to be centered, as set by the ce
993 request.
994
995 \n[.cht]
996 The height of the last character added to the current environ‐
997 ment. It is positive if the character extends above the base‐
998 line.
999
1000 \n[.color]
1001 1 if colors are enabled, 0 otherwise.
1002
1003 \n[.csk]
1004 The skew of the last character added to the current environment.
1005 The skew of a character is how far to the right of the center of
1006 a character the center of an accent over that character should
1007 be placed.
1008
1009 \n[.ev]
1010 The name or number of the current environment. This is a
1011 string-valued register.
1012
1013 \n[.fam]
1014 The current font family. This is a string-valued register.
1015
1016 \n[.fn]
1017 The current (internal) real font name. This is a string-valued
1018 register. If the current font is a style, the value of \n[.fn]
1019 is the proper concatenation of family and style name.
1020
1021 \n[.fp]
1022 The number of the next free font position.
1023
1024 \n[.g] Always 1. Macros should use this to determine whether they are
1025 running under GNU troff.
1026
1027 \n[.hla]
1028 The current hyphenation language as set by the hla request.
1029
1030 \n[.hlc]
1031 The number of immediately preceding consecutive hyphenated
1032 lines.
1033
1034 \n[.hlm]
1035 The maximum allowed number of consecutive hyphenated lines, as
1036 set by the hlm request.
1037
1038 \n[.hy]
1039 The current hyphenation flags (as set by the hy request).
1040
1041 \n[.hym]
1042 The current hyphenation margin (as set by the hym request).
1043
1044 \n[.hys]
1045 The current hyphenation space (as set by the hys request).
1046
1047 \n[.in]
1048 The indent that applies to the current output line.
1049
1050 \n[.int]
1051 Set to a positive value if last output line is interrupted
1052 (i.e., if it contains \c).
1053
1054 \n[.kern]
1055 1 if pairwise kerning is enabled, 0 otherwise.
1056
1057 \n[.lg]
1058 The current ligature mode (as set by the lg request).
1059
1060 \n[.linetabs]
1061 The current line-tabs mode (as set by the linetabs request).
1062
1063 \n[.ll]
1064 The line length that applies to the current output line.
1065
1066 \n[.lt]
1067 The title length as set by the lt request.
1068
1069 \n[.ne]
1070 The amount of space that was needed in the last ne request that
1071 caused a trap to be sprung. Useful in conjunction with the
1072 \n[.trunc] register.
1073
1074 \n[.ns]
1075 1 if no-space mode is active, 0 otherwise.
1076
1077 \n[.pn]
1078 The number of the next page, either the value set by a pn
1079 request, or the number of the current page plus 1.
1080
1081 \n[.ps]
1082 The current pointsize in scaled points.
1083
1084 \n[.psr]
1085 The last-requested pointsize in scaled points.
1086
1087 \n[.pvs]
1088 The current post-vertical line space as set with the pvs
1089 request.
1090
1091 \n[.rj]
1092 The number of lines to be right-justified as set by the rj
1093 request.
1094
1095 \n[.sr]
1096 The last requested pointsize in points as a decimal fraction.
1097 This is a string-valued register.
1098
1099 \n[.ss]
1100 \n[.sss]
1101 These give the values of the parameters set by the first and
1102 second arguments of the ss request.
1103
1104 \n[.tabs]
1105 A string representation of the current tab settings suitable for
1106 use as an argument to the ta request.
1107
1108 \n[.trunc]
1109 The amount of vertical space truncated by the most recently
1110 sprung vertical position trap, or, if the trap was sprung by a
1111 ne request, minus the amount of vertical motion produced by the
1112 ne request. In other words, at the point a trap is sprung,
1113 it represents the difference of what the vertical position
1114 would have been but for the trap, and what the vertical position
1115 actually is. Useful in conjunction with the \n[.ne] register.
1116
1117 \n[.vpt]
1118 1 if vertical position traps are enabled, 0 otherwise.
1119
1120 \n[.warn]
1121 The sum of the numbers associated with each of the currently
1122 enabled warnings. The number associated with each warning is
1123 listed in troff(1).
1124
1125 \n[.x] The major version number. For example, if the version number is
1126 1.03, then \n[.x] will contain 1.
1127
1128 \n[.y] The minor version number. For example, if the version number is
1129 1.03, then \n[.y] will contain 03.
1130
1131 \n[.Y] The revision number of groff.
1132
1133 \n[llx]
1134 \n[lly]
1135 \n[urx]
1136 \n[ury]
1137 These four registers are set by the .psbb request and contain
1138 the bounding box values (in PostScript units) of a given Post‐
1139 Script image.
1140
1141 The following read/write registers are set by the \w escape sequence:
1142
1143 \n[rst]
1144 \n[rsb]
1145 Like the st and sb registers, but take account of the heights
1146 and depths of characters.
1147
1148 \n[ssc]
1149 The amount of horizontal space (possibly negative) that should
1150 be added to the last character before a subscript.
1151
1152 \n[skw]
1153 How far to right of the center of the last character in the \w
1154 argument, the center of an accent from a roman font should be
1155 placed over that character.
1156
1157 Other available read/write number registers are:
1158
1159 \n[c.] The current input line number. \n[.c] is a read-only alias to
1160 this register.
1161
1162 \n[hours]
1163 The number of hours past midnight. Initialized at start-up.
1164
1165 \n[hp] The current horizontal position at input line.
1166
1167 \n[minutes]
1168 The number of minutes after the hour. Initialized at start-up.
1169
1170 \n[seconds]
1171 The number of seconds after the minute. Initialized at start-
1172 up.
1173
1174 \n[systat]
1175 The return value of the system() function executed by the last
1176 sy request.
1177
1178 \n[slimit]
1179 If greater than 0, the maximum number of objects on the input
1180 stack. If less than or equal to 0, there is no limit on the
1181 number of objects on the input stack. With no limit, recursion
1182 can continue until virtual memory is exhausted.
1183
1184 \n[year]
1185 The current year. Note that the traditional troff number regis‐
1186 ter \n[yr] is the current year minus 1900.
1187
1188 Miscellaneous
1189 troff predefines a single (read/write) string-based register, \*(.T,
1190 which contains the argument given to the -T command line option, namely
1191 the current output device (for example, latin1 or ascii). Note that
1192 this is not the same as the (read-only) number register \n[.T] which is
1193 defined to be 1 if troff is called with the -T command line option, and
1194 zero otherwise. This behaviour is different to UNIX troff.
1195
1196 Fonts not listed in the DESC file are automatically mounted on the next
1197 available font position when they are referenced. If a font is to be
1198 mounted explicitly with the fp request on an unused font position, it
1199 should be mounted on the first unused font position, which can be found
1200 in the \n[.fp] register; although troff does not enforce this strictly,
1201 it will not allow a font to be mounted at a position whose number is
1202 much greater than that of any currently used position.
1203
1204 Interpolating a string does not hide existing macro arguments. Thus in
1205 a macro, a more efficient way of doing
1206
1207 .xx \\$@
1208
1209 is
1210
1211 \\*[xx]\\
1212
1213 If the font description file contains pairwise kerning information,
1214 characters from that font will be kerned. Kerning between two charac‐
1215 ters can be inhibited by placing a \& between them.
1216
1217 In a string comparison in a condition, characters that appear at dif‐
1218 ferent input levels to the first delimiter character will not be recog‐
1219 nised as the second or third delimiters. This applies also to the tl
1220 request. In a \w escape sequence, a character that appears at a dif‐
1221 ferent input level to the starting delimiter character will not be
1222 recognised as the closing delimiter character. The same is true for
1223 \A, \b, \B, \C, \l, \L, \o, \X, and \Z. When decoding a macro or
1224 string argument that is delimited by double quotes, a character that
1225 appears at a different input level to the starting delimiter character
1226 will not be recognised as the closing delimiter character. The imple‐
1227 mentation of \$@ ensures that the double quotes surrounding an argument
1228 will appear the same input level, which will be different to the input
1229 level of the argument itself. In a long escape name ] will not be rec‐
1230 ognized as a closing delimiter except when it occurs at the same input
1231 level as the opening ]. In compatibility mode, no attention is paid to
1232 the input-level.
1233
1234 There are some new types of condition:
1235
1236 .if rxxx
1237 True if there is a number register named xxx.
1238
1239 .if dxxx
1240 True if there is a string, macro, diversion, or request named
1241 xxx.
1242
1243 .if mxxx
1244 True if there is a color named xxx.
1245
1246 .if cch
1247 True if there is a character ch available; ch is either an ASCII
1248 character or a special character \(xx or \[xxx]; the condition
1249 will also be true if ch has been defined by the char request.
1250
1251 The tr request can now map characters onto \~.
1252
1253 It is now possible to have whitespace between the first and second dot
1254 (or the name of the ending macro) to end a macro definition. Example:
1255
1256 .de foo
1257 . nop Hello, I'm `foo'.
1258 . nop I will now define `bar'.
1259 . de bar
1260 . nop Hello, I'm `bar'.
1261 . .
1262 . nop Done.
1263 ..
1264 .foo
1265 .bar
1266
1268 This section describes the format output by GNU troff. The output for‐
1269 mat used by GNU troff is very similar to that used by Unix device-inde‐
1270 pendent troff. Only the differences are documented here.
1271
1272 Units
1273 The argument to the s command is in scaled points (units of points/n,
1274 where n is the argument to the sizescale command in the DESC file).
1275 The argument to the x Height command is also in scaled points.
1276
1277 Text Commands
1278 Nn Print character with index n (a non-negative integer) of the
1279 current font.
1280
1281 If the tcommand line is present in the DESC file, troff will use the
1282 following two commands.
1283
1284 txxx xxx is any sequence of characters terminated by a space or a
1285 newline; the first character should be printed at the current
1286 position, the current horizontal position should be increased by
1287 the width of the first character, and so on for each character.
1288 The width of the character is that given in the font file,
1289 appropriately scaled for the current point size, and rounded so
1290 that it is a multiple of the horizontal resolution. Special
1291 characters cannot be printed using this command.
1292
1293 un xxx This is same as the t command except that after printing each
1294 character, the current horizontal position is increased by the
1295 sum of the width of that character and n.
1296
1297 Note that single characters can have the eighth bit set, as can the
1298 names of fonts and special characters.
1299
1300 The names of characters and fonts can be of arbitrary length; drivers
1301 should not assume that they will be only two characters long.
1302
1303 When a character is to be printed, that character will always be in the
1304 current font. Unlike device-independent troff, it is not necessary for
1305 drivers to search special fonts to find a character.
1306
1307 For color support, some new commands have been added:
1308
1309 mc cyan magenta yellow
1310 md
1311 mg gray
1312 mk cyan magenta yellow black
1313 mr red green blue
1314 Set the color components of the current drawing color, using
1315 various color schemes. md resets the drawing color to the
1316 default value. The arguments are integers in the range 0 to
1317 65536.
1318
1319 The x device control command has been extended.
1320
1321 x u n If n is 1, start underlining of spaces. If n is 0, stop under‐
1322 lining of spaces. This is needed for the cu request in nroff
1323 mode and is ignored otherwise.
1324
1325 Drawing Commands
1326 The D drawing command has been extended. These extensions will not be
1327 used by GNU pic if the -n option is given.
1328
1329 Df n\n Set the shade of gray to be used for filling solid objects to n;
1330 n must be an integer between 0 and 1000, where 0 corresponds
1331 solid white and 1000 to solid black, and values in between cor‐
1332 respond to intermediate shades of gray. This applies only to
1333 solid circles, solid ellipses and solid polygons. By default, a
1334 level of 1000 will be used. Whatever color a solid object has,
1335 it should completely obscure everything beneath it. A value
1336 greater than 1000 or less than 0 can also be used: this means
1337 fill with the shade of gray that is currently being used for
1338 lines and text. Normally this will be black, but some drivers
1339 may provide a way of changing this.
1340
1341 DC d\n Draw a solid circle with a diameter of d with the leftmost point
1342 at the current position.
1343
1344 DE dx dy\n
1345 Draw a solid ellipse with a horizontal diameter of dx and a ver‐
1346 tical diameter of dy with the leftmost point at the current
1347 position.
1348
1349 Dp dx1 dy1 dx2 dy2 ... dxn dyn\n
1350 Draw a polygon with, for i=1,...,n+1, the i-th vertex at the
1351 current position +ij−=Σ11(dxj,dyj). At the moment, GNU pic only
1352 uses this command to generate triangles and rectangles.
1353
1354 DP dx1 dy1 dx2 dy2 ... dxn dyn\n
1355 Like Dp but draw a solid rather than outlined polygon.
1356
1357 Dt n\n Set the current line thickness to n machine units. Tradition‐
1358 ally Unix troff drivers use a line thickness proportional to the
1359 current point size; drivers should continue to do this if no Dt
1360 command has been given, or if a Dt command has been given with a
1361 negative value of n. A zero value of n selects the smallest
1362 available line thickness.
1363
1364 A difficulty arises in how the current position should be changed after
1365 the execution of these commands. This is not of great importance since
1366 the code generated by GNU pic does not depend on this. Given a drawing
1367 command of the form
1368
1369 \D′c x1 y1 x2 y2 ... xn yn′
1370
1371 where c is not one of c, e, l, a, or ~, Unix troff will treat each of
1372 the xi as a horizontal quantity, and each of the yi as a vertical quan‐
1373 tity and will assume that the width of the drawn object is in=Σ1xi, and
1374 that the height is in=Σ1yi. (The assumption about the height can be seen
1375 by examining the st and sb registers after using such a D command in a
1376 \w escape sequence). This rule also holds for all the original drawing
1377 commands with the exception of De. For the sake of compatibility GNU
1378 troff also follows this rule, even though it produces an ugly result in
1379 the case of the Dt, and, to a lesser extent, DE commands. Thus after
1380 executing a D command of the form
1381
1382 Dc x1 y1 x2 y2 ... xn yn\n
1383
1384 the current position should be increased by (in=Σ1xi,in=Σ1yi).
1385
1386 Another set of extensions is
1387
1388 DFc cyan magenta yellow\n
1389 DFd\n
1390 DFg gray\n
1391 DFk cyan magenta yellow black\n
1392 DFr red green blue\n
1393 Set the color components of the filling color similar to the m
1394 commands above.
1395
1396 Note that Df is now mapped onto DFg. The current position isn't
1397 changed by those colour commands.
1398
1399 Device Control Commands
1400 There is a continuation convention which permits the argument to the
1401 x X command to contain newlines: when outputting the argument to the
1402 x X command, GNU troff will follow each newline in the argument with a
1403 + character (as usual, it will terminate the entire argument with a
1404 newline); thus if the line after the line containing the x X command
1405 starts with +, then the newline ending the line containing the x X com‐
1406 mand should be treated as part of the argument to the x X command, the
1407 + should be ignored, and the part of the line following the + should be
1408 treated like the part of the line following the x X command.
1409
1410 The first three output commands are guaranteed to be:
1411
1412 x T device
1413 x res n h v
1414 x init
1415
1417 In spite of the many extensions, groff has retained compatibility to
1418 classical troff to a large degree. For the cases where the extensions
1419 lead to collisions, a special compatibility mode with the restricted,
1420 old functionality was created for groff.
1421
1422 Groff Language
1423 groff provides a compatibility mode that allows to process roff code
1424 written for classical or for other implementations of roff in a consis‐
1425 tent way.
1426
1427 Compatibility mode can be turned on with the -C command line option,
1428 and turned on or off with the .cp request. The number register \n(.C
1429 is 1 if compatibility mode is on, 0 otherwise.
1430
1431 This became necessary because the GNU concept for long names causes
1432 some incompatibilities. Classical troff interprets
1433
1434 .dsabcd
1435
1436 as defining a string ab with contents cd. In groff mode, this will be
1437 considered as a call of a macro named dsabcd.
1438
1439 Also classical troff interprets \*[ or \n[ as references to a string or
1440 number register called [ while groff takes this as the start of a long
1441 name.
1442
1443 In compatibility mode, groff interprets these things in the traditional
1444 way; so long names are not recognized.
1445
1446 On the other hand, groff in GNU native mode does not allow to use the
1447 single-character escapes \\ (backslash), \| (vertical bar), \^ (caret),
1448 \& (ampersand), \{ (opening brace), \} (closing brace), ‘\ ’ (space),
1449 \' (single quote), \` (backquote), \- (minus), \_ (underline), \!
1450 (bang), \% (percent), and \c (character c) in names of strings, macros,
1451 diversions, number registers, fonts or environments, whereas classical
1452 troff does.
1453
1454 The \A escape sequence can be helpful in avoiding these escape
1455 sequences in names.
1456
1457 Fractional pointsizes cause one noteworthy incompatibility. In classi‐
1458 cal troff, the ps request ignores scale indicators and so
1459
1460 .ps 10u
1461
1462 will set the pointsize to 10 points, whereas in groff native mode the
1463 pointsize will be set to 10 scaled points.
1464
1465 In groff mode, there is a fundamental difference between unformatted
1466 input characters, and formatted output characters. Everything that
1467 affects how an output character will be output is stored with the char‐
1468 acter; once an output character has been constructed it is unaffected
1469 by any subsequent requests that are executed, including the bd, cs,
1470 tkf, tr, or fp requests.
1471
1472 Normally output characters are constructed from input characters at the
1473 moment immediately before the character is added to the current output
1474 line. Macros, diversions and strings are all, in fact, the same type
1475 of object; they contain lists of input characters and output characters
1476 in any combination.
1477
1478 An output character does not behave like an input character for the
1479 purposes of macro processing; it does not inherit any of the special
1480 properties that the input character from which it was constructed might
1481 have had. The following example will make things clearer.
1482
1483 .di x
1484 \\\\
1485 .br
1486 .di
1487 .x
1488
1489 In GNU mode this will be printed as \\. So each pair of input back‐
1490 slashes ‘\\’ is turned into a single output backslash ‘\’ and the
1491 resulting output backslashes are not interpreted as escape characters
1492 when they are reread.
1493
1494 Classical troff would interpret them as escape characters when they
1495 were reread and would end up printing a single backslash ‘\’.
1496
1497 In GNU, the correct way to get a printable version of the backslash
1498 character ‘\’ is the \(rs escape sequence, but classical troff does not
1499 provide a clean feature for getting a non-syntactical backslash. A
1500 close method is the printable version of the current escape character
1501 using the \e escape sequence; this works if the current escape charac‐
1502 ter is not redefined. It works in both GNU mode and compatibility
1503 mode, while dirty tricks like specifying a sequence of multiple back‐
1504 slashes do not work reliably; for the different handling in diversions,
1505 macro definitions, or text mode quickly leads to a confusion about the
1506 necessary number of backslashes.
1507
1508 To store an escape sequence in a diversion that will be interpreted
1509 when the diversion is reread, either the traditional \! transparent
1510 output facility or the new \? escape sequence can be used.
1511
1512 Intermediate Output
1513 The groff intermediate output format is in a state of evolution. So
1514 far it has some incompatibilities, but it is intended to establish a
1515 full compatibility to the classical troff output format. Actually the
1516 following incompatibilities exist:
1517
1518 · The positioning after the drawing of the polygons conflicts with the
1519 classical definition.
1520
1521 · The intermediate output cannot be rescaled to other devices as clas‐
1522 sical "device-independent" troff did.
1523
1525 Copyright (C) 1989, 2001, 2002 Free Software Foundation, Inc.
1526
1527 This document is distributed under the terms of the FDL (GNU Free Docu‐
1528 mentation License) version 1.1 or later. You should have received a
1529 copy of the FDL on your system, it is also available on-line at the GNU
1530 copyleft site ⟨http://www.gnu.org/copyleft/fdl.html⟩. This document
1531 was written by James Clark, with modifications by Werner Lemberg
1532 ⟨wl@gnu.org⟩ and Bernd Warken ⟨bwarken@mayn.de⟩.
1533
1534 This document is part of groff, the GNU roff distribution. Formerly,
1535 the contents of this document was kept in the manual page troff(1).
1536 Only the parts dealing with the language aspects of the different roff
1537 systems were carried over into this document. The troff command line
1538 options and warnings are still documented in troff(1).
1539
1541 The groff info file, cf. info(1) presents all groff documentation
1542 within a single document.
1543
1544 groff(1)
1545 A list of all documentation around groff.
1546
1547 groff(7)
1548 A description of the groff language, including a short, but com‐
1549 plete reference of all predefined requests, registers, and
1550 escapes of plain groff. From the command line, this is called
1551 using
1552
1553 shell# man 7 groff
1554
1555 roff(7)
1556 A survey of roff systems, including pointers to further histori‐
1557 cal documentation.
1558
1559 [CSTR #54]
1560 The Nroff/Troff User's Manual by J. F. Osanna of 1976 in the
1561 revision of Brian Kernighan of 1992, being the classical troff
1562 documentation ⟨http://cm.bell-labs.com/cm/cs/cstr/54.ps.gz⟩.
1563
1564
1565
1566Groff Version 1.18.1.4 05 July 2002 GROFF_DIFF(7)