ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* is there a problem with local definitions in metafun?
@ 2000-12-08 16:41 Denis B. Roegel
  2000-12-08 19:18 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Denis B. Roegel @ 2000-12-08 16:41 UTC (permalink / raw)
  Cc: Denis B. Roegel

When porting a standard metapost example to context,
I noticed that there was a problem with local definitions.
For instance, in my original file, I had

beginfig(1);

 ...
 def ...

 vardef ...

 other code
endfig;
end

But I first naively translated this into

\startuseMPgraphic{dummy}

 ...
 def ...

 vardef ...

 other code
\stopuseMPgraphic

(as it works for an example in the metafun manual)

It didn't work with my example and I had to split the code:

\startMPinclusions

 ...
 def ...

 vardef ...
\stopMPinclusions

\startuseMPgraphic{dummy}
 other code
\stopuseMPgraphic

Is there an explanation for this?

Thanks,

Denis


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is there a problem with local definitions in metafun?
  2000-12-08 16:41 is there a problem with local definitions in metafun? Denis B. Roegel
@ 2000-12-08 19:18 ` Hans Hagen
  2000-12-08 21:25   ` Denis B. Roegel
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2000-12-08 19:18 UTC (permalink / raw)
  Cc: ntg-context, Denis B. Roegel

At 05:41 PM 12/8/00 +0100, Denis B. Roegel wrote:
>When porting a standard metapost example to context,
>I noticed that there was a problem with local definitions.
>For instance, in my original file, I had
>
>beginfig(1);
>
> ...
> def ...
>
> vardef ...
>
> other code
>endfig;
>end
>
>But I first naively translated this into
>
>\startuseMPgraphic{dummy}
>
> ...
> def ...
>
> vardef ...
>
> other code
>\stopuseMPgraphic
>
>(as it works for an example in the metafun manual)
>
>It didn't work with my example and I had to split the code:
>
>\startMPinclusions
>
> ...
> def ...
>
> vardef ...
>\stopMPinclusions
>
>\startuseMPgraphic{dummy}
> other code
>\stopuseMPgraphic
>
>Is there an explanation for this?

I don't understand this. Everything between start/stop...MPgraphic becomes
a begin/endfig, so local defs should end up there. 

A problem can arise when one graphic defined a macro and another one uses
it, while the graphics are processed independently. 

You can so things like: 

\startuseMPgraphic{common}
  some code
\stopuseMPgraphic

\startuseMPgraphic{aaa}
  \includeMPgraphic{common}
   some more code 
\stopuseMPgraphic

\useMPgraphic{aaa}

Hans

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: is there a problem with local definitions in metafun?
  2000-12-08 19:18 ` Hans Hagen
@ 2000-12-08 21:25   ` Denis B. Roegel
  0 siblings, 0 replies; 3+ messages in thread
From: Denis B. Roegel @ 2000-12-08 21:25 UTC (permalink / raw)
  Cc: Denis B. Roegel, ntg-context, Denis B. Roegel

`Hans Hagen' wrote
>   

>   I don't understand this. Everything between start/stop...MPgraphic becomes
>   a begin/endfig, so local defs should end up there. 
>   

Sorry, I must have made a mistake, it does indeed work.
I think my mistake was that I had written \useMPgraphic
instead of \includeMPgraphic.

Thanks,

Denis


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-12-08 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-08 16:41 is there a problem with local definitions in metafun? Denis B. Roegel
2000-12-08 19:18 ` Hans Hagen
2000-12-08 21:25   ` Denis B. Roegel

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).