![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Taco Hoekwater wrote:
Aditya Mahajan wrote:
Notice the first line of \ascii, and compare that with the definition of \doifelse. The command \!!stringa inside the definition of \doifelse gets expanded too soon. Is there any way to get this work, other than doing the comparison outside the MP code.
Not with \doifelse. If the control sequences are as simple as in the example, you could do the comparison in MP code:
def doifelse (expr a, b)(text c)(text d) = if a=b: c else: d fi enddef; draw doifelse("test")("string")(fullcircle)(fullsquare) scaled 5cm ;
alternatively, in mkiv there is a fully expandable \expdoifelse but at the cost of lua call (\doifelse uses intermediate macros which is why it is not fully expandable) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------