Debian Codegraph @

upstream/fedora-rawhide/man5/groff_out.5

raw
1 .TH groff_out 5 "2026-03-03" "groff 1.24.0"
2 .SH Name
3 groff_out \- GNU
4 .I roff
5 device-independent page description language
6 .
7 .
8 .\" XXX: This page needs review and editing.
9 .\" ====================================================================
10 .\" Legal Terms
11 .\" ====================================================================
12 .\"
13 .\" Copyright 1989-2024 Free Software Foundation, Inc.
14 .\"
15 .\" This file is part of groff, the GNU roff typesetting system.
16 .\"
17 .\" Permission is granted to copy, distribute and/or modify this
18 .\" document under the terms of the GNU Free Documentation License,
19 .\" Version 1.3 or any later version published by the Free Software
20 .\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
21 .\" and with no Back-Cover Texts.
22 .\"
23 .\" A copy of the Free Documentation License is included as a file
24 .\" called FDL in the main directory of the groff source package.
25 .
26 .
27 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
28 .do nr *groff_groff_out_5_man_C \n[.cp]
29 .cp 0
30 .
31 .\" Define fallback for groff 1.23's MR macro if the system lacks it.
32 .nr do-fallback 0
33 .if !\n(.f .nr do-fallback 1 \" mandoc
34 .if \n(.g .if !d MR .nr do-fallback 1 \" older groff
35 .if !\n(.g .nr do-fallback 1 \" non-groff *roff
36 .if \n[do-fallback] \{\
37 . de MR
38 . ie \\n(.$=1 \
39 . I \%\\$1
40 . el \
41 . IR \%\\$1 (\\$2)\\$3
42 . .
43 .\}
44 .rr do-fallback
45 .
46 .
47 .\" ====================================================================
48 .\" Setup
49 .\" ====================================================================
50 .
51 .\" ================= Document configuration
52 .
53 .\" Number register to decide whether the commands '{' and '}' are used
54 .\" 0: disable (current default); 1: enable
55 .nr @USE_ENV_STACK 0
56 .
57 .ig
58 Unfortunately, old versions of groff used an illogical position change
59 after some D\~commands (Dp, DP, Dt). If the register
60 @STUPID_DRAWING_POSITIONING is 1 (current default) then change position
61 after these commands, otherwise the position is not changed.
62 ..
63 .nr @STUPID_DRAWING_POSITIONING 1
64 .
65 .\" ================= Semantical definitions
66 .
67 .nr @maxcolor 65536
68 .ds @backslash \[rs]\"
69 .ds @linebreak \fR\[la]line-break\[ra]\fP\"
70 .
71 .\" Begin of macro definitions
72 .
73 .de offset
74 .RI ( \,\\$1\/ ,\ \,\\$2\/ )\\$3
75 ..
76 .de indexed_offset
77 .offset \fI\\$1\/\fP\d\s-3\\$2\s+3\u\x'\n[.v]/4' \fI\\$3\/\fP\
78 \d\s-3\\$4\s+3\u\x'\n[.v]/4' \\$5\x'\n[.v]/4'\\$6
79 ..
80 .\" format: .command <name> "<arguments>" <punctuation>
81 .de command
82 \fB\\$1\fP\ \fI\,\\$2\/\fP\\$3
83 ..
84 .\" format: .D-command <subcommand> "<arguments>"
85 .de D-command
86 \fBD\\$1\fP\ \fI\,\\$2\/\fP\|\*[@linebreak]
87 ..
88 .
89 .\" We set these as troff micromotions rather than eqn because \d and \u
90 .\" can be lifted to XML subscript/superscript tags. Don't change
91 .\" these to a parameterized string, man2html won't handle that.
92 .ds hv1 \fIh\d\s-3\&1\s+3\u\~v\d\s-3\&1\s+3\u\fP\x'\n[.v]/4'
93 .ds hv2 \fIh\d\s-3\&2\s+3\u\~v\d\s-3\&2\s+3\u\fP\x'\n[.v]/4'
94 .ds hvn \fIh\d\s-3\&n\s+3\u\~v\d\s-3\&n\s+3\u\fP\x'\n[.v]/4'
95 .
96 .de Da-command
97 \fBDa\fP\ \*[hv1] \*[hv2]\|\*[@linebreak]
98 ..
99 .\" graphics command .D with a variable number of arguments
100 .\" format: .D-multiarg <subcommand>
101 .de D-multiarg
102 \fBD\\$1\fP\ \*[hv1] \*[hv2] \&.\|.\|.\& \*[hvn]\|\*[@linebreak]
103 ..
104 .\" format: .x-command <subname> "<arguments>"
105 .de x-command
106 \fBx\\$1\fP\ \fI\\$2\fP\|\*[@linebreak]
107 ..
108 .de xsub
109 .RI "(" "\\$1" " control command)"
110 .br
111 ..
112 .\" End of macro definitions
113 .
114 .
115 .\" ====================================================================
116 .SH Description
117 .\" ====================================================================
118 .
119 .\" BEGIN Keep parallel with introductory paragraph of the "Language
120 .\" Concepts" node in doc/groff.texi.in.
121 The fundamental operation of the GNU
122 .I troff \" GNU
123 formatter,
124 .MR \%troff 1 ,
125 is the translation of the
126 .MR groff 7
127 input language
128 into a series of instructions concerned primarily
129 with placing glyphs or geometric objects
130 at specific positions on a rectangular page.
131 .
132 In the following discussion,
133 the term
134 .I command
135 refers to this device-independent output language,
136 never to the language intended for use by document authors.
137 .
138 Device-independent output commands comprise several categories:
139 glyph output;
140 font,
141 color,
142 and text size selection;
143 motion of the drawing position;
144 page advancement;
145 drawing of geometric primitives;
146 and device extension commands,
147 a catch-all for other operations.
148 .
149 The last includes directives to start and stop output,
150 identify the intended output device,
151 and embed URL hyperlinks in supported output formats.
152 .\" END Keep parallel with introductory paragraph of the "Language
153 .\" Concepts" node in doc/groff.texi.in.
154 .
155 .
156 .\" ====================================================================
157 .SS Background
158 .\" ====================================================================
159 .
160 .\" BEGIN Keep parallel with paragraphs after the first in the "GNU
161 .\" troff Output" node in doc/groff.texi.in.
162 As
163 .MR groff 1
164 is a wrapper program around GNU
165 .I troff \" GNU
166 and automatically calls an output driver,
167 users seldom encounter this format under normal circumstances.
168 .
169 .I groff
170 offers the option
171 .B \-Z
172 to inhibit postprocessing such that GNU
173 .IR troff 's \" GNU
174 output is sent to the standard output stream just as it is when running
175 GNU
176 .I troff \" GNU
177 directly.
178 .
179 .
180 .P
181 The purpose of device-independent output
182 is to facilitate the development of postprocessors
183 by providing a common programming interface for all devices.
184 .
185 It is a distinct,
186 and much simpler,
187 language from that of the formatter,
188 .IR troff . \" generic
189 The device-independent output can be thought of
190 as a \[lq]page description language\[rq].
191 .
192 .
193 .P
194 In the following discussion,
195 the term
196 .I "troff output"
197 describes what is output by GNU
198 .IR troff , \" GNU
199 while
200 .I "page description"
201 denotes the language accepted by the parser that interprets this output
202 for the output drivers.
203 .
204 This parser handles whitespace more flexibly than AT&T
205 .IR troff 's \" AT&T
206 implementation,
207 recognizes a GNU extension to the language,
208 and supports a legacy compressed encoding of a subset of commands
209 for compatibility;
210 otherwise,
211 the formats are the same.
212 .
213 (The parser for device-independent output can be found in the
214 .I groff
215 sources at
216 .IR \%src/\:\%libs/\:\%libdriver/\:\%input.cpp .)
217 .
218 .
219 .P
220 When Brian Kernighan designed AT&T
221 .IR troff 's \" AT&T
222 device-independent page description language circa 1980,
223 he had to balance
224 readability and maintainability against severe constraints on file size
225 and transmission speed to the output device.
226 .
227 A decade later,
228 when James Clark wrote
229 .IR groff ,
230 these constraints were no longer as tight.
231 .\" END Keep parallel with paragraphs after the first in the "gtroff
232 .\" Output" node in doc/groff.texi.in.
233 .
234 .
235 .\" ====================================================================
236 .SS Syntax
237 .\" ====================================================================
238 .
239 .IR roff 's
240 page description language is a sequence of
241 .I tokens:
242 single-letter commands or their arguments.
243 Some commands accept a subcommand as a first argument,
244 followed by one or more further arguments.
245 .
246 .
247 .P
248 AT&T device-independent
249 .I troff \" AT&T
250 used whitespace minimally when producing output.
251 .
252 GNU
253 .IR troff , \" GNU
254 in contrast,
255 attempts to make its output more human-readable.
256 .
257 The whitespace characters\[em]tab,
258 space,
259 and newline\[em]are always meaningful.
260 .
261 They are never used to represent spacing in the document;
262 that is done with horizontal
263 .RB ( h ,\~ H )
264 and vertical
265 .RB ( v ,\~ V )
266 positioning commands.
267 .
268 Any sequence of space and/or tab characters is equivalent to a single
269 space,
270 separating commands from arguments and arguments from each other.
271 .
272 Space is required only where omitting it would cause ambiguity.
273 .
274 A line break separates commands.
275 .
276 The comment character is a pound/hash sign
277 .RB ( # ),
278 and marks the remainder of the line as a comment.
279 .
280 A line comprising only whitespace after comment removal does nothing but
281 separate input tokens.
282 .
283 .
284 .P
285 For example,
286 the relative horizontal motion command
287 .RB ( h )
288 and the command to write one glyph
289 .RB ( c ),
290 each take a single argument;
291 the former a signed integer,
292 and the latter a printable ISO\~646/\[lq]ASCII\[rq] character.
293 .
294 A series of such commands could validly occur without spaces
295 on an input line,
296 but GNU
297 .I troff \" GNU
298 follows each with a newline.
299 .
300 .
301 .P
302 Some commands have a more complex syntax;
303 the GNU
304 .I troff \" GNU
305 extension command for writing glyph sequences
306 .RB ( t )
307 accepts a variable number of arguments.
308 Those that draw geometric objects
309 .RB ( D )
310 or control the device
311 .RB ( x )
312 furthermore recognize subcommand arguments.
313 .
314 Such commands thus must end with a newline.
315 .
316 In GNU
317 .I troff, \" GNU
318 the device extension (sub)command
319 .RB \[lq] x\~X \[rq]
320 uniquely supports a line continuation syntax;
321 a single input line contains any other.
322 .
323 .
324 .\" ====================================================================
325 .SS "Argument units"
326 .\" ====================================================================
327 .
328 Some commands accept integer arguments that represent measurements,
329 but the scaling units of the formatter's language are never used.
330 .
331 Most commands assume a scaling unit
332 .RB of\~\[lq] u \[rq]
333 (basic units),
334 and others
335 .RB use\~\[lq] s \[rq]
336 (scaled points).
337 .
338 These are defined by the parameters specified in the device's
339 .I DESC
340 file;
341 see
342 .MR groff_font 5
343 and,
344 for more on scaling units,
345 .MR groff 7
346 and
347 .IR "Groff: The GNU Implementation of troff" ,
348 the
349 .I groff
350 Texinfo manual.
351 .
352 Color-related commands use dimensionless integers.
353 .
354 .
355 .P
356 Note that single characters can have the eighth bit set, as can the
357 names of fonts and special characters (this is, glyphs).
358 .
359 The names of glyphs and fonts can be of arbitrary length.
360 .
361 A glyph that is to be printed will always be in the current font.
362 .
363 .
364 .P
365 A string argument is always terminated by the next whitespace
366 character (space, tab, or newline); an embedded
367 .B #
368 character is regarded as part of the argument, not as the beginning of
369 a comment command.
370 .
371 An integer argument is already terminated by the next non-digit
372 character, which then is regarded as the first character of the next
373 argument or command.
374 .
375 .
376 .\" ====================================================================
377 .SS "Output structure"
378 .\" ====================================================================
379 .
380 Device-independent
381 .I troff \" system
382 output is organized into three parts:
383 a header,
384 a body,
385 and a trailer.
386 .
387 .
388 .P
389 The task of the header is to set general device parameters.
390 .
391 GNU
392 .I troff \" GNU
393 guarantees that its
394 header consists of the following three lines:
395 .
396 .
397 .RS
398 .P
399 .B x\~T
400 .I device
401 .br
402 .B x\~res
403 .I n\~h\~v
404 .br
405 .B x init
406 .RE
407 .
408 .
409 .P
410 with the parameters
411 .IR n ,
412 .IR h ,
413 and
414 .I v
415 set as outlined in subsection \[lq]Device Control Commands\[rq] below.
416 The parser for the device-independent page description language format
417 is able to interpret additional whitespace and comments as well even in
418 the header.
419 .
420 .
421 .P
422 The body contains the document's visible content.
423 .
424 Once an output driver interprets
425 .RB \[lq] "x init" \[rq],
426 it prepares to handle commands in general.
427 .
428 Processing terminates when a
429 .RB \[lq] "x stop" \[rq]
430 command is encountered;
431 the last line of any
432 GNU
433 .I troff \" GNU
434 page description output always contains such a command.
435 .
436 .
437 .P
438 Semantically,
439 the body is page-oriented.
440 .
441 The
442 .B p
443 command starts a new page.
444 .
445 Positioning,
446 writing,
447 and drawing commands are performed within a page,
448 so they cannot occur before the first
449 .B p
450 command.
451 .
452 The output driver reckons absolute positioning
453 (by the
454 .B H
455 and
456 .B V
457 commands)
458 with respect to the current page's origin
459 at the top left corner,
460 and all other positioning relative to the drawing position on the page.
461 .
462 .
463 .P
464 The trailer advances the drawing position to the bottom of the page
465 and informs the device that the document
466 (or \[lq]job\[rq])
467 has ended.
468 .
469 .
470 .\" ====================================================================
471 .SH "Command reference"
472 .\" ====================================================================
473 .
474 This section describes all page description output commands,
475 both from AT&T
476 .I troff \" AT*T
477 as well as extension commands issued by
478 GNU
479 .I troff. \" GNU
480 .
481 .
482 .\" ====================================================================
483 .SS "Comment command"
484 .\" ====================================================================
485 .
486 .TP
487 .BI # anything\c
488 \[la]line-break\[ra]
489 Apply comment annotation.
490 .
491 Ignore any characters from the
492 .BR # \~character
493 up to the next newline.
494 .
495 Each comment can be preceded by arbitrary syntactical space,
496 and every command can be terminated by a comment.
497 .
498 .
499 .\" ====================================================================
500 .SS "Simple commands"
501 .\" ====================================================================
502 .
503 The commands in this subsection have a command code consisting of a
504 single character, taking a fixed number of arguments.
505 .
506 Most of them are commands for positioning and text writing.
507 .
508 These commands are smart about whitespace.
509 .
510 Optionally,
511 .I syntactical space
512 can be inserted before, after, and between the command letter and its
513 arguments.
514 .
515 All of these commands are stackable, i.e., they can be preceded by
516 other simple commands or followed by arbitrary other commands on the
517 same line.
518 .
519 A separating
520 .I syntactical space
521 is necessary only when two integer arguments would clash or if the
522 preceding argument ends with a string argument.
523 .
524 .
525 .if \n[@USE_ENV_STACK]=1 \{\
526 .TP
527 .command {
528 Open a new environment by copying the current device configuration data
529 to the environment stack.
530 .
531 The current environment is setup by the device specification and
532 manipulated by the setting commands.
533 .
534 .
535 .TP
536 .command }
537 Close the current environment
538 (opened by a preceding
539 .BR { \~command)
540 and restore the previous environment from the environment
541 stack as the current device configuration data.
542 .
543 .\} \" endif @USE_ENV_STACK
544 .
545 .
546 .TP
547 .command C id \[la]white-space\[ra]
548 Typeset the glyph of the special character
549 .IR id .
550 .
551 Trailing syntactical space is necessary to allow special character names
552 of arbitrary length.
553 .
554 The drawing position is not advanced.
555 .\" XXX: Why does it matter that we read its size if we don't advance
556 .\" the drawing position?
557 .\" its size is read from the font description file.
558 .
559 .
560 .TP
561 .command c c
562 Typeset the glyph of the ordinary
563 .RI character\~ c .
564 .
565 The drawing position is not advanced.
566 .\" XXX: Why does it matter that we read its size if we don't advance
567 .\" the drawing position?
568 .\" its size is read from the font description file.
569 .
570 .
571 .TP
572 .command f n
573 Select the font mounted at
574 .RI position\~ n .
575 .
576 .IR n\~ cannot
577 be negative.
578 .
579 .
580 .TP
581 .command H n
582 Horizontally move the drawing position to
583 .IR n\~ basic
584 units from the left edge of the page.
585 .
586 .IR n\~ cannot
587 be negative.
588 .
589 .
590 .TP
591 .command h n
592 Move the drawing position right
593 .I n
594 basic units.
595 .
596 AT&T
597 .I troff \" AT&T
598 allowed negative
599 .I n;
600 GNU
601 .I troff \" GNU
602 does not produce such values,
603 but
604 .IR groff 's
605 output driver library handles them.
606 .
607 .
608 .TP
609 .command m "scheme \f[R][\f[]component\f[R] .\|.\|.]"
610 Select the stroke color using the
611 .IR component s
612 in the color space
613 .IR scheme .
614 .
615 Each
616 .I component
617 is an integer between 0 and \n[@maxcolor].
618 .
619 The quantity of components and their meanings vary with each
620 .IR scheme .
621 .
622 This command is a
623 .I groff
624 extension.
625 .
626 .
627 .RS
628 .TP
629 .command mc "cyan magenta yellow"
630 Use the CMY color scheme with components
631 cyan,
632 magenta,
633 and yellow.
634 .
635 .
636 .TP
637 .command md
638 Use the default color
639 (no components;
640 black in most cases).
641 .
642 .
643 .TP
644 .command mg gray
645 Use a grayscale color scheme with a component ranging
646 between 0 (black) and \n[@maxcolor] (white).
647 .
648 .
649 .TP
650 .command mk "cyan magenta yellow black"
651 Use the CMYK color scheme with components
652 cyan,
653 magenta,
654 yellow,
655 and black.
656 .
657 .
658 .TP
659 .command mr "red green blue"
660 Use the RGB color scheme with components
661 red,
662 green,
663 and blue.
664 .RE
665 .
666 .
667 .TP
668 .command N n
669 Typeset the glyph with
670 .RI index\~ n
671 in the current font.
672 .
673 .IR n\~ is
674 normally a non-negative integer.
675 .
676 The drawing position is not advanced.
677 .
678 The
679 .B html
680 and
681 .B xhtml
682 devices use this command with
683 .RI negative\~ n
684 to produce unbreakable space;
685 the absolute value of
686 .I n
687 is taken and interpreted in basic units.
688 .
689 .
690 .TP
691 .command n b\~a
692 Indicate a break.
693 .
694 No action is performed;
695 the command is present to make the output more easily parsed.
696 .
697 The integers
698 .I b
699 .RI and\~ a
700 describe the vertical space amounts before and after the break,
701 respectively.
702 .
703 GNU
704 .I troff \" GNU
705 issues this command but
706 .IR groff 's
707 output driver library ignores it.
708 .
709 See
710 .B v
711 and
712 .BR V .
713 .
714 .
715 .TP
716 .command p n
717 Begin a new page,
718 setting its number
719 .RI to\~ n .
720 .
721 Each page is independent,
722 even from those using the same number.
723 .
724 The vertical drawing position is set to\~0.
725 .
726 All positioning,
727 writing,
728 and drawing commands are interpreted in the context of a page,
729 so a
730 .BR p \~command
731 must precede them.
732 .
733 .
734 .TP
735 .command s n
736 Set type size to
737 .I n
738 scaled points
739 .RB (unit\~ z
740 in GNU
741 .IR troff ). \" GNU
742 .
743 AT&T
744 .I troff \" AT&T
745 used unscaled points
746 .RB ( p )
747 instead;
748 see section \[lq]Compatibility\[rq] below.
749 .
750 .
751 .TP
752 .command t xyz\f[R]\|.\|.\|.\& \f[R]\[la]white-space\[ra]
753 .TQ
754 .command t "xyz\f[R]\|.\|.\|.\&\f[] dummy-arg" \[la]white-space\[ra]
755 Typeset word
756 .IR xyz ;
757 that is,
758 set a sequence of ordinary glyphs named
759 .IR x ,
760 .IR y ,
761 .IR z ,
762 \&.\|.\|.\|,
763 terminated by a space or newline;
764 an optional second integer argument is ignored
765 (this allows the formatter to generate an even number of arguments).
766 .\" XXX: Why?
767 .
768 Each glyph is set at the current drawing position,
769 and the position is then advanced horizontally by the glyph's width.
770 .
771 A glyph's width is read from its metrics in the font description file,
772 scaled to the current type size,
773 and rounded to a multiple of the horizontal motion quantum.
774 .
775 Use the
776 .B C
777 command to emplace glyphs of special characters.
778 .
779 The
780 .BR t \~command
781 is a
782 .I groff
783 extension and is output only for devices whose
784 .I DESC
785 file contains the
786 .B tcommand
787 directive;
788 see
789 .MR groff_font 5 .
790 .
791 .
792 .TP
793 .command u "n xyz"\f[R]\|.\|.\|.\& \f[R]\[la]white-space\[ra]
794 .TQ
795 .command u "xyz\f[R]\|.\|.\|.\&\f[] dummy-arg" \[la]white-space\[ra]
796 Typeset word
797 .I xyz
798 with track kerning.
799 .
800 As
801 .BR t ,
802 but after placing each glyph,
803 the drawing position is further advanced horizontally
804 .RI by\~ n
805 basic units.
806 .
807 The
808 .BR u \~command
809 is a
810 .I groff
811 extension and is output only for devices whose
812 .I DESC
813 file contains the
814 .B tcommand
815 directive;
816 see
817 .MR groff_font 5 .
818 .
819 .
820 .TP
821 .command V n
822 Vertically move the drawing position to
823 .IR n\~ basic
824 units from the top edge of the page.
825 .
826 .IR n\~ cannot
827 be negative.
828 .
829 .
830 .TP
831 .command v n
832 Move the drawing position down
833 .I n
834 basic units.
835 .
836 AT&T
837 .I troff \" AT&T
838 allowed negative
839 .I n;
840 GNU
841 .I troff \" GNU
842 does not produce such values,
843 but
844 .IR groff 's
845 output driver library handles them.
846 .
847 .
848 .TP
849 .command w
850 Indicate an inter-word space.
851 .
852 No action is performed;
853 the command is present to make the output more easily parsed.
854 .
855 Only inter-word spaces on an output line
856 (be they breakable or not)
857 are thus described;
858 those resulting from horizontal motion escape sequences are not.
859 .
860 GNU
861 .I troff \" GNU
862 issues this command but
863 .IR groff 's
864 output driver library ignores it.
865 .
866 See
867 .B h
868 and
869 .BR H .
870 .
871 .
872 .\" ====================================================================
873 .SS "Graphics commands"
874 .\" ====================================================================
875 .
876 Each graphics or drawing command in the page description language
877 starts with the letter
878 .RB \[lq] D \[rq],
879 followed by one or two characters that specify a subcommand;
880 this is followed by a fixed or variable number of integer
881 arguments that are separated by a single space character.
882 .
883 A
884 .RB \[lq] D \[rq],
885 command may not be followed by another command on the same line
886 (apart from a comment),
887 so each
888 .RB \[lq] D \[rq]
889 command is terminated by a syntactical line break.
890 .
891 .
892 .P
893 .\" XXX: Fact-check this. --GBR
894 GNU
895 .I troff \" GNU
896 output follows AT&T
897 .IR troff 's \" AT&T
898 output conventions
899 (no space between command and subcommand,
900 all arguments are preceded by a single space character),
901 but
902 .IR groff 's
903 parser allows optional space
904 between the command letters
905 and makes the space before the first argument optional.
906 .
907 As usual,
908 each space can be any sequence of tab and space characters.
909 .
910 .
911 .P
912 Some graphics commands can take a variable number of arguments.
913 .
914 In this case, they are integers representing a size measured in basic
915 units\~\c
916 .BR u .
917 .
918 The
919 .I h
920 arguments
921 stand for horizontal distances where positive means right, negative
922 left.
923 .
924 The
925 .I v
926 arguments
927 stand for vertical distances where positive means down, negative up.
928 .
929 All these distances are offsets relative to the current location.
930 .
931 .
932 .P
933 Each graphics command directly corresponds to a
934 .I troff \" generic
935 .B \[rs]D
936 escape sequence.
937 .
938 See subsection \[lq]Drawing commands\[rq] of
939 .MR groff 7 .
940 .
941 .
942 .P
943 Unless indicated otherwise, each graphics command directly corresponds
944 to a similar
945 .I groff
946 .B \*[@backslash]D
947 escape sequence; see
948 .MR groff 7 .
949 .
950 .
951 .P
952 Unknown
953 .BR D \~commands
954 are assumed to be device-specific.
955 .
956 Its arguments are parsed as strings; the whole information is then
957 sent to the postprocessor.
958 .
959 .
960 .P
961 In the following command reference, the syntax element
962 .I \[la]line-break\[ra]
963 means a
964 .I syntactical line break
965 as defined in subsection \[lq]Separation\[rq] above.
966 .
967 .
968 .TP
969 .D-multiarg \[ti]
970 Draw B-spline from current position to offset
971 .indexed_offset h 1 v 1 ,
972 then to offset
973 .indexed_offset h 2 v 2
974 if given, etc., up to
975 .indexed_offset h n v n .
976 This command takes a variable number of argument pairs; the current
977 position is moved to the terminal point of the drawn curve.
978 .
979 .
980 .TP
981 .Da-command
982 Draw arc from current position to
983 .indexed_offset h 1 v 1 \|+\| \c
984 .indexed_offset h 2 v 2
985 with center at
986 .indexed_offset h 1 v 1 ;
987 then move the current position to the final point of the arc.
988 .
989 .
990 .TP
991 .D-command C d
992 .TQ
993 .D-command C "d dummy-arg"
994 Draw a solid circle using the current fill color with diameter\~\c
995 .I d
996 (integer in basic units\~\c
997 .BR u )
998 with leftmost point at the current position; then move the current
999 position to the rightmost point of the circle.
1000 .
1001 An optional second integer argument is ignored (this allows the
1002 formatter to generate an even number of arguments).
1003 .
1004 This command is a GNU extension.
1005 .
1006 .
1007 .TP
1008 .D-command c d
1009 Draw circle line with diameter\~\c
1010 .I d
1011 (integer in basic units\~\c
1012 .BR u )
1013 with leftmost point at the current position; then move the current
1014 position to the rightmost point of the circle.
1015 .
1016 .
1017 .TP
1018 .D-command E "h v"
1019 Draw a solid ellipse in the current fill color with a horizontal
1020 diameter of\~\c
1021 .I h
1022 and a vertical diameter of\~\c
1023 .I v
1024 (both integers in basic units\~\c
1025 .BR u )
1026 with the leftmost point at the current position; then move to the
1027 rightmost point of the ellipse.
1028 .
1029 This command is a GNU extension.
1030 .
1031 .
1032 .br
1033 .ne 4v
1034 .TP
1035 .D-command e "h v"
1036 Draw an outlined ellipse with a horizontal diameter of\~\c
1037 .I h
1038 and a vertical diameter of\~\c
1039 .I v
1040 (both integers in basic units\~\c
1041 .BR u )
1042 with the leftmost point at current position; then move to the
1043 rightmost point of the ellipse.
1044 .
1045 .
1046 .TP
1047 .D-command F "color-scheme \fR[\fPcomponent\fR .\|.\|.]\fP"
1048 Set fill color for solid drawing objects using different color
1049 schemes; the analogous command for setting the color of text, line
1050 graphics, and the outline of graphic objects is
1051 .BR m .
1052 .
1053 The color components are specified as integer arguments between 0 and
1054 \n[@maxcolor].
1055 .
1056 The number of color components and their meaning vary for the
1057 different color schemes.
1058 .
1059 These commands are generated by
1060 GNU
1061 .IR troff 's \" GNU
1062 escape sequences
1063 .RB \[lq] "\[rs]D\[aq]F\~" .\|.\|. \[aq] \[rq]
1064 .B \[rs]M
1065 (with no other corresponding graphics commands).
1066 .
1067 No position changing.
1068 .
1069 This command is a GNU extension.
1070 .
1071 .
1072 .RS
1073 .
1074 .TP
1075 .D-command Fc "cyan magenta yellow"
1076 Set fill color for solid drawing objects using the CMY color scheme,
1077 having the 3\~color components cyan, magenta, and yellow.
1078 .
1079 .
1080 .TP
1081 .D-command Fd
1082 Set fill color for solid drawing objects to the default fill color value
1083 (black in most cases).
1084 .
1085 No component arguments.
1086 .
1087 .
1088 .TP
1089 .D-command Fg "gray"
1090 Set fill color for solid drawing objects to the shade of gray given by
1091 the argument, an integer between 0 (black) and \n[@maxcolor] (white).
1092 .
1093 .
1094 .TP
1095 .D-command Fk "cyan magenta yellow black"
1096 Set fill color for solid drawing objects using the CMYK color scheme,
1097 having the 4\~color components cyan, magenta, yellow, and black.
1098 .
1099 .TP
1100 .D-command Fr "red green blue"
1101 Set fill color for solid drawing objects using the RGB color scheme,
1102 having the 3\~color components red, green, and blue.
1103 .
1104 .RE
1105 .
1106 .
1107 .TP
1108 .D-command f n
1109 The argument
1110 .I n
1111 must be an integer in the range \-32767 to 32767.
1112 .
1113 .RS
1114 .TP
1115 .RI 0\|\[<=]\| n \|\[<=]\|1000
1116 Set the color for filling solid drawing objects to a shade of gray,
1117 where 0 corresponds to solid white, 1000 (the default) to solid black,
1118 and values in between to intermediate shades of gray;
1119 this command is
1120 superseded by
1121 .RB \[lq] DFg \[rq].
1122 .
1123 .TP
1124 .IR n "\|<\|0 or " n \|>\|1000
1125 Set the filling color to the color that is currently being used for
1126 the text and the outline, see command
1127 .BR m .
1128 For example, the command sequence
1129 .
1130 .RS
1131 .IP
1132 .EX
1133 mg 0 0 \n[@maxcolor]
1134 Df \-1
1135 .EE
1136 .RE
1137 .
1138 .IP
1139 sets all colors to blue.
1140 .
1141 .P
1142 This command is a GNU extension.
1143 .RE
1144 .
1145 .
1146 .TP
1147 .D-command l "h v"
1148 Draw line from current position to offset
1149 .offset h v
1150 (integers in basic units\~\c
1151 .BR u );
1152 then set current position to the end of the drawn line.
1153 .
1154 .
1155 .TP
1156 .D-multiarg p
1157 Draw a polygon line from current position to offset
1158 .indexed_offset h 1 v 1 ,
1159 from there to offset
1160 .indexed_offset h 2 v 2 ,
1161 etc., up to offset
1162 .indexed_offset h n v n ,
1163 and from there back to the starting position.
1164 .
1165 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1166 For historical reasons, the position is changed by adding the sum of
1167 all arguments with odd index to the current horizontal position and the
1168 even ones to the vertical position.
1169 .
1170 Although this doesn't make sense it is kept for compatibility.
1171 .
1172 .\}
1173 .el \{\
1174 As the polygon is closed, the end of drawing is the starting point, so
1175 the position doesn't change.
1176 .\}
1177 .
1178 This command is a
1179 .I groff
1180 extension.
1181 .
1182 .
1183 .TP
1184 .D-multiarg P
1185 The same macro as the corresponding
1186 .B Dp
1187 command with the same arguments, but draws a solid polygon in the
1188 current fill color rather than an outlined polygon.
1189 .
1190 .if \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1191 The position is changed in the same way as with
1192 .BR Dp .
1193 .\}
1194 .
1195 This command is a GNU extension.
1196 .
1197 .
1198 .TP
1199 .D-command t n
1200 Set the current line thickness
1201 .RI to\~ n
1202 (an integer in basic
1203 .RB units\~ u )
1204 if
1205 .IR n \|>\|0;
1206 if
1207 .IR n \|=\|0
1208 select the smallest available line thickness;
1209 otherwise,
1210 the line thickness is made proportional to the type size,
1211 which is the default.
1212 .
1213 .if \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1214 For historical reasons,
1215 the horizontal position is changed by adding the argument to the current
1216 horizontal position,
1217 while the vertical position is not changed.
1218 .
1219 Although this doesn't make sense,
1220 it is kept for compatibility.
1221 .\}
1222 .
1223 This command is a GNU extension.
1224 .
1225 .
1226 .\" ====================================================================
1227 .SS "Device control commands"
1228 .\" ====================================================================
1229 .
1230 Each device control command starts with the letter
1231 .RB \[lq] x \[rq],
1232 followed by a space character
1233 (optional or arbitrary space or tab in
1234 GNU
1235 .IR troff ) \" GNU
1236 and a subcommand letter or word;
1237 each argument
1238 (if any)
1239 must be preceded by a syntactical space.
1240 All
1241 .RB \[lq] x \[rq],
1242 commands are terminated by a syntactical line break;
1243 no device control command
1244 can be followed by another command on the same line
1245 (except a comment).
1246 .
1247 .
1248 .P
1249 The subcommand is basically a single letter, but to increase
1250 readability, it can be written as a word, i.e., an arbitrary sequence
1251 of characters terminated by the next tab, space, or newline character.
1252 .
1253 All characters of the subcommand word but the first are simply ignored.
1254 .
1255 For example,
1256 GNU
1257 .I troff \" GNU
1258 outputs the initialization command
1259 .RB \[lq] "x i" \[rq]
1260 as
1261 .RB \[lq] "x init" \[rq]
1262 and the resolution command
1263 .RB \[lq] "x r" \[rq]
1264 as
1265 .RB \[lq] "x res" \[rq].
1266 .
1267 .
1268 .P
1269 In the following, the syntax element
1270 .I \[la]line-break\[ra]
1271 means a
1272 .I syntactical line break
1273 as defined in subsection \[lq]Separation\[rq] above.
1274 .
1275 .TP
1276 .x-command F name
1277 .xsub Filename
1278 Use
1279 .I name
1280 as the intended name for the current file in error reports.
1281 .
1282 This is useful for remembering the original file name when
1283 .I groff
1284 uses its internal piping mechanism.
1285 .
1286 The input file is not changed by this command.
1287 .
1288 This command is a GNU extension.
1289 .
1290 .
1291 .TP
1292 .x-command f "n\ s"
1293 .xsub font
1294 Mount font position\~\c
1295 .I n
1296 (a non-negative integer) with font named\~\c
1297 .I s
1298 (a text word);
1299 see
1300 .MR groff_font 5 .
1301 .
1302 .
1303 .TP
1304 .x-command H n
1305 .xsub Height
1306 Set character height to\~\c
1307 .I n
1308 (a positive integer in scaled points\~\c
1309 .BR z ).
1310 .
1311 .I Classical troff
1312 used the unit points (\c
1313 .BR p )
1314 instead;
1315 see section \[lq]Compatibility\[rq] below.
1316 .
1317 .
1318 .TP
1319 .x-command i
1320 .xsub init
1321 Initialize device.
1322 .
1323 This is the third command of the header.
1324 .
1325 .
1326 .TP
1327 .x-command p
1328 .xsub pause
1329 Parsed but ignored.
1330 .
1331 The classical documentation reads
1332 .I pause device, can be
1333 .IR restarted .
1334 .
1335 .
1336 .TP
1337 .x-command r "n\ h\ v"
1338 .xsub resolution
1339 Resolution is\~\c
1340 .IR n ,
1341 while
1342 .I h
1343 is the minimal horizontal motion, and
1344 .I v
1345 the minimal vertical motion possible with this device; all arguments
1346 are positive integers in basic units\~\c
1347 .B u
1348 per inch.
1349 .
1350 This is the second command of the header.
1351 .
1352 .
1353 .TP
1354 .x-command S n
1355 .xsub Slant
1356 Set slant to\~\c
1357 .I n
1358 degrees (an integer in basic units\~\c
1359 .BR u ).
1360 .
1361 .
1362 .TP
1363 .x-command s
1364 .xsub stop
1365 Terminates the processing of the current file; issued as the last
1366 command of device-independent
1367 .I troff \" generic
1368 output.
1369 .
1370 .
1371 .TP
1372 .x-command t
1373 .xsub trailer
1374 Generate trailer information, if any.
1375 .
1376 In
1377 .BR groff ,
1378 this is currently ignored.
1379 .
1380 .
1381 .TP
1382 .x-command T xxx
1383 .xsub Typesetter
1384 .
1385 Set the name of the output driver to
1386 .IR xxx ,
1387 a sequence of non-whitespace characters terminated by whitespace.
1388 .
1389 The possible names correspond to those of
1390 .IR groff 's
1391 .B \-T
1392 option.
1393 .
1394 This is the first command of the header.
1395 .
1396 .
1397 .TP
1398 .x-command u n
1399 .xsub underline
1400 Configure underlining of spaces.
1401 .
1402 If
1403 .I n
1404 is\~1, start underlining of spaces;
1405 if
1406 .I n
1407 is\~0, stop underlining of spaces.
1408 .
1409 This is needed for the
1410 .B cu
1411 request in
1412 .B \%nroff
1413 mode and is ignored otherwise.
1414 .
1415 This command is a GNU extension.
1416 .
1417 .
1418 .TP
1419 .x-command X anything
1420 .xsub X-escape
1421 Send string
1422 .I anything
1423 uninterpreted to the device.
1424 .
1425 If the line following this command starts with a
1426 .B +
1427 character this line is interpreted as a continuation line in the
1428 following sense.
1429 .
1430 The
1431 .B +
1432 is ignored, but a newline character is sent instead to the device, the
1433 rest of the line is sent uninterpreted.
1434 .
1435 The same applies to all following lines until the first character of a
1436 line is not a
1437 .B +
1438 character.
1439 .
1440 This command is generated by the
1441 .I groff
1442 escape sequence
1443 .BR \*[@backslash]X .
1444 .
1445 Line continuation is a GNU extension.
1446 .
1447 .
1448 .\" ====================================================================
1449 .SS "Legacy compressed encoding"
1450 .\" ====================================================================
1451 .
1452 AT&T
1453 .I troff \" AT&T
1454 primarily emitted glyphs by writing two digits
1455 (a motion)
1456 followed by a single character corresponding to a glyph.
1457 .
1458 This syntax is less a command itself than a compressed encoding of the
1459 .B c
1460 and
1461 .B h
1462 commands.
1463 .
1464 .
1465 .TP
1466 .I ddc
1467 Move right
1468 .I dd
1469 (exactly two decimal digits) basic units\~\c
1470 .BR u ,
1471 then print glyph with single-letter name\~\c
1472 .IR c .
1473 .
1474 .
1475 .RS
1476 .P
1477 In
1478 .IR groff ,
1479 arbitrary
1480 .I syntactical space
1481 around and within this command is allowed to be added.
1482 .
1483 Only when a preceding command on the same line ends with an argument
1484 of variable length a separating space is obligatory.
1485 .
1486 In
1487 .I classical
1488 .IR troff ,
1489 large clusters of these and other commands were used, mostly without
1490 spaces; this made such output almost unreadable.
1491 .
1492 .RE
1493 .
1494 .
1495 .P
1496 For modern high-resolution devices,
1497 this command is impractical
1498 because the widths of the glyphs have a greater magnitude
1499 in basic units
1500 than two decimal digits can represent.
1501 .
1502 In
1503 .IR groff ,
1504 it is used only for output to the
1505 .BR X75 ,
1506 .BR X75\-12 ,
1507 .BR X100 ,
1508 and
1509 .B X100\-12
1510 devices.
1511 .
1512 For others,
1513 the commands
1514 .B t
1515 .RB and\~ u
1516 provide greater functionality and superior troubleshooting capacity.
1517 .
1518 .
1519 .\" ====================================================================
1520 .SH Compatibility
1521 .\" ====================================================================
1522 .
1523 .\" BEGIN Keep parallel with subsection "Output Language Compatibility"
1524 .\" in doc/groff.texi.in.
1525 The page description language of AT&T
1526 .I troff \" AT&T
1527 was first documented in
1528 \[lq]A Typesetter-independent TROFF\[rq],
1529 by Brian Kernighan,
1530 and by 1992 the AT&T
1531 .I troff \" AT&T; system
1532 manual was updated to incorporate a description of it.
1533 .
1534 .
1535 .P
1536 .IR groff 's
1537 page description language is compatible with this specification
1538 except in the following aspects.
1539 .
1540 .
1541 .IP \[bu] 3n
1542 AT&T device-independent
1543 .IR troff 's \" AT&T
1544 quasi-device independence is not yet implemented.
1545 .\" XXX: Explain what that means.
1546 .
1547 .
1548 .IP \[bu]
1549 The printing hardware of the early 1980s differed from today's.
1550 .
1551 .IR groff 's
1552 output device names also differ from those of AT&T
1553 .I troff \" AT&T; system
1554 .
1555 For example,
1556 the PostScript device in AT&T
1557 .I troff, \" AT&T; system
1558 .B post
1559 (implemented by the driver command
1560 .IR dpost ),
1561 has a resolution of only 720 units per inch,
1562 suitable for printers of decades past.
1563 .
1564 .IR groff 's
1565 .B ps
1566 device has a resolution of 72000 units per inch.
1567 .
1568 In principle,
1569 by implementing a rescaling mechanism,
1570 .I groff
1571 could come to emulate AT&T's
1572 .B post
1573 device.
1574 .
1575 .
1576 .IP \[bu]
1577 While the B-spline command
1578 .B D\[ti]
1579 is reliably interpreted by
1580 .IR groff 's
1581 page description language parser,
1582 some output drivers don't implement drawing routines for it.
1583 .
1584 .
1585 .IP \[bu]
1586 In
1587 GNU
1588 .I troff, \" GNU
1589 the argument to the commands
1590 .B s
1591 and
1592 .B x\~H
1593 uses an implicit unit of scaled points
1594 .B z
1595 whereas AT&T
1596 .I troff \" AT&T
1597 uses spacing points
1598 .BR p .
1599 .
1600 This isn't an incompatibility,
1601 but a compatible extension,
1602 for both units coincide for any device without a
1603 .B \%sizescale
1604 directive in its
1605 .I DESC
1606 file,
1607 including all postprocessors from AT&T and
1608 .IR groff 's
1609 text
1610 .RI ( nroff -mode)
1611 devices.
1612 .
1613 .I groff
1614 devices that use
1615 .B \%sizescale
1616 either do not exist for AT&T
1617 .I troff \" AT&T; system
1618 have a different name,
1619 or seem to have a different resolution.
1620 .
1621 So conflicts are very unlikely.
1622 .
1623 .
1624 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1625 .IP \[bu]
1626 The drawing position after the commands
1627 .RB \[lq] Dp \[rq],
1628 .RB \[lq] DP \[rq],
1629 and
1630 .RB \[lq] Dt \[rq],
1631 are processed is illogical.
1632 .
1633 Since old versions of
1634 GNU
1635 .I troff \" GNU
1636 had this wart,
1637 we've retained it for compatibility,
1638 but may change it in the future.
1639 .
1640 Wrap these drawing commands with the
1641 .B \[rs]Z
1642 escape sequence to both overcome the illogical positioning
1643 and keep your input working consistently
1644 regardless of the wart's presence in the implementation.
1645 .\} \" @STUPID_DRAWING_POSITIONING
1646 .el \{\
1647 .IP \[bu]
1648 Temporarily, there existed some confusion on the positioning after the
1649 .B D
1650 commands that are
1651 .I groff
1652 extensions.
1653 .
1654 This has been clarified by establishing the classical rule for all
1655 groff drawing commands:
1656 .
1657 .
1658 .RS
1659 .P
1660 .ft I
1661 The position after a graphic object has been drawn is at its end;
1662 for circles and ellipses, the "end" is at the right side.
1663 .ft
1664 .RE
1665 .
1666 .
1667 .P
1668 From this, the positionings specified for the drawing commands above
1669 follow quite naturally.
1670 .\} \" @STUPID_DRAWING_POSITIONING
1671 .
1672 .P
1673 The differences between
1674 .I groff
1675 and
1676 .I classical troff
1677 are documented in
1678 .MR groff_diff 7 .
1679 .\" END Keep parallel with subsection "Output Language Compatibility" in
1680 .\" doc/groff.texi.in.
1681 .
1682 .
1683 .\" ====================================================================
1684 .SH Files
1685 .\" ====================================================================
1686 .
1687 .TP
1688 .IR /usr/\:\%share/\:\%groff/\:\%1.24.0/\:\%font/\:\%dev name /\:DESC
1689 describes the output device
1690 .IR name .
1691 .
1692 .
1693 .br
1694 .ne 4v
1695 .\" ====================================================================
1696 .SH Authors
1697 .\" ====================================================================
1698 .
1699 James Clark wrote an early version of this document,
1700 which described only the differences between AT&T
1701 device-independent
1702 .IR troff 's \" AT&T
1703 page description language and that of GNU
1704 .IR troff . \" GNU
1705 .
1706 It has since been expanded and revised by
1707 .MT groff\-bernd\:.warken\-72@\:web\:.de
1708 Bernd Warken
1709 .ME
1710 and
1711 .MT g.branden\:.robinson@\:gmail\:.com
1712 G. Branden Robinson
1713 .ME .
1714 .
1715 .
1716 .\" ====================================================================
1717 .SH "See also"
1718 .\" ====================================================================
1719 .
1720 .P
1721 .IR "Groff: The GNU Implementation of troff" ,
1722 by Trent A.\& Fisher and Werner Lemberg,
1723 is the primary
1724 .I groff
1725 manual.
1726 .
1727 You can browse it interactively with \[lq]info groff\[rq].
1728 .
1729 .
1730 .br
1731 .ne 4v
1732 .P
1733 \[lq]Troff User's Manual\[rq]
1734 by Joseph F.\& Ossanna,
1735 1976
1736 (revised by Brian W.\& Kernighan,
1737 1992),
1738 AT&T Bell Laboratories Computing Science Technical Report No.\& 54,
1739 widely called simply \[lq]CSTR\~#54\[rq],
1740 documents the language,
1741 device and font description file formats,
1742 and device-independent page description language
1743 referred to collectively in
1744 .I groff
1745 documentation as
1746 .RI \[lq]AT&T\~ troff \[rq].
1747 .
1748 .
1749 .P
1750 \[lq]A Typesetter-independent TROFF\[rq]
1751 by Brian W.\& Kernighan,
1752 1982,
1753 AT&T Bell Laboratories Computing Science Technical Report No.\& 97,
1754 (CSTR\~#97),
1755 provides additional insights into the
1756 device and font description file formats
1757 and device-independent page description language.
1758 .
1759 .
1760 .TP
1761 .MR groff 1
1762 documents the
1763 .B \-Z
1764 option and contains pointers to further
1765 .I groff
1766 documentation.
1767 .
1768 .
1769 .TP
1770 .MR groff 7
1771 describes the
1772 .I groff
1773 language,
1774 including its escape sequences and system of units.
1775 .
1776 .
1777 .TP
1778 .MR groff_font 5
1779 details the scaling parameters of
1780 .I DESC
1781 (device description)
1782 files.
1783 .
1784 .
1785 .TP
1786 .MR \%troff 1
1787 generates the language documented here.
1788 .
1789 .
1790 .TP
1791 .MR roff 7
1792 presents historical aspects and the general structure of
1793 .I roff
1794 systems.
1795 .
1796 .
1797 .TP
1798 .MR groff_diff 7
1799 enumerates differences between the output of AT&T
1800 .I troff \" AT&T
1801 and that of GNU
1802 .IR troff . \" GNU
1803 .
1804 .
1805 .TP
1806 .MR gxditview 1
1807 is a viewer for device-independent
1808 .I troff \" generic
1809 output.
1810 .
1811 .
1812 .TP
1813 .UR https://\:github.com/\:Alhadis/\:Roff\:.js/
1814 .I Roff.js
1815 .UE
1816 is a viewer for device-independent
1817 .I troff \" generic
1818 output written in JavaScript.
1819 .
1820 .
1821 .P
1822 .MR grodvi 1 ,
1823 .MR grohtml 1 ,
1824 .MR grolbp 1 ,
1825 .MR grolj4 1 ,
1826 .MR gropdf 1 ,
1827 .MR grops 1 ,
1828 and
1829 .MR grotty 1
1830 are
1831 .I groff
1832 postprocessors.
1833 .
1834 .
1835 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
1836 .cp \n[*groff_groff_out_5_man_C]
1837 .do rr *groff_groff_out_5_man_C
1838 .
1839 .
1840 .\" Local Variables:
1841 .\" fill-column: 72
1842 .\" mode: nroff
1843 .\" End:
1844 .\" vim: set filetype=groff textwidth=72: