|
|
1.1 root 1: .de PS \" start picture
2: . \" $1 is height, $2 is width, both in inches
3: .if \\$1>0 .sp .35
4: .ie \\$1>0 .nr $1 \\$1
5: .el .nr $1 0
6: .in (\\n(.lu-\\$2)/2u
7: .ne \\$1
8: ..
9: .de PE \" end of picture
10: .in
11: .if \\n($1>0 .sp .65
12: ..
13: .TH PIC 1
14: .CT 1 writing_troff graphics
15: .SH NAME
16: pic, tpic \(mi troff and tex preprocessors for drawing pictures
17: .SH SYNOPSIS
18: .B pic
19: [
20: .I files
21: ]
22: .PP
23: .B tpic
24: [
25: .I files
26: ]
27: .SH DESCRIPTION
28: .I Pic
29: is a
30: .IR troff (1)
31: preprocessor for drawing figures on a typesetter.
32: .I Pic
33: code is contained between
34: .B .PS
35: and
36: .B .PE
37: lines:
38: .IP
39: .EX
40: \&.PS \f2optional-width\fP \f2optional-height\fP
41: \f2element-list\fP
42: \&.PE
43: .EE
44: .LP
45: or in a file mentioned in a
46: .B .PS
47: line:
48: .IP
49: .BI .PS " optional-width optional-height " < file
50: .LP
51: If
52: .IR optional-width
53: is present, the picture is made that many inches wide,
54: regardless of any dimensions used internally.
55: The height is scaled in the same proportion unless
56: .IR optional-height
57: is present.
58: If
59: .B .PF
60: is used instead of
61: .BR .PE ,
62: the typesetting position after printing is restored to what it was
63: upon entry.
64: .PP
65: An
66: .IR element-list
67: is a list of elements:
68: .EX
69: \f2primitive attribute-list\fP
70: \f2placename\fP : \f2element\fP
71: \f2placename\fP : \f2position\fP
72: \f2var\fP = \f2expr\fP
73: \f2direction\fP
74: { \f2element-list\fP }
75: [ \f2element-list\fP ]
76: for \f2var\fP = \f2expr\fP to \f2expr\fP by \f2expr\fP do { \f2anything\fP }
77: if \f2expr\fP then { \f2anything\fP } else { \f2anything\fP }
78: copy \f2file,\fP copy thru \f2macro,\fP copy \f2file\fP thru \fPmacro\fP
79: sh { \f2commandline\fP }
80: print \f2expr\fP
81: reset \f2optional var-list\fP
82: \f2troff-command\fP
83: .EE
84: .PP
85: Elements are separated by newlines or semicolons;
86: a long element may be continued by ending the line with a backslash.
87: Comments are introduced by a
88: .BI #
89: and terminated by a newline.
90: Variable names begin with a lower case letter;
91: place names begin with upper case.
92: Place and variable names retain their values
93: from one picture to the next.
94: .PP
95: After each primitive
96: the current position moves in the current direction
97: .RB ( up , down ,
98: .BR left , right
99: (default)) by the size of the primitive.
100: The current position and direction are saved upon entry
101: to a
102: .BR { ... }
103: block and restored upon exit.
104: Elements within a block enclosed in
105: .BR [ ... ]
106: are treated as a unit;
107: the dimensions are determined by the extreme points
108: of the contained objects.
109: Names, variables, and direction of motion within a block are local to that block.
110: .PP
111: .IR troff-command
112: is any line that begins with a period.
113: Such a line is assumed to make sense in the context where it appears;
114: generally, this means only size and font changes.
115: .PP
116: The
117: .I primitive
118: objects are:
119: .br
120: .EX
121: box circle ellipse arc line arrow spline move \f2text-list\fP
122: .EE
123: .L arrow
124: is a synonym for
125: .LR "line ->" .
126: .PP
127: An
128: .IR attribute-list
129: is a sequence of zero or more attributes;
130: each attribute consists of a keyword, perhaps followed by a value.
131: .EX
132: .ta .5i 2.5i
133: h(eigh)t \f2expr\fP wid(th) \f2expr\fP
134: rad(ius) \f2expr\fP diam(eter) \f2expr\fP
135: up \f2opt-expr\fP down \f2opt-expr\fP
136: right \f2opt-expr\fP left \f2opt-expr\fP
137: from \f2position\fP to \f2position\fP
138: at \f2position\fP with \f2corner\fP
139: by \f2expr, expr\fP then
140: dotted \f2opt-expr\fP dashed \f2opt-expr\fP
141: chop \f2opt-expr\fP -> <- <->
142: invis same
143: \f2text-list\fP \f2expr\fP
144: .EE
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.
148: The attribute
149: .L at
150: causes the geometrical center to be put at the specified place;
151: .L with
152: causes the position on the object to be put at the specified place.
153: For lines, splines and arcs,
154: .L height
155: and
156: .L width
157: refer to arrowhead size.
158: A bare
159: .I expr
160: implies motion in the current direction.
161: .PP
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.
165: A text list
166: is a list of text items:
167: .EX
168: \f2 text-item\fP:
169: "..." \f2positioning ...\fP
170: sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP
171: \f2 positioning\fP:
172: center ljust rjust above below
173: .EE
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
178: .I troff
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.
182: .PP
183: A position is ultimately an
184: .I x,y
185: coordinate pair, but it may be specified in other ways.
186: .EX
187: \f2 position\fP:
188: \f2expr, expr\fP
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 [\f2of the way\fP] between \f2position\fP and \f2position\fP
193: \f2expr\fP < \f2position\fP , \f2position\fP >
194: ( \f2position\fP )
195: .EE
196: .PP
197: .EX
198: \f2 place\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
203: Here
204: .EE
205: An
206: .IR optional-corner
207: is one of the eight compass points
208: or the center or the start or end of a primitive.
209: .EX
210: \f2 optional-corner\fP:
211: .n .e .w .s .ne .se .nw .sw .c .start .end
212: \f2 corner\fP:
213: top bot left right start end
214: .EE
215: Each object in a picture has an ordinal number;
216: .IR nth
217: refers to this.
218: .EX
219: \f2 nth\fP:
220: \f2n\fPth\f2, n\fPth last
221: .EE
222: .PP
223: The built-in variables and their default values are:
224: .EX
225: .ta .5i 2.5i
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
231: textwid 0 textht 0
232: arrowwid 0.05 arrowht 0.1
233: dashwid 0.1 arrowhead 2
234: scale 1
235: .EE
236: These may be changed at any time,
237: and the new values remain in force from picture to picture until changed again
238: or reset by a
239: .L reset
240: statement.
241: Variables changed within
242: .B [
243: and
244: .B ]
245: revert to their previous value upon exit from the block.
246: Dimensions are divided by
247: .B scale
248: during output.
249: .PP
250: Expressions in
251: .I pic
252: are evaluated in floating point.
253: All numbers representing dimensions are taken to be in inches.
254: .EX
255: \f2 expr\fP:
256: \f2expr\fP \f2op\fP \f2expr\fP
257: - \f2expr\fP
258: ! \f2expr\fP
259: ( \f2expr\fP )
260: variable
261: number
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()
265: \f2 op\fP:
266: + - * / % < <= > >= == != && ||
267: .EE
268: .PP
269: The
270: .B define
271: and
272: .B undef
273: statements are not part of the grammar.
274: .EX
275: define \f2name\fP { \f2replacement text\fP }
276: undef \f2name\fP
277: .EE
278: Occurrences of
279: .BR $1 ,
280: .BR $2 ,
281: etc.,
282: in the replacement text
283: will be replaced by the corresponding arguments if
284: .I name
285: is invoked as
286: .EX
287: \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...)
288: .EE
289: Non-existent arguments are replaced by null strings.
290: Replacement text
291: may contain newlines.
292: The
293: .B undef
294: statement removes the definition of a macro.
295: .PP
296: .I Tpic
297: is a
298: .IR tex (1)
299: preprocessor that accepts
300: .IR pic
301: language.
302: It produces Tex commands that define a box called
303: .BR \egraph ,
304: which contains the picture.
305: The box may be output this way:
306: .IP
307: .L
308: \ecenterline{\ebox\egraph}
309: .SH EXAMPLES
310: .EX
311: arrow "input" above; box "process"; arrow "output" above
312: move
313: A: ellipse
314: circle rad .1 with .w at A.e
315: circle rad .05 at 0.5 <A.c, A.ne>
316: arc from A.c to A.se rad 0.5
317: .EE
318: .PP
319: .PS
320: arrow "input" above; box "process"; arrow "output" above
321: move
322: A: ellipse
323: circle rad .1 with .w at A.e
324: circle rad .05 at 0.5 <A.c, A.ne>
325: arc from A.c to A.se rad 0.5
326: .PE
327: .SH "SEE ALSO"
328: .IR cip (9.1),
329: .IR ideal (1),
330: .IR ped (9.1),
331: .IR grap (1),
332: .IR dag (1),
333: .IR doctype (1),
334: .IR troff (1)
335: .br
336: B. W. Kernighan,
337: `PIC\(ema Graphics Language for Typesetting',
338: this manual, Volume 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.