|
|
1.1 ! root 1: .TH PIC 1 ! 2: .de PS \" start picture ! 3: . \" $1 is height, $2 is width, both in inches ! 4: .if \\$1>0 .sp .35 ! 5: .ie \\$1>0 .nr $1 \\$1 ! 6: .el .nr $1 0 ! 7: .in (\\n(.lu-\\$2)/2u ! 8: .ne \\$1 ! 9: .. ! 10: .de PE \" end of picture ! 11: .in ! 12: .if \\n($1>0 .sp .65 ! 13: .. ! 14: .SH NAME ! 15: pic, tpic \- troff and tex preprocessors for drawing pictures ! 16: .SH SYNOPSIS ! 17: .B pic ! 18: [ ! 19: .I files ! 20: ] ! 21: .PP ! 22: .B tpic ! 23: [ ! 24: .I files ! 25: ] ! 26: .SH DESCRIPTION ! 27: .I Pic ! 28: is a ! 29: .IR troff (1) ! 30: preprocessor for drawing figures on a typesetter. ! 31: .I Pic ! 32: code is contained between ! 33: .B .PS ! 34: and ! 35: .B .PE ! 36: lines: ! 37: .IP ! 38: .EX ! 39: \&.PS \f2optional-width\fP \f2optional-height\fP ! 40: \f2element-list\fP ! 41: \&.PE ! 42: .EE ! 43: .LP ! 44: or in a file mentioned in a ! 45: .B .PS ! 46: line: ! 47: .IP ! 48: .BI .PS " optional-width optional-height " < file ! 49: .LP ! 50: If ! 51: .IR optional-width ! 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 ! 55: .IR optional-height ! 56: is present. ! 57: If ! 58: .B .PF ! 59: is used instead of ! 60: .BR .PE , ! 61: the typesetting position after printing is restored to what it was ! 62: upon entry. ! 63: .PP ! 64: An ! 65: .IR element-list ! 66: is a list of elements: ! 67: .EX ! 68: \f2primitive attribute-list\fP ! 69: \f2placename\fP : \f2element\fP ! 70: \f2placename\fP : \f2position\fP ! 71: \f2var\fP = \f2expr\fP ! 72: \f2direction\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 } ! 79: print \f2expr\fP ! 80: reset \f2optional var-list\fP ! 81: \f2troff-command\fP ! 82: .EE ! 83: .PP ! 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 ! 87: .BI # ! 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. ! 93: .PP ! 94: After each primitive ! 95: the current position moves in the current direction ! 96: .RB ( up , down , ! 97: .BR left , right ! 98: (default)) by the size of the primitive. ! 99: The current position and direction are saved upon entry ! 100: to a ! 101: .BR { ... } ! 102: block and restored upon exit. ! 103: Elements within a block enclosed in ! 104: .BR [ ... ] ! 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. ! 109: .PP ! 110: .IR Troff-command ! 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. ! 114: .PP ! 115: The ! 116: .I primitive ! 117: objects are: ! 118: .br ! 119: .EX ! 120: box circle ellipse arc line arrow spline move \f2text-list\fP ! 121: .EE ! 122: .L arrow ! 123: is a synonym for ! 124: .LR "line ->" . ! 125: .PP ! 126: An ! 127: .IR attribute-list ! 128: is a sequence of zero or more attributes; ! 129: each attribute consists of a keyword, perhaps followed by a value. ! 130: .EX ! 131: .ta .5i 2.5i ! 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 -> <- <-> ! 141: invis same ! 142: \f2text-list\fP \f2expr\fP ! 143: .EE ! 144: Missing attributes and values are filled in from defaults. ! 145: Not all attributes make sense for all primitives; ! 146: irrelevant ones are silently ignored. ! 147: The attribute ! 148: .L at ! 149: causes the geometrical center to be put at the specified place; ! 150: .L with ! 151: causes the position on the object to be put at the specified place. ! 152: For lines, splines and arcs, ! 153: .L height ! 154: and ! 155: .L width ! 156: refer to arrowhead size. ! 157: A bare ! 158: .I expr ! 159: implies motion in the current direction. ! 160: .PP ! 161: Text is normally an attribute of some primitive; ! 162: by default it is placed at the geometrical center of the object. ! 163: Stand-alone text is also permitted. ! 164: A text list ! 165: is a list of text items: ! 166: .EX ! 167: \f2 text-item\fP: ! 168: "..." \f2positioning ...\fP ! 169: sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP ! 170: \f2 positioning\fP: ! 171: center ljust rjust above below ! 172: .EE ! 173: If there are multiple text items for some primitive, ! 174: they are arranged vertically and centered except as qualified. ! 175: Positioning requests apply to each item independently. ! 176: Text items may contain ! 177: .I troff ! 178: commands for size and font changes, local motions, etc., ! 179: but make sure that these are balanced ! 180: so that the entering state is restored before exiting. ! 181: .PP ! 182: A position is ultimately an ! 183: .I x,y ! 184: coordinate pair, but it may be specified in other ways. ! 185: .EX ! 186: \f2 position\fP: ! 187: \f2expr, expr\fP ! 188: \f2place\fP ± \f2expr, expr\fP ! 189: \f2place\fP ± ( \f2expr, expr\fP ) ! 190: ( \f2position\fP,\f2 position\fP ) \f2x\fP\fR from one, \f2y\fP\fR the other\fP ! 191: \f2expr\fP [\fLof the way\fP] between \f2position\fP and \f2position\fP ! 192: \f2expr\fP < \f2position\fP , \f2position\fP > ! 193: ( \f2position\fP ) ! 194: .EE ! 195: .PP ! 196: .EX ! 197: \f2 place\fP: ! 198: \f2placename\fP \f2optional-corner\fP ! 199: \f2corner\fP of \f2placename\fP ! 200: \f2nth\fP \f2primitive\fP \f2optional-corner\fP ! 201: \f2corner\fP of \f2nth\fP \f2primitive\fP ! 202: Here ! 203: .EE ! 204: An ! 205: .IR optional-corner ! 206: is one of the eight compass points ! 207: or the center or the start or end of a primitive. ! 208: .EX ! 209: \f2 optional-corner\fP: ! 210: .n .e .w .s .ne .se .nw .sw .c .start .end ! 211: \f2 corner\fP: ! 212: top bot left right start end ! 213: .EE ! 214: Each object in a picture has an ordinal number; ! 215: .IR nth ! 216: refers to this. ! 217: .EX ! 218: \f2 nth\fP: ! 219: \f2n\fPth\f2, n\fPth last ! 220: .EE ! 221: .PP ! 222: The built-in variables and their default values are: ! 223: .EX ! 224: .ta .5i 2.5i ! 225: boxwid 0.75 boxht 0.5 ! 226: circlerad 0.25 arcrad 0.25 ! 227: ellipsewid 0.75 ellipseht 0.5 ! 228: linewid 0.5 lineht 0.5 ! 229: movewid 0.5 moveht 0.5 ! 230: textwid 0 textht 0 ! 231: arrowwid 0.05 arrowht 0.1 ! 232: dashwid 0.1 arrowhead 2 ! 233: scale 1 ! 234: .EE ! 235: These may be changed at any time, ! 236: and the new values remain in force from picture to picture until changed again ! 237: or reset by a ! 238: .L reset ! 239: statement. ! 240: Variables changed within ! 241: .B [ ! 242: and ! 243: .B ] ! 244: revert to their previous value upon exit from the block. ! 245: Dimensions are divided by ! 246: .B scale ! 247: during output. ! 248: .PP ! 249: Expressions in ! 250: .I pic ! 251: are evaluated in floating point. ! 252: All numbers representing dimensions are taken to be in inches. ! 253: .EX ! 254: \f2 expr\fP: ! 255: \f2expr\fP \f2op\fP \f2expr\fP ! 256: - \f2expr\fP ! 257: ! \f2expr\fP ! 258: ( \f2expr\fP ) ! 259: variable ! 260: number ! 261: \f2place\fP .x \f2place\fP .y \f2place\fP .ht \f2place\fP .wid \f2place\fP .rad ! 262: sin(\f2expr\fP) cos(\f2expr\fP) atan2(\f2expr,expr\fP) log(\f2expr\fP) exp(\f2expr\fP) ! 263: sqrt(\f2expr\fP) max(\f2expr,expr\fP) min(\f2expr,expr\fP) int(\f2expr\fP) rand() ! 264: \f2 op\fP: ! 265: + - * / % < <= > >= == != && || ! 266: .EE ! 267: .PP ! 268: The ! 269: .B define ! 270: and ! 271: .B undef ! 272: statements are not part of the grammar. ! 273: .EX ! 274: define \f2name\fP { \f2replacement text\fP } ! 275: undef \f2name\fP ! 276: .EE ! 277: Occurrences of ! 278: .BR $1 , ! 279: .BR $2 , ! 280: etc., ! 281: in the replacement text ! 282: will be replaced by the corresponding arguments if ! 283: .I name ! 284: is invoked as ! 285: .EX ! 286: \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...) ! 287: .EE ! 288: Non-existent arguments are replaced by null strings. ! 289: Replacement text ! 290: may contain newlines. ! 291: The ! 292: .B undef ! 293: statement removes the definition of a macro. ! 294: .PP ! 295: .I Tpic ! 296: is a ! 297: .IR tex (1) ! 298: preprocessor that accepts ! 299: .IR pic ! 300: language. ! 301: It produces Tex commands that define a box called ! 302: .BR \egraph , ! 303: which contains the picture. ! 304: The box may be output this way: ! 305: .IP ! 306: .L ! 307: \ecenterline{\ebox\egraph} ! 308: .SH EXAMPLES ! 309: .EX ! 310: arrow "input" above; box "process"; arrow "output" above ! 311: move ! 312: A: ellipse ! 313: circle rad .1 with .w at A.e ! 314: circle rad .05 at 0.5 <A.c, A.ne> ! 315: circle rad .065 at 0.5 <A.c, A.ne> ! 316: spline from last circle.nw left .25 then left .05 down .05 ! 317: arc from A.c to A.se rad 0.5 ! 318: for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 } ! 319: .EE ! 320: .PP ! 321: .PS ! 322: arrow "input" above; box "process"; arrow "output" above ! 323: move ! 324: A: ellipse ! 325: circle rad .1 with .w at A.e ! 326: circle rad .05 at 0.5 <A.c, A.ne> ! 327: circle rad .065 at 0.5 <A.c, A.ne> ! 328: spline from last circle.nw left .25 then left .05 down .05 ! 329: arc from A.c to A.se rad 0.5 ! 330: for i = 1 to 10 do { line from A.s+.025*i,.01*i down i/50 } ! 331: .PE ! 332: .SH SOURCE ! 333: .B /sys/src/cmd/pic ! 334: .SH "SEE ALSO" ! 335: .IR grap (1), ! 336: .IR doctype (1), ! 337: .IR troff (1) ! 338: .br ! 339: B. W. Kernighan, ! 340: ``PIC\(ema Graphics Language for Typesetting'', ! 341: .I ! 342: Unix Research System Programmer's Manual, ! 343: Tenth Edition, Volume 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.