Merge branch 'topic/prestrip-down'
[s-roff.git] / man / groff_out.man
blob8b6df59cd8c11249d48414ffdee2c62ee7d737e4
1 '\" e
2 .\" The above line should force the use of eqn as a preprocessor
3 .ig
4 groff_out.5
6 This file is part of groff, the GNU roff type-setting system.
8 Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
9 Free Software Foundation, Inc.
10 rewritten from scrach 2001 by Bernd Warken <bwarken@mayn.de>
12 Permission is granted to copy, distribute and/or modify this document
13 under the terms of the GNU Free Documentation License, Version 1.1 or
14 any later version published by the Free Software Foundation; with the
15 Invariant Sections being this .ig-section and AUTHORS, with no
16 Front-Cover Texts, and with no Back-Cover Texts.
18 A copy of the Free Documentation License is included as a file called
19 FDL in the main directory of the groff source package.
22 .\" --------------------------------------------------------------------
23 .\" Setup
24 .\" --------------------------------------------------------------------
26 .\" ----------------- Document configuration
28 .\" Number register to decide whether the commands `{' and `}' are used
29 .\" 0: disable (actual default); 1: enable
30 .nr @USE_ENV_STACK 0
32 .ig
33 Unfortunately, old versions of groff used an illogical position change
34 after some D\~commands (Dp, DP, Dt).  If the number register
35 @STUPID_DRAWING_POSITIONING is 1 (actual default) then change position
36 after these commands, otherwise the position is not changed.
38 .nr @STUPID_DRAWING_POSITIONING 1
40 .\" ----------------- Semantical definitions
42 .nr @maxcolor 65536
43 .ds @backslash \[rs]\"
44 .ds @linebreak \fR\[la]line-break\[ra]\fP\"
46 .\" Begin of macro definitions
48 .de offset
49 .RI ( \,\\$1\/ ,\  \,\\$2\/ )\\$3
51 .de indexed_offset
52 .offset \fI\\$1\fP\d\s-3\\$2\s+3\u \fI\\$3\fP\d\s-3\\$4\s+3\u \\$5
54 .\" format: .command <name> "<arguments>" <punctuation>
55 .de command
56 \fB\\$1\fP\ \fI\,\\$2\/\fP\\$3
58 .\" format: .D-command <subcommand> "<arguments>"
59 .de D-command
60 \fBD\\$1\fP\ \fI\,\\$2\/\fP\|\*[@linebreak]
63 .\" We set these as troff micromotions rather than eqn because \d and \u 
64 .\" can be lifted to XML subscript/superscript tags.  Don't change
65 .\" these to a parameterized string, man2html won't handle that.
66 .ds hv1 \fIh\d\s-3\&1\s+3\u\~v\d\s-3\&1\s+3\u\fP 
67 .ds hv2 \fIh\d\s-3\&2\s+3\u\~v\d\s-3\&2\s+3\u\fP
68 .ds hvn \fIh\d\s-3\&n\s+3\u\~v\d\s-3\&n\s+3\u\fP
70 .de Da-command
71 \fBDa\fP\ \*[hv1] \*[hv2]\|\*[@linebreak]
73 .\" graphics command .D with a variable number of arguments
74 .\" format: .D-multiarg <subcommand>
75 .de D-multiarg
76 \fBD\\$1\fP\ \*[hv1] \*[hv2] .\|.\|. \*[hvn]\|\*[@linebreak]
78 .\" format: .x-command <subname> "<arguments>"
79 .de x-command
80 \fBx\\$1\fP\ \fI\\$2\fP\|\*[@linebreak]
82 .de xsub
83 .RI "(" "\\$1" " control command)"
84 .br
86 .\" End of macro definitions 
89 .\" --------------------------------------------------------------------
90 .\" Title
91 .\" --------------------------------------------------------------------
93 .TH GROFF_OUT @MAN5EXT@ "@MDATE@" "Groff Version @VERSION@"
95 .SH NAME
96 groff_out \- groff intermediate output format
99 .\" --------------------------------------------------------------------
100 .SH DESCRIPTION
101 .\" --------------------------------------------------------------------
103 This manual page describes the
104 .I intermediate output
105 format of the GNU
106 .BR roff (@MAN7EXT@)
107 text processing system
108 .BR groff (@MAN1EXT@).
110 This output is produced by a run of the GNU
111 .BR @g@troff (@MAN1EXT@)
112 program.
114 It contains already all device-specific information, but it is not yet
115 fed into a device postprocessor program.
119 As the GNU
120 .I roff
121 processor
122 .BR groff (@MAN1EXT@)
123 is a wrapper program around
124 .B @g@troff
125 that automatically calls a
126 postprocessor, this output does not show up normally.
128 This is why it is called
129 .I intermediate
130 within the
131 .I groff
132 .IR system .
135 .B groff
136 program provides the option
137 .B -Z
138 to inhibit postprocessing, such that the produced
139 .I intermediate output
140 is sent to standard output just like calling
141 .B @g@troff
142 manually.
146 In this document, the term
147 .I @g@troff output
148 describes what is output by the GNU
149 .B @g@troff
150 program, while
151 .I intermediate output
152 refers to the language that is accepted by the parser that prepares
153 this output for the postprocessors.
155 This parser is smarter on whitespace and implements obsolete elements
156 for compatibility, otherwise both formats are the same.
160 The main purpose of the
161 .I intermediate output
162 concept is to facilitate the development of postprocessors by
163 providing a common programming interface for all devices.
165 It has a language of its own that is completely different from the
166 .BR groff (@MAN7EXT@)
167 language.
169 While the
170 .I groff
171 language is a high-level programming language for text processing, the
172 .I intermediate output
173 language is a kind of low-level assembler language by specifying all
174 positions on the page for writing and drawing.
179 .RI pre- groff
180 .I roff
181 versions are denoted as
182 .I classical
183 .IR troff .
185 .I intermediate output
186 produced by
187 .B groff
188 is fairly readable, while
189 .I classical troff
190 output was hard to understand because of strange habits that are
191 still supported, but not used any longer by
192 .I GNU
193 .IR @g@troff .
196 .\" --------------------------------------------------------------------
197 .SH "LANGUAGE CONCEPTS"
198 .\" --------------------------------------------------------------------
200 During the run of
201 .BR @g@troff , 
203 .I roff
204 input is cracked down to the information on what has to be printed at
205 what position on the intended device.
207 So the language of the
208 .I intermediate output
209 format can be quite small.
211 Its only elements are commands with or without arguments.
213 In this document, the term \[lq]command\[rq] always refers to the
214 .I intermediate output
215 language, never to the
216 .I roff
217 language used for document formatting.
219 There are commands for positioning and text writing, for drawing, and
220 for device controlling.
223 .\" --------------------------------------------------------------------
224 .SS "Separation"
225 .\" --------------------------------------------------------------------
227 .I Classical troff output
228 had strange requirements on whitespace.
231 .B groff
232 output parser, however, is smart about whitespace by making it
233 maximally optional.
235 The whitespace characters, i.e., the
236 .IR tab ,
237 .IR space ,
239 .I newline
240 characters, always have a syntactical meaning.
242 They are never printable because spacing within the output is always
243 done by positioning commands.
247 Any sequence of
248 .I space
250 .I tab
251 characters is treated as a single
252 .I syntactical
253 .IR space .
255 It separates commands and arguments, but is only required when there
256 would occur a clashing between the command code and the arguments
257 without the space.
259 Most often, this happens when variable length command names,
260 arguments, argument lists, or command clusters meet.
262 Commands and arguments with a known, fixed length need not be
263 separated by
264 .I syntactical
265 .IR space .
269 A line break is a syntactical element, too.
271 Every command argument can be followed by whitespace, a comment, or a
272 newline character.
274 Thus a
275 .I syntactical line break
276 is defined to consist of optional
277 .I syntactical space
278 that is optionally followed by a comment, and a newline character.
282 The normal commands, those for positioning and text, consist of a
283 single letter taking a fixed number of arguments.
285 For historical reasons, the parser allows to stack such commands on
286 the same line, but fortunately, in
287 .I groff intermediate
288 .IR output ,
289 every command with at least one argument is followed by a line break,
290 thus providing excellent readability.
293 The other commands \[em] those for drawing and device controlling \[em]
294 have a more complicated structure; some recognize long command names,
295 and some take a variable number of arguments.
297 So all
298 .B D
300 .B x
301 commands were designed to request a
302 .I syntactical line break
303 after their last argument.
305 Only one command,
306 .RB ` x\ X '
307 has an argument that can stretch over several lines, all other
308 commands must have all of their arguments on the same line as the
309 command, i.e., the arguments may not be split by a line break.
312 Empty lines, i.e., lines containing only space and/or a comment, can
313 occur everywhere.
315 They are just ignored.
318 .\" --------------------------------------------------------------------
319 .SS "Argument Units"
320 .\" --------------------------------------------------------------------
322 Some commands take integer arguments that are assumed to represent
323 values in a measurement unit, but the letter for the corresponding
324 .I scale indicator
325 is not written with the output command arguments; see
326 .BR groff (@MAN7EXT@)
327 and the
328 .I groff info file
329 for more on this topic.
331 Most commands assume the scale indicator\~\c
332 .BR u ,
333 the basic unit of the device, some use\~\c
334 .BR z , 
336 .I scaled point unit
337 of the device, while others, such as the color commands expect plain
338 integers.
340 Note that these scale indicators are relative to the chosen device.
342 They are defined by the parameters specified in the device's
343 .I DESC
344 file; see
345 .BR groff_font (@MAN5EXT@).
349 Note that single characters can have the eighth bit set, as can the
350 names of fonts and special characters (this is, glyphs).
352 The names of glyphs and fonts can be of arbitrary length.
354 A glyph that is to be printed will always be in the current font.
358 A string argument is always terminated by the next whitespace
359 character (space, tab, or newline); an embedded
360 .B #
361 character is regarded as part of the argument, not as the beginning of
362 a comment command.
364 An integer argument is already terminated by the next non-digit
365 character, which then is regarded as the first character of the next
366 argument or command.
369 .\" --------------------------------------------------------------------
370 .SS "Document Parts"
371 .\" --------------------------------------------------------------------
372 A correct
373 .I intermediate output
374 document consists of two parts, the
375 .I prologue
376 and the
377 .IR body .
380 The task of the
381 .I prologue
382 is to set the general device parameters using three exactly specified
383 commands.
386 .I groff prologue
387 is guaranteed to consist of the following three lines (in that order):
390 .B x\ T
391 .I device
393 .B x\ res
394 .I n\ h\ v
396 .B x init
399 with the arguments set as outlined in the section
400 .BR "Device Control Commands" .
402 However, the parser for the
403 .I intermediate output
404 format is able to swallow additional whitespace and comments as well.
409 .I body
410 is the main section for processing the document data.
412 Syntactically, it is a sequence of any commands different from the
413 ones used in the
414 .IR prologue .
416 Processing is terminated as soon as the first
417 .B x\ stop
418 command is encountered; the last line of any
419 .I groff intermediate output
420 always contains such a command.
424 Semantically, the
425 .I body
426 is page oriented.
428 A new page is started by a
429 .BR p \~command.
431 Positioning, writing, and drawing commands are always done within the
432 current page, so they cannot occur before the first
433 .BR p \~command.
435 Absolute positioning (by the
436 .B H
438 .BR V \~commands)
439 is done relative to the current page, all other positioning
440 is done relative to the current location within this page.
443 .\" --------------------------------------------------------------------
444 .SH "COMMAND REFERENCE"
445 .\" --------------------------------------------------------------------
447 This section describes all
448 .I intermediate output
449 commands, the classical commands as well as the
450 .I groff
451 extensions.
454 .\" --------------------------------------------------------------------
455 .SS "Comment Command"
456 .\" --------------------------------------------------------------------
459 .BI # anything \[la]end-of-line\[ra]
460 A comment.
462 Ignore any characters from the
463 .BR # \~\c
464 character up to the next newline character.
467 This command is the only possibility for commenting in the
468 .I intermediate
469 .IR output .
471 Each comment can be preceded by arbitrary
472 .I syntactical
473 .IR space ;
474 every command can be terminated by a comment.
477 .\" --------------------------------------------------------------------
478 .SS "Simple Commands"
479 .\" --------------------------------------------------------------------
481 The commands in this subsection have a command code consisting of a
482 single character, taking a fixed number of arguments.
484 Most of them are commands for positioning and text writing.
486 These commands are smart about whitespace.
488 Optionally,
489 .I syntactical space
490 can be inserted before, after, and between the command letter and its
491 arguments.
493 All of these commands are stackable, i.e., they can be preceded by
494 other simple commands or followed by arbitrary other commands on the
495 same line.
497 A separating
498 .I syntactical space
499 is only necessary when two integer arguments would clash or if the
500 preceding argument ends with a string argument.
503 .if \n[@USE_ENV_STACK]=1 \{\
505 .command {
506 Open a new environment by copying the actual device configuration data
507 to the environment stack.
509 The current environment is setup by the device specification and
510 manipulated by the setting commands.
514 .command }
515 Close the actual environment (opened by a preceding
516 .BR { \~command)
517 and restore the previous environment from the environment
518 stack as the actual device configuration data.
520 .\}              \" endif @USE_ENV_STACK
524 .command C xxx \[la]white-space\[ra]
525 Print a glyph (special character) named
526 .IR xxx .
528 The trailing
529 .I syntactical space
531 .I line break
532 is necessary to allow glyph names of arbitrary length.
534 The glyph is printed at the current print position; the
535 glyph's size is read from the font file.
537 The print position is not changed.
541 .command c c
542 Print glyph with single-letter name\~\c
543 .I c
544 at the current print position;
545 the glyph's size is read from the font file.
547 The print position is not changed.
551 .command f n
552 Set font to font number\~\c
553 .I n
554 (a non-negative integer).
558 .command H n
559 Move right to the absolute vertical position\~\c
560 .I n
561 (a non-negative integer in basic units\~\c
562 .BR u )
563 relative to left edge of current page.
567 .command h n
568 Move
569 .I n
570 (a non-negative integer) basic units\~\c
571 .B u
572 horizontally to the right.
574 .I [CSTR\~#54]
575 allows negative values for
576 .I n
577 also, but
578 .I groff
579 doesn't use this.
583 .command m "color-scheme \fR[\fPcomponent .\|.\|.\fR]\fP"
584 Set the color for text (glyphs), line drawing, and the outline of
585 graphic objects using different color schemes; the analoguous command
586 for the filling color of graphic objects is
587 .BR DF .
589 The color components are specified as integer arguments between 0 and
590 \n[@maxcolor].
592 The number of color components and their meaning vary for the
593 different color schemes.
595 These commands are generated by the
596 .I groff
597 escape sequence
598 .BR \*[@backslash]m .
600 No position changing.
602 These commands are a
603 .I groff
604 extension.
610 .command mc "cyan magenta yellow"
611 Set color using the CMY color scheme, having the 3\~color components
612 cyan, magenta, and yellow.
616 .command md
617 Set color to the default color value
618 (black in most cases).
620 No component arguments.
624 .command mg "gray"
625 Set color to the shade of gray given by the argument, an integer
626 between 0 (black) and \n[@maxcolor] (white).
630 .command mk "cyan magenta yellow black"
631 Set color using the CMYK color scheme, having the 4\~color components
632 cyan, magenta, yellow, and black.
635 .command mr "red green blue"
636 Set color using the RGB color scheme, having the 3\~color components
637 red, green, and blue.
643 .command N n
644 Print glyph with index\~\c
645 .I n
646 (an integer, normally non-negative) of the current font.
648 The print position is not changed.
651 .B \-T\~html
653 .B \-T\~xhtml
654 is used, negative values are emitted also to indicate an unbreakable space
655 with given width.
657 For example,
658 .B N\~\-193
659 represents an unbreakable space which has a width of 193\|u.
661 This command is a
662 .I groff
663 extension.
667 .command n b\ a
668 Inform the device about a line break, but no positioning is done by
669 this command.
672 .I classical
673 .IR troff ,
674 the integer arguments
675 .I b
676 and\~\c
677 .I a
678 informed about the space before and after the current line to
679 make the
680 .I intermediate output
681 more human readable without performing any action.
684 .IR groff ,
685 they are just ignored, but they must be provided for compatibility
686 reasons.
690 .command p n
691 Begin a new page in the outprint.
693 The page number is set to\~\c
694 .IR n .
696 This page is completely independent of pages formerly processed even
697 if those have the same page number.
699 The vertical position on the outprint is automatically set to\~0.
701 All positioning, writing, and drawing is always done relative to a
702 page, so a
703 .BR p \~command
704 must be issued before any of these commands.
708 .command s n
709 Set point size to
710 .I n
711 scaled points
712 (this is unit\~\c
713 .B z
714 in GNU
715 .BR @g@troff ).
717 .I Classical troff
718 used the unit
719 .I points
721 .BR p )
722 instead; see section
723 .BR COMPATIBILITY .
727 .command t xyz\|.\|.\|. \[la]white-space\[ra]
729 .command t "xyz\|.\|.\|.\& dummy-arg" \[la]white-space\[ra]
730 Print a word, i.e., a sequence of glyphs with single-letter names
731 .IR x ,
732 .IR y ,
733 .IR z ,
734 etc., terminated by a space character or a line break; an optional
735 second integer argument is ignored (this allows the formatter to
736 generate an even number of arguments).
738 The first glyph should be printed at the current position, the
739 current horizontal position should then be increased by the width of
740 the first glyph, and so on for each glyph.
742 The widths of the glyph are read from the font file, scaled for the
743 current point size, and rounded to a multiple of the horizontal
744 resolution.
746 Special characters (glyphs with names longer than a single letter)
747 cannot be printed using this command; use the
748 .B C
749 command for those glyphs.
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 xyz\|.\|.\|." \[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 glyph, the current
768 horizontal position is increased by the sum of the width of that
769 glyph and\~\c
770 .I 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 .I 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 .I n
797 basic units\~\c
798 .B 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 .I 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 .I 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 .I h
956 and a vertical diameter of\~\c
957 .I 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 .I h
972 and a vertical diameter of\~\c
973 .I 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 .BR \*[@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 .I 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 inbetween 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
1068 mg 0 0 \n[@maxcolor]
1069 Df -1
1074 sets all colors to blue.
1077 No position changing.
1079 This command is a
1080 .I groff
1081 extension.
1087 .D-command l "h v"
1088 Draw line from current position to offset
1089 .offset h v
1090 (integers in basic units\~\c
1091 .BR u );
1092 then set current position to the end of the drawn line.
1096 .D-multiarg p
1097 Draw a polygon line from current position to offset
1098 .indexed_offset h 1 v 1 ,
1099 from there to offset
1100 .indexed_offset h 2 v 2 ,
1101 etc., up to offset
1102 .indexed_offset h n v n ,
1103 and from there back to the starting position.
1105 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1106 For historical reasons, the position is changed by adding the sum of
1107 all arguments with odd index to the actual horizontal position and the
1108 even ones to the vertical position.
1110 Although this doesn't make sense it is kept for compatibility.
1113 .el \{\
1114 As the polygon is closed, the end of drawing is the starting point, so
1115 the position doesn't change.
1118 This command is a
1119 .I groff
1120 extension.
1124 .D-multiarg P
1125 The same macro as the corresponding
1126 .B Dp
1127 command with the same arguments, but draws a solid polygon in the
1128 current fill color rather than an outlined polygon.
1130 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1131 The position is changed in the same way as with
1132 .BR Dp .
1134 .el \
1135 No position changing.
1137 This command is a
1138 .I groff
1139 extension.
1143 .D-command t n
1144 Set the current line thickness to\~\c
1145 .I n
1146 (an integer in basic units\~\c
1147 .BR u )
1149 .IR n \|>\|0;
1151 .IR n \|=\|0
1152 select the smallest available line thickness; if
1153 .IR n \|<\|0
1154 set the line thickness proportional to the point size (this is the
1155 default before the first
1156 .B Dt
1157 command was specified).
1159 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1160 For historical reasons, the horizontal position is changed by adding
1161 the argument to the actual horizontal position, while the vertical
1162 position is not changed.
1164 Although this doesn't make sense it is kept for compatibility.
1167 .el \
1168 No position changing.
1170 This command is a
1171 .I groff
1172 extension.
1175 .\" --------------------------------------------------------------------
1176 .SS "Device Control Commands"
1177 .\" --------------------------------------------------------------------
1179 Each device control command starts with the letter
1180 .B x
1181 followed by a space character (optional or arbitrary space/\:tab in
1182 .IR groff )
1183 and a subcommand letter or word; each argument (if any) must be
1184 preceded by a
1185 .I syntactical
1186 .IR space .
1189 .B x
1190 commands are terminated by a
1191 .IR "syntactical line break" ;
1192 no device control command can be followed by another command on the same
1193 line (except a comment).
1196 The subcommand is basically a single letter, but to increase
1197 readability, it can be written as a word, i.e., an arbitrary sequence
1198 of characters terminated by the next tab, space, or newline character.
1200 All characters of the subcommand word but the first are simply ignored.
1202 For example,
1203 .B @g@troff
1204 outputs the initialization command
1205 .B x\ i
1207 .B x\ init
1208 and the resolution command
1209 .B x\ r
1211 .BR "x\ res" .
1213 But writings like
1214 .B x\ i_like_groff
1216 .B x\ roff_is_groff
1217 are accepted as well to mean the same commands.
1220 In the following, the syntax element
1221 .I \[la]line-break\[ra]
1222 means a
1223 .I syntactical line break
1224 as defined in section
1225 .BR Separation .
1228 .x-command F name
1229 .xsub Filename
1231 .I name
1232 as the intended name for the current file in error reports.
1234 This is useful for remembering the original file name when
1235 .B groff
1236 uses an internal piping mechanism.
1238 The input file is not changed by this command.
1240 This command is a
1241 .I groff
1242 extension.
1246 .x-command f "n\ s"
1247 .xsub font
1248 Mount font position\~\c
1249 .I n
1250 (a non-negative integer) with font named\~\c
1251 .I s
1252 (a text word),
1254 .BR groff_font (@MAN5EXT@).
1258 .x-command H n
1259 .xsub Height
1260 Set character height to\~\c
1261 .I n
1262 (a positive integer in scaled points\~\c
1263 .BR z ).
1265 .I Classical troff
1266 used the unit points (\c
1267 .BR p )
1268 instead; see section
1269 .BR COMPATIBILITY .
1273 .x-command i
1274 .xsub init
1275 Initialize device.
1277 This is the third command of the
1278 .IR prologue .
1282 .x-command p
1283 .xsub pause
1284 Parsed but ignored.
1286 The classical documentation reads
1287 .I pause device, can be
1288 .IR restarted .
1292 .x-command r "n\ h\ v"
1293 .xsub resolution
1294 Resolution is\~\c
1295 .IR n ,
1296 while
1297 .I h
1298 is the minimal horizontal motion, and
1299 .I v
1300 the minimal vertical motion possible with this device; all arguments
1301 are positive integers in basic units\~\c
1302 .B u
1303 per inch.
1305 This is the second command of the
1306 .IR prologue .
1310 .x-command S n
1311 .xsub Slant
1312 Set slant to\~\c
1313 .I n
1314 degrees (an integer in basic units\~\c
1315 .BR u ).
1319 .x-command s
1320 .xsub stop
1321 Terminates the processing of the current file; issued as the last
1322 command of any
1323 .I intermediate @g@troff
1324 .IR output .
1328 .x-command t
1329 .xsub trailer
1330 Generate trailer information, if any.
1333 .BR groff ,
1334 this is actually just ignored.
1338 .x-command T xxx
1339 .xsub Typesetter
1340 Set name of device to word
1341 .IR xxx ,
1342 a sequence of characters ended by the next whitespace character.
1344 The possible device names coincide with those from the groff
1345 .B \-T
1346 option.
1348 This is the first command of the
1349 .IR prologue .
1353 .x-command u n
1354 .xsub underline
1355 Configure underlining of spaces.
1358 .I n
1359 is\~1, start underlining of spaces;
1361 .I n
1362 is\~0, stop underlining of spaces.
1364 This is needed for the
1365 .B cu
1366 request in
1367 .B @g@nroff
1368 mode and is ignored otherwise.
1370 This command is a
1371 .I groff
1372 extension.
1376 .x-command X anything
1377 .xsub X-escape
1378 Send string
1379 .I anything
1380 uninterpreted to the device.
1382 If the line following this command starts with a
1383 .B +
1384 character this line is interpreted as a continuation line in the
1385 following sense.
1388 .B +
1389 is ignored, but a newline character is sent instead to the device, the
1390 rest of the line is sent uninterpreted.
1392 The same applies to all following lines until the first character of a
1393 line is not a
1394 .B +
1395 character.
1397 This command is generated by the
1398 .I groff
1399 escape sequence
1400 .BR \*[@backslash]X .
1402 The line-continuing feature is a
1403 .I groff
1404 extension.
1407 .\" --------------------------------------------------------------------
1408 .SS "Obsolete Command"
1409 .\" --------------------------------------------------------------------
1412 .I classical troff
1413 output, emitting a single glyph was mostly done by a very
1414 strange command that combined a horizontal move and the printing of a
1415 glyph.
1417 It didn't have a command code, but is represented by a 3-character
1418 argument consisting of exactly 2\~digits and a character.
1421 .I ddc
1422 Move right
1423 .I dd
1424 (exactly two decimal digits) basic units\~\c
1425 .BR u ,
1426 then print glyph with single-letter name\~\c
1427 .IR c .
1433 .IR groff ,
1434 arbitrary
1435 .I syntactical space
1436 around and within this command is allowed to be added.
1438 Only when a preceding command on the same line ends with an argument
1439 of variable length a separating space is obligatory.
1442 .I classical
1443 .IR troff ,
1444 large clusters of these and other commands were used, mostly without
1445 spaces; this made such output almost unreadable.
1451 For modern high-resolution devices, this command does not make sense
1452 because the width of the glyphs can become much larger than two
1453 decimal digits.
1454 The commands
1455 .B t
1456 and\~\c
1457 .B u
1458 provide a better functionality.
1461 .\" --------------------------------------------------------------------
1462 .SH "POSTPROCESSING"
1463 .\" --------------------------------------------------------------------
1466 .I roff
1467 postprocessors are programs that have the task to translate the
1468 .I intermediate output
1469 into actions that are sent to a device.
1471 A device can be some piece of hardware such as a printer, or a software
1472 file format suitable for graphical or text processing.
1475 .I groff
1476 system provides powerful means that make the programming of such
1477 postprocessors an easy task.
1479 There is a library function that parses the
1480 .I intermediate output
1481 and sends the information obtained to the device via methods of a
1482 class with a common interface for each device.
1484 So a
1485 .I groff
1486 postprocessor must only redefine the methods of this class.
1488 For details, see the reference in section
1489 .BR FILES .
1492 .\" --------------------------------------------------------------------
1493 .SH "EXAMPLES"
1494 .\" --------------------------------------------------------------------
1496 This section presents the
1497 .I intermediate output
1498 generated from the same input for three different devices.
1500 The input is the sentence
1501 .I hell world
1502 fed into
1503 .B groff
1504 on the command line.
1507 .IP \[bu] 2m 
1508 High-resolution device
1509 .I ps
1515 \fBshell>\fP echo "hell world" | groff -Z -T ps
1521 .ft CB
1522 x T ps
1523 x res 72000 1 1
1524 x init
1526 x font 5 TR
1528 s10000
1529 V12000
1530 H72000
1531 thell
1532 wh2500
1534 H96620
1535 torld
1536 n12000 0
1537 x trailer
1538 V792000
1539 x stop
1540 .ft P
1546 This output can be fed into the postprocessor
1547 .BR grops (@MAN1EXT@)
1548 to get its representation as a PostScript file.
1551 .IP \[bu] 2m 
1552 Low-resolution device
1553 .I latin1
1558 This is similar to the high-resolution device except that the
1559 positioning is done at a minor scale.
1561 Some comments (lines starting with
1562 .IR # )
1563 were added for clarification; they were not generated by the
1564 formatter.
1569 \fBshell>\fP "hell world" | groff -Z -T latin1
1575 .I "# prologue"
1576 .ft CB
1577 x T latin1
1578 x res 240 24 40
1579 x init
1580 .I "# begin a new page"
1581 .ft CB
1583 .I "# font setup"
1584 .ft CB
1585 x font 1 R
1588 .I "# initial positioning on the page"
1589 .ft CB
1592 .I "# write text `hell'"
1593 .ft CB
1594 thell
1595 .I "# inform about a space, and do it by a horizontal jump"
1596 .ft CB
1597 wh24
1598 .I "# write text `world'"
1599 .ft CB
1600 tworld
1601 .I "# announce line break, but do nothing because ..."
1602 .ft CB
1603 n40 0
1604 .I "# ... the end of the document has been reached"
1605 .ft CB
1606 x trailer
1607 V2640
1608 x stop
1609 .ft P
1615 This output can be fed into the postprocessor
1616 .BR grotty (@MAN1EXT@)
1617 to get a formatted text document.
1622 Due to the obsolete jump-and-write command, the text clusters in the
1623 classical output are almost unreadable.
1626 .\" --------------------------------------------------------------------
1627 .SH "COMPATIBILITY"
1628 .\" --------------------------------------------------------------------
1631 .I intermediate output
1632 language of the 
1633 .I classical troff
1634 was first documented in
1635 .IR [CSTR\~#97] .
1638 .I groff intermediate output
1639 format is compatible with this specification except for the following
1640 features.
1643 .IP \[bu] 2m 
1644 The classical quasi device independence is not yet implemented.
1647 .IP \[bu] 2m 
1648 The old hardware was very different from what we use today.
1650 So the
1651 .I groff
1652 devices are also fundamentally different from the ones in
1653 .I classical
1654 .IR troff .
1656 For example, the classical PostScript device was called
1657 .I post
1658 and had a resolution of 720 units per inch,
1659 while
1660 .IR groff 's
1661 .I ps
1662 device has a resolution of 72000 units per inch.
1664 Maybe, by implementing some rescaling mechanism similar to the
1665 classical quasi device independence, these could be integrated into
1666 modern
1667 .IR groff .
1670 .IP \[bu] 2m 
1671 The B-spline command
1672 .B D~
1673 is correctly handled by the
1674 .I intermediate output
1675 parser, but the drawing routines aren't implemented in some of the
1676 postprocessor programs.
1679 .IP \[bu] 2m 
1680 The argument of the commands
1681 .B s
1683 .B x H
1684 has the implicit unit scaled point\~\c
1685 .B z
1687 .IR groff ,
1688 while
1689 .I classical troff
1690 had point (\c
1691 .BR p ).
1693 This isn't an incompatibility, but a compatible extension, for both
1694 units coincide for all devices without a
1695 .I sizescale
1696 parameter, including all classical and the
1697 .I groff
1698 text devices.
1700 The few
1701 .I groff
1702 devices with a sizescale parameter either did not exist, had a
1703 different name, or seem to have had a different resolution.
1705 So conflicts with classical devices are very unlikely.
1708 .ie \n[@STUPID_DRAWING_POSITIONING]=1 \{\
1709 .IP \[bu] 2m 
1710 The position changing after the commands
1711 .BR Dp ,
1712 .BR DP ,
1714 .B Dt
1715 is illogical, but as old versions of groff used this feature it is
1716 kept for compatibility reasons.
1717 .\}             \" @STUPID_DRAWING_POSITIONING
1718 .el \{\
1719 .IP \[bu] 2m
1720 Temporarily, there existed some confusion on the positioning after the
1721 .B D
1722 commands that are
1723 .I groff
1724 extensions.
1726 This has been clarified by establishing the classical rule for all
1727 groff drawing commands:
1732 .ft I
1733 The position after a graphic object has been drawn is at its end;
1734 for circles and ellipses, the "end" is at the right side.
1740 From this, the positionings specified for the drawing commands above
1741 follow quite naturally.
1742 .\}             \" @STUPID_DRAWING_POSITIONING
1745 The differences between
1746 .I groff
1748 .I classical troff
1749 are documented in
1750 .BR groff_diff (@MAN7EXT@).
1753 .\" --------------------------------------------------------------------
1754 .SH "FILES"
1755 .\" --------------------------------------------------------------------
1758 .BI @FONTDIR@/dev name /DESC
1759 Device description file for device
1760 .IR name .
1763 .IB \[la]groff-source-dir\[ra] /src/libs/libdriver/input.cpp
1764 Defines the parser and postprocessor for the
1765 .I intermediate
1766 .IR output .
1768 It is located relative to the top directory of the
1769 .I groff
1770 source tree.
1772 This parser is the definitive specification of the
1773 .I groff intermediate output
1774 format.
1777 .\" --------------------------------------------------------------------
1778 .SH "SEE ALSO"
1779 .\" --------------------------------------------------------------------
1781 A reference like
1782 .BR groff (@MAN7EXT@)
1783 refers to a manual page; here
1784 .B groff
1785 in section\~\c
1786 .I @MAN7EXT@
1787 of the man-page documentation system.
1789 To read the example, look up section\~@MAN7EXT@ in your desktop help
1790 system or call from the shell prompt
1796 \fBshell>\fP man @MAN7EXT@ groff
1802 For more details, see
1803 .BR man (1).
1807 .BR groff (@MAN1EXT@)
1808 option
1809 .B -Z
1810 and further readings on groff.
1814 .BR groff (@MAN7EXT@)
1815 for details of the
1816 .I groff
1817 language such as numerical units and escape sequences.
1821 .BR groff_font (@MAN5EXT@)
1822 for details on the device scaling parameters of the
1823 .B DESC
1824 file.
1828 .BR @g@troff (@MAN1EXT@)
1829 generates the device-independent intermediate output.
1833 .BR roff (@MAN7EXT@)
1834 for historical aspects and the general structure of roff systems.
1838 .BR groff_diff (@MAN7EXT@)
1839 The differences between the intermediate output in groff and classical
1840 troff.
1844 .BR \%grodvi (@MAN1EXT@),
1845 .BR \%grohtml (@MAN1EXT@),
1846 .BR \%grops (@MAN1EXT@),
1847 .BR \%grotty (@MAN1EXT@)
1850 the groff postprocessor programs.
1855 For a treatment of all aspects of the groff system within a single
1856 document, see the
1857 .I groff info
1858 .IR file .
1860 It can be read within the integrated help systems, within
1861 .BR emacs (1)
1862 or from the shell prompt by
1866 \fBshell>\fP info groff
1873 .I classical troff output language
1874 is described in two AT&T Bell Labs CSTR documents available on-line at
1875 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr.html
1876 Bell Labs CSTR site
1877 .UE .
1881 .I [CSTR #97]
1882 .I A Typesetter-independent TROFF
1884 .I Brian Kernighan
1885 is the original and most comprehensive documentation on the output
1886 language; see
1887 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:97.ps.gz
1888 CSTR\~#97
1889 .UE .
1893 .I [CSTR\~#54]
1894 The 1992 revision of the
1895 .I Nroff/\:Troff User's Manual
1897 .I J.\& F.\& Ossanna
1899 .I Brian Kernighan
1900 isn't as comprehensive as
1901 .I [CSTR\~#97]
1902 regarding the output language; see
1903 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:54.ps.gz
1904 CSTR\~#54
1905 .UE .
1908 .\" --------------------------------------------------------------------
1909 .SH "AUTHORS"
1910 .\" --------------------------------------------------------------------
1912 Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
1913 Free Software Foundation, Inc.
1917 This document is distributed under the terms of the FDL (GNU Free
1918 Documentation License) version 1.1 or later.
1920 You should have received a copy of the FDL with this package; it is also
1921 available on-line at the
1922 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
1923 GNU copyleft site
1924 .UE .
1928 This document is part of
1929 .IR groff ,
1930 the GNU
1931 .I roff
1932 distribution.
1934 It is based on a former version \- published under the GPL \- that
1935 described only parts of the
1936 .I groff
1937 extensions of the output language.
1939 It was rewritten in 2002 by Bernd Warken and is
1940 maintained by
1941 .MT wl@gnu.org
1942 Werner Lemberg
1943 .ME .
1945 .\" --------------------------------------------------------------------
1946 .\" Emacs settings
1947 .\" --------------------------------------------------------------------
1949 .\" Local Variables:
1950 .\" mode: nroff
1951 .\" End: