1 .de PI \" Picture Include
2 . \" $1=file(page) $2=height,width,yoff,xoff $3=flags
3 . \" Height, width, xoff, and yoff are for the frame, flags is for the
4 . \" picture. Default dimensions are inches.
5 \\X'PI:\\n(.o:\\n(.i:\\n(.l:\\n(.t:\\$1:\\$2:\\$3:'\\c
8 .de BP \" Begin a Picture
10 . \" $1=file(page) $2=height $3=width $4=position $5=offset $6=flags $7=label
12 . \" Height, width, position, and offset are for the frame, flags is for
13 . \" the picture. The postion flag should be l, c, r, or "". Omitting the
14 . \" position argument is also allowed for compatibility with the original
15 . \" version of the macro. In that case offset is taken relative to your
18 . \" Need these when we switch environments.
22 . \" Remember the arguments - sometimes as both a string and number register.
30 . \" Accept a few unadvertised position flags.
31 .if '\\*($4'L' .ds $4 l
32 .if '\\*($4'C' .ds $4 c
33 .if '\\*($4'R' .ds $4 r
34 . \" A null with more than three arguments means l.
35 .if \\n(.$>3 .if '\\*($4'' .ds $4 l
36 . \" Default frame dimensions if missing, zero, or null.
37 .if !\\n($2>0 .nr $2 3.0i
38 .if !\\n($3>0 .nr $3 \\n(.lu-\\n(.iu-\\n($4u
39 .if !\\n($3>0 .nr $3 \\n($2u
40 . \" Figure out the offset that will be used the rest of the way.
41 .if '\\*($4'l' .nr $4 \\n($5u
42 .if '\\*($4'c' .nr $4 (\\n(.lu-\\n(.iu-\\n($3u)/2u+\\n($5u
43 .if '\\*($4'r' .nr $4 \\n(.lu-\\n(.iu-\\n($3u+\\n($5u
44 . \" If we haven't recognized the position flag assume it wasn't given and
45 . \" treat argument four as an offset from the left.
46 .if !'\\*($4'l' .if !'\\*($4'c' .if !'\\*($4'r' .ds $5 \\$5
47 .if !'\\*($4'l' .if !'\\*($4'c' .if !'\\*($4'r' .ds $6 \\$6
48 . \" Set increments for line length and indent.
49 .nr Ii \\n($3u+\\n($4u+.1i
50 .nr Il \\n(.lu-\\n(.iu-\\n($4u+.1i
51 . \" Set the frame type to one of:
52 . \" 0 - frame is as wide as a line of text - skip over it.
53 . \" 1 - fits in left or right margins
54 . \" 2 - fill with text on the right
56 . \" 4 - or on both sides of the frame
57 . \" 5 - only set in EP if FT was 4 and now filling on the right.
58 . \" Assume the frame is as wide as a line of text, then check dimensions
59 . \" to see what's really true. The order of these tests is important!
61 .if \\n($4u>1.0i .nr FT 3
62 .if \\n($4u+\\n(.iu>=\\n(.lu .nr FT 1
63 .if \\n($3u+\\n($4u+\\n(.iu+1.0i<\\n(.lu .nr FT 2
64 .if \\n($3u+\\n($4u<=0 .nr FT 1
65 .if \\n(FT=2 .if \\n($4u>1.0i .nr FT 4
66 . \" Ask for some vertical space - labeled pictures need a little extra,
67 . \" margin pictures a little less.
68 .if \\n(FT=1 .if '\\*($6'' .ne \\n($2u
69 .if \\n(FT=1 .if !'\\*($6'' .ne \\n($2u+2v
70 .if !\\n(FT=1 .if '\\*($6'' .ne \\n($2u+3v
71 .if !\\n(FT=1 .if !'\\*($6'' .ne \\n($2u+5v
72 . \" Save our place, draw the picture, label it, and return. Need precise
73 . \" control of when \X'...' is put out - thus the new environment.
80 .if \\n(FT=1 .PI \\$1 \\n($2u,\\n($3u,\\n(.vu,\\n($4u t\\*($5
81 .if !\\n(FT=1 .PI \\$1 \\n($2u,\\n($3u,\\n(.vu,\\n($4u \\*($5
87 .tl \(ts\(ts\\h'\\n($4u+\\n(.iu'\\v'\\n($2u+1.5v'\\*($6\\v'-\\n($2u-1.5v'\\h'-\\n($4u-\\n(.iu'\(ts\(ts
90 . \" Figure out what to do with the text that follows.
91 .if !'\\*($6'' .nr $2 +2v
92 .if \\n(FT=0 .sp \\n($2u+2v
94 .if \\n(FT=2 'in +\\n(Iiu
95 .if \\n(FT>2 .ll -\\n(Ilu
97 .if \\n(FT>1 .dt \\n($2u+2v+1u EP
112 .de EP \" End the Picture - Normally called from a trap, although it can be used
113 . \" on its own to mark the end of a picture.
115 .if \\n(.tu<\\n(.pu .nr Ot \\n(.tu
116 .if \\n(Ot>0 .if \\n(FT=4 .nr FT 3
117 .if \\n(FT<2 .nr Ot 0
119 .if \\n(FT=5 .nr Ot 0
144 . dt \\n(dnu-2v+1u EP\}
145 .if \\n(FT=2 'in -\\n(Iiu
146 .if \\n(FT=3 .ll +\\n(Ilu
147 .if \\n(FT<4 .nr FT 0
148 .if \\n(Ot>0 .sp \\n(Otu