On 1-11-2011 23:21, Meer, H. van der wrote:
The goal is to make the following string in metapost: string s; where s must become "\MPcolor{Blue}". and ultimately execute this at the right moment with: scantokens s;
The following makes s = "MPcolor{Blue}": s := "MPcolor"& char oct"134"& char oct"173"& "Blue"& char oct"134"& char oct"175";
But I seem unable to add a \ in front of it without expanding the string by TeX. Thus it does not work to put: s := char oct"134"& "MPcolor"& char oct"134"& char oct"173"& "Blue"& char oct"134"& char oct"175";
Placing a \noexpand in front does not help.
\MPcolor is expanded when the code is passed to mp so delaying is not possible and once mp runs it already sees the colors what you want is something fill fullcircle scaled 10cm withcolor .5 * namedcolor("gray") ; fill fullcircle scaled 5cm withcolor namedcolor("red") ; fill fullcircle scaled 5cm withcolor namedcolor("green") ; fill fullcircle scaled 5cm withcolor namedcolor("blue") ; (I have that as experimental code but will move it to the regular code) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------