2 .de PS \" start picture
3 . \" $1 is height, $2 is width, both in inches
10 .de PE \" end of picture
15 pic, tpic \- troff and tex preprocessors for drawing pictures
30 preprocessor for drawing figures on a typesetter.
32 code is contained between
39 \&.PS \f2optional-width\fP \f2optional-height\fP
44 or in a file mentioned in a
52 is present, the picture is made that many inches wide,
53 regardless of any dimensions used internally.
54 The height is scaled in the same proportion unless
61 the typesetting position after printing is restored to what it was
66 is a list of elements:
68 \f2primitive attribute-list\fP
69 \f2placename\fP : \f2element\fP
70 \f2placename\fP : \f2position\fP
71 \f2var\fP = \f2expr\fP
73 { \f2element-list\fP }
74 [ \f2element-list\fP ]
75 for \f2var\fP = \f2expr\fP to \f2expr\fP by \f2expr\fP do { \f2anything\fP }
76 if \f2expr\fP then { \f2anything\fP } else { \f2anything\fP }
77 copy \f2file,\fP copy thru \f2macro,\fP copy \f2file\fP thru \fPmacro\fP
78 sh { \f2commandline\fP }
80 reset \f2optional var-list\fP
84 Elements are separated by newlines or semicolons;
85 a long element may be continued by ending the line with a backslash.
86 Comments are introduced by a
88 and terminated by a newline.
89 Variable names begin with a lower case letter;
90 place names begin with upper case.
91 Place and variable names retain their values
92 from one picture to the next.
95 the current position moves in the current direction
98 (default)) by the size of the primitive.
99 The current position and direction are saved upon entry
102 block and restored upon exit.
103 Elements within a block enclosed in
105 are treated as a unit;
106 the dimensions are determined by the extreme points
107 of the contained objects.
108 Names, variables, and direction of motion within a block are local to that block.
111 is any line that begins with a period.
112 Such a line is assumed to make sense in the context where it appears;
113 generally, this means only size and font changes.
120 box circle ellipse arc line arrow spline move \f2text-list\fP
128 is a sequence of zero or more attributes;
129 each attribute consists of a keyword, perhaps followed by a value.
132 h(eigh)t \f2expr\fP wid(th) \f2expr\fP
133 rad(ius) \f2expr\fP diam(eter) \f2expr\fP
134 up \f2opt-expr\fP down \f2opt-expr\fP
135 right \f2opt-expr\fP left \f2opt-expr\fP
136 from \f2position\fP to \f2position\fP
137 at \f2position\fP with \f2corner\fP
138 by \f2expr, expr\fP then
139 dotted \f2opt-expr\fP dashed \f2opt-expr\fP
140 chop \f2opt-expr\fP -> <- <->
143 \f2text-list\fP \f2expr\fP
145 Missing attributes and values are filled in from defaults.
146 Not all attributes make sense for all primitives;
147 irrelevant ones are silently ignored.
150 causes the geometrical center to be put at the specified place;
152 causes the position on the object to be put at the specified place.
153 For lines, splines and arcs,
157 refer to arrowhead size.
160 implies motion in the current direction.
162 Text is normally an attribute of some primitive;
163 by default it is placed at the geometrical center of the object.
164 Stand-alone text is also permitted.
166 is a list of text items:
169 "..." \f2positioning ...\fP
170 sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP
172 center ljust rjust above below
174 If there are multiple text items for some primitive,
175 they are arranged vertically and centered except as qualified.
176 Positioning requests apply to each item independently.
177 Text items may contain
179 commands for size and font changes, local motions, etc.,
180 but make sure that these are balanced
181 so that the entering state is restored before exiting.
183 A position is ultimately an
185 coordinate pair, but it may be specified in other ways.
189 \f2place\fP ± \f2expr, expr\fP
190 \f2place\fP ± ( \f2expr, expr\fP )
191 ( \f2position\fP,\f2 position\fP ) \f2x\fP\fR from one, \f2y\fP\fR the other\fP
192 \f2expr\fP [\fLof the way\fP] between \f2position\fP and \f2position\fP
193 \f2expr\fP < \f2position\fP , \f2position\fP >
199 \f2placename\fP \f2optional-corner\fP
200 \f2corner\fP of \f2placename\fP
201 \f2nth\fP \f2primitive\fP \f2optional-corner\fP
202 \f2corner\fP of \f2nth\fP \f2primitive\fP
207 is one of the eight compass points
208 or the center or the start or end of a primitive.
210 \f2 optional-corner\fP:
211 .n .e .w .s .ne .se .nw .sw .c .start .end
213 top bot left right start end
215 Each object in a picture has an ordinal number;
220 \f2n\fPth\f2, n\fPth last
223 The built-in variables and their default values are:
226 boxwid 0.75 boxht 0.5
227 circlerad 0.25 arcrad 0.25
228 ellipsewid 0.75 ellipseht 0.5
229 linewid 0.5 lineht 0.5
230 movewid 0.5 moveht 0.5
232 arrowwid 0.05 arrowht 0.1
233 dashwid 0.1 arrowhead 2
236 These may be changed at any time,
237 and the new values remain in force from picture to picture until changed again
241 Variables changed within
245 revert to their previous value upon exit from the block.
246 Dimensions are divided by
252 are evaluated in floating point.
253 All numbers representing dimensions are taken to be in inches.
256 \f2expr\fP \f2op\fP \f2expr\fP
262 \f2place\fP .x \f2place\fP .y \f2place\fP .ht \f2place\fP .wid \f2place\fP .rad
263 sin(\f2expr\fP) cos(\f2expr\fP) atan2(\f2expr,expr\fP) log(\f2expr\fP) exp(\f2expr\fP)
264 sqrt(\f2expr\fP) max(\f2expr,expr\fP) min(\f2expr,expr\fP) int(\f2expr\fP) rand()
266 + - * / % < <= > >= == != && ||
273 statements are not part of the grammar.
275 define \f2name\fP { \f2replacement text\fP }
282 in the replacement text
283 will be replaced by the corresponding arguments if
287 \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...)
289 Non-existent arguments are replaced by null strings.
291 may contain newlines.
294 statement removes the definition of a macro.
299 preprocessor that accepts
302 It produces Tex commands that define a box called
304 which contains the picture.
305 The box may be output this way:
308 \ecenterline{\ebox\egraph}
311 arrow "input" above; box "process"; arrow "output" above
314 circle rad .1 with .w at A.e
315 circle rad .05 at 0.5 <A.c, A.ne>
316 circle rad .065 at 0.5 <A.c, A.ne>
317 spline from last circle.nw left .25 then left .05 down .05
318 arc from A.c to A.se rad 0.5
319 for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 }
323 arrow "input" above; box "process"; arrow "output" above
326 circle rad .1 with .w at A.e
327 circle rad .05 at 0.5 <A.c, A.ne>
328 circle rad .065 at 0.5 <A.c, A.ne>
329 spline from last circle.nw left .25 then left .05 down .05
330 arc from A.c to A.se rad 0.5
331 for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 }
341 ``PIC\(ema Graphics Language for Typesetting'',
343 Unix Research System Programmer's Manual,
344 Tenth Edition, Volume 2