Thomas A. Schmitz wrote: > On Sep 11, 2008, at 4:13 PM, Wolfgang Schuster wrote: > >> On Thu, Sep 11, 2008 at 3:28 PM, Thomas A. Schmitz >> <[EMAIL PROTECTED]> wrote: >>> On Sep 11, 2008, at 10:04 AM, Thomas A. Schmitz wrote: >>> >>>> On Sep 11, 2008, at 9:28 AM, Hans Hagen wrote: >>>> >>>>> \starttext >>>>> >>>>> \framed[width=5cm,height4cm]{\externalfigure[mill.png] >>>>> [maxwidth=3cm,maxheight=4cm,width=10cm]} >>>>> >>>>> \stoptext >>>>> >>>>> seems to work >>>> Ah of course! I could set the width to an absurdly high number and >>>> so >>>> make sure that it will always reach the maxheight/maxwidth, no >>>> matter >>>> what the ratio! This seems to work, thanks a lot! >>>> >>> Alas, I spake too soon. Here is an example: >>> >>> \starttext >>> >>> \framed[frame=on,strut=no,width=8cm,height=2cm] >>> {\externalfigure[mill.png][maxwidth=8cm,maxheight=2cm,width=10cm]} >>> >>> \stoptext >>> >>> I would expect the picture to stay within the maxheight, but it >>> doesn't. >> You could write your own macros and comapre the width/height ration >> of the >> picture with the reation of the box, is simple example is shown below. >> >> \starttext >> >> \start >> >> \setbox\scratchbox\vbox{\externalfigure[mill]} >> >> \dimen0=\wd\scratchbox >> \dimen2=\ht\scratchbox >> >> \framed[frame=on,strut=no,width=8cm,height=2cm] >> {\dimen1=\hsize \divide\dimen1 by \dimen0 >> \dimen3=\vsize \divide\dimen3 by \dimen2 >> \ifdim\dimen1>\dimen3 >> \externalfigure[mill][height=\vsize] >> \else >> \externalfigure[mill][width=\hsize] >> \fi} >> >> \framed[frame=on,strut=no,width=2cm,height=8cm] >> {\dimen1=\hsize \divide\dimen1 by \dimen0 >> \dimen3=\vsize \divide\dimen3 by \dimen2 >> \ifdim\dimen1>\dimen3 >> \externalfigure[mill][height=\vsize] >> \else >> \externalfigure[mill][width=\hsize] >> \fi} >> >> \stop >> >> \stoptext >> >> Wolfgang > > Wolfgang, > > as always, you're a source of wisdom and knowledge... Just I > understand this correctly and can adapt it to my macro: \dimen1= > \hsize: here \hsize refers to the size of the \framed inside which > we're operating, right?
be careful ... use \dimen4 and 6 instead of 1 and 3, by convention odd registers < 10 are used global ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________