ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
Subject: Re: does metafun require texexec --final?
Date: Sat, 23 Sep 2006 18:16:27 +0200	[thread overview]
Message-ID: <20060923181627.440dc0c7.schuster.wolfgang@googlemail.com> (raw)
In-Reply-To: <E1GR86n-0004cH-00@skye.ra.phy.cam.ac.uk>

On Sat, 23 Sep 2006 15:03:57 +0100
Sanjoy Mahajan <sanjoy@mrao.cam.ac.uk> wrote:

> [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
> 

Hi Sanjoy,

you should also look in your cont-sys.tex if \runMPgraphicstrue is
enabled for every ConTeXt run. 

Wolfgang

  reply	other threads:[~2006-09-23 16:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-23  4:48 Sanjoy Mahajan
2006-09-23 14:03 ` Sanjoy Mahajan
2006-09-23 16:16   ` Wolfgang Schuster [this message]
2006-09-23 16:46     ` Sanjoy Mahajan
2006-09-23 17:26       ` Wolfgang Schuster
2006-09-24  8:22       ` Mojca Miklavec
2006-09-24  8:37         ` Taco Hoekwater
2006-09-24 19:37       ` Hans Hagen
2006-09-25 19:32         ` Peter Münster
2006-09-26 10:05           ` Hans Hagen
2006-09-26 12:07             ` Sanjoy Mahajan
2006-09-27 10:10               ` Patrick Gundlach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060923181627.440dc0c7.schuster.wolfgang@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).