ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MPinclusions, MPextensions, MPinitializations and MPinstances
@ 2013-02-13 17:59 Marco Patzer
  2013-02-13 23:25 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Patzer @ 2013-02-13 17:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 237 bytes --]

Hi,

I know that MPinclusions are included only once and
MPinitializations are included once for each graphic. But how do
MPextensions fit in?

How can I define variables or definitions that are local to a
particular MP instance?

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-13 17:59 MPinclusions, MPextensions, MPinitializations and MPinstances Marco Patzer
@ 2013-02-13 23:25 ` Hans Hagen
  2013-02-13 23:51   ` Marco Patzer
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2013-02-13 23:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 2/13/2013 6:59 PM, Marco Patzer wrote:
> Hi,
>
> I know that MPinclusions are included only once and
> MPinitializations are included once for each graphic. But how do
> MPextensions fit in?
>
> How can I define variables or definitions that are local to a
> particular MP instance?

by defining a new instance

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-13 23:25 ` Hans Hagen
@ 2013-02-13 23:51   ` Marco Patzer
  2013-02-14 13:01     ` Marco Patzer
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Patzer @ 2013-02-13 23:51 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 994 bytes --]

On 2013–02–14 Hans Hagen wrote:

> >I know that MPinclusions are included only once and
> >MPinitializations are included once for each graphic. But how do
> >MPextensions fit in?
> >
> >How can I define variables or definitions that are local to a
> >particular MP instance?
> 
> by defining a new instance

I guess I didn't make myself clear.

  \startMPinitializations
    numeric n; n=4cm;
  \stopMPinitializations

Now I can use “n” in all MP instances (unless switched off for the
particular instance). I'd like to define some variables only visible
in instance “foo”. Something like

  \startMPinitializations [foo]
    numeric n; n=4cm;
  \stopMPinitializations

I tried

  \startMPcode{foo}
    numeric n; n=4cm;
  \stopMPcode

but this adds some vertical space and doesn't seem to be the right
solution given the face that there are already three other
environments to include MetaPost code. Maybe I'm missing the obvious
here.

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-13 23:51   ` Marco Patzer
@ 2013-02-14 13:01     ` Marco Patzer
  2013-02-14 17:59       ` Alan BRASLAU
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Patzer @ 2013-02-14 13:01 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 868 bytes --]

On 2013–02–14 Marco Patzer wrote:

> Now I can use “n” in all MP instances (unless switched off for the
> particular instance). I'd like to define some variables only visible
> in instance “foo”. Something like
> 
>   \startMPinitializations [foo]
>     numeric n; n=4cm;
>   \stopMPinitializations

What I was looking for was (it's even mentioned in the manual):

  \startMPdefinitions{foo}
    …
  \stopMPdefinitions

That means we have:

- MPdefinitions     (for instance-local definitions)
- MPinclusions      (global definitions)
- MPinitializations (global definitions, can be disabled for an MP instance)
- MPextensions      (???, seems to be the same as MPinitializations)

And all four include code for use within MP graphics. That really is
confusing!

> Maybe I'm missing the obvious here.

Yes, I did :)

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-14 13:01     ` Marco Patzer
@ 2013-02-14 17:59       ` Alan BRASLAU
  2013-02-14 18:14         ` Marco Patzer
  2013-02-14 22:15         ` Wolfgang Schuster
  0 siblings, 2 replies; 9+ messages in thread
From: Alan BRASLAU @ 2013-02-14 17:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users

I am glad to see that I am not alone being confused...

We have:

\defineMPinstance
  [name]
  [\s!format=metafun,
   \s!extensions=\v!yes,
   \s!initializations=\v!yes,
   \c!method=\s!default,
   \c!textstyle=,
   \c!textcolor=]

also, \setupMPinstance

So that extensions=yes|no and initializations=yes|no controls the use
of MPextensions and MPinitializations. It seems that extensions is
intended for all instances ("when enabled").

From what I can see, extensions are read "once", initializations "each",
and inclusions are intended for the "user". It appears that
initializations is used to pass dynamic things from ConTeXt to MP.

I still have not figured out how to specify MPinclusions for a
particular instance.

It would be nice for someone who understands this all to explain it.

Alan 

 

On Thu, 14 Feb 2013 14:01:44 +0100
Marco Patzer <homerow@lavabit.com> wrote:

