![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
Am 04.03.2009 um 13:54 schrieb Curious Learn:
Awesome solution. Works great. Thanks very much Wolfgang. I can now use your solution. If it is not too difficult to explain, I would appreciate if someone could explain why the following does not work. It is not necessary because Wolfgang's solution is great but will help me understand it better.
\def\AnsT {\doglobal\increment\choicecounter \startitem[\choicecounter]#1\stopitem} \def\eAns{\stopitem}
With these commands if I use
\AnsT This is the CORRECT answer. \eAns \startwrongitem Yet another wrong answer. \stopwrongitem
I get the error "File ended while scanning use of \startitem"
It has to do with the that for randomized items ConTeXt has to know the text for each item, to do this the normal \item ... is not enough and \startitem ... \stopitem is needed. Each \startitem ... \stopitem pair collects the text between it and add it to a list. The collecting works in the way that \startitem grab everything untill it sees a \stopitem command. If you want to write your own command you need a similiar mechanism where your \AnsT grab everything till \eAns but this did not work in the way you defined the command yourself. The low level way to do this is: \def\AnsT#1\eAns {\doglobal\increment\choicecounter \startitem[\choicecounter]#1\stopitem} Another way to do this with a few ConTeXt commands is: \define[1]\Rightitem {\doglobal\increment\choicecounter \startitem[\choicecounter]#1\stopitem} \define\AnsT {\grabuntil{eAns}\Rightitem} Wolfgang