[NTG-context] \setupMPvariables in \startMPpage

Hans Hagen pragma at wxs.nl
Tue Dec 27 21:58:55 CET 2005


David Arnold wrote:

> Why doesn't this work?
>
> %output=pdf
>
> \startuseMPgraphic{usquare}
>   draw unitsquare scaled \MPvar{u};
> \stopuseMPgraphic
>
> \starttext
>
> \startMPpage
> \setupMPvariables[usquare][u=4cm]
> \includeMPgraphic{usquare}
> \stopMPpage
>
> \stoptext

because

(1) after startMPpage metapost code is expected (or something like 
\includeMPgraphic{...} that expands to mp code
(2) when the setup is moved outside the startMPpage, contex does not 
know what vars to preset

however, this works (MPrawvar is undocumented, yet)

\startuseMPgraphic{usquare}
  draw unitsquare scaled \MPrawvar{usquare}{u};
\stopuseMPgraphic

\starttext

\setupMPvariables[usquare][u=4cm]

\startMPpage
\includeMPgraphic{usquare}
\stopMPpage

\stoptext



More information about the ntg-context mailing list