<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%
% pts_img.sty -- better include image files (EPS or PDF) into TeX documents
% by pts@fazekas.hu at Wed Jan  8 16:12:53 CET 2003
%
% pdftex at Fri Jan 10 02:21:17 CET 2003
% laemu.sty at Fri Jan 24 13:19:59 CET 2003
% at Sun Jan 26 20:44:09 CET 2003
%
% The routines in this file don't need the image to be present.
%

\expandafter\ifx\csname ifLaTeX\endcsname\relax\input laemu.sty\relax\fi%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pts_img}[2003/01/24 v0.0 include images]
\RequirePackage{div16b}
%\input div16b.tex
%\catcode`\@=11 % \makeatletter

% --- utilities

% by pts@fazekas.hu at Fri Jan 10 00:38:14 CET 2003
%
%** Places a box of width #1, height #2, depth #3. A rectangular dot of size
%** `1sp' will be placed to the llx and ury corners. The reference point is
%** not moved. The dots will have white color.
%**   Don't pass \dimen0 as arguments!
\def\@@spbox#1#2#3{\hbox to0sp{%
  \@@img@push@white%\special{color push White}%
  \dimen0=#3 \relax\dimen0-\dimen0\advance\dimen0 1sp%
  \vrule width1sp height\dimen0 depth#3%
  \kern#1 \kern-2sp%
  \dimen0=#2 \relax\dimen0-\dimen0\advance\dimen0 2sp%
  \vrule width1sp height#2 depth\dimen0%
  \@@img@pop%\special{color pop}%
  \hss%
}}%

% \def\@empty{}% not needed for LaTeX, needed for plain TeX

\def\@@one{1}% must be a macro

{\catcode`p=12\catcode`t=12\gdef\@@mkb#1pt{#1}}% no p,t in @@mkb
{\catcode`p=12\catcode`t=12\gdef\@@mkbi#1.#2pt{#1}}% no p,t in @@mkb

%** by pts@fazekas.hu at Fri Jan 10 01:14:31 CET 2003
%** Expands to the result of the division #1/100.
%** @param #1 a possibly negative decimal integer (-12) or real number
%**   (34.56), or a possibly negated \count register specification (-\count5)
\def\@@divhundred#1{%
  \expandafter\@@divhundred@c\number#1..\end%
}%
\def\@@divhundred@c#1{%
  % Dat: \number will gobble extra leading zeroes after expansion
  \if#1-%
    -\number\expandafter\@@divhundred@d%
  \else%
    \number\expandafter\@@divhundred@e%
  \fi%
  #1%
}%
\def\@@divhundred@d#1{\@@divhundred@a00}%
\def\@@divhundred@e{\@@divhundred@a00}%
\def\@@divhundred@a#1#2#3{%
  \if#3.%
    .#1#2\expandafter\@@divhundred@b%
  \else%
    #1\expandafter\@@divhundred@a%
  \fi%
  #2#3%
}%
\def\@@divhundred@b#1#2#3.#4\end{#3}% Dat: gobble #1 and #2 

% Regression test:
%\count0=42
%\count1=-7
%%\@@divhundred\alma{123}%
%\message{\@@divhundred{1.45}}%
%\message{\@@divhundred{12.45}}%
%\message{\@@divhundred{123.45}}%
%\message{\@@divhundred{1234.5}}%
%\message{\@@divhundred{12345.}}%
%\message{\@@divhundred{-\count0}}%
%\message{\@@divhundred{-0137}}%
%\message{\@@divhundred{-\count1}}%
%\message{\@@divhundred{100}}% 1.00

%** `\@@img@pdfsq#\@empty' expands to #, but `\' changed to `\\', `\(' changed
%** to `\(' and `)' changed to '\)'. This is suitable for encoding something
%** inside a PDF string. Discards space tokens, so the user should call
%** \@@quotespace first.
\def\@@img@pdfsq#1{%
  \ifx\@empty#1%
  \else
    %\ifx\space#1\noexpand\space\else% would preserve \space
      \if(\noexpand#1\@@img@pdfsq@bs\fi
      \if)\noexpand#1\@@img@pdfsq@bs\fi
      \if\@@img@pdfsq@bs\noexpand#1\@@img@pdfsq@bs\fi
      #1%
    %\fi
    \expandafter\@@img@pdfsq
  \fi
}%
\edef\@@img@pdfsq@bs{\expandafter\@gobble\string\\}% a backslash

