From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81166 Path: news.gmane.org!not-for-mail From: Marco Patzer Newsgroups: gmane.comp.tex.context Subject: TeX macro to MP variable Date: Sat, 16 Mar 2013 16:07:31 +0100 Message-ID: <20130316150731.GO9268@homerow> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1810499343==" X-Trace: ger.gmane.org 1363446459 23567 80.91.229.3 (16 Mar 2013 15:07:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Mar 2013 15:07:39 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Mar 16 16:08:04 2013 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 1UGsiK-0000kH-Dy for gctc-ntg-context-518@m.gmane.org; Sat, 16 Mar 2013 16:08:04 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 454D0101EF; Sat, 16 Mar 2013 16:07:41 +0100 (CET) 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 4g+MmT0+u2wN; Sat, 16 Mar 2013 16:07:40 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id DB343101E9; Sat, 16 Mar 2013 16:07:39 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C63C4101E9 for ; Sat, 16 Mar 2013 16:07:38 +0100 (CET) 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 BP7poVPU+S4r for ; Sat, 16 Mar 2013 16:07:37 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id B071F101E3 for ; Sat, 16 Mar 2013 16:07:37 +0100 (CET) Original-Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r2GF7Zfg002190 for ; Sat, 16 Mar 2013 16:07:36 +0100 Original-Received: from c.earth.lavabit.com (c.earth.lavabit.com [192.168.111.12]) by karen.lavabit.com (Postfix) with ESMTP id 779C311B9DB for ; Sat, 16 Mar 2013 10:07:34 -0500 (CDT) Original-Received: from homerow (83.68.239.193) by lavabit.com with ESMTP id KX7NES0C16JG for ; Sat, 16 Mar 2013 10:07:34 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=Q0OG4XjQoHU1eTT/HgPtNfX/XGl6Da0lf97QHFefw9w/wB6ewm2o0ycyee3RcHVLWB1OKZmv1lnNjTZc3C6M8XsS3+Mh7DytAHuu5paYOBaWJWZQuxp9mLSr1aP4reYXCCGHxUVaUG1mMMxsmg/v0f/5YLt022D7Msbt1QF1DVk=; h=Date:From:To:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent; Mail-Followup-To: mailing list for ConTeXt users User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.9419 (Score 4.2, tokens from: @@RPTN) X-CanIt-Geo: ip=72.249.41.33; country=US; region=TX; city=Dallas; postalcode=75204; latitude=32.8019; longitude=-96.7883; metrocode=623; areacode=214; http://maps.google.com/maps?q=32.8019,-96.7883&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0QJcf7zfl - d2ef47ba89b3 - 20130316 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 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:81166 Archived-At: --===============1810499343== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SCOJXUq1iwCn05li" Content-Disposition: inline --SCOJXUq1iwCn05li Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I am looking for a way to assign the value of a TeX macro to an MP variable. However, this only works the first time, then the value is not updated any longer. Example: \startMPdefinitions size = \somesize ; \stopMPdefinitions \startuseMPgraphic{alpha} fill unitcircle scaled size; \stopuseMPgraphic \starttext \def\somesize{1cm} \useMPgraphic{alpha} %% diameter = 1cm \def\somesize{2cm} \useMPgraphic{alpha} %% diameter = 1cm \stoptext I looked into \setupMPvariables, but I couldn't manage to assign them to an MP variable. The setups key from \defineMPinstance seems to to the job, but it's TeX, not MetaPost. What comes to mind is a \processMPbuffer before every MPgraphic: \startbuffer[foo] size := \somesize ; \stopbuffer \startuseMPgraphic{alpha} fill unitcircle scaled size; \stopuseMPgraphic \starttext \def\somesize{1cm} \processMPbuffer[foo] \useMPgraphic{alpha} %% diameter = 1cm \def\somesize{2cm} \processMPbuffer[foo] \useMPgraphic{alpha} %% diameter = 2cm \stoptext Is there a better way? Marco --SCOJXUq1iwCn05li Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRRIqzAAoJEPGqVaNSn0iKZNQH/0QkS1Rm4d8jDTIHlfYuT8/i 8gIvO1cY49zeAg/8Vc3+IT+SAUsu0+m1MlFbkdVxPrQvML/8zzQWwYoVaiJpoJwz PREN8RXPKw+mHO0QXSXAwCEdz7ACXieik2wbN/rMdWmKSefBN4UVQM7CgSX/hVIw /2zvGxpCkr+CV8VeSd4bJeGyqTfVwgc92KIVEY8bHaP3ohNIc0K+y8PJq3o0gn0o dwB/e2zqrulrawaSJV9fSOYWVLfdqKOUZ6/0mCv9zHX4/BampLPJQUxNoJHis6LQ bC8piobWwrLyp1k+NPBcvKftJLt3hHsEFQIvuiRq/n6bGs9uRHGin95SGPI1rws= =wtkK -----END PGP SIGNATURE----- --SCOJXUq1iwCn05li-- --===============1810499343== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1810499343==--