ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Sequence of MetaPost Pages
@ 2012-09-10  3:05 Troy Henderson
  2012-09-10  4:26 ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Troy Henderson @ 2012-09-10  3:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

When I create animations using MetaPost, I typically do something like

for n=1 upto N:
   beginfig(n);
      <some code>
   endfig;
endfor;

and a sequence of figures are created.  How can I do this in ConTeXt using
\startMPpage ... \stopMPpage?

Troy Henderson

[-- Attachment #1.2: Type: text/html, Size: 306 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] 6+ messages in thread

* Re: Sequence of MetaPost Pages
  2012-09-10  3:05 Sequence of MetaPost Pages Troy Henderson
@ 2012-09-10  4:26 ` Aditya Mahajan
  2012-09-10  5:03   ` Troy Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2012-09-10  4:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 9 Sep 2012, Troy Henderson wrote:

> When I create animations using MetaPost, I typically do something like
>
> for n=1 upto N:
>   beginfig(n);
>      <some code>
>   endfig;
> endfor;
>
> and a sequence of figures are created.  How can I do this in ConTeXt using
> \startMPpage ... \stopMPpage?

(untested)

\dorecurse{10}
    {\startMPpage
        label(btex On step \recurselevel etex, origin);
     \stopMPpage}

(There is also \dostepwiserecurse if you need more control).

Aditya

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Sequence of MetaPost Pages
  2012-09-10  4:26 ` Aditya Mahajan
@ 2012-09-10  5:03   ` Troy Henderson
  2012-09-10  5:17     ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Troy Henderson @ 2012-09-10  5:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

That works great.  Now I have defined a global numeric

N:=8;

in \startMPinclusions ... \stopMPinclusions at the be beginning of my
document.  All of my \startMPpage ... \stopMPpage environments understand
this N, but how do I reference this value as the start value for
\dostepwiserecurse?  That is, I would like to do something like

\dostepwiserecurse{N}{0}{-1}{ ... <some code> ... }

Troy

[-- Attachment #1.2: Type: text/html, Size: 433 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] 6+ messages in thread

* Re: Sequence of MetaPost Pages
  2012-09-10  5:03   ` Troy Henderson
@ 2012-09-10  5:17     ` Aditya Mahajan
  2012-09-10  5:23       ` Troy Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2012-09-10  5:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> That works great.  Now I have defined a global numeric
>
> N:=8;
>
> in \startMPinclusions ... \stopMPinclusions at the be beginning of my
> document.  All of my \startMPpage ... \stopMPpage environments understand
> this N, but how do I reference this value as the start value for
> \dostepwiserecurse?  That is, I would like to do something like
>
> \dostepwiserecurse{N}{0}{-1}{ ... <some code> ... }

For that, you'll need to work on the TeX end.

\edef\STEPS{8}

\dorecurse\STEPS{....}

You can either use \STEPS instead of N everywhere in your code (and be 
careful on how TeX code is parsed, i.e., `a := \STEPS 0` will evaluate to 
`a := 80`), or use `N := \STEPS;` somewhere in the beginning of each 
`\MPpage` (the `N :\ \STEPS` can be hidden behind a macro like 
`\initializeAnimation`).

Aditya

___________________________________________________________________________________
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] 6+ messages in thread

* Re: Sequence of MetaPost Pages
  2012-09-10  5:17     ` Aditya Mahajan
@ 2012-09-10  5:23       ` Troy Henderson
  2012-09-10  5:29         ` Troy Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Troy Henderson @ 2012-09-10  5:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

That works great too.  One more question now.  I would like a particular
MetaPost label to contain the value of a variable, say n.  I don't want to
use

label(decimal(n),origin);

because I want the label to be a TeX picture instead of a string.  That is,
I would like to have

label(btex n etex,origin);

where n is the VALUE of n and not the letter n.

Thanks,

Troy

[-- Attachment #1.2: Type: text/html, Size: 416 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] 6+ messages in thread

* Re: Sequence of MetaPost Pages
  2012-09-10  5:23       ` Troy Henderson
@ 2012-09-10  5:29         ` Troy Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Troy Henderson @ 2012-09-10  5:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

>
> label(decimal(n),origin);
>

Sorry.  I found the answer by wrapping the decimal() inside textext().
That is,

label(textext(decimal(n)),origin);

does what I want.

Troy

[-- Attachment #1.2: Type: text/html, Size: 357 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] 6+ messages in thread

end of thread, other threads:[~2012-09-10  5:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-10  3:05 Sequence of MetaPost Pages Troy Henderson
2012-09-10  4:26 ` Aditya Mahajan
2012-09-10  5:03   ` Troy Henderson
2012-09-10  5:17     ` Aditya Mahajan
2012-09-10  5:23       ` Troy Henderson
2012-09-10  5:29         ` Troy Henderson

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