| 1 |
% |
| 2 |
% see pstricks.tex for license and copyright |
| 3 |
% |
| 4 |
\newif\ifpsmathbox |
| 5 |
\psmathboxtrue |
| 6 |
\def\pst@mathflag{\z@} |
| 7 |
\newtoks\everypsbox |
| 8 |
\let\pst@thisbox\relax |
| 9 |
% |
| 10 |
\long\def\pst@makenotverbbox#1#2{% |
| 11 |
\edef\pst@mathflag{% |
| 12 |
\ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else\z@\fi\else\z@\fi}% |
| 13 |
\setbox\pst@hbox=\hbox{% |
| 14 |
\ifcase\pst@mathflag\or$\m@th\textstyle\or$\m@th\displaystyle\fi% |
| 15 |
{\pst@thisbox\the\everypsbox#2}% |
| 16 |
\ifnum\pst@mathflag>\z@$\fi% $ |
| 17 |
}% |
| 18 |
#1} |
| 19 |
% |
| 20 |
\def\pst@makeverbbox#1{% |
| 21 |
\def\pst@afterbox{#1}% |
| 22 |
\edef\pst@mathflag{\ifpsmathbox\ifmmode\ifinner1\else2\fi\else\z@\fi\else\z@\fi}% |
| 23 |
\afterassignment\pst@beginbox% |
| 24 |
\setbox\pst@hbox\hbox% |
| 25 |
} |
| 26 |
\def\pst@beginbox{% |
| 27 |
\ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi% |
| 28 |
\bgroup\aftergroup\pst@endbox% |
| 29 |
\pst@thisbox% |
| 30 |
\the\everypsbox% |
| 31 |
} |
| 32 |
\def\pst@endbox{% |
| 33 |
\ifnum\pst@mathflag>\z@\relax$\fi% $ |
| 34 |
\egroup% |
| 35 |
\pst@afterbox% |
| 36 |
} |
| 37 |
\def\pst@makebox{\pst@@makebox} |
| 38 |
\def\psverbboxtrue{\def\pst@@makebox{\pst@makeverbbox}} |
| 39 |
\def\psverbboxfalse{\def\pst@@makebox{\pst@makenotverbbox}} |
| 40 |
\psverbboxfalse |
| 41 |
\def\pst@longbox{% |
| 42 |
\def\pst@makebox{% |
| 43 |
\gdef\pst@makebox{\pst@@makebox}% |
| 44 |
\pst@makelongbox% |
| 45 |
}% |
| 46 |
} |
| 47 |
\def\pst@makelongbox#1{% |
| 48 |
\def\pst@afterbox{#1}% |
| 49 |
\edef\pst@mathflag{% |
| 50 |
\ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi% |
| 51 |
}% |
| 52 |
\setbox\pst@hbox\hbox\bgroup |
| 53 |
\aftergroup\pst@afterbox |
| 54 |
\ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi |
| 55 |
\begingroup |
| 56 |
\pst@thisbox |
| 57 |
\the\everypsbox% |
| 58 |
} |
| 59 |
\def\pst@endlongbox{% |
| 60 |
\endgroup |
| 61 |
\ifnum\pst@mathflag>\z@$\fi %$ |
| 62 |
\egroup% |
| 63 |
} |
| 64 |
\def\pslongbox#1#2{% |
| 65 |
\@namedef{#1}{\pst@longbox#2}% |
| 66 |
\@namedef{end#1}{\pst@endlongbox}} |
| 67 |
% |
| 68 |
\newdimen\psframesep |
| 69 |
\define@key[psset]{pstricks}{framesep}[3pt]{\pssetlength\psframesep{#1}} |
| 70 |
\psset[pstricks]{framesep=3pt} |
| 71 |
% |
| 72 |
\define@boolkey[psset]{pstricks}[ps]{boxsep}[true]{} |
| 73 |
\psset[pstricks]{boxsep} |
| 74 |
% |
| 75 |
\def\pst@useboxpar{% |
| 76 |
\use@par |
| 77 |
\if@star |
| 78 |
\let\pslinecolor\psfillcolor |
| 79 |
\solid@star |
| 80 |
\let\solid@star\relax |
| 81 |
\fi |
| 82 |
\ifpsdoubleline \pst@setdoublesep \fi} |
| 83 |
% |
| 84 |
\def\psframebox{\def\pst@par{}\pst@object{psframebox}} |
| 85 |
\def\psframebox@i{\pst@makebox\psframebox@ii} |
| 86 |
\def\psframebox@ii{% |
| 87 |
\begingroup |
| 88 |
\pst@useboxpar |
| 89 |
\pst@dima=\pslinewidth |
| 90 |
\advance\pst@dima by \psframesep |
| 91 |
\pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima |
| 92 |
\pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima |
| 93 |
\pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima |
| 94 |
\setbox\pst@hbox=\hbox{% |
| 95 |
\ifpsboxsep\kern\pst@dima\fi |
| 96 |
\begin@ClosedObj |
| 97 |
\addto@pscode{% |
| 98 |
\psk@cornersize % arcradius boolean |
| 99 |
\pst@number\pst@dima neg |
| 100 |
\pst@number\pst@dimb neg |
| 101 |
\pst@number\pst@dimc |
| 102 |
\pst@number\pst@dimd |
| 103 |
.5 |
| 104 |
\tx@Frame% |
| 105 |
}% |
| 106 |
\def\pst@linetype{2}% |
| 107 |
\showpointsfalse |
| 108 |
\end@ClosedObj |
| 109 |
\box\pst@hbox |
| 110 |
\ifpsboxsep\kern\pst@dima\fi% |
| 111 |
}% |
| 112 |
\ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi |
| 113 |
\leavevmode\box\pst@hbox |
| 114 |
\endgroup} |
| 115 |
% |
| 116 |
\def\psdblframebox{\def\pst@par{}\pst@object{psdblframebox}} |
| 117 |
\def\psdblframebox@i{\addto@par{doubleline=true}\psframebox@i} |
| 118 |
% |
| 119 |
\define@key[psset]{pstricks}{clipcommand}[clip]{\def\pst@clipcommand{#1 }} |
| 120 |
\psset[pstricks]{clipcommand=clip}% alternative is eoclip |
| 121 |
% |
| 122 |
\def\psclip{\@ifnextchar[\psclip@i{\psclip@i[]}}% |
| 123 |
\def\psclip@i[#1]#2{% |
| 124 |
\leavevmode% |
| 125 |
\begingroup% |
| 126 |
\ifx\relax#1\relax\else\psset{#1}\fi% |
| 127 |
\begin@psclip% |
| 128 |
\begingroup% |
| 129 |
\def\use@pscode{% |
| 130 |
\pstVerb{ |
| 131 |
\pst@dict |
| 132 |
/mtrxc CM def |
| 133 |
CP CP T |
| 134 |
\tx@STV |
| 135 |
\psk@origin |
| 136 |
\psk@swapaxes |
| 137 |
newpath |
| 138 |
\pst@code |
| 139 |
\pst@clipcommand |
| 140 |
newpath |
| 141 |
mtrxc setmatrix |
| 142 |
moveto |
| 143 |
0 setgray |
| 144 |
end |
| 145 |
}% |
| 146 |
\gdef\pst@code{}}% |
| 147 |
\def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}% |
| 148 |
\def\nc@object##1##2##3##4{\pst@misplaced{node connection}}% |
| 149 |
\hbox to\z@{#2}% |
| 150 |
\endgroup% |
| 151 |
\def\endpsclip{% |
| 152 |
\end@psclip% |
| 153 |
\endgroup}% |
| 154 |
\ignorespaces} |
| 155 |
% |
| 156 |
\def\endpsclip{\pst@misplaced\endpsclip} |
| 157 |
\let\begin@psclip\relax |
| 158 |
\def\end@psclip{\pstVerb{currentpoint initclip moveto}} |
| 159 |
% |
| 160 |
\def\AltClipMode{% |
| 161 |
\def\end@psclip{\pstVerb{\pst@grestore}}% |
| 162 |
\def\begin@psclip{\pstVerb{gsave}}} |
| 163 |
|
| 164 |
\ifPSTlualatex |
| 165 |
\AltClipMode |
| 166 |
\fi |
| 167 |
|
| 168 |
\def\psclipbox{\@ifnextchar[{\psclipbox@}{\psclipbox@[\z@]}} |
| 169 |
% DG modification begin - Apr. 3, 1997 |
| 170 |
% From [email protected] (Dietrich Paulus) |
| 171 |
%\def\clipbox@[#1]{\pst@makebox\clipbox@@{#1}} |
| 172 |
\def\psclipbox@[#1]{\pst@makebox{\psclipbox@@{#1}}} |
| 173 |
% DG modification end |
| 174 |
\def\psclipbox@@#1{% |
| 175 |
\pssetlength\pst@dimg{#1}% |
| 176 |
\leavevmode\hbox{% |
| 177 |
\begin@psclip% |
| 178 |
\pst@Verb{ |
| 179 |
CM \tx@STV CP T newpath |
| 180 |
/a \pst@number\pst@dimg def |
| 181 |
/w \pst@number{\wd\pst@hbox}a add def |
| 182 |
/d \pst@number{\dp\pst@hbox}a add neg def |
| 183 |
/h \pst@number{\ht\pst@hbox}a add def |
| 184 |
a neg d moveto |
| 185 |
a neg h L |
| 186 |
w h L |
| 187 |
w d L |
| 188 |
closepath |
| 189 |
\pst@clipcommand |
| 190 |
newpath |
| 191 |
0 0 moveto |
| 192 |
setmatrix}% |
| 193 |
\unhbox\pst@hbox% |
| 194 |
\end@psclip}} |
| 195 |
% |
| 196 |
\def\psshadowbox{\def\pst@par{}\pst@object{psshadowbox}} |
| 197 |
\def\psshadowbox@i{\pst@makebox\psshadowbox@ii} |
| 198 |
\def\psshadowbox@ii{% |
| 199 |
\begingroup |
| 200 |
\pst@useboxpar |
| 201 |
\psshadowtrue |
| 202 |
\psboxseptrue |
| 203 |
\def\psk@shadowangle{-45 }% |
| 204 |
\setbox\pst@hbox=\hbox{\psframebox@ii}% |
| 205 |
\pst@dimh=\psk@shadowsize\p@ |
| 206 |
\pst@dimh=.7071\pst@dimh |
| 207 |
\pst@dimg=\dp\pst@hbox |
| 208 |
\advance\pst@dimg\pst@dimh |
| 209 |
\dp\pst@hbox=\pst@dimg |
| 210 |
\pst@dimg=\wd\pst@hbox |
| 211 |
\advance\pst@dimg\pst@dimh |
| 212 |
\wd\pst@hbox=\pst@dimg |
| 213 |
\leavevmode |
| 214 |
\box\pst@hbox |
| 215 |
\endgroup} |
| 216 |
% |
| 217 |
\def\pscirclebox{\pst@object{pscirclebox}} |
| 218 |
\def\pscirclebox@i{\pst@makebox\pscirclebox@ii} |
| 219 |
\def\pscirclebox@ii{% |
| 220 |
\begingroup |
| 221 |
\pst@useboxpar |
| 222 |
\setbox\pst@hbox=\hbox{% |
| 223 |
\pst@nodehook |
| 224 |
\pscirclebox@iii |
| 225 |
\box\pst@hbox}% |
| 226 |
\ifpsboxsep\pscirclebox@sep\fi |
| 227 |
\leavevmode |
| 228 |
\box\pst@hbox |
| 229 |
\endgroup |
| 230 |
\ignorespaces |
| 231 |
} |
| 232 |
\def\pscirclebox@iii{% |
| 233 |
\if@star |
| 234 |
\pslinewidth\z@ |
| 235 |
\pstverb{\pst@dict \tx@STP \pst@usecolor\psfillcolor |
| 236 |
newpath \pscirclebox@iv \tx@SD end}% |
| 237 |
\else |
| 238 |
\begin@ClosedObj |
| 239 |
\def\pst@linetype{4}\showpointsfalse |
| 240 |
\addto@pscode{ \pscirclebox@iv\space CLW 2 div add 0 360 arc closepath}% |
| 241 |
\end@ClosedObj |
| 242 |
\fi |
| 243 |
} |
| 244 |
% |
| 245 |
\def\pscirclebox@iv{ |
| 246 |
\pst@number{\wd\pst@hbox} 2 div |
| 247 |
\pst@number{\ht\pst@hbox} \pst@number{\dp\pst@hbox} add 2 div |
| 248 |
2 copy \pst@number{\dp\pst@hbox} sub 4 2 roll |
| 249 |
\tx@Pyth \pst@number\psframesep add } |
| 250 |
% |
| 251 |
\def\pscirclebox@sep{% |
| 252 |
\pst@dimn=\ht\pst@hbox% % the height of the box |
| 253 |
\advance\pst@dimn by \dp\pst@hbox% % the depth of the box added to \pst@dimn |
| 254 |
\divide\pst@dimn by 2% % \pst@dimn/2 |
| 255 |
\pst@dimm=0.5\wd\pst@hbox% % the half of the width |
| 256 |
\pst@Pyth\pst@dimm\pst@dimn\pst@dimo% % the diameter |
| 257 |
\advance\pst@dimo by \pslinewidth% |
| 258 |
\advance\pst@dimo by \psframesep% |
| 259 |
\advance\pst@dimn by -\pst@dimo% |
| 260 |
\setbox\pst@hbox=\hbox to 2\pst@dimo{\hss\vbox{\kern-\pst@dimn\box\pst@hbox}\hss}% |
| 261 |
\advance\pst@dimn by -\dp\pst@hbox% |
| 262 |
\dp\pst@hbox=-\pst@dimn} |
| 263 |
% |
| 264 |
\let\pst@nodehook\relax |
| 265 |
% |
| 266 |
\def\psCirclebox{\def\pst@par{}\pst@object{psCirclebox}} |
| 267 |
\def\psCirclebox@i{\pst@makebox\psCirclebox@ii} |
| 268 |
\def\psCirclebox@ii{% |
| 269 |
\begingroup |
| 270 |
\pst@useboxpar |
| 271 |
\pst@dima=\ht\pst@hbox |
| 272 |
\advance\pst@dima by -\dp\pst@hbox |
| 273 |
\divide\pst@dima\tw@ |
| 274 |
\pssetlength\pst@dimb\psk@radius |
| 275 |
\setbox\pst@hbox=\hbox{% |
| 276 |
\pst@nodehook |
| 277 |
\pscircle(.5\wd\pst@hbox,\pst@dima){\pst@dimb}% |
| 278 |
\box\pst@hbox}% |
| 279 |
\ifpsboxsep \psCirclebox@sep \fi |
| 280 |
\leavevmode |
| 281 |
\box\pst@hbox |
| 282 |
\endgroup |
| 283 |
} |
| 284 |
% |
| 285 |
\def\psCirclebox@sep{% |
| 286 |
\pst@dimc=\pst@dimb |
| 287 |
\advance\pst@dimb-\pst@dima |
| 288 |
\advance\pst@dima\pst@dimc |
| 289 |
\setbox\pst@hbox=\hbox to\tw@\pst@dimc{% |
| 290 |
\hss\vrule width \z@ depth \pst@dimb height \pst@dima |
| 291 |
\box\pst@hbox\hss}} |
| 292 |
% |
| 293 |
\def\psovalbox{\def\pst@par{}\pst@object{psovalbox}} |
| 294 |
\def\psovalbox@i{\pst@makebox{\psovalbox@ii}} |
| 295 |
\def\psovalbox@ii{% |
| 296 |
\begingroup |
| 297 |
\pst@useboxpar |
| 298 |
\psovalbox@iii |
| 299 |
\ifpsboxsep\psovalbox@sep\fi |
| 300 |
\leavevmode |
| 301 |
\box\pst@hbox |
| 302 |
\endgroup} |
| 303 |
% |
| 304 |
\def\psovalbox@iii{% |
| 305 |
\psovalbox@iv |
| 306 |
\setbox\pst@hbox=\hbox{% |
| 307 |
\begin@ClosedObj |
| 308 |
\addto@pscode{% |
| 309 |
0 360 |
| 310 |
\pst@number\pst@dimc CLW 2 div sub |
| 311 |
\pst@number\pst@dimd CLW 2 div sub |
| 312 |
\pst@number\pst@dima |
| 313 |
\pst@number\pst@dimb |
| 314 |
\tx@Ellipse |
| 315 |
closepath }% |
| 316 |
\def\pst@linetype{2}% |
| 317 |
\end@ClosedObj |
| 318 |
\unhbox\pst@hbox}} |
| 319 |
% |
| 320 |
\def\psovalbox@iv{% |
| 321 |
\pst@dimc=\pslinewidth\advance\pst@dimc\psframesep |
| 322 |
\pst@dimd=\ht\pst@hbox\advance\pst@dimd\dp\pst@hbox |
| 323 |
\pst@dima=.5\wd\pst@hbox |
| 324 |
\pst@dimb=.5\pst@dimd\advance\pst@dimb-\dp\pst@hbox |
| 325 |
\pst@dimd=.707\pst@dimd |
| 326 |
\advance\pst@dimd\pst@dimc |
| 327 |
\advance\[email protected]\wd\pst@hbox} |
| 328 |
% |
| 329 |
\def\psovalbox@sep{% |
| 330 |
\setbox\pst@hbox\hbox to 2\pst@dimc{\hss\unhbox\pst@hbox\hss}% |
| 331 |
\pst@dimg=\pst@dimd |
| 332 |
\advance\pst@dimg-\pst@dimb |
| 333 |
\dp\pst@hbox=\pst@dimg |
| 334 |
\advance\pst@dimd\pst@dimb |
| 335 |
\ht\pst@hbox=\pst@dimd} |
| 336 |
% |
| 337 |
\def\psdiabox{\def\pst@par{}\pst@object{psdiabox}} |
| 338 |
\def\psdiabox@i{\pst@makebox{\psdiabox@ii}} |
| 339 |
\def\psdiabox@ii{% |
| 340 |
\begingroup |
| 341 |
\pst@useboxpar |
| 342 |
\psdiabox@iii |
| 343 |
\ifpsboxsep\psdiabox@sep\fi |
| 344 |
\leavevmode |
| 345 |
\box\pst@hbox |
| 346 |
\endgroup} |
| 347 |
\def\psdiabox@iv{% |
| 348 |
\pst@dimg=.707\pslinewidth |
| 349 |
\advance\[email protected]\psframesep |
| 350 |
\pst@dima=\wd\pst@hbox |
| 351 |
\divide\pst@dima 2 |
| 352 |
\pst@dimc=\pst@dima |
| 353 |
\advance\pst@dimc\pst@dimg |
| 354 |
\pst@dimd=\ht\pst@hbox |
| 355 |
\advance\pst@dimd\dp\pst@hbox |
| 356 |
\divide\pst@dimd 2 |
| 357 |
\pst@dimb=\pst@dimd |
| 358 |
\advance\pst@dimb-\dp\pst@hbox |
| 359 |
\advance\pst@dimd\pst@dimg} |
| 360 |
\def\psdiabox@iii{% |
| 361 |
\psdiabox@iv |
| 362 |
\setbox\pst@hbox=\hbox{% |
| 363 |
\begin@ClosedObj |
| 364 |
\addto@pscode{% |
| 365 |
\psline@iii |
| 366 |
pop |
| 367 |
.5 |
| 368 |
\pst@number\pst@dimc 2 mul \pst@number\pst@dimd 2 mul |
| 369 |
0 |
| 370 |
\pst@number\pst@dima \pst@number\pst@dimb |
| 371 |
\tx@Diamond}% |
| 372 |
\def\pst@linetype{4}% |
| 373 |
\end@ClosedObj |
| 374 |
\box\pst@hbox}} |
| 375 |
\def\psdiabox@sep{% |
| 376 |
\setbox\pst@hbox\hbox to 4\pst@dimc{\hss\unhbox\pst@hbox\hss}% |
| 377 |
\multiply\pst@dimd 2 |
| 378 |
\advance\pst@dimd\pst@dimb |
| 379 |
\ht\pst@hbox\pst@dimd |
| 380 |
\advance\pst@dimd-2\pst@dimb |
| 381 |
\dp\pst@hbox\pst@dimd} |
| 382 |
% |
| 383 |
\define@key[psset]{pstricks}{trimode}[U]{\pst@expandafter\psset@@trimode{#1}\@empty\@empty\@nil} |
| 384 |
\def\psset@@trimode#1#2#3\@nil{% |
| 385 |
\let\pst@tempg#1\relax |
| 386 |
\ifx\pst@tempg* |
| 387 |
\let\psk@@trimode\@empty |
| 388 |
\let\pst@tempg#2\relax |
| 389 |
\else |
| 390 |
\let\psk@@trimode\relax |
| 391 |
\fi |
| 392 |
\edef\psk@trimode{% |
| 393 |
\ifx R\pst@tempg 1 % Right |
| 394 |
\else |
| 395 |
\ifx D\pst@tempg 2 % Down |
| 396 |
\else |
| 397 |
\ifx L\pst@tempg 3 % Left |
| 398 |
\else |
| 399 |
\ifx l\pst@tempg 4 % |_ |
| 400 |
\else |
| 401 |
\ifx r\pst@tempg 5 % _| |
| 402 |
\else 0 \fi % Up |
| 403 |
\fi |
| 404 |
\fi |
| 405 |
\fi |
| 406 |
\fi}% |
| 407 |
} |
| 408 |
\psset[pstricks]{trimode=U} |
| 409 |
% |
| 410 |
\def\pstribox{\pst@object{pstribox}} |
| 411 |
\def\pstribox@i{\pst@makebox{\pstribox@ii}} |
| 412 |
\def\pstribox@ii{% |
| 413 |
\begingroup |
| 414 |
\pst@useboxpar |
| 415 |
\pstribox@iii |
| 416 |
\ifpsboxsep\pstribox@sep\fi |
| 417 |
\leavevmode |
| 418 |
\box\pst@hbox |
| 419 |
\endgroup} |
| 420 |
% |
| 421 |
\def\pstribox@iii{% |
| 422 |
\pstribox@iv |
| 423 |
\setbox\pst@hbox=\hbox{% |
| 424 |
\begin@ClosedObj |
| 425 |
\addto@pscode{ |
| 426 |
\psline@iii |
| 427 |
pop |
| 428 |
0.5 |
| 429 |
\pst@number\pst@dimc % Width |
| 430 |
\pst@number\pst@dimd % Height |
| 431 |
\ifcase\psk@trimode |
| 432 |
\or %% 0 |
| 433 |
exch \or %% 1 |
| 434 |
\or %% 2 |
| 435 |
exch \or %% 3 |
| 436 |
\or %% 4 |
| 437 |
\or %% 5 |
| 438 |
\fi |
| 439 |
\psk@trimode -90 mul |
| 440 |
\pst@number\pst@dima % x coor for text |
| 441 |
\pst@number\pst@dimb % y coor for text |
| 442 |
\tx@Triangle}% |
| 443 |
\def\pst@linetype{2}% |
| 444 |
\end@ClosedObj |
| 445 |
\box\pst@hbox}% |
| 446 |
} |
| 447 |
% |
| 448 |
\def\pstribox@iv{% |
| 449 |
\pst@dimh=\pslinewidth |
| 450 |
\advance\pst@dimh\psframesep |
| 451 |
\pst@dimg=\ht\pst@hbox |
| 452 |
\advance\pst@dimg-\dp\pst@hbox % totalheight |
| 453 |
\divide\pst@dimg 2 % 0.5 totalheight |
| 454 |
\edef\pst@tempa{\number\pst@dimg sp}% % For use by nodes. |
| 455 |
\ifodd\psk@trimode % |
| 456 |
\pst@dimb\pst@dimg |
| 457 |
\else |
| 458 |
\pst@dima=\wd\pst@hbox |
| 459 |
\divide\pst@dima 2 |
| 460 |
\fi |
| 461 |
\ifcase\psk@trimode |
| 462 |
\pst@dimb=-\dp\pst@hbox |
| 463 |
\advance\pst@dimb-\pst@dimh |
| 464 |
\or\pst@dima=-\pst@dimh |
| 465 |
\or\pst@dimb=\ht\pst@hbox |
| 466 |
\advance\pst@dimb\pst@dimh |
| 467 |
\or\pst@dima=\wd\pst@hbox |
| 468 |
\advance\pst@dima\pst@dimh |
| 469 |
\fi |
| 470 |
\pst@dimd=\dp\pst@hbox |
| 471 |
\advance\pst@dimd\ht\pst@hbox |
| 472 |
\ifx\psk@@trimode\relax% no star for trimode= |
| 473 |
\pst@dimc=\wd\pst@hbox |
| 474 |
\advance\pst@dimc\ifodd\psk@trimode 1.447\else 1.789\fi\pst@dimh |
| 475 |
\multiply\pst@dimc 2 |
| 476 |
\advance\pst@dimd\ifodd\psk@trimode 1.789\else 1.447\fi\pst@dimh |
| 477 |
\multiply\pst@dimd 2 |
| 478 |
\else% trimode=R*,L*,U*,D* |
| 479 |
\ifodd\psk@trimode |
| 480 |
\advance\pst@dimd 1.1547\wd\pst@hbox |
| 481 |
\advance\pst@dimd 3.4641\pst@dimh |
| 482 |
\pst@dimc=.866\pst@dimd |
| 483 |
\else |
| 484 |
\advance\pst@dimd .866\wd\pst@hbox %.866=(sqrt(3)/2) |
| 485 |
\advance\pst@dimd 3\pst@dimh |
| 486 |
\pst@dimc=1.1547\pst@dimd % 1.1547=(2/sqrt(3)) |
| 487 |
\fi |
| 488 |
\fi} |
| 489 |
% |
| 490 |
\def\pstribox@sep{% |
| 491 |
\ifodd\psk@trimode |
| 492 |
\advance\[email protected]\pst@dimd |
| 493 |
\ht\pst@hbox=\pst@dimb |
| 494 |
\advance\pst@dimd-\pst@dimb |
| 495 |
\dp\pst@hbox=\pst@dimd |
| 496 |
\else |
| 497 |
\setbox\pst@hbox\hbox to \pst@dimc{\hss\unhbox\pst@hbox\hss}% |
| 498 |
\global\pst@dimg=.5\pst@dimc |
| 499 |
\fi |
| 500 |
\ifcase\psk@trimode |
| 501 |
\dp\pst@hbox-\pst@dimb |
| 502 |
\advance\pst@dimd\pst@dimb |
| 503 |
\ht\pst@hbox\pst@dimd |
| 504 |
\or |
| 505 |
\pst@dimg=.5\wd\pst@hbox |
| 506 |
\global\advance\pst@dimg-\pst@dima |
| 507 |
\setbox\pst@hbox\hbox to \pst@dimc{\kern-\pst@dima\box\pst@hbox\hss}% |
| 508 |
\or |
| 509 |
\ht\pst@hbox\pst@dimb |
| 510 |
\advance\pst@dimd-\pst@dimb |
| 511 |
\dp\pst@hbox\pst@dimd |
| 512 |
\or |
| 513 |
\pst@dimg=\pst@dimc |
| 514 |
\advance\pst@dimg-\pst@dima |
| 515 |
\global\advance\[email protected]\wd\pst@hbox |
| 516 |
\setbox\pst@hbox\hbox to \pst@dimc{% |
| 517 |
\hss\box\pst@hbox\kern\psframesep\kern\pslinewidth}% |
| 518 |
\fi} |
| 519 |
% |
| 520 |
\def\pst@starbox{% |
| 521 |
\setbox\pst@hbox\hbox{\psframebox*[boxsep=false]{\unhbox\pst@hbox}}} |
| 522 |
\def\pst@@makesmall#1{% |
| 523 |
\setbox#1=\hbox to\z@{\hss\vbox to \z@{\vss\box#1\vss}\hss}} |
| 524 |
\def\pst@@@makesmall#1{% |
| 525 |
\pst@dimh=\psk@xref\wd#1% |
| 526 |
\ifx\psk@yref\relax |
| 527 |
\pst@dimg=\dp#1% |
| 528 |
\else |
| 529 |
\pst@dimg=\psk@yref\ht#1% |
| 530 |
\advance\pst@dimg\psk@yref\dp#1% |
| 531 |
\fi |
| 532 |
\setbox#1=\hbox to\z@{% |
| 533 |
\kern-\pst@dimh\vbox to\z@{\vss\box#1\kern-\pst@dimg}\hss}} |
| 534 |
% |
| 535 |
\def\psscalebox#1{\pst@makebox{\ps@scalebox{#1}}} |
| 536 |
\def\ps@scalebox#1{% |
| 537 |
\begingroup% |
| 538 |
\pst@getscale{#1}\pst@tempa% |
| 539 |
\let\pst@tempc\pst@tempg% |
| 540 |
\let\pst@tempd\pst@temph% |
| 541 |
\ps@@scalebox% |
| 542 |
\endgroup} |
| 543 |
\def\ps@@scalebox{% |
| 544 |
\leavevmode% |
| 545 |
\hbox{% |
| 546 |
\ifdim\pst@tempd\p@<\z@% |
| 547 |
\pst@dimg=\pst@tempd\ht\pst@hbox% |
| 548 |
\pst@dimh=\pst@tempd\dp\pst@hbox% |
| 549 |
\dp\pst@hbox=-\pst@dimg% |
| 550 |
\ht\pst@hbox=-\pst@dimh% |
| 551 |
\else% |
| 552 |
\ht\pst@hbox=\pst@tempd\ht\pst@hbox% |
| 553 |
\dp\pst@hbox=\pst@tempd\dp\pst@hbox% |
| 554 |
\fi% |
| 555 |
\pst@dima=\pst@tempc\wd\pst@hbox% |
| 556 |
\ifdim\pst@dima<\z@\kern-\pst@dima\fi% |
| 557 |
\pst@Verb{CP CP translate \pst@tempa \tx@NET}% |
| 558 |
\hbox to \z@{\box\pst@hbox\hss}% |
| 559 |
\pst@Verb{ |
| 560 |
CP CP translate |
| 561 |
1 \pst@tempc div 1 \pst@tempd div scale |
| 562 |
\tx@NET}% |
| 563 |
\ifdim\pst@dima>\z@\kern\pst@dima\fi% |
| 564 |
}% |
| 565 |
} |
| 566 |
\pslongbox{Scalebox}{\psscalebox} |
| 567 |
% |
| 568 |
\def\psscaleboxto(#1,#2){\pst@makebox{\ps@scaleboxto(#1,#2)}} |
| 569 |
\def\ps@scaleboxto(#1,#2){% |
| 570 |
\begingroup |
| 571 |
\pssetlength\pst@dima{#1}% |
| 572 |
\pssetlength\pst@dimb{#2}% |
| 573 |
\ifdim\pst@dima=\z@\else |
| 574 |
\pst@divide{\pst@dima}{\wd\pst@hbox}\pst@tempc |
| 575 |
\edef\pst@tempc{\pst@tempc\space}% |
| 576 |
\fi |
| 577 |
\ifdim\pst@dimb=\z@ |
| 578 |
\ifdim\pst@dima=\z@ |
| 579 |
\@pstrickserr{% |
| 580 |
\string\psscaleboxto\space dimensions cannot both be zero}\@ehpa |
| 581 |
\def\pst@tempa{}% |
| 582 |
\def\pst@tempc{1 }% |
| 583 |
\def\pst@tempd{1 }% |
| 584 |
\else |
| 585 |
\let\pst@tempd\pst@tempc |
| 586 |
\fi |
| 587 |
\else |
| 588 |
\pst@dimc=\ht\pst@hbox |
| 589 |
\advance\pst@dimc\dp\pst@hbox |
| 590 |
\pst@divide{\pst@dimb}{\pst@dimc}\pst@tempd |
| 591 |
\edef\pst@tempd{\pst@tempd\space}% |
| 592 |
\ifdim\pst@dima=\z@ \let\pst@tempc\pst@tempd \fi |
| 593 |
\fi |
| 594 |
\edef\pst@tempa{\pst@tempc \pst@tempd scale }% |
| 595 |
\ps@@scalebox |
| 596 |
\endgroup} |
| 597 |
\pslongbox{Scaleboxto}{\psscaleboxto} |