📄 epsf.tex
字号:
% `other' so we process the file in almost verbatim mode % (TeXbook, p. 344). \chardef\other=12 \def\do##1{\catcode`##1=\other}% \dospecials \catcode`\ =10 \epsffileoktrue %true while we are looping \epsfatendfalse %[02-Jul-1996]: add forgotten initialization \loop %reading lines from the EPS file \read\epsffilein to \epsffileline \ifeof\epsffilein %then no more input \epsffileokfalse %so set completion flag \else %otherwise process one line \expandafter\epsfaux\epsffileline:. \\% \fi \ifepsffileok \repeat \ifepsfbbfound \else \ifepsfverbose \immediate\write16{No BoundingBox comment found in % file #1; using defaults}% \fi \fi }% %end catcode changes \closein\epsffilein \fi %end of file processing \epsfsetsize %compute size parameters \epsfstatus{#1}%}%%% Clipping control:\def\epsfclipon{\def\epsfclipstring{ clip}}%\def\epsfclipoff{\def\epsfclipstring{\ifepsfdraft\space clip\fi}}%\epsfclipoff % default for dvips is OFF%% The special that is emitted by \epsfsetgraph comes from this macro.% It is defined separately to allow easy customization by other% packages that first \input epsf.tex, then redefine \epsfspecial.% This macro is invoked in the lower-left corner of a box of the% width and height determined from the arguments to \epsffile, or% from the %%BoundingBox in the EPS file itself.%% This version is for dvips:\def\epsfspecial#1{% \epsftmp=10\epsfxsize \divide\epsftmp\pspoints \ifnum\epsfrsize=0\relax \special{PSfile=\ifepsfdraft psdraft.ps\else#1\fi\space llx=\epsfllx\space lly=\epsflly\space urx=\epsfurx\space ury=\epsfury\space rwi=\number\epsftmp \epsfclipstring }% \else \epsfrsize=10\epsfysize \divide\epsfrsize\pspoints \special{PSfile=\ifepsfdraft psdraft.ps\else#1\fi\space llx=\epsfllx\space lly=\epsflly\space urx=\epsfurx\space ury=\epsfury\space rwi=\number\epsftmp rhi=\number\epsfrsize \epsfclipstring }% \fi}%%% \epsfframe macro adapted from the TeXbook, exercise 21.3, p. 223, 331.% but modified to set the box width to the natural width, rather% than the line width, and to include space for margins and rules\def\epsfframe#1%{% \leavevmode % so we can put this inside % a centered environment \setbox0 = \hbox{#1}% \dimen0 = \wd0 % natural width of argument \advance \dimen0 by 2\epsfframemargin % plus width of 2 margins \advance \dimen0 by 2\epsfframethickness % plus width of 2 rule lines \vbox {% \hrule height \epsfframethickness depth 0pt \hbox to \dimen0 {% \hss \vrule width \epsfframethickness \kern \epsfframemargin \vbox {\kern \epsfframemargin \box0 \kern \epsfframemargin }% \kern \epsfframemargin \vrule width \epsfframethickness \hss }% end hbox \hrule height 0pt depth \epsfframethickness }% end vbox}%%\def\epsfsetgraph#1%{% % % Make the vbox and stick in a \special that the DVI driver can % parse. \vfil and \hfil are used to place the \special origin at % the lower-left corner of the vbox. \epsfspecial can be redefined % to produce alternate \special syntaxes. % \leavevmode \hbox{% so we can put this in \begin{center}...\end{center} \ifepsfframe\expandafter\epsfframe\fi {\vbox to\epsfysize {% \ifepsfshow % output \special{} at lower-left corner of figure box \vfil \hbox to \epsfxsize{\epsfspecial{#1}\hfil}% \else \vfil \hbox to\epsfxsize{% \hss \ifepsfshowfilename {% \epsfframemargin=3pt % local change of margin \epsfframe{{\tt #1}}% }% \fi \hss }% \vfil \fi }% }}% % % Reset \epsfxsize and \epsfysize, as documented above. % \global\epsfxsize=0pt \global\epsfysize=0pt}%%% Now we have to calculate the scale and offset values to use.% First we compute the natural sizes.%\def\epsfsetsize{% \epsfrsize=\epsfury\pspoints \advance\epsfrsize by-\epsflly\pspoints \epsftsize=\epsfurx\pspoints \advance\epsftsize by-\epsfllx\pspoints%% If `epsfxsize' is 0, we default to the natural size of the picture.% Otherwise we scale the graph to be \epsfxsize wide.% \epsfxsize=\epsfsize{\epsftsize}{\epsfrsize}% \ifnum \epsfxsize=0 \ifnum \epsfysize=0 \epsfxsize=\epsftsize \epsfysize=\epsfrsize \epsfrsize=0pt%% We have a sticky problem here: TeX doesn't do floating point arithmetic!% Our goal is to compute y = rx/t. The following loop does this reasonably% fast, with an error of at most about 16 sp (about 1/4000 pt).% \else \epsftmp=\epsftsize \divide\epsftmp\epsfrsize \epsfxsize=\epsfysize \multiply\epsfxsize\epsftmp \multiply\epsftmp\epsfrsize \advance\epsftsize-\epsftmp \epsftmp=\epsfysize \loop \advance\epsftsize\epsftsize \divide\epsftmp 2 \ifnum \epsftmp>0 \ifnum \epsftsize<\epsfrsize \else \advance\epsftsize-\epsfrsize \advance\epsfxsize\epsftmp \fi \repeat \epsfrsize=0pt \fi \else \ifnum \epsfysize=0 \epsftmp=\epsfrsize \divide\epsftmp\epsftsize \epsfysize=\epsfxsize \multiply\epsfysize\epsftmp \multiply\epsftmp\epsftsize \advance\epsfrsize-\epsftmp \epsftmp=\epsfxsize \loop \advance\epsfrsize\epsfrsize \divide\epsftmp 2 \ifnum \epsftmp>0 \ifnum \epsfrsize<\epsftsize \else \advance\epsfrsize-\epsftsize \advance\epsfysize\epsftmp \fi \repeat \epsfrsize=0pt \else \epsfrsize=\epsfysize \fi \fi}%%% Issue some status messages if the user requested them%\def\epsfstatus#1{% arg = filename \ifepsfverbose \immediate\write16{#1: BoundingBox: llx = \epsfllx\space lly = \epsflly\space urx = \epsfurx\space ury = \epsfury\space}% \immediate\write16{#1: scaled width = \the\epsfxsize\space scaled height = \the\epsfysize}% \fi}%%% We still need to define the tricky \epsfaux macro. This requires% a couple of magic constants for comparison purposes.%{\catcode`\%=12 \global\let\epsfpercent=%\global\def\epsfbblit{%BoundingBox}}%\global\def\epsfatend{(atend)}%%% So we're ready to check for `%BoundingBox:' and to grab the% values if they are found.%% If we find a line%% %%BoundingBox: (atend)%% then we ignore it, but set a flag to force parsing all of the% file, so the last %%BoundingBox parsed will be the one used. This% is necessary, because EPS files can themselves contain other EPS% files with their own %%BoundingBox comments.%% If we find a line%% %%BoundingBox: llx lly urx ury%% then we save the 4 values in \epsfllx, \epsflly, \epsfurx, \epsfury.% Then, if we have not previously parsed an (atend), we flag completion% and can stop reading the file. Otherwise, we must keep on reading% to end of file so that we find the values on the LAST %%BoundingBox.\long\def\epsfaux#1#2:#3\\%{% \def\testit{#2}% % save second character up to just before colon \ifx#1\epsfpercent % then first char is percent (quick test) \ifx\testit\epsfbblit % then (slow test) we have %%BoundingBox \epsfgrab #3 . . . \\% \ifx\epsfllx\epsfatend % then ignore %%BoundingBox: (atend) \global\epsfatendtrue \else % else found %%BoundingBox: llx lly urx ury \ifepsfatend % then keep parsing ALL %%BoundingBox lines \else % else stop after first one parsed \epsffileokfalse \fi \global\epsfbbfoundtrue \fi \fi \fi}%%% Here we grab the values and stuff them in the appropriate definitions.%\def\epsfempty{}%\def\epsfgrab #1 #2 #3 #4 #5\\{% \global\def\epsfllx{#1}\ifx\epsfllx\epsfempty \epsfgrab #2 #3 #4 #5 .\\\else \global\def\epsflly{#2}% \global\def\epsfurx{#3}\global\def\epsfury{#4}\fi}%%% We default the epsfsize macro.%\def\epsfsize#1#2{\epsfxsize}%%% Finally, another definition for compatibility with older macros.%\let\epsffile=\epsfbox\endinput
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -