From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/77976 Path: news.gmane.org!not-for-mail From: Olivier Binda Newsgroups: gmane.comp.tex.context Subject: Re: Struggling with ConTeXt Date: Wed, 22 Aug 2012 12:31:00 +0200 Message-ID: <5034B4E4.40601@wanadoo.fr> References: <501A9CCB.1010400@wanadoo.fr> <5032B9D5.6080003@wanadoo.fr> <5034968E.90304@wanadoo.fr> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345631486 13483 80.91.229.3 (22 Aug 2012 10:31:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Aug 2012 10:31:26 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 22 12:31:20 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T48DW-0005NK-V2 for gctc-ntg-context-518@m.gmane.org; Wed, 22 Aug 2012 12:31:19 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D0381101E8; Wed, 22 Aug 2012 12:31:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xewO-flPRvqZ; Wed, 22 Aug 2012 12:31:09 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id CF3B2101EA; Wed, 22 Aug 2012 12:31:09 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5EF0D101EA for ; Wed, 22 Aug 2012 12:31:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xpm9ilCrTJeE for ; Wed, 22 Aug 2012 12:31:03 +0200 (CEST) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id 5FC09101E8 for ; Wed, 22 Aug 2012 12:31:03 +0200 (CEST) Original-Received: from smtp.smtpout.orange.fr (smtp07.smtpout.orange.fr [80.12.242.129]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q7MAV1rQ011716 for ; Wed, 22 Aug 2012 12:31:01 +0200 Original-Received: from [192.168.0.10] ([88.166.223.223]) by mwinf5d66 with ME id pmX11j0054pomkg03mX1Rn; Wed, 22 Aug 2012 12:31:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=80.12.242.129; country=FR; latitude=46.0000; longitude=2.0000; http://maps.google.com/maps?q=46.0000,2.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0NHNKv1yO - ab95ff578309 - 20120822 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:77976 Archived-At: On 22/08/2012 10:42, Aditya Mahajan wrote: > On Wed, 22 Aug 2012, Olivier Binda wrote: > >> Thank you for the tips. >> >> Here, I cleaned up the code some more (sorry to have left stuff over >> last time),. >> >> I added some explanations to make my issue clearer >> >> >> \startusableMPgraphic{myFrame} >> draw OverlayBox withpen pencircle scaled 1pt withcolor green; >> draw (currentpicture enlarged 2cm) withcolor red withpen pencircle >> scaled 2pt; >> \stopusableMPgraphic >> >> \defineoverlay[myOverlay][\useMPgraphic{myFrame}] >> \defineframedtext[myStatement][frame=off] >> \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force] >> >> \starttext >> \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement} >> In the first test, I would like the black box to have the dimensions >> of the red box. > > \defineframed[myStatement][background=myOverlay, > offset=overlay,width=fit] > \dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}} > In the first test, I would like the black box to have the dimensions > of the red box. > >> \blank[big,big,big,big,big,big,big,big,big,big] >> >> \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement} >> In the second test, I'm going to demonstrate the issue by flowing >> text around the framed text, the green color {\em and the red color} >> shouldn't touch the flowing text as I want the float box to include >> the text box {\em and the overlay box.} > > \placefigure[left,none]{}{\framed[strut=no, > offset=2cm Thanks for the help. But I'm affraid that this won't do as I won't know/I am not supposed to know the dimensions of the bounding box of the overlay I'll use. :/ For the sake of the minimal example, I only enlarged the picture by 2cm, but in real production situations, the bounding box is going to be enlarged by random offset, because the overlay will have various parts with weird shapes (super ellipse, squeezed rectangles) that go beyond the original text boundaries (like in the Zapf frametext example of the Context manual : the title is protruding out of the main box and if you put weird stuff in there, you won't know the dimensions). I don't want to manually calculate those offsets, I would like metapost to pass it's bounding box dimensions for the overlay to context so that it automatically applies the correct offset to the text+overlay > ]{\myStatement{SECOND TEST}}} > .... > > If needed, you can hide this behind macros: > > \def\startmyStatement > {\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup} > > \def\stopmyStatement > {\egroup\egroup} > > Aditya > ___________________________________________________________________________________ > > 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 : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ___________________________________________________________________________________ > > ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________