From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31144 Path: news.gmane.org!not-for-mail From: Sanjoy Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: MPenvironment \def gives "Parameters must be numbered consecutively" Date: Sat, 30 Sep 2006 16:46:02 +0100 Message-ID: References: <6faad9f00609290929m4f03532asf0b1abb4ce26500f@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1159631225 21591 80.91.229.2 (30 Sep 2006 15:47:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 30 Sep 2006 15:47:05 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sat Sep 30 17:47:03 2006 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 ciao.gmane.org with esmtp (Exim 4.43) id 1GTh3G-0006YW-7o for gctc-ntg-context-518@m.gmane.org; Sat, 30 Sep 2006 17:46:56 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9E5CB1FE5A; Sat, 30 Sep 2006 17:46:52 +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 08548-03; Sat, 30 Sep 2006 17:46:45 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 47F9D1FE51; Sat, 30 Sep 2006 17:46:45 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0C3401FE51 for ; Sat, 30 Sep 2006 17:46: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 08707-02 for ; Sat, 30 Sep 2006 17:46:29 +0200 (CEST) Original-Received: from mraos.ra.phy.cam.ac.uk (mraos.ra.phy.cam.ac.uk [131.111.48.8]) by ronja.ntg.nl (Postfix) with SMTP id 475331FE3D for ; Sat, 30 Sep 2006 17:46:27 +0200 (CEST) Original-Received: from skye.ra.phy.cam.ac.uk ([131.111.48.158] ident=mail) by mraos.ra.phy.cam.ac.uk with esmtp (Exim 4.43) id 1GTh2n-0005ZL-KD; Sat, 30 Sep 2006 16:46:25 +0100 Original-Received: from sanjoy by skye.ra.phy.cam.ac.uk with local (Exim 3.36 #1) id 1GTh2Q-0007Vc-00; Sat, 30 Sep 2006 16:46:02 +0100 Original-To: mailing list for ConTeXt users In-Reply-To: Your message of "Fri, 29 Sep 2006 18:29:05 +0200." <6faad9f00609290929m4f03532asf0b1abb4ce26500f@mail.gmail.com> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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:31144 Archived-At: > never try to do tricky stuff like definitions inside MPenvironement, > because it is parsed and changed slightly. I'm learning that lesson too. Another one: "don't use btex..etex instead use \sometxt". So I now try to use the MPenvironment only for font and size switching (e.g. if I want the figures to be in a smaller font). I wikified a small example of converting to \sometxt: . It's probably not in the right place on the wiki though. > \def\a{abc} > > \starttext > \startMPcode > label(\sometxt{\a},origin); > \stopMPcode > \stoptext > > Would that kind of approach satisfy your needs? It would. I've used this sed script to help me convert my standalone metapost files: sed 's/btex (.*) etex/\\sometxt{\1}/' < standalone.mp But for the next chapter's figures, I'll write a python script that will do the other transformations: e.g. turn each beginfig into \startstaticMPfigure -- or is it \startstaticMPgraphic? I always have to check, hence I'll put it in a script and have *it* remember. I know that metafun was made for integrating backgrounds and the like, not for standalone figures, so it may seem strange to convert all of one's standalone figures into metafun figures and place them in the .tex source file. But I like having the source for the standalone figures in the same file near their use: it's figure--text integration (one theme of Tufte's books), done in the source file. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.