%** Expands to #1, but all space tokens are replaced by the `\space' control
%** sequence.
%**   Doesn't work if the space is inside curly braces, but this condition can
%** never happen, because beginning-of-group tokens are prohibited in #1.
%** @param #1 must not contain characters of category beginning-of-group,
%**   end-of-group, active-chararacter or control-sequence (not even \space)
\def\@@quotespace#1{%
  \@@quotespace@lowa#1 \hsize\@gobble: %
  % ^^^ \hsize is an arbitrary non-character token for which \ifx\hsize\hsize is true
}%
\def\@@quotespace@lowa#1 {%
  \ifx\hsize#1\@empty%
  \else%
    #1% gobble the very first space (to balance the extra space added to the end by \@@quotespace)
    \expandafter\@@quotespace@lowb
  \fi
}%
\def\@@quotespace@lowb#1 {%
  \ifx\hsize#1\@empty%
    % ^^^ doesn't matter if #1 is more than one token unless \ifx is true
    % ^^^ \@empty is there in case #1 is empty, so `\ifx\hsize\@empty' will be called
  \else%
    \noexpand\space#1%
    \expandafter\@@quotespace@lowb
  \fi
}%

% Regression test:
%\message{s[\@@quotespace{}]}% s[] 
%\message{s[\@@quotespace{ }]}% s[\space ]
%\message{s[\@@quotespace{a  }]}% s[a\space ] % Note that `  ' is a single space token!
%\message{s[\@@quotespace{ b}]}% s[\space b]
%\message{s[\@@quotespace{\space b}]}% s[ b] % arument of \@@quotespace must not contain any control sequence
%\message{s[\@@quotespace{aa bb}]}% s[aa\space bb] 
%\edef\@tempa{{a\space\space bc }}%
%\message{s[\expandafter\@@quotespace\@tempa]}% s[a\space \space bc\space ]


%\message{(\@@img@pdfsq a)l(ma\\;}%

%** \edef#1{} if #1 == expand(#2)
%** @param #1 must not be \@tempa
\def\@@img@supportsit#1#2{%
  \begingroup%
  \edef\@tempa{#2}%
  \ifx#1\@tempa%
    \edef\@tempa{\noexpand\def\noexpand#1{}}%
    \expandafter\endgroup\@tempa
  \else
    \endgroup
  \fi
}%
%\def\@tempb{EPS}%
%\@@img@supportsit\@tempb{EPST}
%\message{(\@tempb)}

% --- driver selection

\def\@@img@driver{}%

\expandafter\ifx\csname pdfoutput\endcsname\relax \chardef\pdfoutput=0 \fi
\expandafter\ifx\csname pdftexversion\endcsname\relax \chardef\pdftexversion=0 \fi

%** @param #1 desired driver name; examples:
\def\@@img@setdriver#1{%
  %\message{setdriver}%
  \ifx\@@img@driver\@empty%
    \edef\@@img@driver{#1}%
    \ifx\@@img@driver\@empty% empty arg
      \expandafter\ifx\csname graphicPdriver\endcsname\relax% guess the driver
        \def\@@img@driver{dvi}% compatible with dvipdfm, dvips and xdvi
        % \expandafter\ifx\csname pdfoutput\endcsname\relax\else% we have already defined it
        \ifnum\pdfoutput&gt;0 %
          \def\@@img@driver{pdftex}%
        \fi%
      \else% Example: latex '\def\graphicPdriver{dvipdfm}\input laltest.tex'
        \edef\@@img@driver{\graphicPdriver}%
      \fi%
    \fi%
    %\errmessage{\@@img@driver}%
    % vvv do driver intitializations
    % vvv Imp: meaningful error if not found
    \expandafter\ifx\csname @@imgdriver@\@@img@driver\endcsname\relax%
      %\errmessage{img driver unknown: "#1"}%
      \@@img@warnerr0{driver unknown: `\@@img@driver'}\@ehc%
      \def\@@img@driver{dvi}% fallback
    \fi
    \csname @@imgdriver@\@@img@driver\endcsname% c@r@y@p@t@i@c, eh?
  \else%
    \edef\@tempa{#1}%
    \ifx\@tempa\@@img@driver\else
      \errmessage{cannot override img driver: `\@@img@driver' -&gt; `#1'}%
    \fi
  \fi%
}%

%
% The Driver interface expects the following macros from the driver:
%
%** Divides by 65536
%** @param #1 \cs to be defined
%** @param #2 number to be divided
%\def\@@img@divword#1#2{...}
%\def\@@img@div#1#2#3{...}
%** Obsolete.
%\def\@@img@mul#1#2#3{...}
%** @deprecated
%** @param #1 key
%** @param #2 value
%\def\@@img@kv#1#2{...}
%** @param #1 expands to filename
%** @param #2 xscale (number in percent, 100 == no scale)
%** @param #3 yscale (number in percent, 100 == no scale)
%** @param #4 expands to FileFormat (not in \@@img@ff)
%\def\@@img@special#1#2#3{...}#4
%** \edef#1{} iff the FileFormat specified in the contents of #1 is supported
%** by the driver.
%** @param #1 a macro \cs
%\def\@@img@supported##1
%** "eps", "pdf" etc.
%\def\@@img@defext{...}
%** Does the driver translate the image automatically as if bbox.llx==0 &amp;&amp;
%** bbox.lly=0? "1" or "0"
%\def\@@img@zeroll{...}

% --- Implementations of the Driver interface

\def\@@imgdriver@dvips{% dvips, xdvi
  \def\@@img@supported##1{%
    \@@img@supportsit##1{EPS}%
    \@@img@supportsit##1{MPS}%
  }%
  \def\@@img@zeroll{0}%
  \def\@@img@defext{eps}%
  \def\@@img@push@white{\special{color push White}}%
  \def\@@img@pop{\special{color pop}}%
  \def\@@img@divword##1##2{%
    \edef##1{##2\space 65536 div}%
  }%
  \def\@@img@div##1##2##3{%
    \edef\@@img@tmp{##3}%
    \ifx\@@img@tmp\@@one% do not divide by 1
      \edef##1{##2}%
    \else%
      \edef##1{##2\space ##3\space div}%
    \fi%
  }%
  %\def\@@img@kv##1##2{##2\space @##1}%
  \def\@@img@special##1##2##3##4{{%
    \def\@@tmp@c{100}%
    \edef\@@tmp@x{##2}%
    \edef\@@tmp@y{##3}%
    \special{ps: @beginspecial %
      \ifx\@@tmp@c\@@tmp@x\else##2 @hscale \fi% Imp: cmp w/o limits
      \ifx\@@tmp@c\@@tmp@y\else##3 @vscale \fi% Imp: cmp w/o limits
      @setspecial%
    }%
    \special{ps: plotfile "##1"}%
    \special{ps: @endspecial}%
  }}%
}% &lt;/driver dvips}

