Annotation of researchv10dc/man/man1/pic.1, revision 1.1.1.1

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: If
                     45: .IR optional-width
                     46: is present, the picture is made that many inches wide,
                     47: regardless of any dimensions used internally.
                     48: The height is scaled in the same proportion unless
                     49: .IR optional-height
                     50: is present.
                     51: If
                     52: .B .PF
                     53: is used instead of
                     54: .BR .PE ,
                     55: the typesetting position after printing is restored to what it was
                     56: upon entry.
                     57: .PP
                     58: A line of the form
                     59: .IP
                     60: .BI .PS < file
                     61: causes
                     62: .I pic
                     63: to treat the the named file as if it stood in place of the
                     64: .B .PS
                     65: line.
                     66: .PP
                     67: An
                     68: .IR element-list
                     69: is a list of elements:
                     70: .EX
                     71:        \f2primitive  attribute-list\fP
                     72:        \f2placename\fP : \f2element\fP
                     73:        \f2placename\fP : \f2position\fP
                     74:        \f2var\fP = \f2expr\fP
                     75:        \f2direction\fP
                     76:        { \f2element-list\fP }
                     77:        [ \f2element-list\fP ]
                     78:        for \f2var\fP = \f2expr\fP to \f2expr\fP by \f2expr\fP do { \f2anything\fP }
                     79:        if \f2expr\fP then { \f2anything\fP } else { \f2anything\fP }
                     80:        copy \f2file,\fP  copy thru \f2macro,\fP  copy \f2file\fP thru \fPmacro\fP
                     81:        sh { \f2commandline\fP }
                     82:        print \f2expr\fP
                     83:        reset \f2optional var-list\fP
                     84:        \f2troff-command\fP
                     85: .EE
                     86: .PP
                     87: Elements are separated by newlines or semicolons;
                     88: a long element may be continued by ending the line with a backslash.
                     89: Comments are introduced by a
                     90: .BI #
                     91: and terminated by a newline.
                     92: Variable names begin with a lower case letter;
                     93: place names begin with upper case.
                     94: Place and variable names retain their values
                     95: from one picture to the next.
                     96: .PP
                     97: After each primitive
                     98: the current position moves in the current direction
                     99: .RB ( up , down ,
                    100: .BR left , right
                    101: (default)) by the size of the primitive.
                    102: The current position and direction are saved upon entry
                    103: to a
                    104: .BR { ... }
                    105: block and restored upon exit.
                    106: Elements within a block enclosed in
                    107: .BR [ ... ]
                    108: are treated as a unit;
                    109: the dimensions are determined by the extreme points
                    110: of the contained objects.
                    111: Names, variables, and direction of motion within a block are local to that block.
                    112: .PP
                    113: .IR troff-command
                    114: is any line that begins with a period.
                    115: Such a line is assumed to make sense in the context where it appears;
                    116: generally, this means only size and font changes.
                    117: Changes to vertical spacing will produce broken pictures.
                    118: .PP
                    119: The
                    120: .I primitive
                    121: objects are:
                    122: .br
                    123: .EX
                    124:        box  circle  ellipse  arc  line  arrow  spline  move  \f2text-list\fP
                    125: .EE
                    126: .L arrow
                    127: is a synonym for
                    128: .LR "line ->" .
                    129: .PP
                    130: An
                    131: .IR attribute-list
                    132: is a sequence of zero or more attributes;
                    133: each attribute consists of a keyword, perhaps followed by a value.
                    134: .EX
                    135: .ta .5i 2.5i
                    136:        h(eigh)t \f2expr\fP     wid(th) \f2expr\fP
                    137:        rad(ius) \f2expr\fP     diam(eter) \f2expr\fP
                    138:        up \f2opt-expr\fP       down \f2opt-expr\fP
                    139:        right \f2opt-expr\fP    left \f2opt-expr\fP
                    140:        from \f2position\fP     to \f2position\fP
                    141:        at \f2position\fP       with \f2corner\fP
                    142:        by \f2expr, expr\fP     then
                    143:        dotted \f2opt-expr\fP   dashed \f2opt-expr\fP
                    144:        chop \f2opt-expr\fP     ->  <-  <->
                    145:        invis   same
                    146:        \f2text-list\fP \f2expr\fP
                    147: .EE
                    148: Missing attributes and values are filled in from defaults.
                    149: Not all attributes make sense for all primitives;
                    150: irrelevant ones are silently ignored.
                    151: The attribute
                    152: .L at
                    153: causes the geometrical center to be put at the specified place;
                    154: .L with
                    155: causes the position on the object to be put at the specified place.
                    156: For lines, splines and arcs,
                    157: .L height
                    158: and
                    159: .L width
                    160: refer to arrowhead size.
                    161: A bare
                    162: .I expr
                    163: implies motion in the current direction.
                    164: .PP
                    165: Text is normally an attribute of some primitive;
                    166: by default it is placed at the geometrical center of the object.
                    167: Stand-alone text is also permitted.
                    168: A text list
                    169: is a list of text items:
                    170: .EX
                    171: \f2  text-item\fP:
                    172:        "..." \f2positioning ...\fP
                    173:        sprintf("\f2format\fP", \f2expr\fP, \f2...\fP) \f2positioning ...\fP
                    174: \f2  positioning\fP:
                    175:        center  ljust  rjust  above  below
                    176: .EE
                    177: If there are multiple text items for some primitive,
                    178: they are arranged vertically and centered except as qualified.
                    179: Positioning requests apply to each item independently.
                    180: Text items may contain in-line
                    181: .I troff
                    182: commands for size and font changes, local motions, etc.,
                    183: but make sure that these are balanced
                    184: so that the entering state is restored before exiting.
                    185: .PP
                    186: A position is ultimately an
                    187: .I x,y
                    188: coordinate pair, but it may be specified in other ways.
                    189: .EX
                    190: \f2  position\fP:
                    191:        \f2expr, expr\fP
                    192:        \f2place\fP \(+- \f2expr, expr\fP
                    193:        \f2place\fP \(+- ( \f2expr, expr\fP )
                    194:        ( \f2position\fP,\f2 position\fP )      \f2x\fP\fR from one, \f2y\fP\fR the other\fP
                    195:        \f2expr\fP [\f2of the way\fP] between \f2position\fP and \f2position\fP
                    196:        \f2expr\fP < \f2position\fP , \f2position\fP >
                    197:        ( \f2position\fP )
                    198: .EE
                    199: .PP
                    200: .EX
                    201: \f2  place\fP:
                    202:        \f2placename\fP \f2optional-corner\fP
                    203:        \f2corner\fP of \f2placename\fP
                    204:        \f2nth\fP \f2primitive\fP \f2optional-corner\fP
                    205:        \f2corner\fP of \f2nth\fP \f2primitive\fP
                    206:        Here
                    207: .EE
                    208: An
                    209: .IR optional-corner
                    210: is one of the eight compass points
                    211: or the center or the start or end of a primitive.
                    212: .EX
                    213: \f2  optional-corner\fP:
                    214:        .n  .e  .w  .s  .ne  .se  .nw  .sw  .c  .start  .end
                    215: \f2  corner\fP:
                    216:        top  bot  left  right  start  end
                    217: .EE
                    218: Each object in a picture has an ordinal number;
                    219: .IR nth
                    220: refers to this.
                    221: .EX
                    222: \f2  nth\fP:
                    223:        \f2n\fPth\f2,     n\fPth last
                    224: .EE
                    225: .PP
                    226: The built-in variables and their default values are:
                    227: .EX
                    228: .ta .5i 2.5i
                    229:        boxwid = 0.75   boxht = 0.5
                    230:        circlerad = 0.25        arcrad = 0.25
                    231:        ellipsewid = 0.75       ellipseht = 0.5
                    232:        linewid = 0.5   lineht = 0.5
                    233:        movewid = 0.5   moveht = 0.5
                    234:        textwid = 0     textht = 0
                    235:        arrowwid = 0.05 arrowht = 0.1
                    236:        dashwid = 0.1   arrowhead = 2
                    237:        scale = 1
                    238: .EE
                    239: These may be changed at any time,
                    240: and the new values remain in force from picture to picture until changed again
                    241: or reset by a
                    242: .L reset
                    243: statement.
                    244: Variables changed within
                    245: .B [
                    246: and
                    247: .B ]
                    248: revert to their previous value upon exit from the block.
                    249: Dimensions are divided by
                    250: .B scale
                    251: during output.
                    252: .PP
                    253: Expressions in
                    254: .I pic
                    255: are evaluated in floating point.
                    256: All numbers representing dimensions are taken to be in inches.
                    257: .EX
                    258: \f2  expr\fP:
                    259:        \f2expr\fP \f2op\fP \f2expr\fP
                    260:        - \f2expr\fP
                    261:        ! \f2expr\fP
                    262:        ( \f2expr\fP )
                    263:        variable
                    264:        number
                    265:        \f2place\fP .x  \f2place\fP .y  \f2place\fP .ht  \f2place\fP .wid  \f2place\fP .rad
                    266:        sin(\f2expr\fP)  cos(\f2expr\fP)  atan2(\f2expr,expr\fP)  log(\f2expr\fP)  exp(\f2expr\fP)
                    267:        sqrt(\f2expr\fP)  max(\f2expr,expr\fP)  min(\f2expr,expr\fP)  int(\f2expr\fP)  rand()
                    268: \f2  op\fP:
                    269:        +  -  *  /  %  <  <=  >  >=  ==  !=  &&  ||
                    270: .EE
                    271: .PP
                    272: The
                    273: .B define
                    274: and
                    275: .B undef
                    276: statements are not part of the grammar.
                    277: .EX
                    278:        define \f2name\fP { \f2replacement text\fP }
                    279:        undef \f2name\fP
                    280: .EE
                    281: Occurrences of
                    282: .BR $1 ,
                    283: .BR $2 ,
                    284: etc.,
                    285: in the replacement text
                    286: will be replaced by the corresponding arguments if
                    287: .I name
                    288: is invoked as
                    289: .EX
                    290:        \f2name\fP(\f2arg1\fP, \f2arg2\fP, ...)
                    291: .EE
                    292: Non-existent arguments are replaced by null strings.
                    293: Replacement text
                    294: may contain newlines.
                    295: The
                    296: .B undef
                    297: statement removes the definition of a macro.
                    298: .PP
                    299: .I Tpic
                    300: is a
                    301: .IR tex (1)
                    302: preprocessor that accepts
                    303: .IR pic
                    304: language.
                    305: It produces Tex commands that define a box called
                    306: .BR \egraph ,
                    307: which contains the picture.
                    308: The box may be output this way:
                    309: .IP
                    310: .L
                    311: \ecenterline{\ebox\egraph}
                    312: .SH EXAMPLES
                    313: .EX
                    314: arrow "input" above; box "process"; arrow "output" above
                    315: move
                    316: A: ellipse 
                    317:    circle rad .1 with .w at A.e
                    318:    circle rad .05 at 0.5 <A.c, A.ne>
                    319:    arc from A.c to A.se rad 0.5
                    320: .EE
                    321: .PP
                    322: .PS
                    323: arrow "input" above; box "process"; arrow "output" above
                    324: move
                    325: A: ellipse 
                    326:    circle rad .1 with .w at A.e
                    327:    circle rad .05 at 0.5 <A.c, A.ne>
                    328:    arc from A.c to A.se rad 0.5
                    329: .PE
                    330: .SH "SEE ALSO"
                    331: .IR cip (9.1),
                    332: .IR ideal (1), 
                    333: .IR ped (9.1),
                    334: .IR grap (1), 
                    335: .IR dag (1),
                    336: .IR doctype (1),
                    337: .IR troff (1)
                    338: .br
                    339: B. W. Kernighan,
                    340: `PIC\(ema Graphics Language for Typesetting',
                    341: this manual, Volume 2

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.