\def\fileversion{v1.1} \def\filedate{4 Dec 91} \immediate\write16{Document style option `epsfig', \fileversion\space <\filedate> (edited by SPQR)} %%%-------------------------------------------------------------------- %%% psfig merged with EPSF =epsfig Release 1 %%% %%% code rearranged by Sebastian Rahtz from work by %%% Trevor Darrell; Tom Rokicki; Daniel Smith; H. Payne, Robert Russell %%% %%% This is a version of Darrell's `psfig' macros which are designed only %%% to be used with Rokicki's dvips program and the `epsf' macros (these %%% are automaticaly included by the style file). I did this because the %%% \special commands used by `epsf' appear to be more robust and %%% portable than the raw \specials used by `psfig', but I preferred the %%% psfig interface, and wanted to use some of its features which epsf %%% did not offer (specifically, clipping to the BoundingBox). This system %%% preserves the psfig interface, but mainly uses epsf macros to carry out %%% the job. The user interface is identical to \psfig, but you just use %%% \epsfig instead. Clipping and rotation uses the original psfig macros, %%% as do specific settings of the Bounding Box in the call to the macro. %%% I could not work out how to do rotation or clipping with the epsf macros. %%% %%% The same applies to `rheight' and `rwidth' %%% %%% One behaviour which may confuse people is that setting width= and %%% height will *not* force a change in the aspect ratio. If you need %%% this behaviour, use the \psfig macro instead of \epsfig. Rokicki's macros %%% do not provide a way of doing the aspect ration stuff. %%% %%% If you *really* want old psfig behaviour regardless, use \psfig. It is %%% still there. Some of the features have gone, however. \figurepath %%% seemed redundant, since it could be controlled by the TEXINPUTS %%% variable anyway. %%% %%% As an added feature, if a file cannot be found, a file called `file'.bb %%% is searched for. This should simply contain a %%BoundingBox line. It is %%% assumed that if this exists, then `file'.Z exists, and is a Unix %%% compressed file. The macros then read the BB from `file'.bb, but insert %%% "zcat `file'.Z" in the output for dvips to interpret (don't worry, it %%% knows about this). Saves a lot of space! Actually, its more %%% complicated than that; the string passed to dvips for file `foo.ps' is %%% actually "zcat `texfind foo.ps.Z`", where `texfind' is assumed to be a %%% shell script which searches the TEXINPUTS path for `foo.ps.Z'. Such a %%% script comes with dvips. Just alias it to `cat' if you have problems. %%% If you are *not* on a Unix system and use this, deliberately or by %%% mischance, you will have problems! %%% %%% This file can be included in a dumped format, or used as a LaTeX %%% style file, or used in plain TeX. It does not load itself twice (I hope!) %%% %%% Sebastian Rahtz December 1991 spqr@uk.ac.soton.ecs %-------------------------------------------------------------------- %-------------------------------------------------------------------- %%% previous notes. this copy of psfig.tex inherited from version 1.7 %-------------------------------------------------------------------- %%% All psfig/tex software, documentation, and related files %%% in this distribution of psfig/tex are %%% Copyright 1987, 1988, 1991 Trevor J. Darrell % %%% Permission is granted for use and non-profit distribution of psfig/tex %%% providing that this notice be clearly maintained. The right to %%% distribute any portion of psfig/tex for profit or as part of any commercial %%% product is specifically reserved for the author(s) of that portion. %%% %%% Thanks to Greg Hager (GDH) and Ned Batchelder for their contributions %%% to this project. %%%-------------------------------------------------------------------------- %%% GDH 7/26/87 -- changed so that it first looks in the local directory, %%% then in a specified global directory for the ps file. %%% SPQR 12/91 removed that last change. it follows TEXINPUTS anyway %%% RPR 6/25/91 -- changed so that it defaults to user-supplied name if %%% boundingbox info is specified, assuming graphic will be created by %%% print time. %%% SPQR 12/91 removed that last change. use LaTeX error message instead %%% SPQR 12/91 -- `no file found' produces LaTeX error message. %%% If you recover from that the file name is set in draft %%% mode in place of the file. %%% %%% Modified by J. Daniel Smith on 9 October 1990 to accept the %%% %%BoundingBox: comment with or without a space after the colon. Stole %%% file reading code from Tom Rokicki's EPSF.TEX file (see below). %%% --- SPQR 12.91 removed most of this to use epsf directly %%% %%% More modifications by J. Daniel Smith on 29 March 1991 to allow the %%% the included PostScript figure to be rotated. The amount of %%% rotation is specified by the "angle=" parameter of the \epsfig command. %%% %%% Modified by Robert Russell on June 25, 1991 to allow users to specify %%% .ps filenames which don't yet exist, provided they explicitly provide %%% boundingbox information via the \epsfig command. Note: This will only work %%% if the "file=" parameter follows all four "bb???=" parameters in the %%% command. This is due to the order in which psfig interprets these params. %%% ---- SPQR 12.91 removed all this %%% %%% 3 Jul 1991 JDS check if file already read in once %%% %%% Modified by H. Payne on 9 October 1991 to allow rotation through %%% arbitrary angles, not just angles in the first quadrant. %-------------------------------------------------------------------------- %%% %%% from a suggestion by eijkhout@csrd.uiuc.edu to allow %%% loading as a style file: \edef\epsfigRestoreAt{\catcode`@=\number\catcode`@\relax} \catcode`\@=11\relax % copies of bits of LaTeX we need.... \ifx\@ifundefined\undefined \long\def\@ifundefined#1#2#3{\expandafter\ifx\csname #1\endcsname\relax#2\else#3\fi} \fi % \@ifundefined{typeout} {\gdef\typeout#1{\immediate\write\sixt@@n{#1}}} {\relax} % %%% check to see if macros already loaded in (maybe some other file says %%% "\input epsfig") ... \@ifundefined{epsfig}{}{\typeout{EPSFIG --- already loaded}\endinput} % % we try to put a box round space of missing figures. plain TeX % doesn't have an easy command, so just ignore it \@ifundefined{fbox}{\def\fbox#1{#1}}{} %%% %%% we need Rokicki's EPSF macros anyway, unless they are already loaded % \@ifundefined{epsfbox}{\input epsf}{} % %% SPQR 12.91 handling of errors using standard LaTeX error %% mechanism. In case we are plain TeX we first define the %% error routines... \ifx\undefined\@latexerr \newlinechar`\^^J \def\@spaces{\space\space\space\space} \def\@latexerr#1#2{% \edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}% \typeout{Error. \space see a manual for explanation.^^J \space\@spaces\@spaces\@spaces Type \space H \space for immediate help.}\errmessage{#1}} \fi %------------------------ %% a couple of LaTeX error messages \def\@whattodo{You tried to include a PostScript figure which cannot be found^^JIf you press return to carry on anyway,^^J The failed name will be printed in place of the figure.^^J or type X to quit} \def\@whattodobb{You tried to include a PostScript figure which has no^^Jbounding box, and you supplied none.^^J If you press return to carry on anyway,^^J The failed name will be printed in place of the figure.^^J or type X to quit} %------------------------ % %------------------------------------------------------------------------ %------------------------------------------------------------------------ %%% @psdo control structure -- similar to Latex @for. %%% I redefined these with different names so that psfig can %%% be used with TeX as well as LaTeX, and so that it will not %%% be vunerable to future changes in LaTeX's internal %%% control structure, % \def\@nnil{\@nil} \def\@empty{} \def\@psdonoop#1\@@#2#3{} \def\@psdo#1:=#2\do#3{\edef\@psdotmp{#2}\ifx\@psdotmp\@empty \else \expandafter\@psdoloop#2,\@nil,\@nil\@@#1{#3}\fi} \def\@psdoloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else #5\def#4{#2}\ifx #4\@nnil \else#5\@ipsdoloop #3\@@#4{#5}\fi\fi} \def\@ipsdoloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil \let\@nextwhile=\@psdonoop \else #4\relax\let\@nextwhile=\@ipsdoloop\fi\@nextwhile#2\@@#3{#4}} \def\@tpsdo#1:=#2\do#3{\xdef\@psdotmp{#2}\ifx\@psdotmp\@empty \else \@tpsdoloop#2\@nil\@nil\@@#1{#3}\fi} \def\@tpsdoloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil \let\@nextwhile=\@psdonoop \else #4\relax\let\@nextwhile=\@tpsdoloop\fi\@nextwhile#2\@@#3{#4}} %%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% file reading stuff from epsf.tex %%% EPSF.TEX macro file: %%% Written by Tomas Rokicki of Radical Eye Software, 29 Mar 1989. %%% Revised by Don Knuth, 3 Jan 1990. %%% Revised by Tomas Rokicki to accept bounding boxes with no %%% space after the colon, 18 Jul 1990. %%% Portions modified/removed for use in PSFIG package by %%% J. Daniel Smith, 9 October 1990. %%% Just the bit which knows about (atend) as a BoundingBox % %%% hacked back a bit by SPQR 12/91 % \long\def\epsfaux#1#2:#3\\{\ifx#1\epsfpercent \def\testit{#2}\ifx\testit\epsfbblit \@atendfalse \epsf@atend #3 . \\% \if@atend \if@verbose \typeout{epsfig: found `(atend)'; continuing search} \fi \else \epsfgrab #3 . . . \\% \global\no@bbfalse \fi \fi\fi}% % %%% Determine if the stuff following the %%BoundingBox is `(atend)' %%% J. Daniel Smith. Copied from \epsf@grab above. % \def\epsf@atendlit{(atend)} % \def\epsf@atend #1 #2 #3\\{% \def\epsf@tmp{#1}\ifx\epsf@tmp\empty \epsf@atend #2 #3 .\\\else \ifx\epsf@tmp\epsf@atendlit\@atendtrue\fi\fi} %%% End of file reading stuff from epsf.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% trigonometry stuff from "trig.tex" \chardef\letter = 11 \chardef\other = 12 \newif\ifdebug %%% turn me on to see TeX hard at work ... \newif\ifc@mpute %%% don't need to compute some values \newif\if@atend \c@mputetrue % but assume that we do \let\then = \relax \def\r@dian{pt } \let\r@dians = \r@dian \let\dimensionless@nit = \r@dian \let\dimensionless@nits = \dimensionless@nit \def\internal@nit{sp } \let\internal@nits = \internal@nit \newif\ifstillc@nverging \def \Mess@ge #1{\ifdebug \then \message {#1} \fi} { %%% Things that need abnormal catcodes %%% \catcode `\@ = \letter \gdef \nodimen {\expandafter \n@dimen \the \dimen} \gdef \term #1 #2 #3% {\edef \t@ {\the #1}%%% freeze parameter 1 (count, by value) \edef \t@@ {\expandafter \n@dimen \the #2\r@dian}% %%% freeze parameter 2 (dimen, by value) \t@rm {\t@} {\t@@} {#3}% } \gdef \t@rm #1 #2 #3% {{% \count 0 = 0 \dimen 0 = 1 \dimensionless@nit \dimen 2 = #2\relax \Mess@ge {Calculating term #1 of \nodimen 2}% \loop \ifnum \count 0 < #1 \then \advance \count 0 by 1 \Mess@ge {Iteration \the \count 0 \space}% \Multiply \dimen 0 by {\dimen 2}% \Mess@ge {After multiplication, term = \nodimen 0}% \Divide \dimen 0 by {\count 0}% \Mess@ge {After division, term = \nodimen 0}% \repeat \Mess@ge {Final value for term #1 of \nodimen 2 \space is \nodimen 0}% \xdef \Term {#3 = \nodimen 0 \r@dians}% \aftergroup \Term }} \catcode `\p = \other \catcode `\t = \other \gdef \n@dimen #1pt{#1} %%% throw away the ``pt'' } \def \Divide #1by #2{\divide #1 by #2} %%% just a synonym \def \Multiply #1by #2%%% allows division of a dimen by a dimen {{%%% should really freeze parameter 2 (dimen, passed by value) \count 0 = #1\relax \count 2 = #2\relax \count 4 = 65536 \Mess@ge {Before scaling, count 0 = \the \count 0 \space and count 2 = \the \count 2}% \ifnum \count 0 > 32767 %%% do our best to avoid overflow \then \divide \count 0 by 4 \divide \count 4 by 4 \else \ifnum \count 0 < -32767 \then \divide \count 0 by 4 \divide \count 4 by 4 \else \fi \fi \ifnum \count 2 > 32767 %%% while retaining reasonable accuracy \then \divide \count 2 by 4 \divide \count 4 by 4 \else \ifnum \count 2 < -32767 \then \divide \count 2 by 4 \divide \count 4 by 4 \else \fi \fi \multiply \count 0 by \count 2 \divide \count 0 by \count 4 \xdef \product {#1 = \the \count 0 \internal@nits}% \aftergroup \product }} \def\r@duce{\ifdim\dimen0 > 90\r@dian \then % sin(x) = sin(180-x) \multiply\dimen0 by -1 \advance\dimen0 by 180\r@dian \r@duce \else \ifdim\dimen0 < -90\r@dian \then % sin(x) = sin(360+x) \advance\dimen0 by 360\r@dian \r@duce \fi \fi} \def\Sine#1% {{% \dimen 0 = #1 \r@dian \r@duce \ifdim\dimen0 = -90\r@dian \then \dimen4 = -1\r@dian \c@mputefalse \fi \ifdim\dimen0 = 90\r@dian \then \dimen4 = 1\r@dian \c@mputefalse \fi \ifdim\dimen0 = 0\r@dian \then \dimen4 = 0\r@dian \c@mputefalse \fi % \ifc@mpute \then % convert degrees to radians \divide\dimen0 by 180 \dimen0=3.141592654\dimen0 % \dimen 2 = 3.1415926535897963\r@dian %%% a well-known constant \divide\dimen 2 by 2 %%% we only deal with -pi/2 : pi/2 \Mess@ge {Sin: calculating Sin of \nodimen 0}% \count 0 = 1 %%% see power-series expansion for sine \dimen 2 = 1 \r@dian %%% ditto \dimen 4 = 0 \r@dian %%% ditto \loop \ifnum \dimen 2 = 0 %%% then we've done \then \stillc@nvergingfalse \else \stillc@nvergingtrue \fi \ifstillc@nverging %%% then calculate next term \then \term {\count 0} {\dimen 0} {\dimen 2}% \advance \count 0 by 2 \count 2 = \count 0 \divide \count 2 by 2 \ifodd \count 2 %%% signs alternate \then \advance \dimen 4 by \dimen 2 \else \advance \dimen 4 by -\dimen 2 \fi \repeat \fi \xdef \sine {\nodimen 4}% %\typeout {Sin: sine of #1 \space is \sine \space}% }} %%% Now the Cosine can be calculated easily by calling \Sine: %%% cos(x) = sin(90-x) \def\Cosine#1{\ifx\sine\UnDefined\edef\Savesine{\relax}\else \edef\Savesine{\sine}\fi {\dimen0=#1\r@dian\multiply\dimen0 by -1 \advance\dimen0 by 90\r@dian \Sine{\nodimen 0} \xdef\cosine{\sine} %\typeout {Cosine: cos of \space \nodimen 0 \space is \cosine \space}% \xdef\sine{\Savesine}}} %%% end of trig stuff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \def\psdraft{\def\@psdraft{0}} \def\psfull{\def\@psdraft{100}} \psfull % \newif\if@draftbox \def\psnodraftbox{\@draftboxfalse} \@draftboxtrue % \newif\if@noisy \def\pssilent{\@noisyfalse} \def\psnoisy{\@noisytrue} \@noisyfalse %%% These are for the option list. %%% A specification of the form a = b maps to calling \@p@@sa{b} \newif\if@bbllx \newif\if@bblly \newif\if@bburx \newif\if@bbury \newif\if@height \newif\if@width \newif\if@rheight \newif\if@rwidth \newif\if@angle \newif\if@clip \newif\if@verbose \newif\if@prologfile \def\@p@@sprolog#1{\@prologfiletrue\def\@prologfileval{#1}} \def\@p@@sclip#1{\@cliptrue} % %%% if this is true, the original Darrell macros and specials are used \newif\ifuse@psfig % \def\@p@@sfile#1{% \def\@p@sfile{NO FILE: #1}% \def\@p@sfilefinal{NO FILE: #1}% \openin1=#1 \ifeof1\closein1 \openin1=#1.bb \ifeof1\closein1 \if@bbllx\if@bblly\if@bburx\if@bbury% added 6/91 Rob Russell \def\@p@sfile{#1}% \def\@p@sfilefinal{#1}% \fi\fi\fi \else \@latexerr{ERROR! PostScript file #1 not found}\@whattodo \@p@@sbbllx{100bp} \@p@@sbblly{100bp} \@p@@sbburx{200bp} \@p@@sbbury{200bp} \def\@p@scost{200} \fi \else \closein1% \edef\@p@sfile{#1.bb}% \edef\@p@sfilefinal{"`zcat `texfind #1.Z`"}% \fi \else\closein1 \edef\@p@sfile{#1}% \edef\@p@sfilefinal{#1}% \fi% } % alternative syntax: figure= \let\@p@@sfigure\@p@@sfile % \def\@p@@sbbllx#1{ %\typeout{bbllx is #1} \use@psfigtrue \@bbllxtrue \dimen100=#1 \edef\@p@sbbllx{\number\dimen100} } \def\@p@@sbblly#1{ %\typeout{bblly is #1} \use@psfigtrue \@bbllytrue \dimen100=#1 \edef\@p@sbblly{\number\dimen100} } \def\@p@@sbburx#1{ %\typeout{bburx is #1} \use@psfigtrue \@bburxtrue \dimen100=#1 \edef\@p@sbburx{\number\dimen100} } \def\@p@@sbbury#1{ %\typeout{bbury is #1} \use@psfigtrue \@bburytrue \dimen100=#1 \edef\@p@sbbury{\number\dimen100} } \def\@p@@sheight#1{ \@heighttrue \epsfysize=#1 \dimen100=#1 \edef\@p@sheight{\number\dimen100} %\typeout{Height is \@p@sheight} } \def\@p@@swidth#1{ %\typeout{Width is #1} \@widthtrue \epsfxsize=#1 \dimen100=#1 \edef\@p@swidth{\number\dimen100} } \def\@p@@srheight#1{ %\typeout{Reserved height is #1} \@rheighttrue\use@psfigtrue \dimen100=#1 \edef\@p@srheight{\number\dimen100} } \def\@p@@srwidth#1{ %\typeout{Reserved width is #1} \@rwidthtrue\use@psfigtrue \dimen100=#1 \edef\@p@srwidth{\number\dimen100} } \def\@p@@sangle#1{ %\typeout{Rotation is #1} \use@psfigtrue \@angletrue % \dimen100=#1 \edef\@p@sangle{#1} %\number\dimen100} } \def\@p@@ssilent#1{ \@verbosefalse } \def\@cs@name#1{\csname #1\endcsname} \def\@setparms#1=#2,{\@cs@name{@p@@s#1}{#2}} % %%% initialize the defaults (size the size of the figure) % \def\ps@init@parms{ \@bbllxfalse \@bbllyfalse \@bburxfalse \@bburyfalse \@heightfalse \@widthfalse \@rheightfalse \@rwidthfalse \def\@p@sbbllx{}\def\@p@sbblly{} \def\@p@sbburx{}\def\@p@sbbury{} \def\@p@sheight{}\def\@p@swidth{} \def\@p@srheight{}\def\@p@srwidth{} \def\@p@sangle{0} \def\@p@sfile{} \def\@p@scost{10} \use@psfigfalse \@prologfilefalse \def\@sc{} \if@noisy \@verbosetrue \else \@verbosefalse \fi \@clipfalse } % %%% Go through the options setting things up. % \def\parse@ps@parms#1{ \@psdo\@psfiga:=#1\do {\expandafter\@setparms\@psfiga,} \if@prologfile \special{header=\@prologfileval} \fi } % %%% Compute bb height and width % \newif\ifno@bb \def\bb@missing{ \epsfgetbb{\@p@sfile} \ifepsfbbfound\no@bbfalse\else\no@bbtrue\bb@cull\epsfllx\epsflly\epsfurx\epsfury\fi } \def\bb@cull#1#2#3#4{ \dimen100=#1 bp\edef\@p@sbbllx{\number\dimen100} \dimen100=#2 bp\edef\@p@sbblly{\number\dimen100} \dimen100=#3 bp\edef\@p@sbburx{\number\dimen100} \dimen100=#4 bp\edef\@p@sbbury{\number\dimen100} \no@bbfalse } \newdimen\p@intvaluex \newdimen\p@intvaluey \newdimen\@ffsetvalue \newdimen\x@ffsetvalue \newdimen\y@ffsetvalue %%% Calculate \@ffsetvalue = (#2 - #1) \sin\theta %%% The sine of the angle is already stored in \sine. %%% If (#2-#1)>0, then the result is zero in the 2nd and 4th quadrants, and %%% if (#2-#1)<0, then the result is zero in the 1st and 3rd quadrants. %%% Only the x coordinate needs an offset in the 1st and 3rd quadrants, %%% and only the y coordinate needs an offset otherwise. \def\compute@offset#1#2{{\dimen0=#1 sp\dimen1=#2 sp \advance\dimen1 by -\dimen0 \dimen1=\sine\dimen1 \dimen0=\cosine\dimen1 \ifdim\dimen0<0sp \dimen1=0sp \fi \global\@ffsetvalue=\dimen1}} %%% rotate point (#1,#2) about (0,0). %%% The sine and cosine of the angle are already stored in \sine and %%% \cosine. The result is placed in (\p@intvaluex, \p@intvaluey). \def\rotate@#1#2{{\dimen0=#1 sp\dimen1=#2 sp %%% calculate x' = x \cos\theta - y \sin\theta \global\p@intvaluex=\cosine\dimen0 \dimen3=\sine\dimen1 \global\advance\p@intvaluex by -\dimen3 %%% calculate y' = x \sin\theta + y \cos\theta \global\p@intvaluey=\sine\dimen0 \dimen3=\cosine\dimen1 \global\advance\p@intvaluey by \dimen3 }} %%% rotate point (#1,#2) about the point (#3,#4), finding the x value. %%% The sine and cosine of the angle are already stored in \sine and %%% \cosine. The result is placed in \p@intvaluex %\def\rotate@x#1#2#3#4{{\dimen0=#1 sp % \dimen1=#2 sp % \dimen2=#3 sp % \dimen4=#4 sp % \advance\dimen0 by -\dimen3 % \dimen0=\cosine\dimen0 % \advance\dimen4 by -\dimen2 % \dimen4=\sine\dimen4 % \global\p@intvaluex=\dimen0 % \global\advance\p@intvaluex by \dimen4 % \global\advance\p@intvaluex by \dimen3 % %}} \def\compute@bb{ \no@bbfalse \if@bbllx \else \no@bbtrue \fi \if@bblly \else \no@bbtrue \fi \if@bburx \else \no@bbtrue \fi \if@bbury \else \no@bbtrue \fi \ifno@bb \bb@missing \fi \ifno@bb \@latexerr{ERROR! cannot locate BB!}\@whattodobb \@p@@sbbllx{100bp} \@p@@sbblly{100bp} \@p@@sbburx{200bp} \@p@@sbbury{200bp} \def\@p@scost{200} \fi %\typeout{BB: \@p@sbbllx, \@p@sbblly, \@p@sbburx, \@p@sbbury} \if@angle \Sine{\@p@sangle}\Cosine{\@p@sangle} \compute@offset{\@p@sbblly}{\@p@sbbury} \x@ffsetvalue=\@ffsetvalue % Note that arguments are reversed to % give a negative interval: \compute@offset{\@p@sbburx}{\@p@sbbllx} \y@ffsetvalue=\@ffsetvalue \rotate@{\@p@sbbllx}{\@p@sbblly} \advance\p@intvaluex by -\x@ffsetvalue \advance\p@intvaluey by -\y@ffsetvalue \edef\@p@sbbllx{\number\p@intvaluex} \edef\@p@sbblly{\number\p@intvaluey} \rotate@{\@p@sbburx}{\@p@sbbury} \advance\p@intvaluex by \x@ffsetvalue \advance\p@intvaluey by \y@ffsetvalue \edef\@p@sbburx{\number\p@intvaluex} \edef\@p@sbbury{\number\p@intvaluey} % swap LL and UR if necessary %\typeout{rotated BB: \@p@sbbllx, \@p@sbblly, \@p@sbburx, \@p@sbbury} { \count0=\@p@sbbllx \count1=\@p@sbblly \count2=\@p@sbburx \count3=\@p@sbbury \dimen0=\@p@sbbllx sp\dimen1=\@p@sbblly sp \dimen2=\@p@sbburx sp\dimen3=\@p@sbbury sp \dimen203=\dimen2 \advance\dimen203 by -\dimen0 \dimen204=\dimen3 \advance\dimen204 by -\dimen1 \ifdim\dimen203<0sp \count203=\count2 \count2=\count0 \count0=\count203 \global\edef\@p@sbbllx{\number\count0} \global\edef\@p@sbburx{\number\count2} \fi \ifdim\dimen204<0sp \count204=\count3 \count3=\count1 \count1=\count204 \global\edef\@p@sbblly{\number\count1} \global\edef\@p@sbbury{\number\count3} \fi } %\typeout{after swap BB: \@p@sbbllx, \@p@sbblly, \@p@sbburx, \@p@sbbury} \fi \count203=\@p@sbburx \count204=\@p@sbbury \advance\count203 by -\@p@sbbllx \advance\count204 by -\@p@sbblly \edef\@bbw{\number\count203} \edef\@bbh{\number\count204} %\typeout{ bbh = \@bbh, bbw = \@bbw } } % %%% \in@hundreds performs #1 * (#2 / #3) correct to the hundreds, % then leaves the result in @result % \def\in@hundreds#1#2#3{\count240=#2 \count241=#3 \count100=\count240 % 100 is first digit #2/#3 \divide\count100 by \count241 \count101=\count100 \multiply\count101 by \count241 \advance\count240 by -\count101 \multiply\count240 by 10 \count101=\count240 %101 is second digit of #2/#3 \divide\count101 by \count241 \count102=\count101 \multiply\count102 by \count241 \advance\count240 by -\count102 \multiply\count240 by 10 \count102=\count240 % 102 is the third digit \divide\count102 by \count241 \count200=#1\count205=0 \count201=\count200 \multiply\count201 by \count100 \advance\count205 by \count201 \count201=\count200 \divide\count201 by 10 \multiply\count201 by \count101 \advance\count205 by \count201 % \count201=\count200 \divide\count201 by 100 \multiply\count201 by \count102 \advance\count205 by \count201 % \edef\@result{\number\count205} } \def\compute@wfromh{ % computing : width = height * (bbw / bbh) \in@hundreds{\@p@sheight}{\@bbw}{\@bbh} %\typeout{ \@p@sheight * \@bbw / \@bbh, = \@result } \edef\@p@swidth{\@result} %\typeout{w from h: width is \@p@swidth} } \def\compute@hfromw{ % computing : height = width * (bbh / bbw) \in@hundreds{\@p@swidth}{\@bbh}{\@bbw} %\typeout{ \@p@swidth * \@bbh / \@bbw = \@result } \edef\@p@sheight{\@result} %\typeout{h from w : height is \@p@sheight} } \def\compute@handw{ \if@height \if@width \else \compute@wfromh \fi \else \if@width \compute@hfromw \else \edef\@p@sheight{\@bbh} \edef\@p@swidth{\@bbw} \fi \fi } \def\compute@resv{ \if@rheight \else \edef\@p@srheight{\@p@sheight} \fi \if@rwidth \else \edef\@p@srwidth{\@p@swidth} \fi %\typeout{rheight = \@p@srheight, rwidth = \@p@srwidth} } % %%% Compute any missing values \def\compute@sizes{ \compute@bb \compute@handw \compute@resv } % %%% \epsfig %%% usage : \epsfig{file=, height=, width=, bbllx=, bblly=, bburx=, bbury=, % rheight=, rwidth=, angle=, clip=} % %%% "clip=" is a switch and takes no value, but the `=' must be present. %------------------------------------------------------------------ %%% by the way, possible parameters to the PSfile= command in dvips are: %%% llx %%% lly %%% urx %%% ury %%% rwi % hoffset The horizontal offset (default 0) % voffset The vertical offset (default 0) % hsize The horizontal clipping size (default 612) % vsize The vertical clipping size (default 792) % hscale The horizontal scaling factor (default 100) % vscale The vertical scaling factor (default 100) % angle The rotation (default 0) %------------------------------------------------------------------ \def\psfig#1{\vbox { % do a zero width hard space so that a single % \epsfig in a centering enviornment will behave nicely %{\setbox0=\hbox{\ }\ \hskip-\wd0} % \ps@init@parms \parse@ps@parms{#1} % \ifnum\@p@scost<\@psdraft \typeout{[\@p@sfilefinal]} \if@verbose \typeout{epsfig: using PSFIG macros} \fi \psfig@method \else \epsfig@draft \fi }} \def\epsfig#1{\vbox { % do a zero width hard space so that a single % \epsfig in a centering enviornment will behave nicely %{\setbox0=\hbox{\ }\ \hskip-\wd0} % \ps@init@parms \parse@ps@parms{#1} % \ifnum\@p@scost<\@psdraft \typeout{[\@p@sfilefinal]} \if@clip\use@psfigtrue\fi \if@angle\use@psfigtrue\fi \ifuse@psfig \if@verbose \typeout{epsfig: using PSFIG macros} \fi \psfig@method \else \if@verbose \typeout{epsfig: using EPSF macros} \fi \epsf@method \fi \else \epsfig@draft \fi }} \def\epsf@method{% \epsfgetbb{\@p@sfile}% \epsfsetgraph{\@p@sfilefinal} } \def\psfig@method{% \compute@sizes \special{ps::[begin] \@p@swidth \space \@p@sheight \space% \@p@sbbllx \space \@p@sbblly \space% \@p@sbburx \space \@p@sbbury \space% startTexFig \space }% \if@angle \special {ps:: \@p@sangle \space rotate \space} \fi \if@clip \if@verbose \typeout{(clipped to BB) } \fi \special{ps:: doclip \space }% \fi \special{ps: plotfile \@p@sfilefinal \space }% \special{ps::[end] endTexFig \space }% % Create the vbox to reserve the space for the figure% \vbox to \@p@srheight true sp{\hbox to \@p@srwidth true sp{\hss}\vss} } % % draft figure, just reserve the space and print the % path name. \def\epsfig@draft{ \compute@sizes \if@draftbox % Verbose draft: print file name in box % NOTE: fbox is a LaTeX command! \hbox{\fbox{\vbox to \@p@srheight true sp{ \vss\hbox to \@p@srwidth true sp{ \hss \@p@sfilefinal \hss }\vss }}} \else % Non-verbose draft \vbox to \@p@srheight true sp{% \vss\hbox to \@p@srwidth true sp{\hss}\vss} \fi } \epsfigRestoreAt