Thanks Peter,

I had tried \expandafter\xdef, \edef, \gdef, but not \expandafter\def… 
Thanks for your quick answer: that's exactly what I was looking for.

Best regards: OK

On 5 janv. 2012, at 21:17, Peter Münster wrote:

> On Thu, Jan 05 2012, Otared Kavian wrote:
> 
>> \define[3]\RandomCoeff{%
>>      \ctxlua{a = math.random(#2,#3)}
>> %    \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not 
>> work as expected...
> 
> \setuprandomize[2012]
> \define[3]\RandomCoeff{%
>  \expandafter\def\csname 
> Coeff#1\endcsname{\ctxlua{tex.print(math.random(#2,#3))}}}
> \starttext
> \RandomCoeff{Alpha}{1}{10}
> \RandomCoeff{Beta}{2}{20}
> \CoeffAlpha
> \CoeffBeta
> \stoptext
> 
> -- 
>           Peter
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to