[NTG-context] Can I share METAPOST vardefs over multiple pages?

Taco Hoekwater taco at elvenkind.com
Fri Mar 13 13:24:30 CET 2020


Hi,



> On 13 Mar 2020, at 12:53, Gerben Wierda <Gerben.Wierda at rna.nl> wrote:
> 
> Suppose I have this code:
> 
> 
> Can I reuse that varied across follow-up MPPages?

Sure, put the vardef inside \startMPinclusions:

\startMPinclusions
vardef MyShape(expr w, h) =
   ...
enddef ;
\stopMPinclusions
\startMPpage
picture s ; s := MyShape(4cm, 2cm);

draw s;
 . . .
\stopMPpage

\startMPpage
picture s ; s := MyShape(8cm, 4cm);

draw s;
 . . .
\stopMPpage


Taco



More information about the ntg-context mailing list