![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
17 Dec
2007
17 Dec
'07
11:33 a.m.
Peter Rolf wrote:
I have written such a macro, but sadly it crashes when used inside \color or \definecolor. Tried to debug it, but this is my first experience with the trace commands (probably not the best example to start with). Sigh, still so much to learn.. :)
The problem is that it defines things, and you can't do that inside an argument. Solution: rewrite the macro to define a new macro (like \def\currentStateDependentColor{green}) instead of expanding on the fly. Then you have to do something like this: \StateDependentColor[stateA=green,stateC=blue,whatever=yellow,...] \ color[\currentStateDependentColor] And that should work. Best wishes, Taco