Meer, Hans van der mailto:H.vanderMeer@uva.nl 11. April 2016 um 10:35 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 \startuseMPgraphic{hans}{color} pickup pencircle scaled 1mm; draw unitsquare scaled 1cm withcolor \MPvar{color}; \stopuseMPgraphic
\setupMPvariables[hans][color=red] \starttext \useMPgraphic{hans} \useMPgraphic{hans}{color=blue} \stoptext Wolfgang