2 .de PS \" start picture
3 . \" $1 is height, $2 is width, both in inches
10 .de PE \" end of picture
15 pic \- troff preprocessor for drawing pictures
26 preprocessor for drawing figures on a typesetter.
28 code is contained between
35 \&.PS \f2optional-width\fP \f2optional-height\fP
40 or in a file mentioned in a
48 is present, the picture is made that many inches wide,
49 regardless of any dimensions used internally.
50 The height is scaled in the same proportion unless
57 the typesetting position after printing is restored to what it was
62 is a list of elements:
64 \f2primitive attribute-list\fP
65 \f2placename\fP : \f2element\fP
66 \f2placename\fP : \f2position\fP
67 \f2var\fP = \f2expr\fP
69 { \f2element-list\fP }
70 [ \f2element-list\fP ]
71 for \f2var\fP = \f2expr\fP to \f2expr\fP by \f2expr\fP do { \f2anything\fP }
72 if \f2expr\fP then { \f2anything\fP } else { \f2anything\fP }
73 copy \f2file,\fP copy thru \f2macro,\fP copy \f2file\fP thru \fPmacro\fP
74 sh { \f2commandline\fP }
76 reset \f2optional var-list\fP
80 Elements are separated by newlines or semicolons;
81 a long element may be continued by ending the line with a backslash.
82 Comments are introduced by a
84 and terminated by a newline.
85 Variable names begin with a lower case letter;
86 place names begin with upper case.
87 Place and variable names retain their values
88 from one picture to the next.
91 the current position moves in the current direction
94 (default)) by the size of the primitive.
95 The current position and direction are saved upon entry
98 block and restored upon exit.
99 Elements within a block enclosed in
101 are treated as a unit;
102 the dimensions are determined by the extreme points
103 of the contained objects.
104 Names, variables, and direction of motion within a block are local to that block.
107 is any line that begins with a period.
108 Such a line is assumed to make sense in the context where it appears;
109 generally, this means only size and font changes.
116 box circle ellipse arc line arrow spline move \f2text-list\fP
124 is a sequence of zero or more attributes;
125 each attribute consists of a keyword, perhaps followed by a value.
128 h(eigh)t \f2expr\fP wid(th) \f2expr\fP
129 rad(ius) \f2expr\fP diam(eter) \f2expr\fP
130 up \f2opt-expr\fP down \f2opt-expr\fP
131 right \f2opt-expr\fP left \f2opt-expr\fP
132 from \f2position\fP to \f2position\fP
133 at \f2position\fP with \f2corner\fP
134 by \f2expr, expr\fP then
135 dotted \f2opt-expr\fP dashed \f2opt-expr\fP
136 chop \f2opt-expr\fP -> <- <->
139 \f2text-list\fP \f2expr\fP
141 Missing attributes and values are filled in from defaults.
142 Not all attributes make sense for all primitives;
143 irrelevant ones are silently ignored.
146 causes the geometrical center to be put at the specified place;
148 causes the position on the object to be put at the specified place.
149 For lines, splines and arcs,
153 refer to arrowhead size.
156 implies motion in the current direction.
158 Text is normally an attribute of some primitive;
159 by default it is placed at the geometrical center of the object.
160 Stand-alone text is also permitted.
162 is a list of text items:
165 "..." \f2positioning ...\fP
166 sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP
168 center ljust rjust above below
170 If there are multiple text items for some primitive,
171 they are arranged vertically and centered except as qualified.
172 Positioning requests apply to each item independently.
173 Text items may contain
175 commands for size and font changes, local motions, etc.,
176 but make sure that these are balanced
177 so that the entering state is restored before exiting.
179 A position is ultimately an
181 coordinate pair, but it may be specified in other ways.
185 \f2place\fP ± \f2expr, expr\fP
186 \f2place\fP ± ( \f2expr, expr\fP )
187 ( \f2position\fP,\f2 position\fP ) \f2x\fP\fR from one, \f2y\fP\fR the other\fP
188 \f2expr\fP [\fLof the way\fP] between \f2position\fP and \f2position\fP
189 \f2expr\fP < \f2position\fP , \f2position\fP >
195 \f2placename\fP \f2optional-corner\fP
196 \f2corner\fP of \f2placename\fP
197 \f2nth\fP \f2primitive\fP \f2optional-corner\fP
198 \f2corner\fP of \f2nth\fP \f2primitive\fP
203 is one of the eight compass points
204 or the center or the start or end of a primitive.
206 \f2 optional-corner\fP:
207 .n .e .w .s .ne .se .nw .sw .c .start .end
209 top bot left right start end
211 Each object in a picture has an ordinal number;
216 \f2n\fPth\f2, n\fPth last
219 The built-in variables and their default values are:
222 boxwid 0.75 boxht 0.5
223 circlerad 0.25 arcrad 0.25
224 ellipsewid 0.75 ellipseht 0.5
225 linewid 0.5 lineht 0.5
226 movewid 0.5 moveht 0.5
228 arrowwid 0.05 arrowht 0.1
229 dashwid 0.1 arrowhead 2
232 These may be changed at any time,
233 and the new values remain in force from picture to picture until changed again
237 Variables changed within
241 revert to their previous value upon exit from the block.
242 Dimensions are divided by
248 are evaluated in floating point.
249 All numbers representing dimensions are taken to be in inches.
252 \f2expr\fP \f2op\fP \f2expr\fP
258 \f2place\fP .x \f2place\fP .y \f2place\fP .ht \f2place\fP .wid \f2place\fP .rad
259 sin(\f2expr\fP) cos(\f2expr\fP) atan2(\f2expr,expr\fP) log(\f2expr\fP) exp(\f2expr\fP)
260 sqrt(\f2expr\fP) max(\f2expr,expr\fP) min(\f2expr,expr\fP) int(\f2expr\fP) rand()
262 + - * / % < <= > >= == != && ||
269 statements are not part of the grammar.
271 define \f2name\fP { \f2replacement text\fP }
278 in the replacement text
279 will be replaced by the corresponding arguments if
283 \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...)
285 Non-existent arguments are replaced by null strings.
287 may contain newlines.
290 statement removes the definition of a macro.
299 ``PIC\(ema Graphics Language for Typesetting'',
301 Unix Research System Programmer's Manual,
302 Tenth Edition, Volume 2