2 Copyright (C) 1989-2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 Permission is granted to make and distribute verbatim copies of
5 this manual provided the copyright notice and this permission notice
6 are preserved on all copies.
8 Permission is granted to copy and distribute modified versions of this
9 manual under the conditions for verbatim copying, provided that the
10 entire resulting derived work is distributed under the terms of a
11 permission notice identical to this one.
13 Permission is granted to copy and distribute translations of this
14 manual into another language, under the above conditions for modified
15 versions, except that this permission notice may be included in
16 translations approved by the Free Software Foundation instead of in
21 .\" Like TP, but if specified indent is more than half
22 .\" the current line-length - indent, use the default indent.
24 .ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP
29 . ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
30 . ds lx L\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\*(tx
40 .\" The BSD man macros can't handle " in arguments to font change macros,
41 .\" so use \(ts instead of ".
45 .TH @G@PIC @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@"
50 @g@pic \- compile pictures for troff or TeX
77 This manual page describes the GNU version of
79 which is part of the groff document formatting system.
81 compiles descriptions of pictures embedded within
83 or \*(tx input files into commands that are understood by \*(tx or
85 Each picture starts with a line beginning with
87 and ends with a line beginning with
93 is passed through without change.
95 It is the user's responsibility to provide appropriate definitions of the
100 When the macro package being used does not supply such definitions
101 (for example, old versions of \-ms),
102 appropriate definitions can be obtained with
104 These will center each picture.
109 Options that do not take arguments may be grouped behind a single
113 can be used to mark the end of the options.
116 refers to the standard input.
124 even when followed by a character other than space or newline.
128 Safer mode; do not execute
131 This can be useful when operating on untrustworthy input.
136 Unsafe mode; revert the default option
141 Don't use the groff extensions to the troff drawing commands.
142 You should use this if you are using a postprocessor that doesn't support
144 The extensions are described in
145 .BR groff_out (@MAN5EXT@).
150 not to use zero-length lines to draw dots in troff mode.
158 Be more compatible with
164 are not passed through transparently.
167 are passed through with the initial
171 A line beginning with
173 is given special treatment:
174 it takes an optional integer argument specifying
175 the line thickness (pen size) in milliinches;
176 a missing argument restores the previous line thickness;
177 the default line thickness is 8 milliinches.
178 The line thickness thus specified takes effect only
179 when a non-negative line thickness has not been
180 specified by use of the
182 attribute or by setting the
188 Print the version number.
192 In \*(tx mode draw dots using zero-length lines.
195 The following options supported by other versions of
201 Draw all lines using the \eD escape sequence.
207 Generate output for the
211 This is unnecessary because the
215 is device-independent.
220 This section describes only the differences between GNU
222 and the original version of
224 Many of these differences also apply to newer versions of Unix
226 A complete documentation is available in the file
234 \*(tx mode is enabled by the
239 will define a vbox called
244 command to change the name of the vbox.
245 You must yourself print that vbox using, for example, the command
249 \ecenterline{\ebox\egraph}
252 Actually, since the vbox has a height of zero (it is defined with
253 \evtop) this will produce slightly more vertical space above the
254 picture than below it;
258 \ecenterline{\eraise 1em\ebox\egraph}
263 To make the vbox having a positive height and a depth of zero
264 (as used e.g.\& by \*(lx's
265 .BR \%graphics.sty ),
266 define the following macro in your document:
269 .B \edef\egpicbox#1{%
271 .B " \evbox{\eunvbox\ecsname #1\eendcsname\ekern 0pt}}"
274 Now you can simply say
276 instead of \ebox\egraph.
278 You must use a \*(tx driver that supports the
284 are passed through transparently; a
286 is added to the end of the line to avoid unwanted spaces.
287 You can safely use this feature to change fonts or to
290 Anything else may well produce undesirable results; use at your own risk.
291 Lines beginning with a period are not given any special treatment.
296 \fBfor\fR \fIvariable\fR \fB=\fR \fIexpr1\fR \fBto\fR \fIexpr2\fR \
297 [\fBby\fR [\fB*\fR]\fIexpr3\fR] \fBdo\fR \fIX\fR \fIbody\fR \fIX\fR
304 is less than or equal to
314 is not given, increment
323 will instead be multiplied by
327 can be negative for the additive case;
329 is then tested whether it is greater than or equal to
331 For the multiplicative case,
333 must be greater than zero.
334 If the constraints aren't met, the loop isn't executed.
336 can be any character not occurring in
340 \fBif\fR \fIexpr\fR \fBthen\fR \fIX\fR \fIif-true\fR \fIX\fR \
341 [\fBelse\fR \fIY\fR \fIif-false\fR \fIY\fR]
344 if it is non-zero then do
349 can be any character not occurring in
352 can be any character not occurring in
356 \fBprint\fR \fIarg\fR\|.\|.\|.
357 Concatenate the arguments and print as a line on stderr.
360 must be an expression, a position, or text.
361 This is useful for debugging.
364 \fBcommand\fR \fIarg\fR\|.\|.\|.
365 Concatenate the arguments
366 and pass them through as a line to troff or \*(tx.
369 must be an expression, a position, or text.
370 This has a similar effect to a line beginning with
374 but allows the values of variables to be passed through.
382 command ".ds string x is " x "."
396 \fBsh\fR \fIX\fR \fIcommand\fR \fIX\fR
401 can be any character not occurring in
405 \fBcopy\fR \fB"\fIfilename\fB"\fR
408 at this point in the file.
411 \fBcopy\fR [\fB"\fIfilename\fB"\fR] \fBthru\fR \fIX\fR \fIbody\fR \fIX\fR \
412 [\fBuntil\fR \fB"\fIword\*(ic\fB"\fR]
415 \fBcopy\fR [\fB"\fIfilename\fB"\fR] \fBthru\fR \fImacro\fR \
416 [\fBuntil\fR \fB"\fIword\*(ic\fB"\fR]
419 once for each line of
421 the line is split into blank-delimited words,
434 is not given, lines are taken from the current input up to
439 lines will be read only until a line the first word of which is
441 that line will then be discarded.
443 can be any character not occurring in
451 copy thru % circle at ($1,$2) % until "END"
477 The commands to be performed for each line can also be taken
478 from a macro defined earlier by giving the name of the macro
487 \fBreset\fI variable1\fR[\fB,\fR]\fI variable2 .\^.\^.
488 Reset pre-defined variables
491 \&.\^.\^. to their default values.
492 If no arguments are given, reset all pre-defined variables
493 to their default values.
494 Note that assigning a value to
496 also causes all pre-defined variables that control dimensions
497 to be reset to their default values times the new value of scale.
500 \fBplot\fR \fIexpr\fR [\fB"\fItext\*(ic\fB"\fR]
501 This is a text object which is constructed by using
503 as a format string for sprintf
508 is omitted a format string of
511 Attributes can be specified in the same way as for a normal text
513 Be very careful that you specify an appropriate format string;
515 does only very limited checking of the string.
516 This is deprecated in favour of
520 .IB variable\ := \ expr
525 must already be defined,
530 without creating a variable local to the current block.
533 defines the variable in the current block if it is not already defined there,
534 and then changes the value in the current block only.)
535 For example, the following:
560 Arguments of the form
564 are also allowed to be of the form
570 can contain balanced occurrences of
576 or imbalanced occurrences of
583 The syntax for expressions has been significantly extended:
600 .ie t 10\v'-.4m'\fIx\*(ic\fR\v'.4m')
608 (return a random number between 0 and 1)
611 (return a random number between 1 and
616 (set the random number seed)
640 \fB"\fIstr1\*(ic\fB" == "\fIstr2\*(ic\fB"\fR
642 \fB"\fIstr1\*(ic\fB" != "\fIstr2\*(ic\fB"\fR
646 String comparison expressions must be parenthesised in some contexts
653 is acceptable as an attribute;
658 is the current direction.
665 means draw a line 2\ inches long in the current direction.
666 The `i' (or `I') character is ignored; to use another measurement unit,
669 variable to an appropriate value.
672 The maximum width and height of the picture are taken from the variables
676 Initially these have values 8.5 and 11.
679 Scientific notation is allowed for numbers.
688 Text attributes can be compounded.
699 There is no limit to the depth to which blocks can be examined.
704 [A: [B: [C: box ]]] with .A.B.C.sw at 1,2
707 circle at last [\^].A.B.C
713 Arcs now have compass points
714 determined by the circle of which the arc is a part.
717 Circles, ellipses, and arcs can be dotted or dashed.
718 In \*(tx mode splines can be dotted or dashed also.
721 Boxes can have rounded corners.
724 attribute specifies the radius of the quarter-circles at each corner.
729 attribute is given, a radius of
735 A box with rounded corners can be dotted or dashed.
740 line can have a second argument specifying a maximum height for
742 If the width of zero is specified the width will be ignored in computing
743 the scaling factor for the picture.
746 will always scale a picture by the same amount vertically as well as
748 This is different from the
752 which may scale a picture by a different amount vertically than
753 horizontally if a height is specified.
756 Each text object has an invisible box associated with it.
757 The compass points of a text object are determined by this box.
758 The implicit motion associated with the object is also determined
760 The dimensions of this box are taken from the width and height attributes;
761 if the width attribute is not supplied then the width will be taken to be
763 if the height attribute is not supplied then the height will be taken to be
764 the number of text strings associated with the object
774 In (almost all) places where a quoted text string can be used,
775 an expression of the form
777 .BI sprintf(\(ts format \(ts,\ arg ,\fR.\|.\|.\fB)
780 this will produce the arguments formatted according to
782 which should be a string as described in
784 appropriate for the number of arguments supplied.
787 The thickness of the lines used to draw objects is controlled by the
790 This gives the thickness of lines in points.
791 A negative value means use the default thickness:
792 in \*(tx output mode, this means use a thickness of 8 milliinches;
793 in \*(tx output mode with the
795 option, this means use the line thickness specified by
798 in troff output mode, this means use a thickness proportional
800 A zero value means draw the thinnest possible line supported by
802 Initially it has a value of -1.
809 .B circle thickness 1.5
812 would draw a circle using a line with a thickness of 1.5 points.
813 The thickness of lines is not affected by the
816 variable, nor by the width or height given in the
821 Boxes (including boxes with rounded corners),
822 circles and ellipses can be filled by giving them an attribute of
824 This takes an optional argument of an expression with a value between
825 0 and 1; 0 will fill it with white, 1 with black, values in between
826 with a proportionally gray shade.
827 A value greater than 1 can also be used:
828 this means fill with the
829 shade of gray that is currently being used for text and lines.
830 Normally this will be black, but output devices may provide
831 a mechanism for changing this.
832 Without an argument, then the value of the variable
835 Initially this has a value of 0.5.
836 The invisible attribute does not affect the filling of objects.
837 Any text associated with a filled object will be added after the
838 object has been filled, so that the text will not be obscured
842 Three additional modifiers are available to specify colored objects:
844 sets the color of the outline,
847 .B colo\fR[\fPu\fR]\fPr\fR[\fPed\fR]
849 All three keywords expect a suffix specifying the color, for example
852 .B circle shaded """green""" outline """black"""
855 Currently, color support isn't available in \*(tx mode.
856 Predefined color names for
858 are in the device macro files, for example
860 additional colors can be defined with the
862 request (see the manual page of
863 .BR @g@troff (@MAN1EXT@)
866 To change the name of the vbox in \*(tx mode, set the pseudo-variable
868 (which is actually a specially parsed command) within a picture.
881 The picture is then available in the box
885 assumes that at the beginning of a picture both glyph and fill color are
886 set to the default value.
889 Arrow heads will be drawn as solid triangles if the variable
891 is non-zero and either \*(tx mode is enabled or the
893 option has not been given.
897 Note that solid arrow heads are always filled with the current outline
903 is device-independent.
906 option is therefore redundant.
907 All numbers are taken to be in inches; numbers are never interpreted
908 to be in troff machine units.
914 This will only work if the postprocessor is
916 Any text associated with an object having the
918 attribute will be rotated about the center of the object
919 so that it is aligned in the direction from the start point
920 to the end point of the object.
921 Note that this attribute will have no effect for objects whose start and
922 end points are coincident.
932 is a single token: no space is allowed between the
941 line from `i'th box.nw to `i+1'th box.se
949 To obtain a stand-alone picture from a
959 configuration commands may be added at the beginning of the file, but no
964 It is necessary to feed this file into
966 without adding any page information, so you must check which
970 requests are actually called.
971 For example, the mm macro package adds a page number, which is very
973 At the moment, calling standard
975 without any macro package works.
976 Alternatively, you can define your own requests, e.g. to do nothing:
991 itself does not provide direct conversion into other graphics file
993 But there are lots of possibilities if you first transform your picture
994 into PostScript\*R format using the
1000 lacks BoundingBox information it is not very useful by itself, but it
1001 may be fed into other conversion programs, usually named
1006 Moreover, the PostScript interpreter
1009 has built-in graphics conversion devices that are called with the option
1012 .BI "gs -sDEVICE=" <devname>
1021 for a list of the available devices.
1024 As the Encapsulated PostScript File Format
1026 is getting more and more important, and the conversion wasn't regarded
1027 trivial in the past you might be interested to know that there is a
1028 conversion tool named
1030 which does the right job.
1031 It is much better than the tool
1036 For bitmapped graphic formats, you should use
1038 the resulting (intermediate)
1040 file can be then converted to virtually any graphics format using the tools
1048 .Tp \w'\fB@MACRODIR@/pic.tmac'u+3n
1051 Example definitions of the
1060 .BR @g@troff (@MAN1EXT@),
1061 .BR groff_out (@MAN5EXT@),
1072 PIC \(em A Graphics Language for Typesetting (User Manual).
1073 AT&T Bell Laboratories, Computing Science Technical Report No.\ 116
1074 <http://cm.bell-labs.com/cm/cs/cstr/116.ps.gz>
1075 (revised May, 1991).
1078 is available from CTAN mirrors, e.g.
1080 <ftp://ftp.dante.de/tex-archive/support/ps2eps/>
1082 W. Richard Stevens - Turning PIC Into HTML
1084 <http://www.kohala.com/start/troff/pic2html.html>
1086 W. Richard Stevens - Examples of picMacros
1088 <http://www.kohala.com/start/troff/pic.examples.ps>
1093 Input characters that are invalid for
1097 code 0, or 013 octal, or between 015 and 037 octal, or between 0200 and 0237
1098 octal) are rejected even in \*(tx mode.
1100 The interpretation of
1102 is incompatible with the pic in 10th edition Unix,
1103 which interprets 0 as black and 1 as white.
1105 PostScript\*R is a registered trademark of Adobe Systems Incorporation.
1107 .\" Local Variables: