| 1 |
% This is latexpicobjs.tex, Version 1.1 9/11/87 |
| 2 |
|
| 3 |
% This file makes the LaTeX line, vector, circle, and oval constructions |
| 4 |
% available to PiCTeX users who are running under plain TeX. |
| 5 |
% It is distributed with Leslie Lamport's permission. |
| 6 |
|
| 7 |
% Do not \input the files prepictex.tex and postpictex.tex along with |
| 8 |
% this file. |
| 9 |
|
| 10 |
\catcode`@=11 \catcode`!=11 |
| 11 |
|
| 12 |
% Save the meaning of plain TeX's \line command |
| 13 |
\let\!texline=\line |
| 14 |
|
| 15 |
% load LaTeX line and circle fonts |
| 16 |
\font\tenln=line10 |
| 17 |
\font\tenlnw=linew10 |
| 18 |
\font\tencirc=circle10 |
| 19 |
\font\tencircw=circlew10 |
| 20 |
|
| 21 |
% set up LaTeX hacks |
| 22 |
\let\@tfor=\!tfor |
| 23 |
\let\@ifnextchar=\!ifnextchar |
| 24 |
|
| 25 |
\def\@whilenoop#1{} |
| 26 |
\def\@whiledim#1\do #2{\ifdim #1\relax#2\@iwhiledim{#1\relax#2}\fi} |
| 27 |
\def\@iwhiledim#1{\ifdim #1\let\@nextwhile=\@iwhiledim |
| 28 |
\else\let\@nextwhile=\@whilenoop\fi\@nextwhile{#1}} |
| 29 |
|
| 30 |
\def\@ifstar#1#2{\@ifnextchar *{\def\@tempa*{#1}\@tempa}{#2}} |
| 31 |
|
| 32 |
\def\@height{height} |
| 33 |
\def\@depth{depth} |
| 34 |
\def\@width{width} |
| 35 |
|
| 36 |
|
| 37 |
% The following are slightly modified versions of the LaTeX |
| 38 |
% \@badlinearg and \@warning commands. |
| 39 |
\def\!@badlinearg{% |
| 40 |
\errmessage{Bad LaTeX \string\line\space or \string\vector |
| 41 |
\space argument. See the LaTeX manual for an explanation.}} |
| 42 |
\def\!@warning#1{\immediate\write16{LaTeX Warning: #1.}\ignorespaces} |
| 43 |
|
| 44 |
% allocate registers |
| 45 |
\newdimen\@tempdima |
| 46 |
\newdimen\@tempdimb |
| 47 |
\newcount\@tempcnta |
| 48 |
\newcount\@tempcntb |
| 49 |
\newbox\@tempboxa |
| 50 |
|
| 51 |
% Until further notice (near the end) what follows are |
| 52 |
% (slightly modified versions of) LaTeX's line/vector/circle/oval macros. |
| 53 |
% See the latex.tex macro package for commentary. |
| 54 |
\newdimen\@wholewidth |
| 55 |
\newdimen\@halfwidth |
| 56 |
\newdimen\unitlength \unitlength =1pt |
| 57 |
|
| 58 |
\def\thinlines{% |
| 59 |
\let\@linefnt\tenln \let\@circlefnt\tencirc |
| 60 |
\@wholewidth\fontdimen8\tenln \@halfwidth .5\@wholewidth} |
| 61 |
\def\thicklines{% |
| 62 |
\let\@linefnt\tenlnw \let\@circlefnt\tencircw |
| 63 |
\@wholewidth\fontdimen8\tenlnw \@halfwidth .5\@wholewidth} |
| 64 |
|
| 65 |
\newif\if@negarg |
| 66 |
|
| 67 |
\def\line(#1,#2)#3{% |
| 68 |
\@xarg #1\relax |
| 69 |
\@yarg #2\relax |
| 70 |
\@linelen=#3\unitlength |
| 71 |
\ifnum\@xarg =0 |
| 72 |
\@vline |
| 73 |
\else |
| 74 |
\ifnum\@yarg =0 |
| 75 |
\@hline |
| 76 |
\else |
| 77 |
\@sline |
| 78 |
\fi |
| 79 |
\fi} |
| 80 |
|
| 81 |
\def\@sline{% |
| 82 |
\ifnum\@xarg< 0 |
| 83 |
\@negargtrue |
| 84 |
\@xarg -\@xarg |
| 85 |
\@yyarg -\@yarg |
| 86 |
\else |
| 87 |
\@negargfalse |
| 88 |
\@yyarg \@yarg |
| 89 |
\fi |
| 90 |
\ifnum \@yyarg >0 |
| 91 |
\@tempcnta\@yyarg |
| 92 |
\else |
| 93 |
\@tempcnta -\@yyarg |
| 94 |
\fi |
| 95 |
\ifnum\@tempcnta>6 |
| 96 |
\!@badlinearg |
| 97 |
\@tempcnta0 |
| 98 |
\fi |
| 99 |
\ifnum\@xarg>6 |
| 100 |
\!@badlinearg |
| 101 |
\@xarg 1 |
| 102 |
\fi |
| 103 |
\setbox\@linechar\hbox{\@linefnt\@getlinechar(\@xarg,\@yyarg)}% |
| 104 |
\ifnum \@yarg >0 |
| 105 |
\let\@upordown\raise |
| 106 |
\@clnht\z@ |
| 107 |
\else |
| 108 |
\let\@upordown\lower |
| 109 |
\@clnht \ht\@linechar |
| 110 |
\fi |
| 111 |
\@clnwd=\wd\@linechar |
| 112 |
\if@negarg |
| 113 |
\hskip -\wd\@linechar |
| 114 |
\def\@tempa{\hskip -2\wd\@linechar}% |
| 115 |
\else |
| 116 |
\let\@tempa\relax |
| 117 |
\fi |
| 118 |
\@whiledim \@clnwd <\@linelen \do |
| 119 |
{\@upordown\@clnht\copy\@linechar |
| 120 |
\@tempa |
| 121 |
\advance\@clnht \ht\@linechar |
| 122 |
\advance\@clnwd \wd\@linechar}% |
| 123 |
\advance\@clnht -\ht\@linechar |
| 124 |
\advance\@clnwd -\wd\@linechar |
| 125 |
\@tempdima\@linelen |
| 126 |
\advance\@tempdima -\@clnwd |
| 127 |
\@tempdimb\@tempdima |
| 128 |
\advance\@tempdimb -\wd\@linechar |
| 129 |
\if@negarg |
| 130 |
\hskip -\@tempdimb |
| 131 |
\else |
| 132 |
\hskip \@tempdimb |
| 133 |
\fi |
| 134 |
\multiply\@tempdima \@m |
| 135 |
\@tempcnta \@tempdima |
| 136 |
\@tempdima \wd\@linechar |
| 137 |
\divide\@tempcnta \@tempdima |
| 138 |
\@tempdima \ht\@linechar |
| 139 |
\multiply\@tempdima \@tempcnta |
| 140 |
\divide\@tempdima \@m |
| 141 |
\advance\@clnht \@tempdima |
| 142 |
\ifdim \@linelen <\wd\@linechar |
| 143 |
\hskip \wd\@linechar |
| 144 |
\else |
| 145 |
\@upordown\@clnht\copy\@linechar |
| 146 |
\fi} |
| 147 |
|
| 148 |
\def\@hline{% |
| 149 |
\ifnum \@xarg <0 \hskip -\@linelen \fi |
| 150 |
\vrule \@height \@halfwidth \@depth \@halfwidth \@width \@linelen |
| 151 |
\ifnum \@xarg <0 \hskip -\@linelen \fi} |
| 152 |
|
| 153 |
\def\@getlinechar(#1,#2){% |
| 154 |
\@tempcnta#1\relax |
| 155 |
\multiply\@tempcnta 8 |
| 156 |
\advance\@tempcnta -9 |
| 157 |
\ifnum #2>0 |
| 158 |
\advance\@tempcnta #2\relax |
| 159 |
\else |
| 160 |
\advance\@tempcnta -#2\relax |
| 161 |
\advance\@tempcnta 64 |
| 162 |
\fi |
| 163 |
\char\@tempcnta} |
| 164 |
|
| 165 |
\def\vector(#1,#2)#3{% |
| 166 |
\@xarg #1\relax |
| 167 |
\@yarg #2\relax |
| 168 |
\@tempcnta \ifnum\@xarg<0 -\@xarg\else\@xarg\fi |
| 169 |
\ifnum\@tempcnta<5\relax |
| 170 |
\@linelen=#3\unitlength |
| 171 |
\ifnum\@xarg =0 |
| 172 |
\@vvector |
| 173 |
\else |
| 174 |
\ifnum\@yarg =0 |
| 175 |
\@hvector |
| 176 |
\else |
| 177 |
\@svector |
| 178 |
\fi |
| 179 |
\fi |
| 180 |
\else |
| 181 |
\!@badlinearg |
| 182 |
\fi} |
| 183 |
|
| 184 |
\def\@hvector{% |
| 185 |
\@hline |
| 186 |
\hbox to 0pt{% |
| 187 |
\@linefnt |
| 188 |
\ifnum \@xarg <0 |
| 189 |
\@getlarrow(1,0)\hss |
| 190 |
\else |
| 191 |
\hss\@getrarrow(1,0)% |
| 192 |
\fi}} |
| 193 |
|
| 194 |
\def\@vvector{\ifnum \@yarg <0 \@downvector \else \@upvector \fi} |
| 195 |
|
| 196 |
\def\@svector{% |
| 197 |
\@sline |
| 198 |
\@tempcnta\@yarg |
| 199 |
\ifnum\@tempcnta <0 |
| 200 |
\@tempcnta=-\@tempcnta |
| 201 |
\fi |
| 202 |
\ifnum\@tempcnta <5 |
| 203 |
\hskip -\wd\@linechar |
| 204 |
\@upordown\@clnht \hbox{% |
| 205 |
\@linefnt |
| 206 |
\if@negarg |
| 207 |
\@getlarrow(\@xarg,\@yyarg) |
| 208 |
\else |
| 209 |
\@getrarrow(\@xarg,\@yyarg) |
| 210 |
\fi}% |
| 211 |
\else |
| 212 |
\!@badlinearg |
| 213 |
\fi} |
| 214 |
|
| 215 |
\def\@getlarrow(#1,#2){% |
| 216 |
\ifnum #2 =\z@ |
| 217 |
\@tempcnta='33 |
| 218 |
\else |
| 219 |
\@tempcnta=#1\relax |
| 220 |
\multiply\@tempcnta \sixt@@n |
| 221 |
\advance\@tempcnta -9 |
| 222 |
\@tempcntb=#2\relax |
| 223 |
\multiply\@tempcntb \tw@ |
| 224 |
\ifnum \@tempcntb >0 |
| 225 |
\advance\@tempcnta \@tempcntb\relax |
| 226 |
\else\advance\@tempcnta -\@tempcntb |
| 227 |
\advance\@tempcnta 64 |
| 228 |
\fi |
| 229 |
\fi |
| 230 |
\char\@tempcnta} |
| 231 |
|
| 232 |
\def\@getrarrow(#1,#2){% |
| 233 |
\@tempcntb=#2\relax |
| 234 |
\ifnum\@tempcntb < 0 |
| 235 |
\@tempcntb=-\@tempcntb\relax |
| 236 |
\fi |
| 237 |
\ifcase \@tempcntb\relax |
| 238 |
\@tempcnta='55 |
| 239 |
\or |
| 240 |
\ifnum #1<3 |
| 241 |
\@tempcnta=#1\relax |
| 242 |
\multiply\@tempcnta 24 |
| 243 |
\advance\@tempcnta -6 |
| 244 |
\else |
| 245 |
\ifnum #1=3 |
| 246 |
\@tempcnta=49 |
| 247 |
\else |
| 248 |
\@tempcnta=58 |
| 249 |
\fi |
| 250 |
\fi |
| 251 |
\or |
| 252 |
\ifnum #1<3 |
| 253 |
\@tempcnta=#1\relax |
| 254 |
\multiply\@tempcnta 24 |
| 255 |
\advance\@tempcnta -3 |
| 256 |
\else |
| 257 |
\@tempcnta=51 |
| 258 |
\fi |
| 259 |
\or |
| 260 |
\@tempcnta=#1\relax |
| 261 |
\multiply\@tempcnta \sixt@@n |
| 262 |
\advance\@tempcnta -\tw@ |
| 263 |
\else |
| 264 |
\@tempcnta=#1\relax |
| 265 |
\multiply\@tempcnta \sixt@@n |
| 266 |
\advance\@tempcnta 7 |
| 267 |
\fi |
| 268 |
\ifnum #2<0 |
| 269 |
\advance\@tempcnta 64 |
| 270 |
\fi |
| 271 |
\char\@tempcnta} |
| 272 |
|
| 273 |
\def\@vline{% |
| 274 |
\ifnum \@yarg <0 |
| 275 |
\@downline |
| 276 |
\else |
| 277 |
\@upline |
| 278 |
\fi} |
| 279 |
|
| 280 |
\def\@upline{% |
| 281 |
\hbox to \z@{% |
| 282 |
\hskip -\@halfwidth |
| 283 |
\vrule \@width \@wholewidth \@height \@linelen \@depth \z@\hss}} |
| 284 |
|
| 285 |
\def\@downline{% |
| 286 |
\hbox to \z@{% |
| 287 |
\hskip -\@halfwidth |
| 288 |
\vrule \@width \@wholewidth \@height \z@ \@depth \@linelen \hss}} |
| 289 |
|
| 290 |
\def\@upvector{% |
| 291 |
\@upline |
| 292 |
\setbox\@tempboxa\hbox{% |
| 293 |
\@linefnt\char'66}% |
| 294 |
\raise \@linelen \hbox to\z@{\lower \ht\@tempboxa\box\@tempboxa\hss}} |
| 295 |
|
| 296 |
\def\@downvector{% |
| 297 |
\@downline |
| 298 |
\lower \@linelen \hbox to \z@{\@linefnt\char'77\hss}} |
| 299 |
|
| 300 |
|
| 301 |
\newif\if@ovt |
| 302 |
\newif\if@ovb |
| 303 |
\newif\if@ovl |
| 304 |
\newif\if@ovr |
| 305 |
\newdimen\@ovxx |
| 306 |
\newdimen\@ovyy |
| 307 |
\newdimen\@ovdx |
| 308 |
\newdimen\@ovdy |
| 309 |
\newdimen\@ovro |
| 310 |
\newdimen\@ovri |
| 311 |
|
| 312 |
\def\@getcirc#1{% |
| 313 |
\@tempdima #1\relax |
| 314 |
\@tempcnta\@tempdima |
| 315 |
\@tempdima 4pt\relax |
| 316 |
\divide\@tempcnta\@tempdima |
| 317 |
\ifnum \@tempcnta > 10\relax |
| 318 |
\@tempcnta 10\relax |
| 319 |
\fi |
| 320 |
\ifnum \@tempcnta >\z@ |
| 321 |
\advance\@tempcnta \m@ne |
| 322 |
\else |
| 323 |
\!@warning{Oval too small}% |
| 324 |
\fi |
| 325 |
\multiply\@tempcnta 4\relax |
| 326 |
\setbox \@tempboxa \hbox{\@circlefnt \char \@tempcnta}% |
| 327 |
\@tempdima \wd \@tempboxa} |
| 328 |
|
| 329 |
\def\@put#1#2#3{% |
| 330 |
\raise #2\hbox to \z@{\hskip #1#3\hss}} |
| 331 |
|
| 332 |
\def\oval(#1,#2){% |
| 333 |
\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[]}} |
| 334 |
|
| 335 |
\def\@oval(#1,#2)[#3]{% |
| 336 |
\begingroup |
| 337 |
\boxmaxdepth \maxdimen |
| 338 |
\@ovttrue \@ovbtrue \@ovltrue \@ovrtrue |
| 339 |
\@tfor\@tempa :=#3\do{% |
| 340 |
\csname @ov\@tempa false\endcsname}% |
| 341 |
\@ovxx #1\unitlength |
| 342 |
\@ovyy #2\unitlength |
| 343 |
\@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi |
| 344 |
\@getcirc \@tempdimb |
| 345 |
\@ovro \ht\@tempboxa |
| 346 |
\@ovri \dp\@tempboxa |
| 347 |
\@ovdx\@ovxx |
| 348 |
\advance\@ovdx -\@tempdima |
| 349 |
\divide\@ovdx \tw@ |
| 350 |
\@ovdy\@ovyy |
| 351 |
\advance\@ovdy -\@tempdima |
| 352 |
\divide\@ovdy \tw@ |
| 353 |
\@circlefnt |
| 354 |
\setbox\@tempboxa \hbox{% |
| 355 |
\if@ovr |
| 356 |
\@ovvert32\kern -\@tempdima |
| 357 |
\fi |
| 358 |
\if@ovl |
| 359 |
\kern \@ovxx |
| 360 |
\@ovvert01\kern -\@tempdima |
| 361 |
\kern -\@ovxx |
| 362 |
\fi |
| 363 |
\if@ovt |
| 364 |
\@ovhorz \kern -\@ovxx |
| 365 |
\fi |
| 366 |
\if@ovb |
| 367 |
\raise \@ovyy \@ovhorz |
| 368 |
\fi}% |
| 369 |
\advance\@ovdx\@ovro |
| 370 |
\advance\@ovdy\@ovro |
| 371 |
\ht\@tempboxa\z@ |
| 372 |
\dp\@tempboxa\z@ |
| 373 |
\@put{-\@ovdx}{-\@ovdy}{\box\@tempboxa}% |
| 374 |
\endgroup} |
| 375 |
|
| 376 |
\def\@ovvert#1#2{% |
| 377 |
\vbox to \@ovyy{% |
| 378 |
\if@ovb |
| 379 |
\@tempcntb \@tempcnta |
| 380 |
\advance \@tempcntb by #1\relax |
| 381 |
\kern -\@ovro |
| 382 |
\hbox{\char \@tempcntb}% |
| 383 |
\nointerlineskip |
| 384 |
\else |
| 385 |
\kern \@ovri |
| 386 |
\kern \@ovdy |
| 387 |
\fi |
| 388 |
\leaders\vrule width \@wholewidth\vfil |
| 389 |
\nointerlineskip |
| 390 |
\if@ovt |
| 391 |
\@tempcntb \@tempcnta |
| 392 |
\advance \@tempcntb by #2\relax |
| 393 |
\hbox{\char \@tempcntb}% |
| 394 |
\else |
| 395 |
\kern \@ovdy |
| 396 |
\kern \@ovro |
| 397 |
\fi}} |
| 398 |
|
| 399 |
\def\@ovhorz{% |
| 400 |
\hbox to \@ovxx{% |
| 401 |
\kern \@ovro |
| 402 |
\if@ovr |
| 403 |
\else |
| 404 |
\kern \@ovdx |
| 405 |
\fi |
| 406 |
\leaders \hrule height \@wholewidth \hfil |
| 407 |
\if@ovl |
| 408 |
\else |
| 409 |
\kern \@ovdx |
| 410 |
\fi |
| 411 |
\kern \@ovri}} |
| 412 |
|
| 413 |
\def\circle{% |
| 414 |
\@ifstar{\@dot}{\@circle}} |
| 415 |
\def\@circle#1{% |
| 416 |
\begingroup |
| 417 |
\boxmaxdepth \maxdimen |
| 418 |
\@tempdimb #1\unitlength |
| 419 |
\ifdim \@tempdimb >15.5pt\relax |
| 420 |
\@getcirc\@tempdimb |
| 421 |
\@ovro\ht\@tempboxa |
| 422 |
\setbox\@tempboxa\hbox{% |
| 423 |
\@circlefnt |
| 424 |
\advance\@tempcnta\tw@ |
| 425 |
\char \@tempcnta |
| 426 |
\advance\@tempcnta\m@ne |
| 427 |
\char \@tempcnta |
| 428 |
\kern -2\@tempdima |
| 429 |
\advance\@tempcnta\tw@ |
| 430 |
\raise \@tempdima \hbox{\char\@tempcnta}% |
| 431 |
\raise \@tempdima \box\@tempboxa}% |
| 432 |
\ht\@tempboxa\z@ |
| 433 |
\dp\@tempboxa\z@ |
| 434 |
\@put{-\@ovro}{-\@ovro}{\box\@tempboxa}% |
| 435 |
\else |
| 436 |
\@circ\@tempdimb{96}% |
| 437 |
\fi |
| 438 |
\endgroup} |
| 439 |
|
| 440 |
\def\@dot#1{% |
| 441 |
\@tempdimb #1\unitlength |
| 442 |
\@circ\@tempdimb{112}} |
| 443 |
|
| 444 |
\def\@circ#1#2{% |
| 445 |
\@tempdima #1\relax |
| 446 |
\advance\@tempdima .5pt\relax |
| 447 |
\@tempcnta\@tempdima |
| 448 |
\@tempdima 1pt\relax |
| 449 |
\divide\@tempcnta\@tempdima |
| 450 |
\ifnum\@tempcnta > 15\relax |
| 451 |
\@tempcnta 15\relax \fi |
| 452 |
\ifnum |
| 453 |
\@tempcnta >\z@ |
| 454 |
\advance\@tempcnta\m@ne |
| 455 |
\fi |
| 456 |
\advance\@tempcnta #2\relax |
| 457 |
\@circlefnt |
| 458 |
\char\@tempcnta} |
| 459 |
|
| 460 |
\thinlines |
| 461 |
|
| 462 |
\newcount\@xarg |
| 463 |
\newcount\@yarg |
| 464 |
\newcount\@yyarg |
| 465 |
\newcount\@multicnt |
| 466 |
\newdimen\@xdim |
| 467 |
\newdimen\@ydim |
| 468 |
\newbox\@linechar |
| 469 |
\newdimen\@linelen |
| 470 |
\newdimen\@clnwd |
| 471 |
\newdimen\@clnht |
| 472 |
|
| 473 |
% That's the end of the definitions of lines/vectors/circles/ovals. |
| 474 |
|
| 475 |
|
| 476 |
% Save LaTeX's meaning of \line |
| 477 |
\let\!latexline=\line |
| 478 |
|
| 479 |
% Set variable meaning of line |
| 480 |
\def\line{\!ifnextchar(\!latexline\!texline} |
| 481 |
|
| 482 |
\catcode`@=12 \catcode`!=12 |