[NTG-context] \startuseMPgraphic

Meer, Hans van der H.vanderMeer at uva.nl
Mon Apr 11 10:35:33 CEST 2016


I seem to remember the following variations in \startuseMPgraphic.

(1) \startuseMPgraphic{name}{comma separated list of variables}
(2) \startuseMPgraphic{name}{comma separated list of key=value pairs}
In the second case one is able to set a default value to that variable, possibly to be overridden with \useMPgraphic{name}{key=value}.
I very much would like to specify default values on the \startuseMPgraphic definition of the graphic.

However, I cannot get option (2) working. Do I have a bad memory (possible of course ;-), Has it to be done otherwise?
In the example below the graphic myname1 is ok, but myname2 gives the following error:
metapost        > error:
>> orange
! Improper type.
<to be read again>
                   ;
<*> ...raw unitsquare scaled 1cm withcolor orange;

minimal example:

\starttext
\startuseMPgraphic{myname1}{color}
  pickup pencircle scaled 1mm;
  draw unitsquare scaled 1cm withcolor \MPvar{color};
\stopuseMPgraphic

\startuseMPgraphic{myname2}{color=red}
  pickup pencircle scaled 1mm;
  draw unitsquare scaled 1cm withcolor \MPvar{color};
\stopuseMPgraphic

\useMPgraphic{myname1}{color=blue}
\useMPgraphic{myname2}{color=orange}

\stoptext

Hans van der Meer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20160411/96595de2/attachment.html>


More information about the ntg-context mailing list