From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30946 Path: news.gmane.org!not-for-mail From: Sanjoy Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: does metafun require texexec --final? Date: Sat, 23 Sep 2006 15:03:57 +0100 Message-ID: References: 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 1159020258 26102 80.91.229.2 (23 Sep 2006 14:04:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 23 Sep 2006 14:04:18 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sat Sep 23 16:04:16 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 1GR873-0008CF-6L for gctc-ntg-context-518@m.gmane.org; Sat, 23 Sep 2006 16:04:13 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0801D1FDF7; Sat, 23 Sep 2006 16:04:12 +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 10873-01; Sat, 23 Sep 2006 16:04:06 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A9E621FDE2; Sat, 23 Sep 2006 16:04:06 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 845B51FDE2 for ; Sat, 23 Sep 2006 16:04:03 +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 10833-02 for ; Sat, 23 Sep 2006 16:03:59 +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 332341FDDD for ; Sat, 23 Sep 2006 16:03:58 +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 1GR86n-00016V-5s; Sat, 23 Sep 2006 15:03:57 +0100 Original-Received: from sanjoy by skye.ra.phy.cam.ac.uk with local (Exim 3.36 #1) id 1GR86n-0004cH-00; Sat, 23 Sep 2006 15:03:57 +0100 Original-To: mailing list for ConTeXt users In-Reply-To: Your message of "Sat, 23 Sep 2006 00:48:34 EDT." 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:30946 Archived-At: [Hans: Feature suggestion for figure inclusion at the end...] I wrote: > So, is --final a requirement when using metafun, or am I hacking > around a problem I've caused by leaving something out? An answer is that I should set \runMPgraphicstrue. I thought it was automatically set, half-remembering what Aditya said in the previous thread on metafun. So the following works (changing the r changes the result right away without requiring --final or requiring two texexec runs): ========= cut here ================== \runMPgraphicstrue \starttext \startreusableMPgraphic{a} r := 1cm; fill fullcircle scaled r; \stopreusableMPgraphic \placefigure[force,none]{}{\reuseMPgraphic{a}} the figure above should be a small circle \stoptext ========= cut here ================== To see where and when \runMPgraphicstrue was done, I looked into the metafun interface code, and asked grep for help: $ grep '\\runMPgraphicstrue' *.tex s-pre-02.tex:113:%D switch \type {\runMPgraphicstrue} to the local file \type supp-mps.tex:1195:%D \runMPgraphicstrue supp-mps.tex:1209:%D \type{\runMPgraphicstrue}, the \METAPOST\ scratch file supp-mps.tex:1653:%D \global\runMPgraphicstrue supp-mps.tex:1991: \runMPgraphicstrue So it's commented-in only at line 1991, which is part of a new (to me) method of figure inclusion: \startstaticMPgraphic, which says "Dedicated to Aditya Mahajan. See meta-ini for usage", so I see how Aditya would conclude that \runMPgraphicstrue is always true :-) The following therefore also works to get instant updating, and is more efficient than reusable MP graphics in that it reruns metapost on included figures only when they change: ========= cut here ================== % no need to set \runMPgraphicstrue \starttext % see how smart staticMPfigure is by changing r here but not % in the figure definition itself. Will it re-metapost the graphic? % Answer: It's smart. \startMPinclusions r := 1cm; \stopMPinclusions \startstaticMPfigure{a} fill fullcircle scaled r; \stopstaticMPfigure \placefigure[force,none]{}{\usestaticMPfigure[a]} the figure above should be a small or large circle \stoptext ========= cut here ================== Which I just now see is on the Wiki page about metafun (I'd been working from the excellent metafun manual). It's doubly smart in that changing the papersize (which changes the layout parameters, which are included in the metapost file) will rerun the graphic, even if r stays the same. So the graphic can base itself on those parameters and be updated when needed. Thanks, Hans and Aditya! While experimenting with the methods of figure inclusion, I've been changing among \reuseMPgraphic, \usestaticMPfigure, \useMPgraphic, and \externalfigure to call up the figure. Do all the figure labels live in the same namespace? In which case (warning: feature suggestion!) when they are defined, e.g. with \useexternalfigure, \startstaticMPfigure, ..., could the label have associated with it the command that calls it up? So one could do for all types: \usefigure[thelabel] and ConTeXt would figure out what kind of figure it is and turn \usefigure into the appropriate one (\reuseMPgraphic, ...). Then speaking purely hypothetically of course: If, after learning metafun, one decides to turn many external metapost figures into metafun figures (and then static figures instead of reusable figures), the figure placement commands don't have change. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.