From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60579 Path: news.gmane.org!not-for-mail From: Oliver Buerschaper Newsgroups: gmane.comp.tex.context Subject: Re: Passing info from MetaPost to TeX Date: Sun, 1 Aug 2010 12:16:45 +0200 Message-ID: <38DD56B8-F7E1-47EE-8C41-4146D4BBD780@mpq.mpg.de> References: <4C48A86C.7050505@wxs.nl> <14EF1920-A946-478D-A0F6-FE67F0E66933@mpq.mpg.de> <4C527966.3030504@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280657829 371 80.91.229.12 (1 Aug 2010 10:17:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 Aug 2010 10:17:09 +0000 (UTC) Cc: Hoekwater Taco To: mailing ConTeXt users list for Original-X-From: ntg-context-bounces@ntg.nl Sun Aug 01 12:17:07 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OfVbO-0006dY-F6 for gctc-ntg-context-518@m.gmane.org; Sun, 01 Aug 2010 12:17:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 34D22C9E05; Sun, 1 Aug 2010 12:17:05 +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 3ygWTX6jUlL9; Sun, 1 Aug 2010 12:17:02 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 516CFC9E01; Sun, 1 Aug 2010 12:17:02 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 49CE3C9E02 for ; Sun, 1 Aug 2010 12:17:01 +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 SqRPNIndM4hQ for ; Sun, 1 Aug 2010 12:16:49 +0200 (CEST) Original-Received: from post.rzg.mpg.de (post.rzg.mpg.de [130.183.30.42]) by balder.ntg.nl (Postfix) with ESMTP id C9724C9DCD for ; Sun, 1 Aug 2010 12:16:49 +0200 (CEST) Original-Received: from [192.168.0.13] (95.pool85-49-237.dynamic.orange.es [85.49.237.95]) (authenticated bits=0) by post.rzg.mpg.de (8.14.3/8.14.3) with ESMTP id o71AGkdj1536014 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 1 Aug 2010 12:16:48 +0200 In-Reply-To: <4C527966.3030504@elvenkind.com> X-Mailer: Apple Mail (2.1081) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:60579 Archived-At: Hi Taco, > Well, you could create a temporary file from withing the metapost > graphic, then read that file back on the TeX side, and then shift > the image vertically based on the info from that. Could you give me a hint on how to parse such an auxiliary file in TeX? I've never done any sort of that programming before... I'm asking... > Complicated and a bit ugly, but doable. A nicer solution is to > adjust the bounging box of the image itself so that it does the > right thing. This seems to do the trick (but I recall there is > a way to pass a TeX variable to the figure; and that would be much > cleaner; but I don't remember how offhand). > > > \startuseMPgraphic{diagram2} > u := StrutHeight; > draw origin--(2u,0)--(u,sqrt(3)*u)--cycle; > currentpicture := currentpicture shifted (0,-(sqrt(3)*u/3)); > setbounds currentpicture to (origin--(2u,0)--(u,sqrt(3)*u)--cycle); > \stopuseMPgraphic > > \starttext > > \startformula > A\raise\Umathaxis\displaystyle\hbox{\useMPgraphic{diagram2}} > =B > \stopformula > > \stoptext ... because adjusting the bounding box fails once the figure grows a bit larger. Just use u := 3StrutHeight; in the code above and you'll see the effect. Thanks for your help, Oliver ___________________________________________________________________________________ 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 ___________________________________________________________________________________