| 1 |
% All this stuff comes from latex.tex, most of it from the |
| 2 |
% picture environment. No changes!!! |
| 3 |
% It is needed if you want to use TreeTeX together with plain TeX. |
| 4 |
|
| 5 |
\catcode`\@=11 |
| 6 |
|
| 7 |
\def\@height{height} |
| 8 |
\def\@depth{depth} |
| 9 |
\def\@width{width} |
| 10 |
|
| 11 |
\font\tenln=line10 |
| 12 |
\font\tencirc=circle10 |
| 13 |
\font\tenlnw=linew10 |
| 14 |
\font\tencircw=circlew10 |
| 15 |
|
| 16 |
\newcount\@tempcnta |
| 17 |
\newcount\@tempcntb |
| 18 |
\newdimen\@tempdima |
| 19 |
\newdimen\@tempdimb |
| 20 |
\newbox\@tempboxa |
| 21 |
|
| 22 |
\def\@whilenoop#1{} |
| 23 |
|
| 24 |
\def\@whiledim#1\do #2{\ifdim #1\relax#2\@iwhiledim{#1\relax#2}\fi} |
| 25 |
\def\@iwhiledim#1{\ifdim #1\let\@nextwhile=\@iwhiledim |
| 26 |
\else\let\@nextwhile=\@whilenoop\fi\@nextwhile{#1}} |
| 27 |
|
| 28 |
\def\@ifnextchar#1#2#3{\let\@tempe #1\def\@tempa{#2}\def\@tempb{#3}\futurelet |
| 29 |
\@tempc\@ifnch} |
| 30 |
\def\@ifnch{\ifx \@tempc \@sptoken \let\@tempd\@xifnch |
| 31 |
\else \ifx \@tempc \@tempe\let\@tempd\@tempa\else\let\@tempd\@tempb\fi |
| 32 |
\fi \@tempd} |
| 33 |
|
| 34 |
% NOTE: the following hacking must precede the definition of \: |
| 35 |
% as math medium space. |
| 36 |
|
| 37 |
\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token |
| 38 |
|
| 39 |
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@tempc\@ifnch} |
| 40 |
|
| 41 |
\def\@ifstar#1#2{\@ifnextchar *{\def\@tempa*{#1}\@tempa}{#2}} |
| 42 |
|
| 43 |
\let\:=\> |
| 44 |
|
| 45 |
% **************************************** |
| 46 |
% * THE PICTURE ENVIRONMENT * |
| 47 |
% **************************************** |
| 48 |
% |
| 49 |
% \unitlength = value of dimension argument |
| 50 |
% \@wholewidth = current line width |
| 51 |
% \@halfwidth = half of current line width |
| 52 |
% \@linefnt = font for drawing lines |
| 53 |
% \@circlefnt = font for drawing circles |
| 54 |
% |
| 55 |
% \linethickness{DIM} : Sets the width of horizontal and vertical lines |
| 56 |
% in a picture to DIM. Does not change width of slanted lines |
| 57 |
% or circles. Width of all lines reset by \thinlines and |
| 58 |
% \thicklines |
| 59 |
% |
| 60 |
% \picture(XSIZE,YSIZE)(XORG,YORG) |
| 61 |
% BEGIN |
| 62 |
% \@picht :=L YSIZE * \unitlength |
| 63 |
% box \@picbox := |
| 64 |
% \hbox to XSIZE * \unitlength |
| 65 |
% {\hskip -XORG * \unitlength |
| 66 |
% \lower YORG * \unitlength |
| 67 |
% \hbox{ |
| 68 |
% END |
| 69 |
% |
| 70 |
% \endpicture == |
| 71 |
% BEGIN |
| 72 |
% } \hss } |
| 73 |
% heigth of \@picbox := \@picht |
| 74 |
% depth of \@picbox := 0 |
| 75 |
% leavevmode |
| 76 |
% \box\@picbox |
| 77 |
% END |
| 78 |
% |
| 79 |
% \put(X, Y){OBJ} == |
| 80 |
% BEGIN |
| 81 |
% \@killglue |
| 82 |
% \raise Y * \unitlength \hbox to 0pt { \hskip X * \unitlength |
| 83 |
% OBJ \hss } |
| 84 |
% \ignorespaces |
| 85 |
% END |
| 86 |
% |
| 87 |
% \multiput(X,Y)(DELX,DELY){N}{OBJ} == |
| 88 |
% BEGIN |
| 89 |
% \@killglue |
| 90 |
% \@multicnt := N |
| 91 |
% \@xdim := X * \unitlength |
| 92 |
% \@ydim := Y * \unitlength |
| 93 |
% while \@multicnt > 0 |
| 94 |
% do \raise \@ydim \hbox to 0pt { \hskip \@xdim |
| 95 |
% OBJ \hss } |
| 96 |
% \@multicnt := \@multicnt - 1 |
| 97 |
% \@xdim := \@xdim + DELX * \unitlength |
| 98 |
% \@ydim := \@ydim + DELY * \unitlength |
| 99 |
% od |
| 100 |
% \ignorespaces |
| 101 |
% END |
| 102 |
% |
| 103 |
% \shortstack[POS]{TEXT} : Makes a \vbox containing TEXT stacked as |
| 104 |
% a one-column array, positioned l, r or c as indicated by POS. |
| 105 |
|
| 106 |
\newdimen\@wholewidth |
| 107 |
\newdimen\@halfwidth |
| 108 |
\newdimen\unitlength \unitlength =1pt |
| 109 |
\newbox\@picbox |
| 110 |
\newdimen\@picht |
| 111 |
|
| 112 |
\def\picture(#1,#2){\@ifnextchar({\@picture(#1,#2)}{\@picture(#1,#2)(0,0)}} |
| 113 |
|
| 114 |
\def\@picture(#1,#2)(#3,#4){\@picht #2\unitlength |
| 115 |
\setbox\@picbox\hbox to #1\unitlength\bgroup |
| 116 |
\hskip -#3\unitlength \lower #4\unitlength \hbox\bgroup} |
| 117 |
|
| 118 |
\def\endpicture{\egroup\hss\egroup\ht\@picbox\@picht |
| 119 |
\dp\@picbox\z@\leavevmode\box\@picbox} |
| 120 |
|
| 121 |
\long\def\put(#1,#2)#3{\@killglue\raise#2\unitlength\hbox to \z@{\hskip |
| 122 |
#1\unitlength #3\hss}\ignorespaces} |
| 123 |
|
| 124 |
\long\def\multiput(#1,#2)(#3,#4)#5#6{\@killglue\@multicnt=#5\relax |
| 125 |
\@xdim=#1\unitlength |
| 126 |
\@ydim=#2\unitlength |
| 127 |
\@whilenum \@multicnt > 0\do |
| 128 |
{\raise\@ydim\hbox to \z@{\hskip |
| 129 |
\@xdim #6\hss}\advance\@multicnt \m@ne\advance\@xdim |
| 130 |
#3\unitlength\advance\@ydim #4\unitlength}\ignorespaces} |
| 131 |
|
| 132 |
\def\@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}} |
| 133 |
|
| 134 |
\def\thinlines{\let\@linefnt\tenln \let\@circlefnt\tencirc |
| 135 |
\@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth} |
| 136 |
\def\thicklines{\let\@linefnt\tenlnw \let\@circlefnt\tencircw |
| 137 |
\@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth} |
| 138 |
|
| 139 |
\def\linethickness#1{\@wholewidth #1\relax \@halfwidth .5\@wholewidth} |
| 140 |
|
| 141 |
\def\shortstack{\@ifnextchar[{\@shortstack}{\@shortstack[c]}} |
| 142 |
|
| 143 |
\def\@shortstack[#1]{\leavevmode |
| 144 |
\vbox\bgroup\baselineskip-1pt\lineskip 3pt\let\mb@l\hss |
| 145 |
\let\mb@r\hss \expandafter\let\csname mb@#1\endcsname\relax |
| 146 |
\let\\\@stackcr\@ishortstack} |
| 147 |
|
| 148 |
\def\@ishortstack#1{\halign{\mb@l ##\unskip\mb@r\cr #1\crcr}\egroup} |
| 149 |
|
| 150 |
|
| 151 |
\def\@stackcr{\@ifstar{\@ixstackcr}{\@ixstackcr}} |
| 152 |
\def\@ixstackcr{\@ifnextchar[{\@istackcr}{\cr\ignorespaces}} |
| 153 |
|
| 154 |
\def\@istackcr[#1]{\cr\noalign{\vskip #1}\ignorespaces} |
| 155 |
|
| 156 |
|
| 157 |
% \line(X,Y){LEN} == |
| 158 |
% BEGIN |
| 159 |
% \@xarg := X |
| 160 |
% \@yarg := Y |
| 161 |
% \@linelen := LEN * \unitlength |
| 162 |
% if \@xarg = 0 |
| 163 |
% then \@vline |
| 164 |
% else if \@yarg = 0 |
| 165 |
% then \@hline |
| 166 |
% else \@sline |
| 167 |
% if |
| 168 |
% if |
| 169 |
% END |
| 170 |
% |
| 171 |
% \@sline == |
| 172 |
% BEGIN |
| 173 |
% if \@xarg < 0 |
| 174 |
% then @negarg := T |
| 175 |
% \@xarg := -\@xarg |
| 176 |
% \@yyarg := -\@yarg |
| 177 |
% else @negarg := F |
| 178 |
% \@yyarg := \@yarg |
| 179 |
% fi |
| 180 |
% \@tempcnta := |\@yyarg| |
| 181 |
% if \@tempcnta > 6 |
| 182 |
% then error: 'LATEX ERROR: Illegal \line or \vector argument.' |
| 183 |
% \@tempcnta := 0 |
| 184 |
% fi |
| 185 |
% \box\@linechar := \hbox{\@linefnt \@getlinechar(\@xarg,\@yyarg) } |
| 186 |
% if \@yarg > 0 then \@upordown = \raise |
| 187 |
% \@clnht := 0 |
| 188 |
% else \@upordown = \lower |
| 189 |
% \@clnht := height of \box\@linechar |
| 190 |
% fi |
| 191 |
% \@clnwd := width of \box\@linechar |
| 192 |
% if @negarg |
| 193 |
% then \hskip - width of \box\@linechar |
| 194 |
% \@tempa == \hskip - 2* width of box \@linechar |
| 195 |
% else \@tempa == \relax |
| 196 |
% fi |
| 197 |
% %% Put out integral number of line segments |
| 198 |
% while \@clnwd < \@linelen |
| 199 |
% do \@upordown \@clnht \copy\@linechar |
| 200 |
% \@tempa |
| 201 |
% \@clnht := \@clnht + ht of \box\@linechar |
| 202 |
% \@clnwd := \@clnwd + width of \box\@linechar |
| 203 |
% od |
| 204 |
% |
| 205 |
% %% Put out last segment |
| 206 |
% \@clnht := \@clnht - height of \box\@linechar |
| 207 |
% \@clnwd := \@clnwd - width of \box\@linechar |
| 208 |
% \@tempdima := \@linelen - \@clnwd |
| 209 |
% \@tempdimb := \@tempdima - width of \box\@linechar |
| 210 |
% if @negarg then \hskip -\@tempdimb |
| 211 |
% else \hskip \@tempdimb |
| 212 |
% fi |
| 213 |
% \@tempdima := 1000 * \@tempdima |
| 214 |
% \@tempcnta := \@tempdima / width of \box\@linechar |
| 215 |
% \@tempdima := (\@tempcnta * ht of \box\@linechar)/1000 |
| 216 |
% \@clnht := \@clnht + \@tempdima |
| 217 |
% if \@linelen < width of box\@linechar |
| 218 |
% then \hskip width of box\@linechar |
| 219 |
% else \hbox{\@upordown \@clnht \copy\@linechar} |
| 220 |
% fi |
| 221 |
% END |
| 222 |
% |
| 223 |
% \@hline == |
| 224 |
% BEGIN |
| 225 |
% if \@xarg < 0 then \hskip -\@linelen \fi |
| 226 |
% \vrule height \@halfwidth depth \@halfwidth width \@linelen |
| 227 |
% if \@xarg < 0 then \hskip -\@linelen \fi |
| 228 |
% END |
| 229 |
% |
| 230 |
% \@vline == if \@yarg < 0 \@downline else \@upline fi |
| 231 |
% |
| 232 |
% |
| 233 |
% \@getlinechar(X,Y) == |
| 234 |
% BEGIN |
| 235 |
% \@tempcnta := 8*X - 9 |
| 236 |
% if Y > 0 |
| 237 |
% then \@tempcnta := \@tempcnta + Y |
| 238 |
% else \@tempcnta := \@tempcnta - Y + 64 |
| 239 |
% fi |
| 240 |
% \char\@tempcnta |
| 241 |
% END |
| 242 |
% |
| 243 |
% \vector(X,Y){LEN} == |
| 244 |
% BEGIN |
| 245 |
% \@xarg := X |
| 246 |
% \@yarg := Y |
| 247 |
% \@linelen := LEN * \unitlength |
| 248 |
% if \@xarg = 0 |
| 249 |
% then \@vvector |
| 250 |
% else if \@yarg = 0 |
| 251 |
% then \@hvector |
| 252 |
% else \@svector |
| 253 |
% if |
| 254 |
% if |
| 255 |
% END |
| 256 |
% |
| 257 |
% \@hvector == |
| 258 |
% BEGIN |
| 259 |
% \@hline |
| 260 |
% {\@linefnt if \@xarg < 0 then \@getlarrow(1,0) |
| 261 |
% else \@getrarrow(1,0) |
| 262 |
% fi} |
| 263 |
% END |
| 264 |
% |
| 265 |
% \@vvector == if \@yarg < 0 \@downvector else \@upvector fi |
| 266 |
% |
| 267 |
% \@svector == |
| 268 |
% BEGIN |
| 269 |
% \@sline |
| 270 |
% \@tempcnta := |\@yarg| |
| 271 |
% if \@tempcnta < 5 |
| 272 |
% then \hskip - width of \box\@linechar |
| 273 |
% \@upordown \@clnht \hbox |
| 274 |
% {\@linefnt |
| 275 |
% if @negarg then \@getlarrow(\@xarg,\@yyarg) |
| 276 |
% else \@getrarrow(\@xarg,\@yyarg) |
| 277 |
% fi } |
| 278 |
% else error: 'LATEX ERROR: Illegal \line or \vector argument.' |
| 279 |
% fi |
| 280 |
% END |
| 281 |
% |
| 282 |
% \@getlarrow(X,Y) == |
| 283 |
% BEGIN |
| 284 |
% if Y = 0 |
| 285 |
% then \@tempcnta := '33 |
| 286 |
% else \@tempcnta := 16 * X - 9 |
| 287 |
% \@tempcntb := 2 * Y |
| 288 |
% if \@tempcntb > 0 |
| 289 |
% then \@tempcnta := \@tempcnta + \@tempcntb |
| 290 |
% else \@tempcnta := \@tempcnta - \@tempcntb + 64 |
| 291 |
% fi |
| 292 |
% fi |
| 293 |
% \char\@tempcnta |
| 294 |
% END |
| 295 |
% |
| 296 |
% \@getrarrow(X,Y) == |
| 297 |
% BEGIN |
| 298 |
% \@tempcntb := |Y| |
| 299 |
% case of \@tempcntb |
| 300 |
% 0 : \@tempcnta := '55 |
| 301 |
% 1 : if X < 3 |
| 302 |
% then \@tempcnta := 24*X - 6 |
| 303 |
% else if X = 3 |
| 304 |
% then \@tempcnta := 49 |
| 305 |
% else \@tempcnta := 58 fi |
| 306 |
% fi |
| 307 |
% 2 : if X < 3 |
| 308 |
% then \@tempcnta := 24*X - 3 |
| 309 |
% else \@tempcnta := 51 % X must = 3 |
| 310 |
% fi |
| 311 |
% 3 : \@tempcnta := 16*X - 2 |
| 312 |
% 4 : \@tempcnta := 16*X + 7 |
| 313 |
% endcase |
| 314 |
% if Y < 0 |
| 315 |
% then \@tempcnta := \@tempcnta + 64 |
| 316 |
% fi |
| 317 |
% \char\@tempcnta |
| 318 |
% END |
| 319 |
|
| 320 |
\newif\if@negarg |
| 321 |
|
| 322 |
\def\line(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax |
| 323 |
\@linelen=#3\unitlength |
| 324 |
\ifnum\@xarg =0 \@vline |
| 325 |
\else \ifnum\@yarg =0 \@hline \else \@sline\fi |
| 326 |
\fi} |
| 327 |
|
| 328 |
\def\@sline{\ifnum\@xarg< 0 \@negargtrue \@xarg -\@xarg \@yyarg -\@yarg |
| 329 |
\else \@negargfalse \@yyarg \@yarg \fi |
| 330 |
\ifnum \@yyarg >0 \@tempcnta\@yyarg \else \@tempcnta -\@yyarg \fi |
| 331 |
\ifnum\@tempcnta>6 \@badlinearg\@tempcnta0 \fi |
| 332 |
\setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}% |
| 333 |
\ifnum \@yarg >0 \let\@upordown\raise \@clnht\z@ |
| 334 |
\else\let\@upordown\lower \@clnht \ht\@linechar\fi |
| 335 |
\@clnwd=\wd\@linechar |
| 336 |
\if@negarg \hskip -\wd\@linechar \def\@tempa{\hskip -2\wd\@linechar}\else |
| 337 |
\let\@tempa\relax \fi |
| 338 |
\@whiledim \@clnwd <\@linelen \do |
| 339 |
{\@upordown\@clnht\copy\@linechar |
| 340 |
\@tempa |
| 341 |
\advance\@clnht \ht\@linechar |
| 342 |
\advance\@clnwd \wd\@linechar}% |
| 343 |
\advance\@clnht -\ht\@linechar |
| 344 |
\advance\@clnwd -\wd\@linechar |
| 345 |
\@tempdima\@linelen\advance\@tempdima -\@clnwd |
| 346 |
\@tempdimb\@tempdima\advance\@tempdimb -\wd\@linechar |
| 347 |
\if@negarg \hskip -\@tempdimb \else \hskip \@tempdimb \fi |
| 348 |
\multiply\@tempdima \@m |
| 349 |
\@tempcnta \@tempdima \@tempdima \wd\@linechar \divide\@tempcnta \@tempdima |
| 350 |
\@tempdima \ht\@linechar \multiply\@tempdima \@tempcnta |
| 351 |
\divide\@tempdima \@m |
| 352 |
\advance\@clnht \@tempdima |
| 353 |
\ifdim \@linelen <\wd\@linechar |
| 354 |
\hskip \wd\@linechar |
| 355 |
\else\@upordown\@clnht\copy\@linechar\fi} |
| 356 |
|
| 357 |
\def\@hline{\ifnum \@xarg <0 \hskip -\@linelen \fi |
| 358 |
\vrule \@height \@halfwidth \@depth \@halfwidth \@width \@linelen |
| 359 |
\ifnum \@xarg <0 \hskip -\@linelen \fi} |
| 360 |
|
| 361 |
\def\@getlinechar(#1,#2){\@tempcnta#1\relax\multiply\@tempcnta 8 |
| 362 |
\advance\@tempcnta -9 \ifnum #2>0 \advance\@tempcnta #2\relax\else |
| 363 |
\advance\@tempcnta -#2\relax\advance\@tempcnta 64 \fi |
| 364 |
\char\@tempcnta} |
| 365 |
|
| 366 |
\def\vector(#1,#2)#3{\@xarg #1\relax \@yarg #2\relax |
| 367 |
\@linelen=#3\unitlength |
| 368 |
\ifnum\@xarg =0 \@vvector |
| 369 |
\else \ifnum\@yarg =0 \@hvector \else \@svector\fi |
| 370 |
\fi} |
| 371 |
|
| 372 |
\def\@hvector{\@hline\hbox to 0pt{\@linefnt |
| 373 |
\ifnum \@xarg <0 \@getlarrow(1,0)\hss\else |
| 374 |
\hss\@getrarrow(1,0)\fi}} |
| 375 |
|
| 376 |
\def\@vvector{\ifnum \@yarg <0 \@downvector \else \@upvector \fi} |
| 377 |
|
| 378 |
\def\@svector{\@sline |
| 379 |
\@tempcnta\@yarg \ifnum\@tempcnta <0 \@tempcnta=-\@tempcnta\fi |
| 380 |
\ifnum\@tempcnta <5 |
| 381 |
\hskip -\wd\@linechar |
| 382 |
\@upordown\@clnht \hbox{\@linefnt \if@negarg |
| 383 |
\@getlarrow(\@xarg,\@yyarg) \else \@getrarrow(\@xarg,\@yyarg) \fi}% |
| 384 |
\else\@badlinearg\fi} |
| 385 |
|
| 386 |
\def\@getlarrow(#1,#2){\ifnum #2 =\z@ \@tempcnta='33\else |
| 387 |
\@tempcnta=#1\relax\multiply\@tempcnta \sixt@@n \advance\@tempcnta |
| 388 |
-9 \@tempcntb=#2\relax\multiply\@tempcntb \tw@ |
| 389 |
\ifnum \@tempcntb >0 \advance\@tempcnta \@tempcntb\relax |
| 390 |
\else\advance\@tempcnta -\@tempcntb\advance\@tempcnta 64 |
| 391 |
\fi\fi\char\@tempcnta} |
| 392 |
|
| 393 |
\def\@getrarrow(#1,#2){\@tempcntb=#2\relax |
| 394 |
\ifnum\@tempcntb < 0 \@tempcntb=-\@tempcntb\relax\fi |
| 395 |
\ifcase \@tempcntb\relax \@tempcnta='55 \or |
| 396 |
\ifnum #1<3 \@tempcnta=#1\relax\multiply\@tempcnta |
| 397 |
24 \advance\@tempcnta -6 \else \ifnum #1=3 \@tempcnta=49 |
| 398 |
\else\@tempcnta=58 \fi\fi\or |
| 399 |
\ifnum #1<3 \@tempcnta=#1\relax\multiply\@tempcnta |
| 400 |
24 \advance\@tempcnta -3 \else \@tempcnta=51\fi\or |
| 401 |
\@tempcnta=#1\relax\multiply\@tempcnta |
| 402 |
\sixt@@n \advance\@tempcnta -\tw@ \else |
| 403 |
\@tempcnta=#1\relax\multiply\@tempcnta |
| 404 |
\sixt@@n \advance\@tempcnta 7 \fi\ifnum #2<0 \advance\@tempcnta 64 \fi |
| 405 |
\char\@tempcnta} |
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
\def\@vline{\ifnum \@yarg <0 \@downline \else \@upline\fi} |
| 410 |
|
| 411 |
\def\@upline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth |
| 412 |
\@height \@linelen \@depth \z@\hss}} |
| 413 |
|
| 414 |
\def\@downline{\hbox to \z@{\hskip -\@halfwidth \vrule \@width \@wholewidth |
| 415 |
\@height \z@ \@depth \@linelen \hss}} |
| 416 |
|
| 417 |
\def\@upvector{\@upline\setbox\@tempboxa\hbox{\@linefnt\char'66}\raise |
| 418 |
\@linelen \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}} |
| 419 |
|
| 420 |
\def\@downvector{\@downline\lower \@linelen |
| 421 |
\hbox to \z@{\@linefnt\char'77\hss}} |
| 422 |
|
| 423 |
% \dashbox{D}(X,Y) == |
| 424 |
% BEGIN |
| 425 |
% leave vertical mode |
| 426 |
% \hbox to 0pt { |
| 427 |
% \baselineskip := 0pt |
| 428 |
% \lineskip := 0pt |
| 429 |
% %% HORIZONTAL DASHES |
| 430 |
% \@dashdim := X * \unitlength |
| 431 |
% \@dashcnt := \@dashdim + 200 % to prevent roundoff error |
| 432 |
% \@dashdim := D * \unitlength |
| 433 |
% \@dashcnt := \@dashcnt / \@dashdim |
| 434 |
% if \@dashcnt is odd |
| 435 |
% then \@dashdim := 0pt |
| 436 |
% \@dashcnt := (\@dashcnt + 1) / 2 |
| 437 |
% else \@dashdim := \@dashdim / 2 |
| 438 |
% \@dashcnt := \@dashcnt / 2 - 1 |
| 439 |
% \box\@dashbox := \hbox{\vrule height \@halfwidth |
| 440 |
% depth \@halfwidth width \@dashdim} |
| 441 |
% \put(0,0){\copy\@dashbox} |
| 442 |
% \put(0,Y){\copy\@dashbox} |
| 443 |
% \put(X,0){\hskip -\@dashdim\copy\@dashbox} |
| 444 |
% \put(X,Y){\hskip -\@dashdim\box\@dashbox} |
| 445 |
% \@dashdim := 3 * \@dashdim |
| 446 |
% fi |
| 447 |
% \box\@dashbox := \hbox{\vrule height \@halfwidth |
| 448 |
% depth \@halfwidth width D * \unitlength |
| 449 |
% \hskip D * \unitlength} |
| 450 |
% \@tempcnta := 0 |
| 451 |
% \put(0,0){\hskip \@dashdim |
| 452 |
% while \@tempcnta < \@dascnt |
| 453 |
% do \copy\@dashbox |
| 454 |
% \@tempcnta := \@tempcnta + 1 |
| 455 |
% od |
| 456 |
% } |
| 457 |
% \@tempcnta := 0 |
| 458 |
% put(0,Y){\hskip \@dashdim |
| 459 |
% while \@tempcnta < \@dascnt |
| 460 |
% do \copy\@dashbox |
| 461 |
% \@tempcnta := \@tempcnta + 1 |
| 462 |
% od |
| 463 |
% } |
| 464 |
% |
| 465 |
% %% vertical dashes |
| 466 |
% \@dashdim := Y * \unitlength |
| 467 |
% \@dashcnt := \@dashdim + 200 % to prevent roundoff error |
| 468 |
% \@dashdim := D * \unitlength |
| 469 |
% \@dashcnt := \@dashcnt / \@dashdim |
| 470 |
% if \@dashcnt is odd |
| 471 |
% then \@dashdim := 0pt |
| 472 |
% \@dashcnt := (\@dashcnt + 1) / 2 |
| 473 |
% else \@dashdim := \@dashdim / 2 |
| 474 |
% \@dashcnt := \@dashcnt / 2 - 1 |
| 475 |
% \box\@dashbox := \hbox{\hskip -\@halfwidth |
| 476 |
% \vrule width \@wholewidth |
| 477 |
% height \@dashdim } |
| 478 |
% \put(0,0){\copy\@dashbox} |
| 479 |
% \put(X,0){\copy\@dashbox} |
| 480 |
% \put(0,Y){\lower\@dashdim\copy\@dashbox} |
| 481 |
% \put(X,Y){\lower\@dashdim\copy\@dashbox} |
| 482 |
% \@dashdim := 3 * \@dashdim |
| 483 |
% fi |
| 484 |
% \box\@dashbox := \hbox{\vrule width \@wholewidth |
| 485 |
% height D * \unitlength } |
| 486 |
% \@tempcnta := 0 |
| 487 |
% put(0,0){\hskip -\halfwidth |
| 488 |
% \vbox{while \@tempcnta < \@dashcnt |
| 489 |
% do \vskip D*\unitlength |
| 490 |
% \copy\@dashbox |
| 491 |
% \@tempcnta := \@tempcnta + 1 |
| 492 |
% od |
| 493 |
% \vskip \@dashdim |
| 494 |
% } } |
| 495 |
% \@tempcnta := 0 |
| 496 |
% put(X,0){\hskip -\halfwidth |
| 497 |
% \vbox{while \@tempcnta < \@dashcnt |
| 498 |
% do \vskip D*\unitlength |
| 499 |
% \copy\@dashbox |
| 500 |
% \@tempcnta := \@tempcnta + 1 |
| 501 |
% od |
| 502 |
% \vskip \@dashdim |
| 503 |
% } |
| 504 |
% } |
| 505 |
% } % END DASHES |
| 506 |
% |
| 507 |
% \@imakepicbox(X,Y) |
| 508 |
% END |
| 509 |
|
| 510 |
\def\dashbox#1(#2,#3){\leavevmode\hbox to \z@{\baselineskip \z@% |
| 511 |
\lineskip \z@% |
| 512 |
\@dashdim=#2\unitlength% |
| 513 |
\@dashcnt=\@dashdim \advance\@dashcnt 200 |
| 514 |
\@dashdim=#1\unitlength\divide\@dashcnt \@dashdim |
| 515 |
\ifodd\@dashcnt\@dashdim=\z@% |
| 516 |
\advance\@dashcnt \@ne \divide\@dashcnt \tw@ |
| 517 |
\else \divide\@dashdim \tw@ \divide\@dashcnt \tw@ |
| 518 |
\advance\@dashcnt \m@ne |
| 519 |
\setbox\@dashbox=\hbox{\vrule \@height \@halfwidth \@depth \@halfwidth |
| 520 |
\@width \@dashdim}\put(0,0){\copy\@dashbox}% |
| 521 |
\put(0,#3){\copy\@dashbox}% |
| 522 |
\put(#2,0){\hskip-\@dashdim\copy\@dashbox}% |
| 523 |
\put(#2,#3){\hskip-\@dashdim\box\@dashbox}% |
| 524 |
\multiply\@dashdim 3 |
| 525 |
\fi |
| 526 |
\setbox\@dashbox=\hbox{\vrule \@height \@halfwidth \@depth \@halfwidth |
| 527 |
\@width #1\unitlength\hskip #1\unitlength}\@tempcnta=0 |
| 528 |
\put(0,0){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt |
| 529 |
\do{\copy\@dashbox\advance\@tempcnta \@ne }}\@tempcnta=0 |
| 530 |
\put(0,#3){\hskip\@dashdim \@whilenum \@tempcnta <\@dashcnt |
| 531 |
\do{\copy\@dashbox\advance\@tempcnta \@ne }}% |
| 532 |
\@dashdim=#3\unitlength% |
| 533 |
\@dashcnt=\@dashdim \advance\@dashcnt 200 |
| 534 |
\@dashdim=#1\unitlength\divide\@dashcnt \@dashdim |
| 535 |
\ifodd\@dashcnt \@dashdim=\z@% |
| 536 |
\advance\@dashcnt \@ne \divide\@dashcnt \tw@ |
| 537 |
\else |
| 538 |
\divide\@dashdim \tw@ \divide\@dashcnt \tw@ |
| 539 |
\advance\@dashcnt \m@ne |
| 540 |
\setbox\@dashbox\hbox{\hskip -\@halfwidth |
| 541 |
\vrule \@width \@wholewidth |
| 542 |
\@height \@dashdim}\put(0,0){\copy\@dashbox}% |
| 543 |
\put(#2,0){\copy\@dashbox}% |
| 544 |
\put(0,#3){\lower\@dashdim\copy\@dashbox}% |
| 545 |
\put(#2,#3){\lower\@dashdim\copy\@dashbox}% |
| 546 |
\multiply\@dashdim 3 |
| 547 |
\fi |
| 548 |
\setbox\@dashbox\hbox{\vrule \@width \@wholewidth |
| 549 |
\@height #1\unitlength}\@tempcnta0 |
| 550 |
\put(0,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta < \@dashcnt |
| 551 |
\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }% |
| 552 |
\vskip\@dashdim}}\@tempcnta0 |
| 553 |
\put(#2,0){\hskip -\@halfwidth \vbox{\@whilenum \@tempcnta< \@dashcnt |
| 554 |
\relax\do{\vskip #1\unitlength\copy\@dashbox\advance\@tempcnta \@ne }% |
| 555 |
\vskip\@dashdim}}}\@makepicbox(#2,#3)} |
| 556 |
|
| 557 |
% CIRCLES AND OVALS |
| 558 |
% |
| 559 |
% USER COMMANDS: |
| 560 |
% |
| 561 |
% \circle{D} : Produces the circle with the diameter as close as |
| 562 |
% possible to D * \unitlength. \put(X,Y){\circle{D}} |
| 563 |
% puts the circle with its center at (X,Y). |
| 564 |
% |
| 565 |
% \oval(X,Y) : Makes an oval as round as possible that fits in the |
| 566 |
% rectangle of width X * \unitlength and height |
| 567 |
% Y * \unitlength. The reference point is the center. |
| 568 |
% |
| 569 |
% \oval(X,Y)[POS] : Save as \oval(X,Y) except it draws only the |
| 570 |
% half or quadrant of the oval indicated by POS. |
| 571 |
% E.G., \oval(X,Y)[t] draws just the top half |
| 572 |
% and \oval(X,Y)[br] draws just the bottom right |
| 573 |
% quadrant. In all cases, the reference point is |
| 574 |
% the same as the unqualified \oval(X,Y) command. |
| 575 |
% |
| 576 |
% \@ovvert {DELTA1} {DELTA2} : Makes a vbox containing either the left side |
| 577 |
% or the right side of the oval being constructed. The baseline |
| 578 |
% will coincide with the outside bottom edge of the oval; the left |
| 579 |
% side of the box will coincide with the left edge of the vertical |
| 580 |
% rule. The width of the box will be \@tempdima. |
| 581 |
% DELTA1 and DELTA2 are added to the character number in \@tempcnta |
| 582 |
% to get the characters for the top and bottom quarter circle pieces. |
| 583 |
% |
| 584 |
% \@ovhorz : Makes an hbox containing the straight rule for either the |
| 585 |
% top or the bottom of the oval being constructed. The baseline |
| 586 |
% will coincide with bottom edge of the rule; the left side of |
| 587 |
% the box will coincide with the left side of the oval. |
| 588 |
% The width of the box will be \@ovxx. |
| 589 |
% |
| 590 |
% \@getcirc {DIAM} : Sets \@tempcnta to the character number |
| 591 |
% of the top-right quarter circle with the largest |
| 592 |
% diameter less than or equal to DIAM. |
| 593 |
% Sets \@tempboxa to an hbox containing that character. |
| 594 |
% Sets \@tempdima to \wd \@tempboxa, which is the distance |
| 595 |
% from the circle's left outside edge to its right |
| 596 |
% inside edge. |
| 597 |
% (These characters are like those described in the |
| 598 |
% TeXbook, pp. 389-90.) |
| 599 |
% |
| 600 |
% \@getcirc {DIAM} == |
| 601 |
% BEGIN |
| 602 |
% \@tempcnta := integer coercion of DIAM |
| 603 |
% \@tempcnta := \@tempcnta / integer coercion of 4pt |
| 604 |
% if \@tempcnta > 10 |
| 605 |
% then \@tempcnta := 10 fi |
| 606 |
% if \@tempcnta > 0 |
| 607 |
% then \@tempcnta := \@tempcnta-1 |
| 608 |
% else LaTeX Warning: Oval too small. |
| 609 |
% fi |
| 610 |
% \@tempcnta := 4 * \@tempcnta |
| 611 |
% \@tempboxa := \hbox{\@circlefnt \char \@tempcnta} |
| 612 |
% \@tempdima := \wd \@tempboxa |
| 613 |
% END |
| 614 |
% |
| 615 |
% \@put{X}{Y}{OBJ} == |
| 616 |
% BEGIN |
| 617 |
% \raise Y \hbox to 0pt{\hskip X OBJ \hss} |
| 618 |
% END |
| 619 |
% |
| 620 |
% \@oval(X,Y)[POS] == |
| 621 |
% BEGIN |
| 622 |
% \begingroup |
| 623 |
% \boxmaxdepth := \maxdimen |
| 624 |
% @ovt := @ovb := @ovl := @ovr := true |
| 625 |
% for all E in POS |
| 626 |
% do @ovE := false od |
| 627 |
% \@ovxx := X * \unitlength |
| 628 |
% \@ovyy := Y * \unitlength |
| 629 |
% \@tempdimb := min(\@ovxx,\@ovyy) |
| 630 |
% \@getcirc{\@tempdimb} |
| 631 |
% \@ovro := \ht \@tempboxa |
| 632 |
% \@ovri := \dp \@tempboxa |
| 633 |
% \@ovdx := \@ovxx - \@tempdima |
| 634 |
% \@ovdx := \@ovdx/2 |
| 635 |
% \@ovdy := \@ovyy - \@tempdima |
| 636 |
% \@ovdy := \@ovyy/2 |
| 637 |
% \@circlefnt |
| 638 |
% \@tempboxa := |
| 639 |
% \hbox{ |
| 640 |
% if @ovr |
| 641 |
% then \@ovvert{3}{2} \kern -\@tempdima |
| 642 |
% fi |
| 643 |
% if @ovl |
| 644 |
% then \kern \@ovxx \@ovvert{0}{1} \kern -\@tempdima |
| 645 |
% \kern -\@ovxx |
| 646 |
% fi |
| 647 |
% if @ovt |
| 648 |
% then \@ovhorz \kern -\@ovxx |
| 649 |
% fi |
| 650 |
% if @ovb |
| 651 |
% then \raise \@ovyy \@ovhorz |
| 652 |
% fi |
| 653 |
% } |
| 654 |
% \@ovdx := \@ovdx + \@ovro |
| 655 |
% \@ovdy := \@ovdy + \@ovro |
| 656 |
% \ht\@tempboxa := \dp\@tempboxa := 0 |
| 657 |
% \@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa} |
| 658 |
% \endgroup |
| 659 |
% END |
| 660 |
% |
| 661 |
% \@ovvert {DELTA1} {DELTA2} == |
| 662 |
% BEGIN |
| 663 |
% \vbox to \@ovyy { |
| 664 |
% if @ovb |
| 665 |
% then \@tempcntb := \@tempcnta + DELTA1 |
| 666 |
% \kern -\@ovro |
| 667 |
% \hbox { \char \@tempcntb } |
| 668 |
% \nointerlineskip |
| 669 |
% else \kern \@ovri \kern \@ovdy |
| 670 |
% fi |
| 671 |
% \leaders \vrule width \@wholewidth \vfil |
| 672 |
% \nointerlineskip |
| 673 |
% if @ovt |
| 674 |
% then \@tempcntb := \@tempcnta + DELTA2 |
| 675 |
% \hbox { \char \@tempcntb } |
| 676 |
% else \kern \@ovdy \kern \@ovro |
| 677 |
% fi |
| 678 |
% } |
| 679 |
% END |
| 680 |
% |
| 681 |
% \@ovhorz == |
| 682 |
% BEGIN |
| 683 |
% \hbox to \@ovxx{ |
| 684 |
% \kern \@ovro |
| 685 |
% if @ovr |
| 686 |
% then |
| 687 |
% else \kern \@ovdx |
| 688 |
% fi |
| 689 |
% \leaders \hrule height \@wholewidth \hfil |
| 690 |
% if @ovl |
| 691 |
% then |
| 692 |
% else \kern \@ovdx |
| 693 |
% fi |
| 694 |
% \kern \@ovri |
| 695 |
% } |
| 696 |
% END |
| 697 |
% |
| 698 |
% \circle{DIAM} == |
| 699 |
% BEGIN |
| 700 |
% \begingroup |
| 701 |
% \boxmaxdepth := maxdimen |
| 702 |
% \@tempdimb := DIAM *\unitlength |
| 703 |
% if \@tempdimb > 15.5pt |
| 704 |
% then \@getcirc{\@tempdimb} |
| 705 |
% \@ovro := \ht \@tempboxa |
| 706 |
% \@tempboxa := \hbox{ |
| 707 |
% \@circlefnt |
| 708 |
% \@tempcnta := \@tempcnta + 2 |
| 709 |
% \char \@tempcnta |
| 710 |
% \@tempcnta := \@tempcnta - 1 |
| 711 |
% \char \@tempcnta |
| 712 |
% \kern -2\@tempdima |
| 713 |
% \@tempcnta := \@tempcnta + 2 |
| 714 |
% \raise \@tempdima \hbox { \char \@tempcnta } |
| 715 |
% \raise \@tempdima \box\@tempboxa |
| 716 |
% } |
| 717 |
% \ht\@tempboxa := \dp\@tempboxa := 0 |
| 718 |
% \@put{-\@ovro}{-\@ovro}{\@tempboxa} |
| 719 |
% else |
| 720 |
% \@circ{\@tempdimb}{96} |
| 721 |
% fi |
| 722 |
% \endgroup |
| 723 |
% END |
| 724 |
% |
| 725 |
% \circle*{DIAM} == \@dot{DIAM} == \@circ{DIAM*\unitlength}{112} |
| 726 |
% |
| 727 |
% \@circ{DIAM}{CHAR} == |
| 728 |
% BEGIN |
| 729 |
% \@tempcnta := integer coercion of (DIAM + .5pt)/1pt. |
| 730 |
% if \@tempcnta > 15 then \@tempcnta := 15 fi |
| 731 |
% if \@tempcnta > 1 then \@tempcnta := \@tempcnta - 1 fi |
| 732 |
% \@tempcnta := \@tempcnta + CHAR |
| 733 |
% \@circlefnt |
| 734 |
% \char \@tempcnta |
| 735 |
% END |
| 736 |
% |
| 737 |
|
| 738 |
\newif\if@ovt |
| 739 |
\newif\if@ovb |
| 740 |
\newif\if@ovl |
| 741 |
\newif\if@ovr |
| 742 |
\newdimen\@ovxx |
| 743 |
\newdimen\@ovyy |
| 744 |
\newdimen\@ovdx |
| 745 |
\newdimen\@ovdy |
| 746 |
\newdimen\@ovro |
| 747 |
\newdimen\@ovri |
| 748 |
|
| 749 |
\def\@getcirc#1{\@tempdima #1\relax \@tempcnta\@tempdima |
| 750 |
\@tempdima 4pt\relax \divide\@tempcnta\@tempdima |
| 751 |
\ifnum \@tempcnta > 10\relax \@tempcnta 10\relax\fi |
| 752 |
\ifnum \@tempcnta >\z@ \advance\@tempcnta\m@ne |
| 753 |
\else \@warning{Oval too small}\fi |
| 754 |
\multiply\@tempcnta 4\relax |
| 755 |
\setbox \@tempboxa \hbox{\@circlefnt |
| 756 |
\char \@tempcnta}\@tempdima \wd \@tempboxa} |
| 757 |
|
| 758 |
\def\@put#1#2#3{\raise #2\hbox to \z@{\hskip #1#3\hss}} |
| 759 |
|
| 760 |
\def\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}} |
| 761 |
|
| 762 |
\def\@oval(#1,#2)[#3]{\begingroup\boxmaxdepth \maxdimen |
| 763 |
\@ovttrue \@ovbtrue \@ovltrue \@ovrtrue |
| 764 |
\@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}\@ovxx |
| 765 |
#1\unitlength \@ovyy #2\unitlength |
| 766 |
\@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi |
| 767 |
\@getcirc \@tempdimb |
| 768 |
\@ovro \ht\@tempboxa \@ovri \dp\@tempboxa |
| 769 |
\@ovdx\@ovxx \advance\@ovdx -\@tempdima \divide\@ovdx \tw@ |
| 770 |
\@ovdy\@ovyy \advance\@ovdy -\@tempdima \divide\@ovdy \tw@ |
| 771 |
\@circlefnt \setbox\@tempboxa |
| 772 |
\hbox{\if@ovr \@ovvert32\kern -\@tempdima \fi |
| 773 |
\if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi |
| 774 |
\if@ovt \@ovhorz \kern -\@ovxx \fi |
| 775 |
\if@ovb \raise \@ovyy \@ovhorz \fi}\advance\@ovdx\@ovro |
| 776 |
\advance\@ovdy\@ovro \ht\@tempboxa\z@ \dp\@tempboxa\z@ |
| 777 |
\@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}% |
| 778 |
\endgroup} |
| 779 |
|
| 780 |
\def\@ovvert#1#2{\vbox to \@ovyy{% |
| 781 |
\if@ovb \@tempcntb \@tempcnta \advance \@tempcntb by #1\relax |
| 782 |
\kern -\@ovro \hbox{\char \@tempcntb}\nointerlineskip |
| 783 |
\else \kern \@ovri \kern \@ovdy \fi |
| 784 |
\leaders\vrule width \@wholewidth\vfil \nointerlineskip |
| 785 |
\if@ovt \@tempcntb \@tempcnta \advance \@tempcntb by #2\relax |
| 786 |
\hbox{\char \@tempcntb}% |
| 787 |
\else \kern \@ovdy \kern \@ovro \fi}} |
| 788 |
|
| 789 |
\def\@ovhorz{\hbox to \@ovxx{\kern \@ovro |
| 790 |
\if@ovr \else \kern \@ovdx \fi |
| 791 |
\leaders \hrule height \@wholewidth \hfil |
| 792 |
\if@ovl \else \kern \@ovdx \fi |
| 793 |
\kern \@ovri}} |
| 794 |
|
| 795 |
\def\circle{\@ifstar{\@dot}{\@circle}} |
| 796 |
\def\@circle#1{\begingroup \boxmaxdepth \maxdimen \@tempdimb #1\unitlength |
| 797 |
\ifdim \@tempdimb >15.5pt\relax \@getcirc\@tempdimb |
| 798 |
\@ovro\ht\@tempboxa |
| 799 |
\setbox\@tempboxa\hbox{\@circlefnt |
| 800 |
\advance\@tempcnta\tw@ \char \@tempcnta |
| 801 |
\advance\@tempcnta\m@ne \char \@tempcnta \kern -2\@tempdima |
| 802 |
\advance\@tempcnta\tw@ |
| 803 |
\raise \@tempdima \hbox{\char\@tempcnta}\raise \@tempdima |
| 804 |
\box\@tempboxa}\ht\@tempboxa\z@ \dp\@tempboxa\z@ |
| 805 |
\@put{-\@ovro}{-\@ovro}{\box\@tempboxa}% |
| 806 |
\else \@circ\@tempdimb{96}\fi\endgroup} |
| 807 |
|
| 808 |
\def\@dot#1{\@tempdimb #1\unitlength \@circ\@tempdimb{112}} |
| 809 |
|
| 810 |
\def\@circ#1#2{\@tempdima #1\relax \advance\@tempdima .5pt\relax |
| 811 |
\@tempcnta\@tempdima \@tempdima 1pt\relax |
| 812 |
\divide\@tempcnta\@tempdima |
| 813 |
\ifnum\@tempcnta > 15\relax \@tempcnta 15\relax \fi |
| 814 |
\ifnum \@tempcnta >\z@ \advance\@tempcnta\m@ne\fi |
| 815 |
\advance\@tempcnta #2\relax |
| 816 |
\@circlefnt \char\@tempcnta} |
| 817 |
|
| 818 |
|
| 819 |
%INITIALIZATION |
| 820 |
\thinlines |
| 821 |
|
| 822 |
\newcount\@xarg |
| 823 |
\newcount\@yarg |
| 824 |
\newcount\@yyarg |
| 825 |
\newcount\@multicnt |
| 826 |
\newdimen\@xdim |
| 827 |
\newdimen\@ydim |
| 828 |
\newbox\@linechar |
| 829 |
\newdimen\@linelen |
| 830 |
\newdimen\@clnwd |
| 831 |
\newdimen\@clnht |
| 832 |
\newdimen\@dashdim |
| 833 |
\newbox\@dashbox |
| 834 |
\newcount\@dashcnt |
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
% |
| 839 |
|