\def\@@imgdriver@dvipdfm{%
  \def\@@img@MPS{MPS}% helper for \ifx
  \def\@@img@EPS{EPS}% helper for \ifx
  \def\@@img@PDF{PDF}% helper for \ifx
  \def\@@img@supported##1{% v0.13.2b
    \@@img@supportsit##1{EPS}% via the command in -D in dvipdfm/config
    \@@img@supportsit##1{MPS}% natively (without HiReSB*), even with .ps extension
    \@@img@supportsit##1{PDF}%
    \@@img@supportsit##1{JPEG}%
    \@@img@supportsit##1{PNG}%
  }%
  \def\@@img@zeroll{0}%
  \def\@@img@defext{pdf}%
  \def\@@img@push@white{\special{color push White}}%
  \def\@@img@pop{\special{color pop}}%
  \def\@@img@divword##1##2{{%
    \dimen0 ##2 sp%
    \edef##1{\expandafter\@@mkb\the\dimen0}%
    \@@keepdefaftergroup##1%
  }}%
  %\def\@@img@kv##1##2{##1=##2}%
  \def\@@img@suppCount{0}%
  \def\@@img@special##1##2##3##4{{%
    % This could be easy, but we do the hard way because
    % -- PNG and JPEG images have to be scaled up by a factor of 100/72. This
    %    seems to be an intentional misfeature of dvipdfm, because the ebb(1)
    %    utility outputs bounding boxes scaled down by 72/100.
    % -- for PNG and JPEG images \special{pdf: usexobj @N} doesn't work
    %    properly if N represents an Image XObject. (it outputs a
    %    scaled-down, square-shaped image) So we create a Form XObject.
    % -- a Form XObject crops the negative left sidebearing of its contents,
    %    so we must not use it for MPS, EPS and PDF images. We use an Image
    %    XObject then.
    % -- MPS seems to work fine, nothing is cropped by PSfile=... (it is
    %    obviously not an Image XObject, as defined by PDFRef.pdf)
    \def\@@tmp@c{1.00}% 100 --\@@divhundred--&gt; 1.00
    \edef\@@tmp@x{\@@divhundred##2}%
    \edef\@@tmp@y{\@@divhundred##3}%
    \edef\@@tmp@ff{##4}%
    \edef\@@tmp@ff{%
      \ifx\@@tmp@ff\@@img@MPS 1\else%
      \ifx\@@tmp@ff\@@img@EPS 1\else%
      \ifx\@@tmp@ff\@@img@PDF 1\else%
      \ifx\@@tmp@ff\@empty 1\else%
      0\fi\fi\fi\fi
    }%
    % vvv need additional scaling for non-MPS, non-EPS, non-PDF images
    \if0\@@tmp@ff% not a scalable format (PNG or JPEG)
      % stupid dvipdfm 0.13.2b: PNG and JPEG images must be upscaled 100/72
      % Do an equivalent of \special{pdf: bt scale 1.38888888}
      \begingroup
      \dimen0=\@@tmp@x pt \dimen0=1.3888888\dimen0 % Imp: more accurate??
      \dimen1=\@@tmp@y pt \dimen1=1.3888888\dimen1 %
      %\message{##4;}%
      \edef\@@tmp@x{\noexpand\def\noexpand\@@tmp@x{\expandafter\@@mkb\the\dimen0}%
                    \noexpand\def\noexpand\@@tmp@y{\expandafter\@@mkb\the\dimen1}}%
      \expandafter\endgroup\@@tmp@x
      \def\@@tmp@c{1.0}% 1 --\the--&gt; 1.0pt
    \fi%
    % vvv define \special{pdf: bt ...} and \special{pdf: et}
    \edef\@@tmp@xy{%
      \ifx\@@tmp@c\@@tmp@x\else\space xscale \@@tmp@x\fi%
      \ifx\@@tmp@c\@@tmp@y\else\space yscale \@@tmp@y\fi%
    }%
    \ifx\@@tmp@xy\@empty%
      \let\@@tmp@xy\@empty
      \let\@@tmp@et\@empty
    \else
      \edef\@@tmp@xy{\noexpand\special{pdf: bt\@@tmp@xy}}%
      \def\@@tmp@et{\special{pdf: et}}%
    \fi
    %\message{[\@@tmp@xy]}%
    %
    \edef\@@img@cs{@@xi@##1}% remember only the filename, because of the bug
    \@@tmp@xy
    \expandafter\ifx\csname\@@img@cs\endcsname\relax%
      \count0=\@@img@suppCount\relax%
      %\message{tc0=\the\count0;\@@img@suppCount}%
      \advance\count0 1%
      %\edef\@@img@suppCount{\noexpand\def\noexpand\@@img@suppCount{\the\count0}}%
      \global\edef\@@img@suppCount{\the\count0}%
      \global\expandafter\edef\csname\@@img@cs\endcsname{\@@img@suppCount}%
      %\message{alloced(\csname\@@img@cs\endcsname)}%
      \if0\@@tmp@ff% not a scalable format (PNG or JPEG)
        % vvv crops if bbox.llx is negative
        \special{pdf: bxobj @p_i\@@img@suppCount\space width 16383pt height 16383pt depth 16383pt}%
        \special{PSfile="##1"}% safely omit \@@img@pdfsq
        \special{pdf: exobj}%
        \special{pdf: uxobj @p_i\csname\@@img@cs\endcsname}%
      \else
        %\edef\@@tmp@ff{\expandafter\string\csname\@@img@cs\endcsname}% do the expansion before \@@img@pdfsq
        %\chardef\space=0 %
        \edef\@@tmp@ff{##1}% must be fully expanded before \@@tmp@ff. Imp: \string
        \edef\@@tmp@ff{\expandafter\@@quotespace\expandafter{\@@tmp@ff}}% do the expansion before \@@img@pdfsq
        %\def\space{ }%
        %\show\@@tmp@ff%
        %\message{pdf: image @p_i\@@img@suppCount(\expandafter\@@img@pdfsq\@@tmp@ff\@empty)}%
        \special{pdf: image @p_i\@@img@suppCount(\expandafter\@@img@pdfsq\@@tmp@ff\@empty)}%
      \fi
    \else%
      \special{pdf: uxobj @p_i\csname\@@img@cs\endcsname}%
    \fi%
    \@@tmp@et
    %\if0\@@tmp@ff% not a scalable format (PNG or JPEG)
    %  \special{pdf: et}%
    %\fi
  }}%
}% &lt;/driver dvipdfm&gt;

\def\@@imgdriver@dvi{%
  \@@imgdriver@dvipdfm%
  \def\@@img@defext{eps}%
  \def\@@img@supported##1{% v0.13.2b
    \@@img@supportsit##1{EPS}%
    \@@img@supportsit##1{MPS}%
  }%
  \def\@@img@special##1##2##3##4{{% works for both dvips and dvipdfm
    \def\@@tmp@c{100}%
    \edef\@@tmp@x{##2}%
    \edef\@@tmp@y{##3}%
    \edef\@@tmp@ff{##4}%
    \special{PSfile="##1"%
      \ifx\@@tmp@c\@@tmp@x\else\space hscale=##2\fi% Imp: cmp w/o limits
      \ifx\@@tmp@c\@@tmp@y\else\space vscale=##3\fi% Imp: cmp w/o limits
    }%
  }}%
}%
\def\@@imgdriver@invisible{%
  \def\@@img@push@white{}%
  \def\@@img@pop{}%
  \def\@@img@divword##1##2{{%
    \dimen0 ##2 sp%
    \edef##1{\expandafter\@@mkb\the\dimen0}%
    \@@keepdefaftergroup##1%
  }}%
  \def\@@img@zeroll{1}%
  \def\@@img@defext{eps}%
  \def\@@img@supported##1{%
    \let##1\@empty% supports all file formats
  }%
  \def\@@img@special##1##2##3##4{}% works for all dvips, dvipdfm and pdftex :-)
}%
\def\@@imgdriver@blackbox{%
  \@@imgdriver@invisible% inherit
  \def\@@img@special##1##2##3##4{% works for all dvips, dvipdfm and pdftex :-)
    %\vrule width\DW sp height\URY sp depth\DP sp % if not lowered
    \vrule width\DW sp height\DH sp % if already lowered
  }
}%
\def\@@imgdriver@frame{%
  \@@imgdriver@invisible% inherit
  \def\@@img@special##1##2##3##4{% works for all dvips, dvipdfm and pdftex :-)
    %\vrule width\DW sp height\URY sp depth\DP sp % if not lowered
    \hbox to0sp{\vrule height\@@img@framewidth width\DW sp\hss}% bottom
    \raise\DH sp\hbox to0sp{\vrule height0sp depth\@@img@framewidth width\DW sp\hss}% top
    \hbox to\DW sp{%
      \vrule height\DH sp width\@@img@framewidth \hss% left
      \vrule height\DH sp width\@@img@framewidth% right
    }%
    %\vrule width\DW sp height\DH sp % if already lowered
  }
}%
\def\@@imgdriver@namedframe{%
  \@@imgdriver@invisible% inherit
  \def\@@img@special##1##2##3##4{% works for all dvips, dvipdfm and pdftex :-)
    %\vrule width\DW sp height\URY sp depth\DP sp % if not lowered
    \hbox to0sp{\vrule height\@@img@framewidth width\DW sp\hss}% bottom
    \raise\DH sp\hbox to0sp{\vrule height0sp depth\@@img@framewidth width\DW sp\hss}% top
    \hbox to\DW sp{%
      \vrule height\DH sp width\@@img@framewidth \hss% left
      \vrule height\DH sp width\@@img@framewidth% right
    }%
    \kern-\DW sp%
    % vvv Imp: use \textascii to typeset \textbar etc. in the filename
    \setbox0=\hbox{\@@img@framefont\raise1ex\hbox{\expandafter\expandafter\expandafter\@gobble\expandafter\string\csname##1\endcsname}}%
    \wd0=0sp \ht0=0sp \dp0=0sp \copy0%
    %\vrule width\DW sp height\DH sp % if already lowered
  }
}%
\def\@@img@framewidth{.4pt}% used by the frameonly and namedframe drivers
\def\@@img@framefont{\ttfamily\space}% Dat: \space: don't overwrite the frame

\def\@@imgdriver@pdftex{%
  \expandafter\ifx\csname graphicPnopdftexmpost\endcsname\relax%
    % Don't load \convertMPtoPDF support in ConTeXt supp-pdf.tex if
    % \usepackage[nopdftexmpost]{graphicP} was specified, because supp-pdf
    % uses plenty of TeX resources.
    \edef\@tempa{% Imp: allow user not load this
      \catcode`\noexpand\!\the\catcode`\!
      \catcode`\noexpand\@\the\catcode`\@
      \catcode`\noexpand\?\the\catcode`\?
      \catcode`\noexpand\`\the\catcode`\`
      \catcode`\noexpand\"\the\catcode`\"
    }%
    % Dat: \unprotect is the macro that fails without \catcode96=12
    \catcode96=12% ` is active in Babel magyar.ldf; does many harm on supp-pdf
    \catcode34=12% " is active in Babel germanb.ldf; no harm on supp-pdf, but play it safe
    \LaemuInputQuiet{supp-pdf}%
    \@tempa%
  \fi%
  \@@imgdriver@@pdftexlow
  % ^^^ must be a separate macro, otherwise supp-pdf won't load (limit exceeded)
}%

\def\@@imgdriver@@pdftexlow{%
  \def\@@img@MPS{MPS}% helper for \ifx
  \expandafter\ifx\csname convertMPtoPDF\endcsname\relax%
    \def\@@img@suppMPS##1{}%
  \else
    \def\@@img@suppMPS##1{%
      \ifx##1\@@img@MPS%
        \def\@@img@zeroll{1}% \convertMPtoPDF assumes it, overrides when \pdftexversion&lt;13
        \let##1\@empty%
      \fi%
    }%
  \fi
  \def\@@img@supported##1{%
    \@@img@supportsit##1{PDF}%
    \@@img@supportsit##1{PNG}%
    \@@img@supportsit##1{TIFF}%
    \@@img@supportsit##1{JPEG}%
    \@@img@suppMPS##1%
  }%
  \def\@@img@zeroll{1}%
  \def\@@img@defext{pdf}%
  % Imp: implement a real color _stack_
  \def\@@img@@curcolor{0 g}% Dat: pdftex.def sets `0 g 0 G'
  \def\@@img@push@white{\pdfliteral {1 g}}%
  \def\@@img@pop{\pdfliteral {\@@img@@curcolor}}%
  \def\@@img@divword##1##2{{%
    \dimen0 ##2 sp%
    \edef##1{\expandafter\@@mkb\the\dimen0}%
    \@@keepdefaftergroup##1%
  }}%
  %\def\@@img@tobp##1##2{{%
  %  \dimen0 ##2 sp%
  %  \dimen0 0.996264\dimen0% pt -&gt; bp
  %  \edef##1{\expandafter\@@mkb\the\dimen0}%
  %  \@@keepdefaftergroup##1%
  %}}%
  \def\@@img@kv##1##2{##1=##2}%
  \def\@@img@special##1##2##3##4{{%
    \def\@@tmp@c{1.00}%
    \edef\@@tmp@x{\@@divhundred##2}%
    \edef\@@tmp@y{\@@divhundred##3}%
    \edef\@@tmp@ff{##4}%
    %\message{\@@tmp@x*\@@tmp@y}%
    \ifx\@@tmp@ff\@@img@MPS%
      %\errmessage{embedding MetaPost to PDF}%
      % vvv Use ConTeXt supp-pdf.tex
      \convertMPtoPDF{##1}{\@@tmp@x}{\@@tmp@y}% Dat: fine, does --below margins right
    \else%
      \pdfliteral{ q \@@tmp@x\space 0 0 \@@tmp@y\space 0 0 cm}%
      \hbox to0sp{%
        \@@pdfimagecompat{}{##1}%
      \hss}%
      %\pdfliteral direct{q h 0 0 m 0 1 l h W* Q}% SUXX: cannot set clipping path :-(
      \pdfliteral{ Q}%
    \fi%
    %\special{PSfile="##1"%
    %  \ifx\@@tmp@c\@@tmp@x\else\space hscale=##2\fi% Imp: cmp w/o limits
    %  \ifx\@@tmp@c\@@tmp@y\else\space vscale=##3\fi% Imp: cmp w/o limits
    %}%
  }}%
  %
  % This is how pdftex.def detects pdftex version:
  %\ifx\pdftexversion\@undefined
  %  \def\@@pdftex@release{1}%
  %\else
  %  \ifnum\pdftexversion&lt;12
  %    \def\@@pdftex@release{2}%
  %  \else
  %    \ifnum\pdftexversion&lt;13
  %      \ifnum \expandafter `\pdftexrevision &lt; `n
  %        \def\@@pdftex@release{3}%
  %      \else
  %        \def\@@pdftex@release{4}%
  %      \fi
  %    \else
  %      \ifnum\pdftexversion=13
  %        \def\@@pdftex@release{5}%
  %      \else
  %        \ifnum\pdftexversion=14
  %          \def\@@pdftex@release{6}%
  %        \else
  %          \def\@@pdftex@release{7}%
  %        \fi
  %      \fi
  %    \fi
  %  \fi
  %\fi
  %
  %\ifnum\pdftexversion&lt;13% older, Debian Slink
  %\else\ifnum\pdftexversion&lt;15% newer, SuSE 6.2 and Debian Potato
  %\else\ifnum\pdftexversion&gt;99% newest, Debian Woody
  %
  % vvv before Sun Feb  9 20:06:01 CET 2003
  %\ifnum\pdftexversion&lt;13% older, Debian Slink
  %  \def\@@img@zeroll{0}%
  %  \def\@@pdfimagecompat##1##2{\pdfimage##1\noexpand\noexpand\noexpand\@empty ##2 \relax}%
  %  % Note the magic in front of the file name after \pdfimage, to
  %  % prevent it fouling up with file names starting with "depth".
  %\else%
  %  \ifnum\pdftexversion&lt;15% newer, SuSE 6.2 and Debian Potato
  %    \def\@@pdfimagecompat##1##2{\pdfimage##1 {##2}}%
  %  \else% newest, Debian Woody
  %    \def\@@pdfimagecompat##1##2{%
  %       \edef\@@img@cs{@@xi@##2}% remember only the filename, because of the bug
  %       \expandafter\ifx\csname\@@img@cs\endcsname\relax%
  %         \immediate\pdfximage##1{##2}% Dat: \immediate\pdfteximage solved a bug in pdftex_bug.tex
  %         \global\expandafter\edef\csname\@@img@cs\endcsname{\the\pdflastximage}%
  %       \fi%
  %       %\expandafter\expandafter\expandafter\pdfrefximage%
  %       \expandafter\pdfrefximage\csname\@@img@cs\endcsname%
  %     }%
  %  \fi%
  %\fi%
  % I have evaluated the use of \pdfxform / \pdfform instead of \pdfximage
  % on older pdfTeXes (Debian Slink), and I got terrible results. pdfTeX
  % insists on cropping the image to the size of the \hbox, and there are
  % also other strange, excess cropping effects (especially on
  % f2mletter.pdf), so I gave up and reverted to \pdfimage. Currently I
  % don't know of any solution that uses \pdfxform, and doesn't embed the
  % same image multiple times.
  \expandafter\ifx\csname pdfximage\endcsname\relax
    \expandafter\ifx\csname pdfimage\endcsname\relax
      \@@img@warnerr0{Need either \string\pdfximage or \string\pdfimage.}\@ehc
    \fi
    \ifnum\pdftexversion&lt;13% older, Debian Slink
      \def\@@img@zeroll{0}%
      \def\@@pdfimagecompat##1##2{\pdfimage##1\noexpand\noexpand\noexpand\@empty ##2 \relax}%
    \else
      \def\@@pdfimagecompat##1##2{\pdfimage##1 {##2}}%
    \fi
  \else
    %** param ##1 attrs "width ... height ... depth ..."
    %** param ##2 expands to filename
    \def\@@pdfimagecompat##1##2{%
      % pdfTeX, Version 3.14159-1.00a-pretest-20011114-ojmw (Web2C 7.3.7)
      % has a bug that prevents including the same image with different
      % /XObject numbers. (Actually, \immediate\pdfximage also solves the
      % problem. 
      %  So we cache /XObject numbers already allocated.
      % Caching is a good idea anyway, so the output PDF file will be
      % smaller.
      \edef\@@img@cs{@@xi@##2}% remember only the filename, because of the bug
      \expandafter\ifx\csname\@@img@cs\endcsname\relax%
        \immediate\pdfximage##1{##2}% Dat: \immediate\pdfteximage solved a bug in pdftex_bug.tex
        \global\expandafter\edef\csname\@@img@cs\endcsname{\the\pdflastximage}%
      \fi%
      %\expandafter\expandafter\expandafter\pdfrefximage%
      \expandafter\pdfrefximage\csname\@@img@cs\endcsname%
    }%
  \fi
}% &lt;/driver pdftex&gt;

% ---- main PutImage code

\expandafter\ifx\csname @@img@forceunknown\endcsname\relax
  %** What to do if the FileFormat is unknown/unsupported by the driver?
  %** 0: PackageError, skip
  %** 1: PackageWarning, skip
  %** 2: PackageWarning, include the image
  \def\@@img@forceunknown{0}% \let and \chardef are not good (both \if and \ifnum)
\fi

%** @param #1 error if 0; warning otherwise
\def\@@img@warnerr#1#2#3{%
  \if0#1%
    \PackageError{pts_img}{#2}{#3}%
  \else  
    \PackageWarning{pts_img}{#2}%
  \fi
}%

%** @param #1..#4 \count register spec
%** @param #5..#8 dimensions
\def\@@img@letbbox#1#2#3#4#5#6#7#8{%
  \@@letdimcountany{#1}{#5}{bp}%
  \@@letdimcountany{#2}{#6}{bp}%
  \@@letdimcountany{#3}{#7}{bp}%
  \@@letdimcountany{#4}{#8}{bp}%
}%

%\def\@@gobblecomma#1,#2\end{}%
\def\@@img@minus{-}%

%** Puts a \hbox containing the specified image. Doesn't open the image file.
%**   New arguments may be added in subsequent versions
%** @param #1 dimension (in image pixels or image bp) to raise above the
%**   baseline. May contain a double minus sign. Default metric unit is `bp'.
%**   If omitted, then negative bbox.lly will be converted to a lowering.
%** @param #2 empty or overrides \@@img@forceunknown
%** @param #3 ignored
%** @param #4 {llx}{lly}{urx}{ury}
%** @param #5 desired width, or 0pt
%** @param #6 desired height+depth, or 0pt
%** @param #7 0 if noclip, 1 if clip [ignored]
%** @param #8 filename
%** @param #9 FileFormat
\def\@@PutImage#1#2#3#4#5#6#7#8#9{%
  \ifx\@@img@driver\@empty%
    \@@img@setdriver{}% guess a resonable default
  \fi%
 {%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else \edef\@@img@forceunknown{#2}\fi%
  \countdef\LLX1 \countdef\LLY2 \countdef\URX3 \countdef\URY4 %
  \@@img@letbbox\LLX\LLY\URX\URY#4%
  %\countdef\LLX1 \@@letdimcount\LLX{#1}% old default: sp
  \countdef\DW 5 \@@letdimcount\DW {#5}%
  \countdef\DH 6 \@@letdimcount\DH {#6}%
  \countdef\WD 7 \WD\URX \advance\WD-\LLX%
  % Imp: check for \ifnum\WD&lt;0, the same for height
  \countdef\UP 8 \UP0%
  \edef\@tempa{#1}%
  \ifx\@tempa\@@img@minus \let\@tempa\@empty\fi
  \ifx\@tempa\@empty% calculate lowering from the image
    \ifnum0&lt;\LLY \UP-\LLY \advance\URY-\LLY \LLY0 \fi
    % ^^^ Dat: LLY&lt;0 and LLY&gt;=0 are treated quite differently
    % ^^^ -\LLY BUGFIX at Sun Feb  9 21:50:23 CET 2003
  \else
    \UP-\LLY \advance\URY-\LLY %
    \@@letdimcountany\LLY{#1}{bp}%
    \advance\URY\LLY%
    \advance\UP\LLY%
  \fi
  \countdef\DP 9 \DP-\LLY%
  \countdef\MLX10 \MLX-\LLX%
  \countdef\TC 11% temporary count register
  \countdef\TH 12 \TH\URY \advance\TH\DP% total height+depth
  \countdef\SW 13 % width scale facter
  \countdef\SH 14 % height scale factor
  % Now: LLY=-depth URY=height
  \def\DOhscale{100}% horizontal scale
  \def\DOvscale{100}% vertical scale
  \ifnum0&gt;\DW
    \PackageError{pts_img}{Desired width must be positive}\@ehc
    \DW0%
  \fi%
  \ifnum0&gt;\DH
    \PackageError{pts_img}{Desired height must be positive}\@ehc
    \DH0%
  \fi%
  \ifnum\DH&gt;0%
    \@@muldivletposdim\SH{100pt}\DH\TH%
    \ifnum\DW&gt;0% both \DW and \DH are given
      \@@muldivletposdim\SW{100pt}\DW\WD%
      %\message{100pt*\the\DH/\the\TH=\the\SH;100pt*\the\DW/\the\WD:\the\SW}%
      % ^^^ 100*5594039/1973452=18577140;100*3729359/1315635:18577134
      % I've verified that \@@muldivletposdim works accurately, but the input
      % values are inaccurate!
      \@@muldivletposdim\MLX\MLX\DW\WD%
    \else% \DH given, calculate \DW from it
      \@@muldivletposdim\DW\DH\WD\TH%
      % if initially DW==0: TC:=(DH*WD/TH)/WD; should be: TC:=DH/TH
      \SW\SH%
      \@@muldivletposdim\MLX\MLX\DH\TH%
    \fi%
    \@@muldivletposdim\UP\UP\DH\TH%
    \ifnum\DP=0% \DP=0 &lt;=&gt; \URY=\TH
      \URY=\DH%
    \else%
      \@@muldivletposdim\URY\URY\DH\TH%
      \@@muldivletposdim\DP\DP\DH\TH%
    \fi%
  \else%
    \ifnum\DW&gt;0% \DW given, calculate \DH from it
      \@@muldivletposdim\SW{100pt}\DW\WD%
      \SH\SW%
      \@@muldivletposdim\DH\TH\DW\WD%
      \@@muldivletposdim\UP\UP\DW\WD%
      \ifnum\DP=0% \DP=0 &lt;=&gt; \URY=\TH
        \URY=\DW%
      \else%
        \@@muldivletposdim\URY\URY\DW\WD%
        \@@muldivletposdim\DP\DP\DW\WD%
      \fi%
      \@@muldivletposdim\MLX\MLX\DH\TH%
    \else% \DW and \DH are not given
      \DW=\WD \DH=\TH%
    \fi%
  \fi%
  %
  \ifnum\DW=\WD\else% vvv scale width
    \@@img@divword\DOhscale{\the\SW}%
    %\edef\DOhscale{\@@img@kv{hscale}{\DOhscale} }%
  \fi%
  \ifnum\DH=\TH\else% vvv scale height
    \@@img@divword\DOvscale{\the\SH}%
    %\edef\DOvscale{\@@img@kv{vscale}{\DOvscale} }%
  \fi%
  % Dat: we replace `@beginspecial @hoffset' with \raise...\hbox{\kern...}',
  % because dvipdfm version 0.13.2b ignores @hoffset and @voffset
  %\ifnum\MLX=0\else%
  %  %\@@img@div\TMP{\the\MLX}{65781.76}% Dat: 65781.76 == 65536/72*72.27
  %  % Dat: dvipdfm doesn't support @hoffset
  %\fi%
  %\ifnum\UP=0\else% Imp: create test case
  %\fi%
  %
  % vvv aid `dvips -E' bbox calculation
  \@@spbox{\DW sp}{\URY sp}{\DP sp}%
  % vvv Dat: \special{PSfile=...} calculates bbox incorrectly with
  %     dvips 5.86e, and xdvi the bbox even if it shouldn't. So I decided to
  %     use \special{ps: plotfile}, which is understood by both dvips and
  %     xdvi.
  % ^^^ is this still true? (test it!) (how is a bbox calculated)
  \edef\@@img@ff{#9}% FileFormat
  \@@img@supported\@@img@ff% driver sets it to empty if supported
  %\message{ffsupp=(\@@img@ff)}%
  \ifx\@@img@ff\@empty\else%
    % Only a warning, because further implementations may support it in fact.
    %\message{\@@img@forceunknown!}%
    \@@img@warnerr\@@img@forceunknown{Unsupported FileFormat `#9' for driver `\@@img@driver'\MessageBreak in image file `#8'}\@ehc%
    \expandafter\ifnum\@@img@forceunknown&gt;1 \let\@@img@ff\@empty\fi
  \fi%
  \ifx\@@img@ff\@empty% include the image only if FileFormat is known
    %\edef\@@img@ff{#9}%
    \ifnum\@@img@zeroll=1 %
      \vrule width0pt % leave vertical mode
      \lower\DP sp\hbox to0pt{\@@img@special{#8}\DOhscale\DOvscale{#9}\hss}%
    \else%
      %\message{#8:::\the\UP;;; }%
      \setbox1=\hbox{\raise\UP sp\hbox to0pt{\kern\MLX sp
        \@@img@special{#8}\DOhscale\DOvscale{#9}%
      \hss}}%
      \dp1=0sp \ht1=0sp \copy1% TeX overestimates box size because of \raise
    \fi%
  \fi
  % vvv Really put the \hbox there
  \hbox to\DW sp{\vrule width0sp height\URY sp depth\DP sp\hss}%
}}%

%\@@imgdriver@pdftex
</pre></body></html>