1 .TH @G@PIC @MAN1EXT@ "@MDATE@" "groff @VERSION@"
3 @g@pic \- compile pictures for troff or TeX
6 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
11 .\" ====================================================================
13 .\" ====================================================================
15 .\" Copyright (C) 1989-2018 Free Software Foundation, Inc.
17 .\" Permission is granted to make and distribute verbatim copies of this
18 .\" manual provided the copyright notice and this permission notice are
19 .\" preserved on all copies.
21 .\" Permission is granted to copy and distribute modified versions of
22 .\" this manual under the conditions for verbatim copying, provided that
23 .\" the entire resulting derived work is distributed under the terms of
24 .\" a permission notice identical to this one.
26 .\" Permission is granted to copy and distribute translations of this
27 .\" manual into another language, under the above conditions for
28 .\" modified versions, except that this permission notice may be
29 .\" included in translations approved by the Free Software Foundation
30 .\" instead of in the original English.
33 .\" ====================================================================
35 .\" ====================================================================
38 . ds tx T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
39 . ds lx L\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\*(tx
49 .\" The BSD man macros can't handle " in arguments to font change macros,
50 .\" so use \(ts instead of ".
54 .\" ====================================================================
56 .\" ====================================================================
72 .\" ====================================================================
74 .\" ====================================================================
76 This manual page describes the GNU version of
78 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
86 Each picture starts with a line beginning with
88 and ends with a line beginning with
95 is passed through without change.
99 It is the user's responsibility to provide appropriate definitions
106 When the macro package being used does not supply such definitions
107 (for example, old versions of \-ms), appropriate definitions can be
111 These will center each picture.
114 .\" ====================================================================
116 .\" ====================================================================
118 Options that do not take arguments may be grouped behind a single
123 can be used to mark the end of the options.
127 refers to the standard input.
135 even when followed by a character other than space or newline.
139 Safer mode; do not execute
143 This can be useful when operating on untrustworthy input (enabled by
148 Unsafe mode; revert the default option
153 Don't use the groff extensions to the troff drawing commands.
155 You should use this if you are using a postprocessor that doesn't
156 support these extensions.
158 The extensions are described in
159 .BR groff_out (@MAN5EXT@).
165 not to use zero-length lines to draw dots in troff mode.
173 Be more compatible with
180 are not passed through transparently.
184 are passed through with the initial
189 A line beginning with
191 is given special treatment:
192 it takes an optional integer argument specifying
193 the line thickness (pen size) in milliinches;
194 a missing argument restores the previous line thickness;
195 the default line thickness is 8 milliinches.
197 The line thickness thus specified takes effect only when a
198 non-negative line thickness has not been specified by use of the
200 attribute or by setting the
206 Print the version number.
210 In \*(tx mode draw dots using zero-length lines.
214 The following options supported by other versions of
220 Draw all lines using the \eD escape sequence.
226 Generate output for the
231 This is unnecessary because the
235 is device-independent.
238 .\" ====================================================================
240 .\" ====================================================================
242 This section describes only the differences between GNU
244 and the original version of
247 Many of these differences also apply to newer versions of Unix
250 A complete documentation is available in the file
259 .\" ====================================================================
261 .\" ====================================================================
263 \*(tx mode is enabled by the
269 will define a vbox called
275 command to change the name of the vbox.
277 You must yourself print that vbox using, for example, the command
283 \ecenterline{\ebox\egraph}
288 Actually, since the vbox has a height of zero (it is defined with
289 \evtop) this will produce slightly more vertical space above the
290 picture than below it;
294 \ecenterline{\eraise 1em\ebox\egraph}
301 To make the vbox having a positive height and a depth of zero
302 (as used e.g.\& by \*[lx]'s
303 .BR \%graphics.sty ),
304 define the following macro in your document:
307 .B \edef\egpicbox#1{%
309 .B " \evbox{\eunvbox\ecsname #1\eendcsname\ekern 0pt}}"
312 Now you can simply say
314 instead of \ebox\egraph.
318 You must use a \*(tx driver that supports the
326 are passed through transparently; a
328 is added to the end of the line to avoid unwanted spaces.
330 You can safely use this feature to change fonts or to
334 Anything else may well produce undesirable results; use at your own risk.
336 Lines beginning with a period are not given any special treatment.
339 .\" ====================================================================
341 .\" ====================================================================
344 \fBfor\fR \fIvariable\fR \fB=\fR \fIexpr1\fR \fBto\fR \fIexpr2\fR \
345 [\fBby\fR [\fB*\fR]\,\fIexpr3\/\fR] \fBdo\fR \fIX\fR \fIbody\fR \fIX\fR
353 is less than or equal to
363 is not given, increment
373 will instead be multiplied by
378 can be negative for the additive case;
380 is then tested whether it is greater than or equal to
383 For the multiplicative case,
385 must be greater than zero.
387 If the constraints aren't met, the loop isn't executed.
390 can be any character not occurring in
394 \fBif\fR \fIexpr\fR \fBthen\fR \fIX\fR \fIif-true\fR \fIX\fR \
395 [\fBelse\fR \fIY\fR \fIif-false\fR \fIY\fR]
398 if it is non-zero then do
404 can be any character not occurring in
408 can be any character not occurring in
412 \fBprint\fR \fIarg\fR\|.\|.\|.
413 Concatenate the arguments and print as a line on stderr.
417 must be an expression, a position, or text.
419 This is useful for debugging.
422 \fBcommand\fR \fIarg\fR\|.\|.\|.
423 Concatenate the arguments
424 and pass them through as a line to troff or \*(tx.
428 must be an expression, a position, or text.
430 This has a similar effect to a line beginning with
434 but allows the values of variables to be passed through.
443 command ".ds string x is " x "."
457 \fBsh\fR \fIX\fR \fIcommand\fR \fIX\fR
463 can be any character not occurring in
467 \fBcopy\fR \fB"\,\fIfilename\/\fB"\fR
470 at this point in the file.
473 \fBcopy\fR [\fB"\,\fIfilename\/\fB"\fR] \fBthru\fR \fIX\fR \fIbody\fR \fIX\fR \
474 [\fBuntil\fR \fB"\,\fIword\*(ic\fB"\fR]
477 \fBcopy\fR [\fB"\,\fIfilename\/\fB"\fR] \fBthru\fR \fImacro\fR \
478 [\fBuntil\fR \fB"\,\fIword\*(ic\fB"\fR]
481 once for each line of
483 the line is split into blank-delimited words,
497 is not given, lines are taken from the current input up to
503 lines will be read only until a line the first word of which is
505 that line will then be discarded.
508 can be any character not occurring in
517 copy thru % circle at ($1,$2) % until "END"
544 The commands to be performed for each line can also be taken
545 from a macro defined earlier by giving the name of the macro
555 \fBreset\fI variable1\/\fR[\fB,\fR]\fI variable2 .\^.\^.
556 Reset pre-defined variables
559 \&.\^.\^.\& to their default values.
561 If no arguments are given, reset all pre-defined variables to their
564 Note that assigning a value to
566 also causes all pre-defined variables that control dimensions to be
567 reset to their default values times the new value of scale.
570 \fBplot\fR \fIexpr\fR [\fB"\,\fItext\*(ic\fB"\fR]
571 This is a text object which is constructed by using
573 as a format string for sprintf
579 is omitted a format string of
583 Attributes can be specified in the same way as for a normal text
585 Be very careful that you specify an appropriate format string;
587 does only very limited checking of the string.
588 This is deprecated in favour of
592 .IB variable\ := \ expr
597 must already be defined,
602 without creating a variable local to the current block.
606 defines the variable in the current block if it is not already defined
607 there, and then changes the value in the current block only.)
609 For example, the following:
635 Arguments of the form
639 are also allowed to be of the form
647 can contain balanced occurrences of
653 or imbalanced occurrences of
659 .\" ====================================================================
661 .\" ====================================================================
663 The syntax for expressions has been significantly extended:
681 .ie t 10\v'-.4m'\fIx\*(ic\fR\v'.4m')
689 (return a random number between 0 and 1)
692 (return a random number between 1 and
697 (set the random number seed)
721 \fB"\,\fIstr1\*(ic\fB" == "\,\fIstr2\*(ic\fB"\fR
723 \fB"\,\fIstr1\*(ic\fB" != "\,\fIstr2\*(ic\fB"\fR
728 String comparison expressions must be parenthesised in some contexts
732 .\" ====================================================================
734 .\" ====================================================================
738 is acceptable as an attribute;
743 is the current direction.
751 means draw a line 2\ inches long in the current direction.
753 The \[oq]i\[cq] (or \[oq]I\[cq]) character is ignored; to use another
754 measurement unit, set the
756 variable to an appropriate value.
760 The maximum width and height of the picture are taken from the variables
765 Initially these have values 8.5 and 11.
769 Scientific notation is allowed for numbers.
779 Text attributes can be compounded.
792 There is no limit to the depth to which blocks can be examined.
798 [A: [B: [C: box ]]] with .A.B.C.sw at 1,2
801 circle at last [\^].A.B.C
808 Arcs now have compass points determined by the circle of which the arc
813 Circles, ellipses, and arcs can be dotted or dashed.
815 In \*(tx mode splines can be dotted or dashed also.
819 Boxes can have rounded corners.
823 attribute specifies the radius of the quarter-circles at each corner.
828 attribute is given, a radius of
836 A box with rounded corners can be dotted or dashed.
840 Boxes can have slanted sides.
842 This effectively changes the shape of a box from a rectangle to an
843 arbitrary parallelogram.
849 attributes specify the x and y\~offset of the box's upper right
850 corner from its default position.
856 line can have a second argument specifying a maximum height for
859 If the width of zero is specified the width will be ignored in computing
860 the scaling factor for the picture.
864 will always scale a picture by the same amount vertically as well as
867 This is different from the DWB
870 which may scale a picture by a different amount vertically than
871 horizontally if a height is specified.
875 Each text object has an invisible box associated with it.
877 The compass points of a text object are determined by this box.
879 The implicit motion associated with the object is also determined
882 The dimensions of this box are taken from the width and height attributes;
883 if the width attribute is not supplied then the width will be taken to be
885 if the height attribute is not supplied then the height will be taken to be
886 the number of text strings associated with the object
898 In (almost all) places where a quoted text string can be used,
899 an expression of the form
901 .BI sprintf(\(ts format \(ts,\ arg ,\fR.\|.\|.\fB)
904 this will produce the arguments formatted according to
906 which should be a string as described in
908 appropriate for the number of arguments supplied.
912 The thickness of the lines used to draw objects is controlled by the
916 This gives the thickness of lines in points.
918 A negative value means use the default thickness:
919 in \*(tx output mode, this means use a thickness of 8 milliinches;
920 in \*(tx output mode with the
922 option, this means use the line thickness specified by
925 in troff output mode, this means use a thickness proportional
928 A zero value means draw the thinnest possible line supported by
931 Initially it has a value of \-1.
940 .B circle thickness 1.5
943 would draw a circle using a line with a thickness of 1.5 points.
945 The thickness of lines is not affected by the
948 variable, nor by the width or height given in the
954 Boxes (including boxes with rounded corners or slanted sides),
955 circles and ellipses can be filled by giving them an attribute of
958 This takes an optional argument of an expression with a value between
959 0 and 1; 0 will fill it with white, 1 with black, values in between
960 with a proportionally gray shade.
962 A value greater than 1 can also be used:
963 this means fill with the
964 shade of gray that is currently being used for text and lines.
966 Normally this will be black, but output devices may provide
967 a mechanism for changing this.
969 Without an argument, then the value of the variable
973 Initially this has a value of 0.5.
975 The invisible attribute does not affect the filling of objects.
977 Any text associated with a filled object will be added after the
978 object has been filled, so that the text will not be obscured
983 Three additional modifiers are available to specify colored objects:
985 sets the color of the outline,
988 .B colo\fR[\fPu\fR]\fPr\fR[\fPed\fR]
991 All three keywords expect a suffix specifying the color, for example
994 .B circle shaded """green""" outline """black"""
999 Currently, color support isn't available in \*(tx mode.
1001 Predefined color names for
1003 are in the device macro files, for example
1005 additional colors can be defined with the
1007 request (see the manual page of
1008 .BR @g@troff (@MAN1EXT@)
1013 To change the name of the vbox in \*(tx mode, set the pseudo-variable
1015 (which is actually a specially parsed command) within a picture.
1022 .B figname = foobar;
1031 The picture is then available in the box
1037 assumes that at the beginning of a picture both glyph and fill color are
1038 set to the default value.
1042 Arrow heads will be drawn as solid triangles if the variable
1044 is non-zero and either \*(tx mode is enabled or the
1046 option has not been given.
1052 Note that solid arrow heads are always filled with the current outline
1059 is device-independent.
1063 option is therefore redundant.
1065 All numbers are taken to be in inches; numbers are never interpreted
1066 to be in troff machine units.
1074 This will only work if the postprocessor is
1079 Any text associated with an object having the
1081 attribute will be rotated about the center of the object
1082 so that it is aligned in the direction from the start point
1083 to the end point of the object.
1085 Note that this attribute will have no effect for objects whose start
1086 and end points are coincident.
1093 .BI \[oq] expr \[cq]th
1098 is a single token: no space is allowed between the
1108 line from \[oq]i\[cq]th box.nw to \[oq]i+1\[cq]th box.se
1114 .\" ====================================================================
1116 .\" ====================================================================
1118 To obtain a stand-alone picture from a
1128 configuration commands may be added at the beginning of the file, but no
1134 It is necessary to feed this file into
1136 without adding any page information, so you must check which
1140 requests are actually called.
1142 For example, the mm macro package adds a page number, which is very
1145 At the moment, calling standard
1147 without any macro package works.
1149 Alternatively, you can define your own requests, e.g.\& to do nothing:
1165 itself does not provide direct conversion into other graphics file
1168 But there are lots of possibilities if you first transform your
1169 picture into PostScript\*R format using the
1176 lacks BoundingBox information it is not very useful by itself, but it
1177 may be fed into other conversion programs, usually named
1183 Moreover, the PostScript interpreter
1186 has built-in graphics conversion devices that are called with the option
1189 .BI "gs \-sDEVICE=" <devname>
1198 for a list of the available devices.
1202 An alternative may be to use the
1204 option to convert your picture directly into
1208 The MediaBox of the file produced can be controlled by passing a
1214 As the Encapsulated PostScript File Format
1216 is getting more and more important, and the conversion wasn't
1217 regarded trivial in the past you might be interested to know that
1218 there is a conversion tool named
1220 which does the right job.
1222 It is much better than the tool
1229 For bitmapped graphic formats, you should use
1231 the resulting (intermediate)
1233 file can be then converted to virtually any graphics format using the
1239 .\" ====================================================================
1241 .\" ====================================================================
1244 .I @MACRODIR@/pic.tmac
1245 Example definitions of the
1252 .\" ====================================================================
1254 .\" ====================================================================
1256 .BR @g@troff (@MAN1EXT@),
1257 .BR groff_out (@MAN5EXT@),
1268 .I Making Pictures With GNU PIC.
1271 (this file, together with its source file, pic.ms, is part
1272 of the groff documentation)
1278 Brian W.\& Kernighan,
1279 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:116.ps.gz
1280 .I PIC \(em A Graphics Language for Typesetting (User Manual)
1282 AT&T Bell Laboratories, Computing Science Technical Report No.\ 116
1283 (revised May, 1991).
1288 is available from CTAN mirrors, e.g.\&
1289 .UR ftp://\:ftp.dante.de/\:tex\-archive/\:support/\:ps2eps/
1294 W.\& Richard Stevens,
1295 .UR http://\:www.kohala.com/\:start/\:troff/\:pic2html.html
1296 .I Turning PIC into HTML
1301 W.\& Richard Stevens,
1302 .UR http://\:www.kohala.com/\:start/\:troff/\:pic.examples.ps
1303 .IR "Examples of " pic " Macros"
1307 .\" ====================================================================
1309 .\" ====================================================================
1311 Input characters that are invalid for
1313 (i.e., those with ASCII code 0,
1314 or 013 octal, or between 015 and 037 octal, or between 0200 and 0237
1315 octal) are rejected even in \*(tx mode.
1319 The interpretation of
1321 is incompatible with the pic in 10th edition Unix,
1322 which interprets 0 as black and 1 as white.
1326 PostScript\*R is a registered trademark of Adobe Systems Incorporation.
1329 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
1333 .\" Local Variables:
1336 .\" vim: set filetype=groff: