s/concise/comprehensive/
[s-roff.git] / man / groff_out.man
blob916d81b01003b4ca26b8bb53c921d5dd373c3781
1 '\" e
2 .\" The above line should force the use of eqn as a preprocessor
3 .ig
4 groff_out.5
6 Last update: 10 Feb 2007
8 This file is part of groff, the GNU roff type-setting system.
10 Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007
11 Free Software Foundation, Inc.
12 rewritten from scrach 2001 by Bernd Warken <bwarken@mayn.de>
14 Permission is granted to copy, distribute and/or modify this document
15 under the terms of the GNU Free Documentation License, Version 1.1 or
16 any later version published by the Free Software Foundation; with the
17 Invariant Sections being this .ig-section and AUTHORS, with no
18 Front-Cover Texts, and with no Back-Cover Texts.
20 A copy of the Free Documentation License is included as a file called
21 FDL in the main directory of the groff source package.
24 .\" --------------------------------------------------------------------
25 .\" Setup
26 .\" --------------------------------------------------------------------
28 .\" ----------------- Document configuration
30 .\" Number register to decide whether the commands `{' and `}' are used
31 .\" 0: disable (actual default); 1: enable
32 .nr @USE_ENV_STACK 0
34 .ig
35 Unfortunately, old versions of groff used an illogical position change
36 after some D\~commands (Dp, DP, Dt).  If the number register
37 @STUPID_DRAWING_POSITIONING is 1 (actual default) then change position
38 after these commands, otherwise the position is not changed.
40 .nr @STUPID_DRAWING_POSITIONING 1
42 .\" ----------------- Semantical definitions
44 .nr @maxcolor 65536
45 .ds @backslash \[rs]\"
46 .ds @linebreak \fR\[la]line_break\[ra]\fP\"
48 .\" Begin of macro definitions
50 .de offset
51 .RI ( \,\\$1\/ ,\  \,\\$2\/ )\\$3
53 .de indexed_offset
54 .offset \fI\\$1\fP\d\s-3\\$2\s+3\u \fI\\$3\fP\d\s-3\\$4\s+3\u \\$5
56 .\" format: .command <name> "<arguments>" <punctuation>
57 .de command
58 \fB\\$1\fP\ \fI\,\\$2\/\fP\\$3
60 .\" format: .D-command <subcommand> "<arguments>"
61 .de D-command
62 \fBD\\$1\fP\ \fI\,\\$2\/\fP\|\*[@linebreak]
65 .\" We set these as troff micromotions rather than eqn because \d and \u 
66 .\" can be lifted to XML subscript/superscript tags.  Don't change
67 .\" these to a parameterized string, man2html won't handle that.
68 .ds hv1 \fIh\d\s-3\&1\s+3\u\~v\d\s-3\&1\s+3\u\fP 
69 .ds hv2 \fIh\d\s-3\&2\s+3\u\~v\d\s-3\&2\s+3\u\fP
70 .ds hvn \fIh\d\s-3\&n\s+3\u\~v\d\s-3\&n\s+3\u\fP
72 .de Da-command
73 \fBDa\fP\ \*[hv1] \*[hv2]\|\*[@linebreak]
75 .\" graphics command .D with a variable number of arguments
76 .\" format: .D-multiarg <subcommand>
77 .de D-multiarg
78 \fBD\\$1\fP\ \*[hv1] \*[hv2] ... \*[hvn]\|\*[@linebreak]
80 .\" format: .x-command <subname> "<arguments>"
81 .de x-command
82 \fBx\\$1\fP\ \fI\\$2\fP\|\*[@linebreak]
84 .de xsub
85 .RI "(" "\\$1" " control command)"
86 .br
88 .\" End of macro definitions 
91 .\" --------------------------------------------------------------------
92 .\" Title
93 .\" --------------------------------------------------------------------
95 .TH GROFF_OUT @MAN5EXT@ "@MDATE@" "Groff Version @VERSION@"
97 .SH NAME
98 groff_out \- groff intermediate output format
101 .\" --------------------------------------------------------------------
102 .SH DESCRIPTION
103 .\" --------------------------------------------------------------------
105 This manual page describes the
106 .I intermediate output
107 format of the GNU
108 .BR roff (@MAN7EXT@)
109 text processing system
110 .BR groff (@MAN1EXT@).
112 This output is produced by a run of the GNU
113 .BR @g@troff (@MAN1EXT@)
114 program.
116 It contains already all device-specific information, but it is not yet
117 fed into a device postprocessor program.
121 As the GNU
122 .I roff
123 processor
124 .BR groff (@MAN1EXT@)
125 is a wrapper program around
126 .B @g@troff
127 that automatically calls a
128 postprocessor, this output does not show up normally.
130 This is why it is called
131 .I intermediate
132 within the
133 .I groff
134 .IR system .
137 .B groff
138 program provides the option
139 .B -Z
140 to inhibit postprocessing, such that the produced
141 .I intermediate output
142 is sent to standard output just like calling
143 .B @g@troff
144 manually.
148 In this document, the term
149 .I @g@troff output
150 describes what is output by the GNU
151 .B @g@troff
152 program, while
153 .I intermediate output
154 refers to the language that is accepted by the parser that prepares
155 this output for the postprocessors.
157 This parser is smarter on whitespace and implements obsolete elements
158 for compatibility, otherwise both formats are the same.
160 Both formats can be viewed directly with
161 .BR \%gxditview (@MAN1EXT@).
165 The main purpose of the
166 .I intermediate output
167 concept is to facilitate the development of postprocessors by
168 providing a common programming interface for all devices.
170 It has a language of its own that is completely different from the
171 .BR groff (@MAN7EXT@)
172 language.
174 While the
175 .I groff
176 language is a high-level programming language for text processing, the
177 .I intermediate output
178 language is a kind of low-level assembler language by specifying all
179 positions on the page for writing and drawing.
184 .RI pre- groff
185 .I roff
186 versions are denoted as
187 .I classical
188 .IR troff .
190 .I intermediate output
191 produced by
192 .B groff
193 is fairly readable, while
194 .I classical troff
195 output was hard to understand because of strange habits that are
196 still supported, but not used any longer by
197 .I GNU
198 .IR @g@troff .
201 .\" --------------------------------------------------------------------
202 .SH "LANGUAGE CONCEPTS"
203 .\" --------------------------------------------------------------------
205 During the run of
206 .BR @g@troff , 
208 .I roff
209 input is cracked down to the information on what has to be printed at
210 what position on the intended device.
212 So the language of the
213 .I intermediate output
214 format can be quite small.
216 Its only elements are commands with or without arguments.
218 In this document, the term "command" always refers to the
219 .I intermediate output
220 language, never to the
221 .I roff
222 language used for document formatting.
224 There are commands for positioning and text writing, for drawing, and
225 for device controlling.
228 .\" --------------------------------------------------------------------
229 .SS "Separation"
230 .\" --------------------------------------------------------------------
232 .I Classical troff output
233 had strange requirements on whitespace.
236 .B groff
237 output parser, however, is smart about whitespace by making it
238 maximally optional.
240 The whitespace characters, i.e., the
241 .IR tab ,
242 .IR space ,
244 .I newline
245 characters, always have a syntactical meaning.
247 They are never printable because spacing within the output is always
248 done by positioning commands.
252 Any sequence of
253 .I space
255 .I tab
256 characters is treated as a single
257 .I syntactical
258 .IR space .
260 It separates commands and arguments, but is only required when there
261 would occur a clashing between the command code and the arguments
262 without the space.
264 Most often, this happens when variable length command names,
265 arguments, argument lists, or command clusters meet.
267 Commands and arguments with a known, fixed length need not be
268 separated by
269 .I syntactical
270 .IR space .
274 A line break is a syntactical element, too.
276 Every command argument can be followed by whitespace, a comment, or a
277 newline character.
279 Thus a
280 .I syntactical line break
281 is defined to consist of optional
282 .I syntactical space
283 that is optionally followed by a comment, and a newline character.
287 The normal commands, those for positioning and text, consist of a
288 single letter taking a fixed number of arguments.
290 For historical reasons, the parser allows to stack such commands on
291 the same line, but fortunately, in
292 .I groff intermediate
293 .IR output ,
294 every command with at least one argument is followed by a line break,
295 thus providing excellent readability.
298 The other commands \[em] those for drawing and device controlling \[em]
299 have a more complicated structure; some recognize long command names,
300 and some take a variable number of arguments.
302 So all
303 .B D
305 .B x
306 commands were designed to request a
307 .I syntactical line break
308 after their last argument.
310 Only one command,
311 .RB ` x\ X '
312 has an argument that can stretch over several lines, all other
313 commands must have all of their arguments on the same line as the
314 command, i.e., the arguments may not be split by a line break.
317 Empty lines, i.e., lines containing only space and/or a comment, can
318 occur everywhere.
320 They are just ignored.
323 .\" --------------------------------------------------------------------
324 .SS "Argument Units"
325 .\" --------------------------------------------------------------------
327 Some commands take integer arguments that are assumed to represent
328 values in a measurement unit, but the letter for the corresponding
329 .I scale indicator
330 is not written with the output command arguments; see
331 .BR groff (@MAN7EXT@)
332 and the
333 .I groff info file
334 for more on this topic.
336 Most commands assume the scale indicator\~\c
337 .BR u ,
338 the basic unit of the device, some use\~\c
339 .BR z , 
341 .I scaled point unit
342 of the device, while others, such as the color commands expect plain
343 integers.
345 Note that these scale indicators are relative to the chosen device.
347 They are defined by the parameters specified in the device's
348 .I DESC
349 file; see
350 .BR groff_font (@MAN5EXT@).
354 Note that single characters can have the eighth bit set, as can the
355 names of fonts and special characters.
357 The names of characters and fonts can be of arbitrary length.
359 A character that is to be printed will always be in the current font.
363 A string argument is always terminated by the next whitespace
364 character (space, tab, or newline); an embedded
365 .B #
366 character is regarded as part of the argument, not as the beginning of
367 a comment command.
369 An integer argument is already terminated by the next non-digit
370 character, which then is regarded as the first character of the next
371 argument or command.
374 .\" --------------------------------------------------------------------
375 .SS "Document Parts"
376 .\" --------------------------------------------------------------------
377 A correct
378 .I intermediate output
379 document consists of two parts, the
380 .I prologue
381 and the
382 .IR body .
385 The task of the
386 .I prologue
387 is to set the general device parameters using three exactly specified
388 commands.
391 .I groff prologue
392 is guaranteed to consist of the following three lines (in that order):
395 .B x\ T
396 .I device
398 .B x\ res
399 .I n\ h\ v
401 .B x init
404 with the arguments set as outlined in the section
405 .BR "Device Control Commands" .
407 But the parser for the
408 .I intermediate output
409 format is able to swallow additional whitespace and comments as well.
414 .I body
415 is the main section for processing the document data.
417 Syntactically, it is a sequence of any commands different from the
418 ones used in the
419 .IR prologue .
421 Processing is terminated as soon as the first
422 .B x\ stop
423 command is encountered; the last line of any
424 .I groff intermediate output
425 always contains such a command.
429 Semantically, the
430 .I body
431 is page oriented.
433 A new page is started by a
434 .BR p \~command.
436 Positioning, writing, and drawing commands are always done within the
437 current page, so they cannot occur before the first
438 .BR p \~command.
440 Absolute positioning (by the
441 .B H
443 .BR V \~commands)
444 is done relative to the current page, all other positioning
445 is done relative to the current location within this page.
448 .\" --------------------------------------------------------------------
449 .SH "COMMAND REFERENCE"
450 .\" --------------------------------------------------------------------
452 This section describes all
453 .I intermediate output
454 commands, the classical commands as well as the
455 .I groff
456 extensions.
459 .\" --------------------------------------------------------------------
460 .SS "Comment Command"
461 .\" --------------------------------------------------------------------
464 .BI # anything \[la]end_of_line\[ra]
465 A comment.
467 Ignore any characters from the
468 .BR # \~\c
469 character up to the next newline character.
472 This command is the only possibility for commenting in the
473 .I intermediate
474 .IR output .
476 Each comment can be preceded by arbitrary
477 .I syntactical
478 .IR space ;
479 every command can be terminated by a comment.
482 .\" --------------------------------------------------------------------
483 .SS "Simple Commands"
484 .\" --------------------------------------------------------------------
486 The commands in this subsection have a command code consisting of a
487 single character, taking a fixed number of arguments.
489 Most of them are commands for positioning and text writing.
491 These commands are smart about whitespace.
493 Optionally,
494 .I syntactical space
495 can be inserted before, after, and between the command letter and its
496 arguments.
498 All of these commands are stackable, i.e., they can be preceded by
499 other simple commands or followed by arbitrary other commands on the
500 same line.
502 A separating
503 .I syntactical space
504 is only necessary when two integer arguments would clash or if the
505 preceding argument ends with a string argument.
508 .if \n[@USE_ENV_STACK]=1 \{\
510 .command {
511 Open a new environment by copying the actual device configuration data
512 to the environment stack.
514 The current environment is setup by the device specification and
515 manipulated by the setting commands.
519 .command }
520 Close the actual environment (opened by a preceding
521 .BR { \~command)
522 and restore the previous environment from the environment
523 stack as the actual device configuration data.
525 .\}              \" endif @USE_ENV_STACK
529 .command C xxx \[la]white_space\[ra]
530 Print a special groff character named
531 .IR xxx .
533 The trailing
534 .I syntactical space
536 .I line break
537 is necessary to allow character names of arbitrary length.
539 The character is printed at the current print position; the
540 character's size is read from the font file.
542 The print position is not changed.
546 .command c c
547 Print character\~\c
548 .IR c
549 at the current print position;
550 the character's size is read from the font file.
552 The print position is not changed.
556 .command f n
557 Set font to font number\~\c
558 .IR n
559 (a non-negative integer).
563 .command H n
564 Move right to the absolute vertical position\~\c
565 .IR n
566 (a non-negative integer in basic units\~\c
567 .BR u )
568 relative to left edge of current page.
572 .command h n
573 Move
574 .IR n
575 (a non-negative integer) basic units\~\c
576 .BR u
577 horizontally to the right.
579 .I [CSTR\~#54]
580 allows negative values for
581 .I n
582 also, but
583 .I groff
584 doesn't use this.
588 .command m "color_scheme \fR[\fPcomponent .\|.\|.\fR]\fP"
589 Set the color for text (glyphs), line drawing, and the outline of
590 graphic objects using different color schemes; the analoguous command
591 for the filling color of graphic objects is
592 .BR DF .
594 The color components are specified as integer arguments between 0 and
595 \n[@maxcolor].
597 The number of color components and their meaning vary for the
598 different color schemes.
600 These commands are generated by the
601 .I groff
602 escape sequence
603 .BR \*[@backslash]m .
605 No position changing.
607 These commands are a
608 .I groff
609 extension.
615 .command mc "cyan magenta yellow"
616 Set color using the CMY color scheme, having the 3\~color components
617 cyan, magenta, and yellow.
621 .command md
622 Set color to the default color value
623 (black in most cases).
625 No component arguments.
629 .command mg "gray"
630 Set color to the shade of gray given by the argument, an integer
631 between 0 (black) and \n[@maxcolor] (white).
635 .command mk "cyan magenta yellow black"
636 Set color using the CMYK color scheme, having the 4\~color components
637 cyan, magenta, yellow, and black.
640 .command mr "red green blue"
641 Set color using the RGB color scheme, having the 3\~color components
642 red, green, and blue.
648 .command N n
649 Print character with index\~\c
650 .IR n
651 (an integer, normally non-negative) of the current font.
653 The print position is not changed.
656 .B \-T\~html
657 is used, negative values are emitted also to indicate an unbreakable space
658 with given width.
660 For example,
661 .B N\~-193
662 represents an unbreakable space which has a width of 193u.
664 This command is a
665 .I groff
666 extension.
670 .command n b\ a
671 Inform the device about a line break, but no positioning is done by
672 this command.
675 .I classical
676 .IR troff ,
677 the integer arguments
678 .IR b
679 and\~\c
680 .IR a
681 informed about the space before and after the current line to
682 make the
683 .I intermediate output
684 more human readable without performing any action.
687 .IR groff ,
688 they are just ignored, but they must be provided for compatibility
689 reasons.
693 .command p n
694 Begin a new page in the outprint.
696 The page number is set to\~\c
697 .IR n .
699 This page is completely independent of pages formerly processed even
700 if those have the same page number.
702 The vertical position on the outprint is automatically set to\~0.
704 All positioning, writing, and drawing is always done relative to a
705 page, so a
706 .BR p \~command
707 must be issued before any of these commands.
711 .command s n
712 Set point size to
713 .IR n
714 scaled points
715 (this is unit\~\c
716 .BR z
717 in GNU
718 .BR @g@troff ).
720 .I Classical troff
721 used the unit
722 .I points
724 .BR p )
725 instead; see section
726 .BR COMPATIBILITY .
730 .command t xxx \[la]white_space\[ra]
732 .command t "xxx dummy_arg" \[la]white_space\[ra]
733 Print a word, i.e., a sequence of characters
734 .IR xxx
735 terminated by a space character or a line break; an optional second
736 integer argument is ignored (this allows the formatter to generate
737 an even number of arguments).
739 The first character should be printed at the current position, the
740 current horizontal position should then be increased by the width of
741 the first character, and so on for each character.
743 The widths of the characters are read from the font file, scaled for the
744 current point size, and rounded to a multiple of the horizontal
745 resolution.
747 Special characters cannot be printed using this command (use the
748 .B C
749 command for named characters).
751 This command is a
752 .I groff
753 extension; it is only used for devices whose
754 .I DESC
755 file contains the
756 .B tcommand
757 keyword; see
758 .BR groff_font (@MAN5EXT@).
762 .command u "n xxx" \[la]white_space\[ra]
763 Print word with track kerning.
765 This is the same as the
766 .B t
767 command except that after printing each character, the current
768 horizontal position is increased by the sum of the width of that
769 character and\~\c
770 .IR n
771 (an integer in
772 basic units\~\c
773 .BR u ).
774 This command is a
775 .I groff
776 extension; it is only used for devices whose
777 .I DESC
778 file contains the
779 .B tcommand
780 keyword; see
781 .BR groff_font (@MAN5EXT@).
785 .command V n
786 Move down to the absolute vertical position\~\c
787 .IR n
788 (a non-negative integer in basic units\~\c
789 .BR u )
790 relative to upper edge of current page.
794 .command v n
795 Move
796 .IR n
797 basic units\~\c
798 .BR u
799 down
800 .RI ( n
801 is a non-negative integer).
803 .I [CSTR\~#54]
804 allows negative values for
805 .I n
806 also, but
807 .I groff
808 doesn't use this.
812 .command w
813 Informs about a paddable whitespace to increase readability.
815 The spacing itself must be performed explicitly by a move command.
818 .\" --------------------------------------------------------------------
819 .SS "Graphics Commands"
820 .\" --------------------------------------------------------------------
822 Each graphics or drawing command in the
823 .I intermediate output
824 starts with the letter\~\c
825 .B D
826 followed by one or two characters that specify a subcommand; this
827 is followed by a fixed or variable number of integer arguments that
828 are separated by a single space character.
831 .B D\c
832 \~command
833 may not be followed by another command on the same line (apart from a
834 comment), so each
835 .B D\c
836 \~command
837 is terminated by a
838 .I syntactical line
839 .IR break .
843 .B @g@troff
844 output follows the classical spacing rules (no space between command
845 and subcommand, all arguments are preceded by a single space
846 character), but the parser allows optional space between the command
847 letters and makes the space before the first argument optional.
849 As usual, each space can be any sequence of tab and space characters.
853 Some graphics commands can take a variable number of arguments.
855 In this case, they are integers representing a size measured in basic
856 units\~\c
857 .BR u .
859 The 
860 .I h 
861 arguments
862 stand for horizontal distances where positive means right, negative
863 left.
865 The 
866 .I v 
867 arguments
868 stand for vertical distances where positive means down, negative up.
870 All these distances are offsets relative to the current location.
874 Unless indicated otherwise, each graphics command directly corresponds
875 to a similar
876 .I groff
877 .B \*[@backslash]D
878 escape sequence; see
879 .BR groff (@MAN7EXT@).
883 Unknown
884 .B D\c
885 \~commands are assumed to be device-specific.
887 Its arguments are parsed as strings; the whole information is then
888 sent to the postprocessor.
892 In the following command reference, the syntax element
893 .I \[la]line_break\[ra]
894 means a
895 .I syntactical line break
896 as defined in section
897 .BR Separation .
901 .D-multiarg ~
902 Draw B-spline from current position to offset
903 .indexed_offset h 1 v 1 ,
904 then to offset
905 .indexed_offset h 2 v 2
906 if given, etc.\& up to
907 .indexed_offset h n v n .
908 This command takes a variable number of argument pairs; the current
909 position is moved to the terminal point of the drawn curve.
913 .Da-command
914 Draw arc from current position to
915 .indexed_offset h 1 v 1 \|+\|\c
916 .indexed_offset h 2 v 2
917 with center at
918 .indexed_offset h 1 v 1 ;
919 then move the current position to the final point of the arc.
923 .D-command C d
925 .D-command C "d dummy_arg"
926 Draw a solid circle using the current fill color with diameter\~\c
927 .IR d
928 (integer in basic units\~\c
929 .BR u )
930 with leftmost point at the current position; then move the current
931 position to the rightmost point of the circle.
933 An optional second integer argument is ignored (this allows to the
934 formatter to generate an even number of arguments).
936 This command is a
937 .I groff
938 extension.
942 .D-command c d
943 Draw circle line with diameter\~\c
944 .IR d
945 (integer in basic units\~\c
946 .BR u )
947 with leftmost point at the current position; then move the current
948 position to the rightmost point of the circle.
952 .D-command E "h v"
953 Draw a solid ellipse in the current fill color with a horizontal
954 diameter of\~\c
955 .IR h
956 and a vertical diameter of\~\c
957 .IR v
958 (both integers in basic units\~\c
959 .BR u )
960 with the leftmost point at the current position; then move to the
961 rightmost point of the ellipse.
963 This command is a
964 .I groff
965 extension.
969 .D-command e "h v"
970 Draw an outlined ellipse with a horizontal diameter of\~\c
971 .IR h
972 and a vertical diameter of\~\c
973 .IR v
974 (both integers in basic units\~\c
975 .BR u )
976 with the leftmost point at current position; then move to the
977 rightmost point of the ellipse.
981 .D-command F "color_scheme \fR[\fPcomponent .\|.\|.\fR]\fP"
982 Set fill color for solid drawing objects using different color
983 schemes; the analoguous command for setting the color of text, line
984 graphics, and the outline of graphic objects is
985 .BR m .
987 The color components are specified as integer arguments between 0 and
988 \n[@maxcolor].
990 The number of color components and their meaning vary for the
991 different color schemes.
993 These commands are generated by the
994 .I groff
995 escape sequences
996 .B \*[@backslash]D'F\ .\|.\|.'
998 .B \*[@backslash]M
999 (with no other corresponding graphics commands).
1001 No position changing.
1003 This command is a
1004 .I groff
1005 extension.
1011 .D-command Fc "cyan magenta yellow"
1012 Set fill color for solid drawing objects using the CMY color scheme,
1013 having the 3\~color components cyan, magenta, and yellow.
1017 .D-command Fd
1018 Set fill color for solid drawing objects to the default fill color value
1019 (black in most cases).
1021 No component arguments.
1025 .D-command Fg "gray"
1026 Set fill color for solid drawing objects to the shade of gray given by
1027 the argument, an integer between 0 (black) and \n[@maxcolor] (white).
1031 .D-command Fk "cyan magenta yellow black"
1032 Set fill color for solid drawing objects using the CMYK color scheme,
1033 having the 4\~color components cyan, magenta, yellow, and black.
1036 .D-command Fr "red green blue"
1037 Set fill color for solid drawing objects using the RGB color scheme,
1038 having the 3\~color components red, green, and blue.
1044 .D-command f n
1045 The argument
1046 .IR n
1047 must be an integer in the range -32767 to 32767.
1051 .RI "0 \[<=] " n " \[<=] 1000"
1052 Set the color for filling solid drawing objects to a shade of gray,
1053 where 0 corresponds to solid white, 1000 (the default) to solid black,
1054 and values in between to intermediate shades of gray; this is
1055 obsoleted by command
1056 .BR DFg .
1059 .IR n " < 0 or " n " > 1000"
1060 Set the filling color to the color that is currently being used for
1061 the text and the outline, see command
1062 .BR m .
1063 For example, the command sequence
1066 .ft CB
1069 mg 0 0 \n[@maxcolor]
1070 Df -1
1075 sets all colors to blue.
1080 No position changing.
1082 This command is a
1083 .I groff
1084 extension.
1090 .D-command l "h v"
1091 Draw line from current position to offset
1092 .offset h v
1093 (integers in basic units\~\c
1094 .BR u );
1095 then set current position to the end of the drawn line.
1099 .D-multiarg p
1100 Draw a polygon line from current position to offset
1101 .offset h1 v1 ,
1102 from there to offset
1103 .offset h2 v2 ,
1104 etc.\& up to offset
1105 .offset hn vn ,
1106 and from there back to the starting position.
1108 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1109 For historical reasons, the position is changed by adding the sum of
1110 all arguments with odd index to the actual horizontal position and the
1111 even ones to the vertical position.
1113 Although this doesn't make sense it is kept for compatibility.
1116 .el \{\
1117 As the polygon is closed, the end of drawing is the starting point, so
1118 the position doesn't change.
1121 This command is a
1122 .I groff
1123 extension.
1127 .D-multiarg P
1128 The same macro as the corresponding
1129 .B Dp
1130 command with the same arguments, but draws a solid polygon in the
1131 current fill color rather than an outlined polygon.
1133 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1134 The position is changed in the same way as with
1135 .BR Dp .
1137 .el \
1138 No position changing.
1140 This command is a
1141 .I groff
1142 extension.
1146 .D-command t n
1147 Set the current line thickness to\~\c
1148 .IR n
1149 (an integer in basic units\~\c
1150 .BR u )
1152 .IR n >0;
1154 .IR n =0
1155 select the smallest available line thickness; if
1156 .IR n <0
1157 set the line thickness proportional to the point size (this is the
1158 default before the first
1159 .B Dt
1160 command was specified).
1162 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1163 For historical reasons, the horizontal position is changed by adding
1164 the argument to the actual horizontal position, while the vertical
1165 position is not changed.
1167 Although this doesn't make sense it is kept for compatibility.
1170 .el \
1171 No position changing.
1173 This command is a
1174 .I groff
1175 extension.
1178 .\" --------------------------------------------------------------------
1179 .SS "Device Control Commands"
1180 .\" --------------------------------------------------------------------
1182 Each device control command starts with the letter
1183 .B x
1184 followed by a space character (optional or arbitrary space/\:tab in
1185 .IR groff )
1186 and a subcommand letter or word; each argument (if any) must be
1187 preceded by a
1188 .I syntactical
1189 .IR space .
1192 .B x
1193 commands are terminated by a
1194 .IR "syntactical line break" ;
1195 no device control command can be followed by another command on the same
1196 line (except a comment).
1199 The subcommand is basically a single letter, but to increase
1200 readability, it can be written as a word, i.e., an arbitrary sequence
1201 of characters terminated by the next tab, space, or newline character.
1203 All characters of the subcommand word but the first are simply ignored.
1205 For example,
1206 .B @g@troff
1207 outputs the initialization command
1208 .B x\ i
1210 .B x\ init
1211 and the resolution command
1212 .B x\ r
1214 .BR "x\ res" .
1216 But writings like
1217 .B x\ i_like_groff
1219 .B x\ roff_is_groff
1220 resp.\& are accepted as well to mean the same commands.
1223 In the following, the syntax element
1224 .I \[la]line_break\[ra]
1225 means a
1226 .I syntactical line break
1227 as defined in section
1228 .BR Separation .
1231 .x-command F name
1232 .xsub Filename
1234 .IR name
1235 as the intended name for the current file in error reports.
1237 This is useful for remembering the original file name when
1238 .B groff
1239 uses an internal piping mechanism.
1241 The input file is not changed by this command.
1243 This command is a
1244 .I groff
1245 extension.
1249 .x-command f "n\ s"
1250 .xsub font
1251 Mount font position\~\c
1252 .IR n
1253 (a non-negative integer) with font named\~\c
1254 .IR s
1255 (a text word),
1257 .BR groff_font (@MAN5EXT@).
1261 .x-command H n
1262 .xsub Height
1263 Set character height to\~\c
1264 .IR n
1265 (a positive integer in scaled points\~\c
1266 .BR z ).
1268 .I Classical troff
1269 used the unit points (\c
1270 .BR p )
1271 instead; see section
1272 .BR COMPATIBILITY .
1276 .x-command i
1277 .xsub init
1278 Initialize device.
1280 This is the third command of the
1281 .IR prologue .
1285 .x-command p
1286 .xsub pause
1287 Parsed but ignored.
1289 The classical documentation reads
1290 .I pause device, can be
1291 .IR restarted .
1295 .x-command r "n\ h\ v"
1296 .xsub resolution
1297 Resolution is\~\c
1298 .IR n ,
1299 while
1300 .IR h
1301 is the minimal horizontal motion, and
1302 .IR v
1303 the minimal vertical motion possible with this device; all arguments
1304 are positive integers in basic units\~\c
1305 .BR u
1306 per inch.
1308 This is the second command of the
1309 .IR prologue .
1313 .x-command S n
1314 .xsub Slant
1315 Set slant to\~\c
1316 .IR n
1317 degrees (an integer in basic units\~\c
1318 .BR u ).
1322 .x-command s
1323 .xsub stop
1324 Terminates the processing of the current file; issued as the last
1325 command of any
1326 .I intermediate @g@troff
1327 .IR output .
1331 .x-command t
1332 .xsub trailer
1333 Generate trailer information, if any.
1336 .BR groff ,
1337 this is actually just ignored.
1341 .x-command T xxx
1342 .xsub Typesetter
1343 Set name of device to word
1344 .IR xxx ,
1345 a sequence of characters ended by the next whitespace character.
1347 The possible device names coincide with those from the groff
1348 .B -T
1349 option.
1351 This is the first command of the
1352 .IR prologue .
1356 .x-command u n
1357 .xsub underline
1358 Configure underlining of spaces.
1361 .IR n
1362 is\~1, start underlining of spaces;
1364 .IR n
1365 is\~0, stop underlining of spaces.
1367 This is needed for the
1368 .B cu
1369 request in
1370 .B @g@nroff
1371 mode and is ignored otherwise.
1373 This command is a
1374 .I groff
1375 extension.
1379 .x-command X anything
1380 .xsub X-escape
1381 Send string
1382 .IR anything
1383 uninterpreted to the device.
1385 If the line following this command starts with a
1386 .B +
1387 character this line is interpreted as a continuation line in the
1388 following sense.
1391 .B +
1392 is ignored, but a newline character is sent instead to the device, the
1393 rest of the line is sent uninterpreted.
1395 The same applies to all following lines until the first character of a
1396 line is not a
1397 .B +
1398 character.
1400 This command is generated by the
1401 .I groff
1402 escape sequence
1403 .BR \*[@backslash]X .
1405 The line-continuing feature is a
1406 .I groff
1407 extension.
1410 .\" --------------------------------------------------------------------
1411 .SS "Obsolete Command"
1412 .\" --------------------------------------------------------------------
1415 .I classical troff
1416 output, the writing of a single character was mostly done by a very
1417 strange command that combined a horizontal move and the printing of a
1418 character.
1420 It didn't have a command code, but is represented by a 3-character
1421 argument consisting of exactly 2\~digits and a character.
1424 .IR ddc
1425 Move right
1426 .IR dd
1427 (exactly two decimal digits) basic units\~\c
1428 .BR u ,
1429 then print character\~\c
1430 .IR c .
1436 .IR groff ,
1437 arbitrary
1438 .I syntactical space
1439 around and within this command is allowed to be added.
1441 Only when a preceding command on the same line ends with an argument
1442 of variable length a separating space is obligatory.
1445 .I classical
1446 .IR troff ,
1447 large clusters of these and other commands were used, mostly without
1448 spaces; this made such output almost unreadable.
1454 For modern high-resolution devices, this command does not make sense
1455 because the width of the characters can become much larger than two
1456 decimal digits.
1459 .BR groff ,
1460 this is only used for the devices
1461 .BR X75 ,
1462 .BR X75-12 ,
1463 .BR X100 ,
1465 .BR X100-12 .
1467 For other devices,
1468 the commands
1469 .B t
1470 and\~\c
1471 .B u
1472 provide a better functionality.
1475 .\" --------------------------------------------------------------------
1476 .SH "POSTPROCESSING"
1477 .\" --------------------------------------------------------------------
1480 .I roff
1481 postprocessors are programs that have the task to translate the
1482 .I intermediate output
1483 into actions that are sent to a device.
1485 A device can be some piece of hardware such as a printer, or a software
1486 file format suitable for graphical or text processing.
1489 .I groff
1490 system provides powerful means that make the programming of such
1491 postprocessors an easy task.
1493 There is a library function that parses the
1494 .I intermediate output
1495 and sends the information obtained to the device via methods of a
1496 class with a common interface for each device.
1498 So a
1499 .I groff
1500 postprocessor must only redefine the methods of this class.
1502 For details, see the reference in section
1503 .BR FILES .
1506 .\" --------------------------------------------------------------------
1507 .SH "EXAMPLES"
1508 .\" --------------------------------------------------------------------
1510 This section presents the
1511 .I intermediate output
1512 generated from the same input for three different devices.
1514 The input is the sentence
1515 .I hell world
1516 fed into
1517 .B groff
1518 on the command line.
1521 .IP \[bu] 2m 
1522 High-resolution device
1523 .I ps
1529 \fBshell>\fP echo "hell world" | groff -Z -T ps
1535 .ft CB
1536 x T ps
1537 x res 72000 1 1
1538 x init
1540 x font 5 TR
1542 s10000
1543 V12000
1544 H72000
1545 thell
1546 wh2500
1548 H96620
1549 torld
1550 n12000 0
1551 x trailer
1552 V792000
1553 x stop
1554 .ft P
1560 This output can be fed into the postprocessor
1561 .BR grops (@MAN1EXT@)
1562 to get its representation as a PostScript file.
1565 .IP \[bu] 2m 
1566 Low-resolution device
1567 .I latin1
1572 This is similar to the high-resolution device except that the
1573 positioning is done at a minor scale.
1575 Some comments (lines starting with
1576 .IR # )
1577 were added for clarification; they were not generated by the
1578 formatter.
1583 \fBshell>\fP "hell world" | groff -Z -T latin1
1589 .I "# prologue"
1590 .ft CB
1591 x T latin1
1592 x res 240 24 40
1593 x init
1594 .I "# begin a new page"
1595 .ft CB
1597 .I "# font setup"
1598 .ft CB
1599 x font 1 R
1602 .I "# initial positioning on the page"
1603 .ft CB
1606 .I "# write text `hell'"
1607 .ft CB
1608 thell
1609 .I "# inform about a space, and do it by a horizontal jump"
1610 .ft CB
1611 wh24
1612 .I "# write text `world'"
1613 .ft CB
1614 tworld
1615 .I "# announce line break, but do nothing because ..."
1616 .ft CB
1617 n40 0
1618 .I "# ... the end of the document has been reached"
1619 .ft CB
1620 x trailer
1621 V2640
1622 x stop
1623 .ft P
1629 This output can be fed into the postprocessor
1630 .BR grotty (@MAN1EXT@)
1631 to get a formatted text document.
1634 .IP \[bu] 2m 
1635 Classical style output
1640 As a computer monitor has a very low resolution compared to modern
1641 printers the
1642 .I intermediate output
1643 for the X\~devices can use the jump-and-write command with its 2-digit
1644 displacements.
1649 \fBshell>\fP "hell world" | groff -Z -T X100
1655 .ft CB
1656 x T X100
1657 x res 100 1 1
1658 x init
1660 x font 5 TR
1664 H100
1665 .I "# write text with old-style jump-and-write command"
1666 .ft CB
1667 ch07e07l03lw06w11o07r05l03dh7
1668 n16 0
1669 x trailer
1670 V1100
1671 x stop
1672 .ft P
1678 This output can be fed into the postprocessor
1679 .BR \%xditview (1x)
1681 .BR \%gxditview (@MAN1EXT@)
1682 for displaying in\~X.
1686 Due to the obsolete jump-and-write command, the text clusters in the
1687 classical output are almost unreadable.
1690 .\" --------------------------------------------------------------------
1691 .SH "COMPATIBILITY"
1692 .\" --------------------------------------------------------------------
1695 .I intermediate output
1696 language of the 
1697 .I classical troff
1698 was first documented in
1699 .IR [CSTR\~#97] .
1702 .I groff intermediate output
1703 format is compatible with this specification except for the following
1704 features.
1707 .IP \[bu] 2m 
1708 The classical quasi device independence is not yet implemented.
1711 .IP \[bu] 2m 
1712 The old hardware was very different from what we use today.
1714 So the
1715 .I groff
1716 devices are also fundamentally different from the ones in
1717 .I classical
1718 .IR troff .
1720 For example, the classical PostScript device was called
1721 .I post
1722 and had a resolution of 720 units per inch,
1723 while
1724 .IR groff 's
1725 .I ps
1726 device has a resolution of 72000 units per inch.
1728 Maybe, by implementing some rescaling mechanism similar to the
1729 classical quasi device independence, these could be integrated into
1730 modern
1731 .IR groff .
1734 .IP \[bu] 2m 
1735 The B-spline command
1736 .B D~
1737 is correctly handled by the
1738 .I intermediate output
1739 parser, but the drawing routines aren't implemented in some of the
1740 postprocessor programs.
1743 .IP \[bu] 2m 
1744 The argument of the commands
1745 .B s
1747 .B x H
1748 has the implicit unit scaled point\~\c
1749 .BR z
1751 .IR groff ,
1752 while
1753 .I classical troff
1754 had point (\c
1755 .BR p ).
1757 This isn't an incompatibility, but a compatible extension, for both
1758 units coincide for all devices without a
1759 .I sizescale
1760 parameter, including all classical and the
1761 .I groff
1762 text devices.
1764 The few
1765 .I groff
1766 devices with a sizescale parameter either did not exist, had a
1767 different name, or seem to have had a different resolution.
1769 So conflicts with classical devices are very unlikely.
1772 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1773 .IP \[bu] 2m 
1774 The position changing after the commands
1775 .BR Dp ,
1776 .BR DP ,
1778 .B Dt
1779 is illogical, but as old versions of groff used this feature it is
1780 kept for compatibility reasons.
1781 .\}             \" @STUPID_DRAWING_POSITIONING
1782 .el \{\
1783 .IP \[bu] 2m
1784 Temporarily, there existed some confusion on the positioning after the
1785 .B D
1786 commands that are
1787 .I groff
1788 extensions.
1790 This has been clarified by establishing the classical rule for all
1791 groff drawing commands:
1796 .ft I
1797 The position after a graphic object has been drawn is at its end;
1798 for circles and ellipses, the "end" is at the right side.
1804 From this, the positionings specified for the drawing commands above
1805 follow quite naturally.
1806 .\}             \" @STUPID_DRAWING_POSITIONING
1809 The differences between
1810 .I groff
1812 .I classical troff
1813 are documented in
1814 .BR groff_diff (@MAN7EXT@).
1817 .\" --------------------------------------------------------------------
1818 .SH "FILES"
1819 .\" --------------------------------------------------------------------
1822 .BI @FONTDIR@/dev name /DESC
1823 Device description file for device
1824 .IR name .
1827 .IB \[la]groff_source_dir\[ra] /src/libs/libdriver/input.cpp
1828 Defines the parser and postprocessor for the
1829 .I intermediate
1830 .IR output .
1832 It is located relative to the top directory of the
1833 .I groff
1834 source tree, e.g.
1835 .IR @GROFFSRCDIR@ .
1837 This parser is the definitive specification of the
1838 .I groff intermediate output
1839 format.
1842 .\" --------------------------------------------------------------------
1843 .SH "SEE ALSO"
1844 .\" --------------------------------------------------------------------
1846 A reference like
1847 .BR groff (@MAN7EXT@)
1848 refers to a manual page; here
1849 .B groff
1850 in section\~\c
1851 .I @MAN7EXT@
1852 of the man-page documentation system.
1854 To read the example, look up section\~@MAN7EXT@ in your desktop help
1855 system or call from the shell prompt
1861 \fBshell>\fP man @MAN7EXT@ groff
1867 For more details, see
1868 .BR man (1).
1872 .BR groff (@MAN1EXT@)
1873 option
1874 .B -Z
1875 and further readings on groff.
1879 .BR groff (@MAN7EXT@)
1880 for details of the
1881 .I groff
1882 language such as numerical units and escape sequences.
1886 .BR groff_font (@MAN5EXT@)
1887 for details on the device scaling parameters of the
1888 .B DESC
1889 file.
1893 .BR @g@troff (@MAN1EXT@)
1894 generates the device-independent intermediate output.
1898 .BR roff (@MAN7EXT@)
1899 for historical aspects and the general structure of roff systems.
1903 .BR groff_diff (@MAN7EXT@)
1904 The differences between the intermediate output in groff and classical
1905 troff.
1909 .BR gxditview (@MAN1EXT@)
1910 Viewer for the
1911 .I intermediate
1912 .IR output .
1916 .BR \%grodvi (@MAN1EXT@),
1917 .BR \%grohtml (@MAN1EXT@),
1918 .BR \%grolbp (@MAN1EXT@),
1919 .BR \%grolj4 (@MAN1EXT@),
1920 .BR \%grops (@MAN1EXT@),
1921 .BR \%grotty (@MAN1EXT@)
1924 the groff postprocessor programs.
1929 For a treatment of all aspects of the groff system within a single
1930 document, see the
1931 .I groff info
1932 .IR file .
1934 It can be read within the integrated help systems, within
1935 .BR emacs (1)
1936 or from the shell prompt by
1940 \fBshell>\fP info groff
1947 .I classical troff output language
1948 is described in two AT&T Bell Labs CSTR documents available on-line at
1949 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr.html
1950 Bell Labs CSTR site
1951 .UE .
1955 .I [CSTR #97]
1956 .I A Typesetter-independent TROFF
1958 .I Brian Kernighan
1959 is the original and most comprehensive documentation on the output
1960 language; see
1961 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:97.ps.gz
1962 CSTR\~#97
1963 .UE .
1967 .I [CSTR\~#54]
1968 The 1992 revision of the
1969 .I Nroff/\:Troff User's Manual
1971 .I J.\& F.\& Osanna
1973 .I Brian Kernighan
1974 isn't as comprehensive as
1975 .I [CSTR\~#97]
1976 regarding the output language; see
1977 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:54.ps.gz
1978 CSTR\~#54
1979 .UE .
1982 .\" --------------------------------------------------------------------
1983 .SH "AUTHORS"
1984 .\" --------------------------------------------------------------------
1986 Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007
1987 Free Software Foundation, Inc.
1991 This document is distributed under the terms of the FDL (GNU Free
1992 Documentation License) version 1.1 or later.
1994 You should have received a copy of the FDL with this package; it is also
1995 available on-line at the
1996 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
1997 GNU copyleft site
1998 .UE .
2002 This document is part of
2003 .IR groff ,
2004 the GNU
2005 .I roff
2006 distribution.
2008 It is based on a former version \- published under the GPL \- that
2009 described only parts of the
2010 .I groff
2011 extensions of the output language.
2013 It was rewritten in 2002 by Bernd Warken and is
2014 maintained by
2015 .MT wl@gnu.org
2016 Werner Lemberg
2017 .ME .
2019 .\" --------------------------------------------------------------------
2020 .\" Emacs settings
2021 .\" --------------------------------------------------------------------
2023 .\" Local Variables:
2024 .\" mode: nroff
2025 .\" End: