2 dfc67f9b 2004-05-16 devnull .de PS \" start picture
3 dfc67f9b 2004-05-16 devnull . \" $1 is height, $2 is width, both in inches
4 dfc67f9b 2004-05-16 devnull .if \\$1>0 .sp .35
5 dfc67f9b 2004-05-16 devnull .ie \\$1>0 .nr $1 \\$1
6 dfc67f9b 2004-05-16 devnull .el .nr $1 0
7 dfc67f9b 2004-05-16 devnull .in (\\n(.lu-\\$2)/2u
10 dfc67f9b 2004-05-16 devnull .de PE \" end of picture
12 dfc67f9b 2004-05-16 devnull .if \\n($1>0 .sp .65
15 dfc67f9b 2004-05-16 devnull pic, tpic \- troff and tex preprocessors for drawing pictures
16 dfc67f9b 2004-05-16 devnull .SH SYNOPSIS
26 dfc67f9b 2004-05-16 devnull .SH DESCRIPTION
29 dfc67f9b 2004-05-16 devnull .IR troff (1)
30 dfc67f9b 2004-05-16 devnull preprocessor for drawing figures on a typesetter.
32 dfc67f9b 2004-05-16 devnull code is contained between
39 dfc67f9b 2004-05-16 devnull \&.PS \f2optional-width\fP \f2optional-height\fP
40 dfc67f9b 2004-05-16 devnull \f2element-list\fP
44 dfc67f9b 2004-05-16 devnull or in a file mentioned in a
48 dfc67f9b 2004-05-16 devnull .BI .PS " " < file
51 dfc67f9b 2004-05-16 devnull .IR optional-width
52 dfc67f9b 2004-05-16 devnull is present, the picture is made that many inches wide,
53 dfc67f9b 2004-05-16 devnull regardless of any dimensions used internally.
54 dfc67f9b 2004-05-16 devnull The height is scaled in the same proportion unless
55 dfc67f9b 2004-05-16 devnull .IR optional-height
56 dfc67f9b 2004-05-16 devnull is present.
59 dfc67f9b 2004-05-16 devnull is used instead of
60 dfc67f9b 2004-05-16 devnull .BR .PE ,
61 dfc67f9b 2004-05-16 devnull the typesetting position after printing is restored to what it was
62 dfc67f9b 2004-05-16 devnull upon entry.
65 dfc67f9b 2004-05-16 devnull .IR element-list
66 dfc67f9b 2004-05-16 devnull is a list of elements:
68 dfc67f9b 2004-05-16 devnull \f2primitive attribute-list\fP
69 dfc67f9b 2004-05-16 devnull \f2placename\fP : \f2element\fP
70 dfc67f9b 2004-05-16 devnull \f2placename\fP : \f2position\fP
71 dfc67f9b 2004-05-16 devnull \f2var\fP = \f2expr\fP
72 dfc67f9b 2004-05-16 devnull \f2direction\fP
73 dfc67f9b 2004-05-16 devnull { \f2element-list\fP }
74 dfc67f9b 2004-05-16 devnull [ \f2element-list\fP ]
75 dfc67f9b 2004-05-16 devnull for \f2var\fP = \f2expr\fP to \f2expr\fP by \f2expr\fP do { \f2anything\fP }
76 dfc67f9b 2004-05-16 devnull if \f2expr\fP then { \f2anything\fP } else { \f2anything\fP }
77 dfc67f9b 2004-05-16 devnull copy \f2file,\fP copy thru \f2macro,\fP copy \f2file\fP thru \fPmacro\fP
78 dfc67f9b 2004-05-16 devnull sh { \f2commandline\fP }
79 dfc67f9b 2004-05-16 devnull print \f2expr\fP
80 dfc67f9b 2004-05-16 devnull reset \f2optional var-list\fP
81 dfc67f9b 2004-05-16 devnull \f2troff-command\fP
84 dfc67f9b 2004-05-16 devnull Elements are separated by newlines or semicolons;
85 dfc67f9b 2004-05-16 devnull a long element may be continued by ending the line with a backslash.
86 dfc67f9b 2004-05-16 devnull Comments are introduced by a
88 dfc67f9b 2004-05-16 devnull and terminated by a newline.
89 dfc67f9b 2004-05-16 devnull Variable names begin with a lower case letter;
90 dfc67f9b 2004-05-16 devnull place names begin with upper case.
91 dfc67f9b 2004-05-16 devnull Place and variable names retain their values
92 dfc67f9b 2004-05-16 devnull from one picture to the next.
94 dfc67f9b 2004-05-16 devnull After each primitive
95 dfc67f9b 2004-05-16 devnull the current position moves in the current direction
96 dfc67f9b 2004-05-16 devnull .RB ( up , down ,
97 dfc67f9b 2004-05-16 devnull .BR left , right
98 dfc67f9b 2004-05-16 devnull (default)) by the size of the primitive.
99 dfc67f9b 2004-05-16 devnull The current position and direction are saved upon entry
101 dfc67f9b 2004-05-16 devnull .BR { ... }
102 dfc67f9b 2004-05-16 devnull block and restored upon exit.
103 dfc67f9b 2004-05-16 devnull Elements within a block enclosed in
104 dfc67f9b 2004-05-16 devnull .BR [ ... ]
105 dfc67f9b 2004-05-16 devnull are treated as a unit;
106 dfc67f9b 2004-05-16 devnull the dimensions are determined by the extreme points
107 dfc67f9b 2004-05-16 devnull of the contained objects.
108 dfc67f9b 2004-05-16 devnull Names, variables, and direction of motion within a block are local to that block.
110 dfc67f9b 2004-05-16 devnull .IR Troff-command
111 dfc67f9b 2004-05-16 devnull is any line that begins with a period.
112 dfc67f9b 2004-05-16 devnull Such a line is assumed to make sense in the context where it appears;
113 dfc67f9b 2004-05-16 devnull generally, this means only size and font changes.
116 dfc67f9b 2004-05-16 devnull .I primitive
117 dfc67f9b 2004-05-16 devnull objects are:
120 dfc67f9b 2004-05-16 devnull box circle ellipse arc line arrow spline move \f2text-list\fP
122 dfc67f9b 2004-05-16 devnull .L arrow
123 dfc67f9b 2004-05-16 devnull is a synonym for
124 dfc67f9b 2004-05-16 devnull .LR "line ->" .
127 dfc67f9b 2004-05-16 devnull .IR attribute-list
128 dfc67f9b 2004-05-16 devnull is a sequence of zero or more attributes;
129 dfc67f9b 2004-05-16 devnull each attribute consists of a keyword, perhaps followed by a value.
131 dfc67f9b 2004-05-16 devnull .ta .5i 2.5i
132 dfc67f9b 2004-05-16 devnull h(eigh)t \f2expr\fP wid(th) \f2expr\fP
133 dfc67f9b 2004-05-16 devnull rad(ius) \f2expr\fP diam(eter) \f2expr\fP
134 dfc67f9b 2004-05-16 devnull up \f2opt-expr\fP down \f2opt-expr\fP
135 dfc67f9b 2004-05-16 devnull right \f2opt-expr\fP left \f2opt-expr\fP
136 dfc67f9b 2004-05-16 devnull from \f2position\fP to \f2position\fP
137 dfc67f9b 2004-05-16 devnull at \f2position\fP with \f2corner\fP
138 dfc67f9b 2004-05-16 devnull by \f2expr, expr\fP then
139 dfc67f9b 2004-05-16 devnull dotted \f2opt-expr\fP dashed \f2opt-expr\fP
140 dfc67f9b 2004-05-16 devnull chop \f2opt-expr\fP -> <- <->
141 dfc67f9b 2004-05-16 devnull invis same
142 dfc67f9b 2004-05-16 devnull fill \f2opt-expr\fP
143 dfc67f9b 2004-05-16 devnull \f2text-list\fP \f2expr\fP
145 dfc67f9b 2004-05-16 devnull Missing attributes and values are filled in from defaults.
146 dfc67f9b 2004-05-16 devnull Not all attributes make sense for all primitives;
147 dfc67f9b 2004-05-16 devnull irrelevant ones are silently ignored.
148 dfc67f9b 2004-05-16 devnull The attribute
150 dfc67f9b 2004-05-16 devnull causes the geometrical center to be put at the specified place;
152 dfc67f9b 2004-05-16 devnull causes the position on the object to be put at the specified place.
153 dfc67f9b 2004-05-16 devnull For lines, splines and arcs,
154 dfc67f9b 2004-05-16 devnull .L height
156 dfc67f9b 2004-05-16 devnull .L width
157 dfc67f9b 2004-05-16 devnull refer to arrowhead size.
160 dfc67f9b 2004-05-16 devnull implies motion in the current direction.
162 dfc67f9b 2004-05-16 devnull Text is normally an attribute of some primitive;
163 dfc67f9b 2004-05-16 devnull by default it is placed at the geometrical center of the object.
164 dfc67f9b 2004-05-16 devnull Stand-alone text is also permitted.
165 dfc67f9b 2004-05-16 devnull A text list
166 dfc67f9b 2004-05-16 devnull is a list of text items:
168 dfc67f9b 2004-05-16 devnull \f2 text-item\fP:
169 dfc67f9b 2004-05-16 devnull "..." \f2positioning ...\fP
170 dfc67f9b 2004-05-16 devnull sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP
171 dfc67f9b 2004-05-16 devnull \f2 positioning\fP:
172 dfc67f9b 2004-05-16 devnull center ljust rjust above below
174 dfc67f9b 2004-05-16 devnull If there are multiple text items for some primitive,
175 dfc67f9b 2004-05-16 devnull they are arranged vertically and centered except as qualified.
176 dfc67f9b 2004-05-16 devnull Positioning requests apply to each item independently.
177 dfc67f9b 2004-05-16 devnull Text items may contain
178 dfc67f9b 2004-05-16 devnull .I troff
179 dfc67f9b 2004-05-16 devnull commands for size and font changes, local motions, etc.,
180 dfc67f9b 2004-05-16 devnull but make sure that these are balanced
181 dfc67f9b 2004-05-16 devnull so that the entering state is restored before exiting.
183 dfc67f9b 2004-05-16 devnull A position is ultimately an
185 dfc67f9b 2004-05-16 devnull coordinate pair, but it may be specified in other ways.
187 dfc67f9b 2004-05-16 devnull \f2 position\fP:
188 dfc67f9b 2004-05-16 devnull \f2expr, expr\fP
189 dfc67f9b 2004-05-16 devnull \f2place\fP ± \f2expr, expr\fP
190 dfc67f9b 2004-05-16 devnull \f2place\fP ± ( \f2expr, expr\fP )
191 dfc67f9b 2004-05-16 devnull ( \f2position\fP,\f2 position\fP ) \f2x\fP\fR from one, \f2y\fP\fR the other\fP
192 dfc67f9b 2004-05-16 devnull \f2expr\fP [\fLof the way\fP] between \f2position\fP and \f2position\fP
193 dfc67f9b 2004-05-16 devnull \f2expr\fP < \f2position\fP , \f2position\fP >
194 dfc67f9b 2004-05-16 devnull ( \f2position\fP )
198 dfc67f9b 2004-05-16 devnull \f2 place\fP:
199 dfc67f9b 2004-05-16 devnull \f2placename\fP \f2optional-corner\fP
200 dfc67f9b 2004-05-16 devnull \f2corner\fP of \f2placename\fP
201 dfc67f9b 2004-05-16 devnull \f2nth\fP \f2primitive\fP \f2optional-corner\fP
202 dfc67f9b 2004-05-16 devnull \f2corner\fP of \f2nth\fP \f2primitive\fP
206 dfc67f9b 2004-05-16 devnull .IR optional-corner
207 dfc67f9b 2004-05-16 devnull is one of the eight compass points
208 dfc67f9b 2004-05-16 devnull or the center or the start or end of a primitive.
210 dfc67f9b 2004-05-16 devnull \f2 optional-corner\fP:
211 dfc67f9b 2004-05-16 devnull .n .e .w .s .ne .se .nw .sw .c .start .end
212 dfc67f9b 2004-05-16 devnull \f2 corner\fP:
213 dfc67f9b 2004-05-16 devnull top bot left right start end
215 dfc67f9b 2004-05-16 devnull Each object in a picture has an ordinal number;
217 dfc67f9b 2004-05-16 devnull refers to this.
219 dfc67f9b 2004-05-16 devnull \f2 nth\fP:
220 dfc67f9b 2004-05-16 devnull \f2n\fPth\f2, n\fPth last
223 dfc67f9b 2004-05-16 devnull The built-in variables and their default values are:
225 dfc67f9b 2004-05-16 devnull .ta .5i 2.5i
226 dfc67f9b 2004-05-16 devnull boxwid 0.75 boxht 0.5
227 dfc67f9b 2004-05-16 devnull circlerad 0.25 arcrad 0.25
228 dfc67f9b 2004-05-16 devnull ellipsewid 0.75 ellipseht 0.5
229 dfc67f9b 2004-05-16 devnull linewid 0.5 lineht 0.5
230 dfc67f9b 2004-05-16 devnull movewid 0.5 moveht 0.5
231 dfc67f9b 2004-05-16 devnull textwid 0 textht 0
232 dfc67f9b 2004-05-16 devnull arrowwid 0.05 arrowht 0.1
233 dfc67f9b 2004-05-16 devnull dashwid 0.1 arrowhead 2
236 dfc67f9b 2004-05-16 devnull These may be changed at any time,
237 dfc67f9b 2004-05-16 devnull and the new values remain in force from picture to picture until changed again
238 dfc67f9b 2004-05-16 devnull or reset by a
239 dfc67f9b 2004-05-16 devnull .L reset
240 dfc67f9b 2004-05-16 devnull statement.
241 dfc67f9b 2004-05-16 devnull Variables changed within
245 dfc67f9b 2004-05-16 devnull revert to their previous value upon exit from the block.
246 dfc67f9b 2004-05-16 devnull Dimensions are divided by
247 dfc67f9b 2004-05-16 devnull .B scale
248 dfc67f9b 2004-05-16 devnull during output.
250 dfc67f9b 2004-05-16 devnull Expressions in
252 dfc67f9b 2004-05-16 devnull are evaluated in floating point.
253 dfc67f9b 2004-05-16 devnull All numbers representing dimensions are taken to be in inches.
255 dfc67f9b 2004-05-16 devnull \f2 expr\fP:
256 dfc67f9b 2004-05-16 devnull \f2expr\fP \f2op\fP \f2expr\fP
257 dfc67f9b 2004-05-16 devnull - \f2expr\fP
258 dfc67f9b 2004-05-16 devnull ! \f2expr\fP
259 dfc67f9b 2004-05-16 devnull ( \f2expr\fP )
260 dfc67f9b 2004-05-16 devnull variable
262 dfc67f9b 2004-05-16 devnull \f2place\fP .x \f2place\fP .y \f2place\fP .ht \f2place\fP .wid \f2place\fP .rad
263 dfc67f9b 2004-05-16 devnull sin(\f2expr\fP) cos(\f2expr\fP) atan2(\f2expr,expr\fP) log(\f2expr\fP) exp(\f2expr\fP)
264 dfc67f9b 2004-05-16 devnull sqrt(\f2expr\fP) max(\f2expr,expr\fP) min(\f2expr,expr\fP) int(\f2expr\fP) rand()
265 dfc67f9b 2004-05-16 devnull \f2 op\fP:
266 dfc67f9b 2004-05-16 devnull + - * / % < <= > >= == != && ||
270 dfc67f9b 2004-05-16 devnull .B define
272 dfc67f9b 2004-05-16 devnull .B undef
273 dfc67f9b 2004-05-16 devnull statements are not part of the grammar.
275 dfc67f9b 2004-05-16 devnull define \f2name\fP { \f2replacement text\fP }
276 dfc67f9b 2004-05-16 devnull undef \f2name\fP
278 dfc67f9b 2004-05-16 devnull Occurrences of
279 dfc67f9b 2004-05-16 devnull .BR $1 ,
280 dfc67f9b 2004-05-16 devnull .BR $2 ,
282 dfc67f9b 2004-05-16 devnull in the replacement text
283 dfc67f9b 2004-05-16 devnull will be replaced by the corresponding arguments if
285 dfc67f9b 2004-05-16 devnull is invoked as
287 dfc67f9b 2004-05-16 devnull \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...)
289 dfc67f9b 2004-05-16 devnull Non-existent arguments are replaced by null strings.
290 dfc67f9b 2004-05-16 devnull Replacement text
291 dfc67f9b 2004-05-16 devnull may contain newlines.
293 dfc67f9b 2004-05-16 devnull .B undef
294 dfc67f9b 2004-05-16 devnull statement removes the definition of a macro.
298 dfc67f9b 2004-05-16 devnull .IR tex (1)
299 dfc67f9b 2004-05-16 devnull preprocessor that accepts
301 dfc67f9b 2004-05-16 devnull language.
302 dfc67f9b 2004-05-16 devnull It produces Tex commands that define a box called
303 dfc67f9b 2004-05-16 devnull .BR \egraph ,
304 dfc67f9b 2004-05-16 devnull which contains the picture.
305 dfc67f9b 2004-05-16 devnull The box may be output this way:
308 dfc67f9b 2004-05-16 devnull \ecenterline{\ebox\egraph}
309 dfc67f9b 2004-05-16 devnull .SH EXAMPLES
311 dfc67f9b 2004-05-16 devnull arrow "input" above; box "process"; arrow "output" above
313 dfc67f9b 2004-05-16 devnull A: ellipse
314 dfc67f9b 2004-05-16 devnull circle rad .1 with .w at A.e
315 dfc67f9b 2004-05-16 devnull circle rad .05 at 0.5 <A.c, A.ne>
316 dfc67f9b 2004-05-16 devnull circle rad .065 at 0.5 <A.c, A.ne>
317 dfc67f9b 2004-05-16 devnull spline from last circle.nw left .25 then left .05 down .05
318 dfc67f9b 2004-05-16 devnull arc from A.c to A.se rad 0.5
319 dfc67f9b 2004-05-16 devnull for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 }
323 dfc67f9b 2004-05-16 devnull arrow "input" above; box "process"; arrow "output" above
325 dfc67f9b 2004-05-16 devnull A: ellipse
326 dfc67f9b 2004-05-16 devnull circle rad .1 with .w at A.e
327 dfc67f9b 2004-05-16 devnull circle rad .05 at 0.5 <A.c, A.ne>
328 dfc67f9b 2004-05-16 devnull circle rad .065 at 0.5 <A.c, A.ne>
329 dfc67f9b 2004-05-16 devnull spline from last circle.nw left .25 then left .05 down .05
330 dfc67f9b 2004-05-16 devnull arc from A.c to A.se rad 0.5
331 dfc67f9b 2004-05-16 devnull for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 }
333 dfc67f9b 2004-05-16 devnull .SH SOURCE
334 c3674de4 2005-01-11 devnull .B \*9/src/cmd/pic
335 dfc67f9b 2004-05-16 devnull .SH "SEE ALSO"
336 dfc67f9b 2004-05-16 devnull .IR grap (1),
337 dfc67f9b 2004-05-16 devnull .IR doctype (1),
338 dfc67f9b 2004-05-16 devnull .IR troff (1)
340 dfc67f9b 2004-05-16 devnull B. W. Kernighan,
341 dfc67f9b 2004-05-16 devnull ``PIC\(ema Graphics Language for Typesetting'',
343 dfc67f9b 2004-05-16 devnull Unix Research System Programmer's Manual,
344 dfc67f9b 2004-05-16 devnull Tenth Edition, Volume 2