From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/43945 Path: news.gmane.org!not-for-mail From: "Thomas A. Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: fitting a picture to the available space Date: Fri, 12 Sep 2008 14:37:42 +0200 Message-ID: <4E2E560C-EA58-424D-A7CB-06FB1BDCCF8E@uni-bonn.de> References: <396E487E-2550-48FB-BF43-BC51ED2388F4@uni-bonn.de> <48C8C8AA.8080003@wxs.nl> <115224fb0809110713w734719bl2c547d8897a0c442@mail.gmail.com> <3452072A-ED37-44F0-BC02-C4386C288080@uni-bonn.de> <8CF62E00-1F4E-4E9E-8AA8-85BB3F12DD50@uni-bonn.de> <6CC7A5A8-9679-4501-B8D0-34571BD72038@uni-bonn.de> <115224fb0809120014w21fdf697n1f4221d9a4d3839c@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221223176 28750 80.91.229.12 (12 Sep 2008 12:39:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Sep 2008 12:39:36 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Sep 12 14:40:32 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Ke7wr-0004lE-Vx for gctc-ntg-context-518@m.gmane.org; Fri, 12 Sep 2008 14:40:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 96A921FBFB; Fri, 12 Sep 2008 14:39:27 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 09070-04-3; Fri, 12 Sep 2008 14:38:42 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6A63C1FC90; Fri, 12 Sep 2008 14:38:42 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5FFC11FB49 for ; Fri, 12 Sep 2008 14:38:40 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 09070-04-2 for ; Fri, 12 Sep 2008 14:38:01 +0200 (CEST) Original-Received: from mailout06.t-online.de (mailout06.t-online.de [194.25.134.19]) by ronja.ntg.nl (Postfix) with ESMTP id 6BFEF1FC90 for ; Fri, 12 Sep 2008 14:38:01 +0200 (CEST) Original-Received: from fwd04.aul.t-online.de by mailout06.sul.t-online.de with smtp id 1Ke7uS-0008Fl-02; Fri, 12 Sep 2008 14:38:00 +0200 Original-Received: from [192.168.0.2] (XpisMcZpQhg5oTmsSagR2tqAe8fkbfaEGvLYE4uyUxouHyKAjpjO9G+77liDcSnQCO@[87.178.100.19]) by fwd04.aul.t-online.de with esmtp id 1Ke7uA-1kogwS0; Fri, 12 Sep 2008 14:37:42 +0200 In-Reply-To: <115224fb0809120014w21fdf697n1f4221d9a4d3839c@mail.gmail.com> X-Mailer: Apple Mail (2.926) X-ID: XpisMcZpQhg5oTmsSagR2tqAe8fkbfaEGvLYE4uyUxouHyKAjpjO9G+77liDcSnQCO@t-dialin.net X-TOI-MSGID: e585e2f6-52a2-4189-84dd-efb74ff981de X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:43945 Archived-At: On Sep 12, 2008, at 9:14 AM, Wolfgang Schuster wrote: > You should close the box before you want to get it's dimensions. :-) That seems like a reasonable suggestion... I had been copy-pasting and adapting my code. > > > \unprotect > > \def\????bf{@@@@bf} > > \presetlocalframed[\????bf] > > \def\boxfigure[#1][#2]% > {\bgroup > \setbox\scratchbox\hbox{\externalfigure[#1]}% > \!!dimena\wd\scratchbox > \!!dimenb\ht\scratchbox > \localframed > [\????bf] > [\c!strut=\v!no, > \c!width=8cm, > \c!height=6cm, > #2] > \bgroup > \!!dimena\dimexpr\hsize/\!!dimena\relax > \!!dimenb\dimexpr\vsize/\!!dimenb\relax > \ifdim\!!dimena>\!!dimenb > \externalfigure[mill][height=\vsize] > \else > \externalfigure[mill][width=\hsize] > \fi > \egroup > \egroup} > > \protect > > \starttext > > \boxfigure[mill][width=8cm,height=2cm] > > \boxfigure[mill][width=2cm,height=8cm] > > \stoptext > > Wolfgang Wow, that looks good! I could adapt this to my circumstances, and it seems to do exactly what I want! Hans: could something like this be added to the core? The keywords "max fit broad" for the "factor" option are already taken, so what about "fill"? But I guess it only makes sense if we can test and adapt to the current vbox (not necessarily the page). Anyway: Wolfgang, thanks a lot, this does exactly what I want! All best Thomas ___________________________________________________________________________________ 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 ___________________________________________________________________________________