[NTG-context] expansion problem: random location

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sat Sep 14 08:47:31 CEST 2019


Henning Hraban Ramm schrieb am 13.09.2019 um 20:41:
>> Am 2019-09-13 um 19:44 schrieb Wolfgang Schuster <wolfgang.schuster.lists at gmail.com>:
>>
>> Henning Hraban Ramm schrieb am 13.09.2019 um 18:51:
>>> Hi, in an example document I’m trying to get pictures of random size and placement.
>>> Unfortunately the expansion is over my head:
>> Put the value of the random location in a macro.
> Thank you!
> I thought I had tried that, but probably only defining the macro outside of the other…
It could have been that you used \def which doesn't work because this 
will always
call the Lua function and you get a new random value but with \edef the 
result
of the first random value is stored in the macro.

  \def\RandomA{\cldcontext{math.random(1,4)}}
\edef\RandomB{\cldcontext{math.random(1,4)}}

\starttext
\dorecurse{10}{A: \RandomA \quad B: \RandomB\par}
\stoptext

Wolfgang



More information about the ntg-context mailing list