2 \def\PsfigVersion{1.10}
3 \def\setDriver{\DvipsDriver} % \DvipsDriver or \OzTeXDriver
5 % All software, documentation, and related files in this distribution of
6 % psfig/tex are Copyright 1993 Trevor J. Darrell
8 % Permission is granted for use and non-profit distribution of psfig/tex
9 % providing that this notice is clearly maintained. The right to
10 % distribute any portion of psfig/tex for profit or as part of any commercial
11 % product is specifically reserved for the author(s) of that portion.
13 % To use with LaTeX, use \documentstyle[psfig,...]{...}
14 % To use with TeX, use \input psfig.sty
16 % Bugs and improvements to trevor@media.mit.edu.
18 % Thanks to Ned Batchelder, Greg Hager (GDH), J. Daniel Smith (JDS),
19 % Tom Rokicki (TR), Robert Russell (RR), George V. Reilly (GVR),
20 % Ken McGlothlen (KHC), Baron Grey (BG), Gerhard Tobermann (GT).
21 % and all others who have contributed code and comments to this project!
23 % ======================================================================
24 % Modification History:
26 % 9 Oct 1990 JDS used more robust bbox reading code from Tom Rokicki
27 % 29 Mar 1991 JDS implemented rotation= option
28 % 25 Jun 1991 RR if bb specified on cmd line don't check
30 % 3 Jul 1991 JDS check if file already read in once
31 % 4 Sep 1991 JDS fixed incorrect computation of rotated
33 % 25 Sep 1991 GVR expanded synopsis of \psfig
34 % 14 Oct 1991 JDS \fbox code from LaTeX so \psdraft works with TeX
35 % changed \typeout to \ps@typeout
36 % 17 Oct 1991 JDS added \psscalefirst and \psrotatefirst
37 % 23 Jun 1993 KHC ``doclip'' must appear before ``rotate''
38 % 27 Oct 1993 TJD removed printing of filename to avoid
39 % underscore problems. changed \frame to \fbox.
40 % Added OzTeX support from BG. Added new
41 % figure search path code from GT.
43 % ======================================================================
47 % \psdraft draws an outline box, but doesn't include the figure
48 % in the DVI file. Useful for previewing.
50 % \psfull includes the figure in the DVI file (default).
52 % \psscalefirst width= or height= specifies the size of the figure
54 % \psrotatefirst (default) width= or height= specifies the size of the
55 % figure after rotation. Asymetric figures will
58 % \psfigurepath{dir:dir:...} sets the path to search for the figure
61 % usage: \psfig{file=, figure=, height=, width=,
62 % bbllx=, bblly=, bburx=, bbury=,
63 % rheight=, rwidth=, clip=, angle=, silent=}
65 % "file" is the filename. If no path name is specified and the
66 % file is not found in the current directory,
67 % it will be looked for in directory \psfigurepath.
68 % "figure" is a synonym for "file".
69 % By default, the width and height of the figure are taken from
70 % the BoundingBox of the figure.
71 % If "width" is specified, the figure is scaled so that it has
72 % the specified width. Its height changes proportionately.
73 % If "height" is specified, the figure is scaled so that it has
74 % the specified height. Its width changes proportionately.
75 % If both "width" and "height" are specified, the figure is scaled
77 % "bbllx", "bblly", "bburx", and "bbury" control the PostScript
78 % BoundingBox. If these four values are specified
79 % *before* the "file" option, the PSFIG will not try to
80 % open the PostScript file.
81 % "rheight" and "rwidth" are the reserved height and width
82 % of the figure, i.e., how big TeX actually thinks
83 % the figure is. They default to "width" and "height".
84 % The "clip" option ensures that no portion of the figure will
85 % appear outside its BoundingBox. "clip=" is a switch and
86 % takes no value, but the `=' must be present.
87 % The "angle" option specifies the angle of rotation (degrees, ccw).
88 % The "silent" option makes \psfig work silently.
90 % ======================================================================
91 % check to see if macros already loaded in (maybe some other file says
93 \ifx\undefined\psfig\else\endinput\fi
95 % from a suggestion by eijkhout@csrd.uiuc.edu to allow
96 % loading as a style file. Changed to avoid problems
97 % with amstex per suggestion by jbence@math.ucla.edu
101 \edef\psfigRestoreAt{\catcode`\@=\number\catcode`@\relax}
102 %\edef\psfigRestoreAt{\catcode`@=\number\catcode`@\relax}
105 \def\ps@typeout#1{{\let\protect\string\immediate\write\@unused{#1}}}
108 \ps@typeout{psfig/tex \PsfigVersion -dvips}
109 \def\PsfigSpecials{\DvipsSpecials} \def\ps@dir{/}
112 \ps@typeout{psfig/tex \PsfigVersion -oztex}
113 \def\PsfigSpecials{\OzTeXSpecials}
119 %% Here's how you define your figure path. Should be set up with null
120 %% default and a user useable definition.
123 \def\psfigurepath#1{\edef\figurepath{#1:}}
125 %%% inserted for Searching Unixpaths
126 %%% (the path must end with :)
127 %%% (call: \DoPaths\figurepath )
128 %%%------------------------------------------------------
129 \def\DoPaths#1{\expandafter\EachPath#1\stoplist}
132 \def\EachPath#1:#2\stoplist{% #1 part of the list (delimiter :)
133 \ExistsFile{#1}{\SearchedFile}
136 \expandafter\EachPath#2\stoplist
139 % exists the file (does not work for directories!)
142 \def\ExistsFile#1#2{%
143 \openin1=\ps@predir#1\ps@dir#2
146 %\ps@typeout{...not: \ps@predir#1\ps@dir#2}
149 %\ps@typeout{...in: \ps@predir#1\ps@dir#2}
150 \ifx\ps@founddir\leer
151 %\ps@typeout{set founddir #1}
152 \edef\ps@founddir{#1}
155 %------------------------------------------------------
157 % Get dir in path or error
161 \def\SearchedFile{#1}
165 %------------------------------------------------------
166 %%% END of Searching Unixpaths
170 % @psdo control structure -- similar to Latex @for.
171 % I redefined these with different names so that psfig can
172 % be used with TeX as well as LaTeX, and so that it will not
173 % be vunerable to future changes in LaTeX's internal
178 \def\@psdonoop#1\@@#2#3{}
179 \def\@psdo#1:=#2\do#3{\edef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
180 \expandafter\@psdoloop#2,\@nil,\@nil\@@#1{#3}\fi}
181 \def\@psdoloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
182 #5\def#4{#2}\ifx #4\@nnil \else#5\@ipsdoloop #3\@@#4{#5}\fi\fi}
183 \def\@ipsdoloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
184 \let\@nextwhile=\@psdonoop \else
185 #4\relax\let\@nextwhile=\@ipsdoloop\fi\@nextwhile#2\@@#3{#4}}
186 \def\@tpsdo#1:=#2\do#3{\xdef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
187 \@tpsdoloop#2\@nil\@nil\@@#1{#3}\fi}
188 \def\@tpsdoloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
189 \let\@nextwhile=\@psdonoop \else
190 #4\relax\let\@nextwhile=\@tpsdoloop\fi\@nextwhile#2\@@#3{#4}}
192 % \fbox is defined in latex.tex; so if \fbox is undefined, assume that
193 % we are not in LaTeX.
194 % Perhaps this could be done better???
196 % \fbox code from modified slightly from LaTeX
199 \newdimen\ps@tempdima
203 \long\def\fbox#1{\leavevmode\setbox\ps@tempboxa\hbox{#1}\ps@tempdima\fboxrule
204 \advance\ps@tempdima \fboxsep \advance\ps@tempdima \dp\ps@tempboxa
205 \hbox{\lower \ps@tempdima\hbox
206 {\vbox{\hrule height \fboxrule
207 \hbox{\vrule width \fboxrule \hskip\fboxsep
208 \vbox{\vskip\fboxsep \box\ps@tempboxa\vskip\fboxsep}\hskip
209 \fboxsep\vrule width \fboxrule}
210 \hrule height \fboxrule}}}}
213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214 % file reading stuff from epsf.tex
215 % EPSF.TEX macro file:
216 % Written by Tomas Rokicki of Radical Eye Software, 29 Mar 1989.
217 % Revised by Don Knuth, 3 Jan 1990.
218 % Revised by Tomas Rokicki to accept bounding boxes with no
219 % space after the colon, 18 Jul 1990.
220 % Portions modified/removed for use in PSFIG package by
221 % J. Daniel Smith, 9 October 1990.
224 \newif\ifnot@eof % continue looking for the bounding box?
225 \newif\if@noisy % report what you're making?
226 \newif\if@atend % %%BoundingBox: has (at end) specification
227 \newif\if@psfile % does this look like a PostScript file?
229 % PostScript files should start with `%!'
231 {\catcode`\%=12\global\gdef\epsf@start{%!}}
236 % The first thing we need to do is to open the
237 % PostScript file, if possible.
239 \openin\ps@stream=\ps@predir#1
240 \ifeof\ps@stream\ps@typeout{Error, File #1 not found}\else
242 % Okay, we got it. Now we'll scan lines until we find one that doesn't
243 % start with %. We're looking for the bounding box comment.
245 {\not@eoftrue \chardef\other=12
246 \def\do##1{\catcode`##1=\other}\dospecials \catcode`\ =10
249 \read\ps@stream to \epsf@fileline
252 \read\ps@stream to \epsf@tmp\global\let\epsf@fileline\epsf@tmp}
254 \ifeof\ps@stream\not@eoffalse\else
256 % Check the first line for `%!'. Issue a warning message if its not
257 % there, since the file might not be a PostScript file.
260 \expandafter\epsf@test\epsf@fileline:. \\%
263 % We check to see if the first character is a % sign;
264 % if so, we look further and stop only if the line begins with
265 % `%%BoundingBox:' and the `(atend)' specification was not found.
266 % That is, the only way to stop is when the end of file is reached,
267 % or a `%%BoundingBox: llx lly urx ury' line is found.
269 \expandafter\epsf@aux\epsf@fileline:. \\%
272 }\closein\ps@stream\fi}%
274 % This tests if the file we are reading looks like a PostScript file.
276 \long\def\epsf@test#1#2#3:#4\\{\def\epsf@testit{#1#2}
277 \ifx\epsf@testit\epsf@start\else
278 \ps@typeout{Warning! File does not start with `\epsf@start'. It may not be a PostScript file.}
280 \@psfiletrue} % don't test after 1st line
282 % We still need to define the tricky \epsf@aux macro. This requires
283 % a couple of magic constants for comparison purposes.
285 {\catcode`\%=12\global\let\epsf@percent=%\global\def\epsf@bblit{%BoundingBox}}
288 % So we're ready to check for `%BoundingBox:' and to grab the
289 % values if they are found. We continue searching if `(at end)'
290 % was found after the `%BoundingBox:'.
292 \long\def\epsf@aux#1#2:#3\\{\ifx#1\epsf@percent
293 \def\epsf@testit{#2}\ifx\epsf@testit\epsf@bblit
298 \ps@typeout{psfig: found `(atend)'; continuing search}
301 \epsf@grab #3 . . . \\%
307 % Here we grab the values and stuff them in the appropriate definitions.
309 \def\epsf@grab #1 #2 #3 #4 #5\\{%
310 \global\def\epsf@llx{#1}\ifx\epsf@llx\empty
311 \epsf@grab #2 #3 #4 #5 .\\\else
312 \global\def\epsf@lly{#2}%
313 \global\def\epsf@urx{#3}\global\def\epsf@ury{#4}\fi}%
315 % Determine if the stuff following the %%BoundingBox is `(atend)'
316 % J. Daniel Smith. Copied from \epsf@grab above.
318 \def\epsf@atendlit{(atend)}
319 \def\epsf@atend #1 #2 #3\\{%
320 \def\epsf@tmp{#1}\ifx\epsf@tmp\empty
321 \epsf@atend #2 #3 .\\\else
322 \ifx\epsf@tmp\epsf@atendlit\@atendtrue\fi\fi}
325 % End of file reading stuff from epsf.tex
326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329 % trigonometry stuff from "trig.tex"
330 \chardef\psletter = 11 % won't conflict with \begin{letter} now...
333 \newif \ifdebug %%% turn me on to see TeX hard at work ...
334 \newif\ifc@mpute %%% don't need to compute some values
335 \c@mputetrue % but assume that we do
339 \let\r@dians = \r@dian
340 \let\dimensionless@nit = \r@dian
341 \let\dimensionless@nits = \dimensionless@nit
342 \def\internal@nit{sp }
343 \let\internal@nits = \internal@nit
344 \newif\ifstillc@nverging
345 \def \Mess@ge #1{\ifdebug \then \message {#1} \fi}
347 { %%% Things that need abnormal catcodes %%%
348 \catcode `\@ = \psletter
349 \gdef \nodimen {\expandafter \n@dimen \the \dimen}
350 \gdef \term #1 #2 #3%
351 {\edef \t@ {\the #1}%%% freeze parameter 1 (count, by value)
352 \edef \t@@ {\expandafter \n@dimen \the #2\r@dian}%
353 %%% freeze parameter 2 (dimen, by value)
354 \t@rm {\t@} {\t@@} {#3}%
356 \gdef \t@rm #1 #2 #3%
359 \dimen 0 = 1 \dimensionless@nit
361 \Mess@ge {Calculating term #1 of \nodimen 2}%
364 \then \advance \count 0 by 1
365 \Mess@ge {Iteration \the \count 0 \space}%
366 \Multiply \dimen 0 by {\dimen 2}%
367 \Mess@ge {After multiplication, term = \nodimen 0}%
368 \Divide \dimen 0 by {\count 0}%
369 \Mess@ge {After division, term = \nodimen 0}%
371 \Mess@ge {Final value for term #1 of
372 \nodimen 2 \space is \nodimen 0}%
373 \xdef \Term {#3 = \nodimen 0 \r@dians}%
376 \catcode `\p = \other
377 \catcode `\t = \other
378 \gdef \n@dimen #1pt{#1} %%% throw away the ``pt''
381 \def \Divide #1by #2{\divide #1 by #2} %%% just a synonym
383 \def \Multiply #1by #2%%% allows division of a dimen by a dimen
384 {{%%% should really freeze parameter 2 (dimen, passed by value)
388 \Mess@ge {Before scaling, count 0 = \the \count 0 \space and
389 count 2 = \the \count 2}%
390 \ifnum \count 0 > 32767 %%% do our best to avoid overflow
391 \then \divide \count 0 by 4
392 \divide \count 4 by 4
393 \else \ifnum \count 0 < -32767
394 \then \divide \count 0 by 4
395 \divide \count 4 by 4
399 \ifnum \count 2 > 32767 %%% while retaining reasonable accuracy
400 \then \divide \count 2 by 4
401 \divide \count 4 by 4
402 \else \ifnum \count 2 < -32767
403 \then \divide \count 2 by 4
404 \divide \count 4 by 4
408 \multiply \count 0 by \count 2
409 \divide \count 0 by \count 4
410 \xdef \product {#1 = \the \count 0 \internal@nits}%
414 \def\r@duce{\ifdim\dimen0 > 90\r@dian \then % sin(x+90) = sin(180-x)
415 \multiply\dimen0 by -1
416 \advance\dimen0 by 180\r@dian
418 \else \ifdim\dimen0 < -90\r@dian \then % sin(-x) = sin(360+x)
419 \advance\dimen0 by 360\r@dian
426 \dimen 0 = #1 \r@dian
428 \ifdim\dimen0 = -90\r@dian \then
432 \ifdim\dimen0 = 90\r@dian \then
436 \ifdim\dimen0 = 0\r@dian \then
442 % convert degrees to radians
443 \divide\dimen0 by 180
444 \dimen0=3.141592654\dimen0
446 \dimen 2 = 3.1415926535897963\r@dian %%% a well-known constant
447 \divide\dimen 2 by 2 %%% we only deal with -pi/2 : pi/2
448 \Mess@ge {Sin: calculating Sin of \nodimen 0}%
449 \count 0 = 1 %%% see power-series expansion for sine
450 \dimen 2 = 1 \r@dian %%% ditto
451 \dimen 4 = 0 \r@dian %%% ditto
453 \ifnum \dimen 2 = 0 %%% then we've done
454 \then \stillc@nvergingfalse
455 \else \stillc@nvergingtrue
457 \ifstillc@nverging %%% then calculate next term
458 \then \term {\count 0} {\dimen 0} {\dimen 2}%
459 \advance \count 0 by 2
461 \divide \count 2 by 2
462 \ifodd \count 2 %%% signs alternate
463 \then \advance \dimen 4 by \dimen 2
464 \else \advance \dimen 4 by -\dimen 2
468 \xdef \sine {\nodimen 4}%
471 % Now the Cosine can be calculated easily by calling \Sine
472 \def\Cosine#1{\ifx\sine\UnDefined\edef\Savesine{\relax}\else
473 \edef\Savesine{\sine}\fi
474 {\dimen0=#1\r@dian\advance\dimen0 by 90\r@dian
477 \xdef\sine{\Savesine}}}
479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
483 %\ps@typeout{draft level now is \@psdraft \space . }
487 %\ps@typeout{draft level now is \@psdraft \space . }
493 \def\psscalefirst{\@scalefirsttrue}
494 \def\psrotatefirst{\@scalefirstfalse}
507 \newif\if@postlogfile
515 %%% These are for the option list.
516 %%% A specification of the form a = b maps to calling \@p@@sa{b}
528 \def\@p@@sclip#1{\@cliptrue}
533 \def\@p@@sfigure#1{\def\@p@sfile{null}\def\@p@sbbfile{null}\@decmprfalse
534 % look directly for file (e.g. absolute path)
535 \openin1=\ps@predir#1
538 % failed, search directories for file
540 \ifx\ps@founddir\leer
541 % failed, search directly for file.bb
542 \openin1=\ps@predir#1.bb
545 % failed, search directories for file.bb
547 \ifx\ps@founddir\leer
549 \ps@typeout{Can't find #1 in \figurepath}
551 % found file.bb in search dir
553 \def\@p@sfile{\ps@founddir\ps@dir#1}
554 \def\@p@sbbfile{\ps@founddir\ps@dir#1.bb}
558 %found file.bb directly
561 \def\@p@sbbfile{#1.bb}
564 % found file in search dir
565 \def\@p@sfile{\ps@founddir\ps@dir#1}
566 \def\@p@sbbfile{\ps@founddir\ps@dir#1}
569 % found file directly
578 \def\@p@@sfile#1{\@p@@sfigure{#1}}
581 %\ps@typeout{bbllx is #1}
584 \edef\@p@sbbllx{\number\dimen100}
587 %\ps@typeout{bblly is #1}
590 \edef\@p@sbblly{\number\dimen100}
593 %\ps@typeout{bburx is #1}
596 \edef\@p@sbburx{\number\dimen100}
599 %\ps@typeout{bbury is #1}
602 \edef\@p@sbbury{\number\dimen100}
607 \edef\@p@sheight{\number\dimen100}
608 %\ps@typeout{Height is \@p@sheight}
611 %\ps@typeout{Width is #1}
614 \edef\@p@swidth{\number\dimen100}
617 %\ps@typeout{Reserved height is #1}
620 \edef\@p@srheight{\number\dimen100}
623 %\ps@typeout{Reserved width is #1}
626 \edef\@p@srwidth{\number\dimen100}
629 %\ps@typeout{Rotation is #1}
632 \edef\@p@sangle{#1} %\number\dimen100}
637 \def\@p@@sprolog#1{\@prologfiletrue\def\@prologfileval{#1}}
638 \def\@p@@spostlog#1{\@postlogfiletrue\def\@postlogfileval{#1}}
639 \def\@cs@name#1{\csname #1\endcsname}
640 \def\@setparms#1=#2,{\@cs@name{@p@@s#1}{#2}}
642 % initialize the defaults (size the size of the figure)
645 \@bbllxfalse \@bbllyfalse
646 \@bburxfalse \@bburyfalse
647 \@heightfalse \@widthfalse
648 \@rheightfalse \@rwidthfalse
649 \def\@p@sbbllx{}\def\@p@sbblly{}
650 \def\@p@sbburx{}\def\@p@sbbury{}
651 \def\@p@sheight{}\def\@p@swidth{}
652 \def\@p@srheight{}\def\@p@srwidth{}
654 \def\@p@sfile{} \def\@p@sbbfile{}
667 % Go through the options setting things up.
669 \def\parse@ps@parms#1{
670 \@psdo\@psfiga:=#1\do
671 {\expandafter\@setparms\@psfiga,}}
673 % Compute bb height and width
678 \ps@typeout{psfig: searching \@p@sbbfile \space for bounding box}
681 \epsf@getbb{\@p@sbbfile}
682 \ifno@bb \else \bb@cull\epsf@llx\epsf@lly\epsf@urx\epsf@ury\fi
684 \def\bb@cull#1#2#3#4{
685 \dimen100=#1 bp\edef\@p@sbbllx{\number\dimen100}
686 \dimen100=#2 bp\edef\@p@sbblly{\number\dimen100}
687 \dimen100=#3 bp\edef\@p@sbburx{\number\dimen100}
688 \dimen100=#4 bp\edef\@p@sbbury{\number\dimen100}
691 % rotate point (#1,#2) about (0,0).
692 % The sine and cosine of the angle are already stored in \sine and
693 % \cosine. The result is placed in (\p@intvaluex, \p@intvaluey).
694 \newdimen\p@intvaluex
695 \newdimen\p@intvaluey
696 \def\rotate@#1#2{{\dimen0=#1 sp\dimen1=#2 sp
697 % calculate x' = x \cos\theta - y \sin\theta
698 \global\p@intvaluex=\cosine\dimen0
700 \global\advance\p@intvaluex by -\dimen3
701 % calculate y' = x \sin\theta + y \cos\theta
702 \global\p@intvaluey=\sine\dimen0
703 \dimen3=\cosine\dimen1
704 \global\advance\p@intvaluey by \dimen3
708 \if@bbllx \else \no@bbtrue \fi
709 \if@bblly \else \no@bbtrue \fi
710 \if@bburx \else \no@bbtrue \fi
711 \if@bbury \else \no@bbtrue \fi
712 \ifno@bb \bb@missing \fi
713 \ifno@bb \ps@typeout{FATAL ERROR: no bb supplied or found}
717 %\ps@typeout{BB: \@p@sbbllx, \@p@sbblly, \@p@sbburx, \@p@sbbury}
719 % store height/width of original (unrotated) bounding box
722 \advance\count203 by -\@p@sbbllx
723 \advance\count204 by -\@p@sbblly
724 \edef\ps@bbw{\number\count203}
725 \edef\ps@bbh{\number\count204}
726 %\ps@typeout{ psbbh = \ps@bbh, psbbw = \ps@bbw }
728 \Sine{\@p@sangle}\Cosine{\@p@sangle}
729 {\dimen100=\maxdimen\xdef\r@p@sbbllx{\number\dimen100}
730 \xdef\r@p@sbblly{\number\dimen100}
731 \xdef\r@p@sbburx{-\number\dimen100}
732 \xdef\r@p@sbbury{-\number\dimen100}}
734 % Need to rotate all four points and take the X-Y extremes of the new
735 % points as the new bounding box.
737 \ifnum\number\p@intvaluex<\r@p@sbbllx
738 \xdef\r@p@sbbllx{\number\p@intvaluex}\fi
739 \ifnum\number\p@intvaluex>\r@p@sbburx
740 \xdef\r@p@sbburx{\number\p@intvaluex}\fi
741 \ifnum\number\p@intvaluey<\r@p@sbblly
742 \xdef\r@p@sbblly{\number\p@intvaluey}\fi
743 \ifnum\number\p@intvaluey>\r@p@sbbury
744 \xdef\r@p@sbbury{\number\p@intvaluey}\fi
747 \rotate@{\@p@sbbllx}{\@p@sbblly}
750 \rotate@{\@p@sbbllx}{\@p@sbbury}
753 \rotate@{\@p@sbburx}{\@p@sbblly}
756 \rotate@{\@p@sbburx}{\@p@sbbury}
758 \edef\@p@sbbllx{\r@p@sbbllx}\edef\@p@sbblly{\r@p@sbblly}
759 \edef\@p@sbburx{\r@p@sbburx}\edef\@p@sbbury{\r@p@sbbury}
760 %\ps@typeout{rotated BB: \r@p@sbbllx, \r@p@sbblly, \r@p@sbburx, \r@p@sbbury}
764 \advance\count203 by -\@p@sbbllx
765 \advance\count204 by -\@p@sbblly
766 \edef\@bbw{\number\count203}
767 \edef\@bbh{\number\count204}
768 %\ps@typeout{ bbh = \@bbh, bbw = \@bbw }
771 % \in@hundreds performs #1 * (#2 / #3) correct to the hundreds,
772 % then leaves the result in @result
774 \def\in@hundreds#1#2#3{\count240=#2 \count241=#3
775 \count100=\count240 % 100 is first digit #2/#3
776 \divide\count100 by \count241
778 \multiply\count101 by \count241
779 \advance\count240 by -\count101
780 \multiply\count240 by 10
781 \count101=\count240 %101 is second digit of #2/#3
782 \divide\count101 by \count241
784 \multiply\count102 by \count241
785 \advance\count240 by -\count102
786 \multiply\count240 by 10
787 \count102=\count240 % 102 is the third digit
788 \divide\count102 by \count241
789 \count200=#1\count205=0
791 \multiply\count201 by \count100
792 \advance\count205 by \count201
794 \divide\count201 by 10
795 \multiply\count201 by \count101
796 \advance\count205 by \count201
799 \divide\count201 by 100
800 \multiply\count201 by \count102
801 \advance\count205 by \count201
803 \edef\@result{\number\count205}
806 % computing : width = height * (bbw / bbh)
807 \in@hundreds{\@p@sheight}{\@bbw}{\@bbh}
808 %\ps@typeout{ \@p@sheight * \@bbw / \@bbh, = \@result }
809 \edef\@p@swidth{\@result}
810 %\ps@typeout{w from h: width is \@p@swidth}
813 % computing : height = width * (bbh / bbw)
814 \in@hundreds{\@p@swidth}{\@bbh}{\@bbw}
815 %\ps@typeout{ \@p@swidth * \@bbh / \@bbw = \@result }
816 \edef\@p@sheight{\@result}
817 %\ps@typeout{h from w : height is \@p@sheight}
829 \edef\@p@sheight{\@bbh}
830 \edef\@p@swidth{\@bbw}
835 \if@rheight \else \edef\@p@srheight{\@p@sheight} \fi
836 \if@rwidth \else \edef\@p@srwidth{\@p@swidth} \fi
837 %\ps@typeout{rheight = \@p@srheight, rwidth = \@p@srwidth}
840 % Compute any missing values
843 \if@scalefirst\if@angle
844 % at this point the bounding box has been adjsuted correctly for
845 % rotation. PSFIG does all of its scaling using \@bbh and \@bbw. If
846 % a width= or height= was specified along with \psscalefirst, then the
847 % width=/height= value needs to be adjusted to match the new (rotated)
848 % bounding box size (specifed in \@bbw and \@bbh).
850 % ------- = ----------
852 % so `new width=' = (width= * \@bbw) / \ps@bbw; where \ps@bbw is the
853 % width of the original (unrotated) bounding box.
855 \in@hundreds{\@p@swidth}{\@bbw}{\ps@bbw}
856 \edef\@p@swidth{\@result}
859 \in@hundreds{\@p@sheight}{\@bbh}{\ps@bbh}
860 \edef\@p@sheight{\@result}
869 \special{empty.ps /@isp {true} def}
870 \special{empty.ps \@p@swidth \space \@p@sheight \space
871 \@p@sbbllx \space \@p@sbblly \space
872 \@p@sbburx \space \@p@sbbury \space
878 \special{empty.ps doclip \space }
882 \ps@typeout{(rotate)}
884 \special {empty.ps \@p@sangle \space rotate \space}
887 \special{\@prologfileval \space } \fi
890 \ps@typeout{psfig: Compression not available
891 in OzTeX version \space }
895 \ps@typeout{psfig: including \@p@sfile \space }
897 \special{epsf=\@p@sfile \space }
900 \special{\@postlogfileval \space } \fi
901 \special{empty.ps /@isp {false} def}
905 \special{ps::[begin] \@p@swidth \space \@p@sheight \space
906 \@p@sbbllx \space \@p@sbblly \space
907 \@p@sbburx \space \@p@sbbury \space
913 \special{ps:: doclip \space }
919 \special {ps:: \@p@sangle \space rotate \space}
922 \special{ps: plotfile \@prologfileval \space } \fi
925 \ps@typeout{psfig: including \@p@sfile.Z \space }
927 \special{ps: plotfile "`zcat \@p@sfile.Z" \space }
930 \ps@typeout{psfig: including \@p@sfile \space }
932 \special{ps: plotfile \@p@sfile \space }
935 \special{ps: plotfile \@postlogfileval \space } \fi
936 \special{ps::[end] endTexFig \space }
940 % usage : \psfig{file=, height=, width=, bbllx=, bblly=, bburx=, bbury=,
941 % rheight=, rwidth=, clip=}
943 % "clip=" is a switch and takes no value, but the `=' must be present.
945 % do a zero width hard space so that a single
946 % \psfig in a centering enviornment will behave nicely
947 %{\setbox0=\hbox{\ }\ \hskip-\wd0}
953 \ifnum\@p@scost<\@psdraft{
955 % Create the vbox to reserve the space for the figure.
956 \vbox to \@p@srheight sp{
957 % 1/92 TJD Changed from "true sp" to "sp" for magnification.
958 \hbox to \@p@srwidth sp{
964 % draft figure, just reserve the space and print the
967 % Verbose draft: print file name in box
968 % 10/93 TJD changed to fbox from frame
969 \hbox{\fbox{\vbox to \@p@srheight sp{
971 \hbox to \@p@srwidth sp{ \hss
972 % 10/93 TJD deleted to avoid ``_'' problems
979 \vbox to \@p@srheight sp{
981 \hbox to \@p@srwidth sp{\hss}