> On 2013–02–14 Marco Patzer wrote:
> 
> > Now I can use “n” in all MP instances (unless switched off for the
> > particular instance). I'd like to define some variables only visible
> > in instance “foo”. Something like
> > 
> >   \startMPinitializations [foo]
> >     numeric n; n=4cm;
> >   \stopMPinitializations
> 
> What I was looking for was (it's even mentioned in the manual):
> 
>   \startMPdefinitions{foo}
>     …
>   \stopMPdefinitions
> 
> That means we have:
> 
> - MPdefinitions     (for instance-local definitions)
> - MPinclusions      (global definitions)
> - MPinitializations (global definitions, can be disabled for an MP
> instance)
> - MPextensions      (???, seems to be the same as MPinitializations)
> 
> And all four include code for use within MP graphics. That really is
> confusing!
> 
> > Maybe I'm missing the obvious here.
> 
> Yes, I did :)

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

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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-14 17:59       ` Alan BRASLAU
@ 2013-02-14 18:14         ` Marco Patzer
  2013-02-14 18:28           ` Alan BRASLAU
  2013-02-15  0:21           ` Hans Hagen
  2013-02-14 22:15         ` Wolfgang Schuster
  1 sibling, 2 replies; 9+ messages in thread
From: Marco Patzer @ 2013-02-14 18:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1283 bytes --]

On 2013–02–14 Alan BRASLAU wrote:

> So that extensions=yes|no and initializations=yes|no controls the use
> of MPextensions and MPinitializations. It seems that extensions is
> intended for all instances ("when enabled").
> 
> From what I can see, extensions are read "once", initializations "each",
> and inclusions are intended for the "user". It appears that
> initializations is used to pass dynamic things from ConTeXt to MP.

This means we have two cases:

  - read one single time (once)
  - read one time per graphic (each)

And another two cases:

  - global to all instances (global)
  - local to a particular instance (local)

And we have four inclusion environments. I don't know how to map
them to the cases listed above.

- MPdefinitions     (local, ???)
- MPinclusions      (global, ???)
- MPinitializations (global, each)
- MPextensions      (global, once)

I don't understand the need of so many different environments. E.g.
MPinclusions could be global unless an argument specifying the
instance is provided.

> It would be nice for someone who understands this all to explain it.

+1

> I still have not figured out how to specify MPinclusions for a
> particular instance.

Try \startMPdefinitions{myinstance}

Marco

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-14 18:14         ` Marco Patzer
@ 2013-02-14 18:28           ` Alan BRASLAU
  2013-02-15  0:21           ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Alan BRASLAU @ 2013-02-14 18:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 14 Feb 2013 19:14:46 +0100
Marco Patzer <homerow@lavabit.com> wrote:

> > I still have not figured out how to specify MPinclusions for a
> > particular instance.  
> 
> Try \startMPdefinitions{myinstance}

This is *not* the same as MPinclusions!

We may have an instance with its own MPdefinitions, already,
to which the user may wish to add his own MPinclusions (eventually
several times using the [+] argument).

\startMPinclusions{myinstance} does not work.

Alan
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-14 17:59       ` Alan BRASLAU
  2013-02-14 18:14         ` Marco Patzer
@ 2013-02-14 22:15         ` Wolfgang Schuster
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2013-02-14 22:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.02.2013 um 18:59 schrieb Alan BRASLAU <alan.braslau@cea.fr>:

> I still have not figured out how to specify MPinclusions for a
> particular instance.

That’s not supported, the settings are applied to all instances and you only enable or disable them.

Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: MPinclusions, MPextensions, MPinitializations and MPinstances
  2013-02-14 18:14         ` Marco Patzer
  2013-02-14 18:28           ` Alan BRASLAU
@ 2013-02-15  0:21           ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2013-02-15  0:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 2/14/2013 7:14 PM, Marco Patzer wrote:
> On 2013–02–14 Alan BRASLAU wrote:
>
>> So that extensions=yes|no and initializations=yes|no controls the use
>> of MPextensions and MPinitializations. It seems that extensions is
>> intended for all instances ("when enabled").
>>
>>  From what I can see, extensions are read "once", initializations "each",
>> and inclusions are intended for the "user". It appears that
>> initializations is used to pass dynamic things from ConTeXt to MP.
>
> This means we have two cases:
>
>    - read one single time (once)
>    - read one time per graphic (each)
>
> And another two cases:
>
>    - global to all instances (global)
>    - local to a particular instance (local)
>
> And we have four inclusion environments. I don't know how to map
> them to the cases listed above.
>
> - MPdefinitions     (local, ???)
> - MPinclusions      (global, ???)
> - MPinitializations (global, each)
> - MPextensions      (global, once)
>
> I don't understand the need of so many different environments. E.g.
> MPinclusions could be global unless an argument specifying the
> instance is provided.
>
>> It would be nice for someone who understands this all to explain it.
>
> +1
>
>> I still have not figured out how to specify MPinclusions for a
>> particular instance.

% initializations
%     to be used by context / modules
%     cummulative
%     things like page states, use by context itself
%     each instance (unless disabled, as not all instances need them)
%     each graphic

% definitions
%     can be used to add helpers and such
%     cummulative
%     per instance
%     just after a format is loaded

% extensions
%     cummulative
%     used for all instances
%     blocked per instance after first graphic % was: reset after first use

% fix for 'all' instances instead of first used instance:
%
% \def\meta_reset_current_preamble
%   {\ifconditional\c_meta_include_extensions
%      \global\letMPinstanceparameter\s!extensions\v!no
%      %global\t_meta_extensions\emptytoks
%    \fi}

% inclusions
%     user stuff
%     cummulative
%     used next instance/graphic
%     reset afterwards (always)
%     can be blocked per instance

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2013-02-15  0:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 17:59 MPinclusions, MPextensions, MPinitializations and MPinstances Marco Patzer
2013-02-13 23:25 ` Hans Hagen
2013-02-13 23:51   ` Marco Patzer
2013-02-14 13:01     ` Marco Patzer
2013-02-14 17:59       ` Alan BRASLAU
2013-02-14 18:14         ` Marco Patzer
2013-02-14 18:28           ` Alan BRASLAU
2013-02-15  0:21           ` Hans Hagen
2013-02-14 22:15         ` Wolfgang Schuster

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