OT (Re: [pdftex] simple graphics question)

Radhakrishnan C V cvr at river-valley.com
Fri Feb 16 22:10:08 CET 2001


: >>>>> "siepo" == siepo  <siepo at cybercomm.nl> writes:
: 
:     > That reminds me: once upon a time I needed a macro to
:     > automatically scale an eps graphic proportionally to fit within
:     > a given rectangle. So the figure would fit horizontally if it
:     > was wide, or vertically if it was tall. I loaded epsf because it
:     > provided access to the boundingbox parameters, but I used the
: 


\def\myincludegraphics#1#2#3{%
       \global\setbox0=\hbox{\includegraphics{#3}}%
       \ifdim\ht0>\wd0%
        \includegraphics[height=#1]{#3}%
        \else%
       \ifdim\wd0>\ht0%
        \includegraphics[width=#2]{#3}%
        \else%
       \ifdim\wd0=\ht0%%
        \includegraphics[height=#1,widht=#2,keepaspectratio]{#3}%
       \fi\fi\fi
}

The usage is 

 \myincludegraphics{<height>}{<width>}{<graphic file>}



-- 
Radhakrishnan
-------------------------------------------------------------------
GPG Fingerprint: 208E F5EB A4B4 2024 AEE9  575D 13DE E3B9 0292 70EF
GPG Public key : http://www.river-valley.com/gpg/cvr.gpg




More information about the pdftex mailing list