On Tue, May 11, 2010 at 9:27 PM, Mojca Miklavec
On Tue, May 11, 2010 at 21:03, Marco wrote:
numeric r, g, b ;
r := uniformdeviate 1 ; g := uniformdeviate 1 ; b := uniformdeviate 1 ;
textext("\colored[r=" & r & ",g=" & g & ",b=" & b & "]{Test}") Thanks for this snipped, Hans. It looks promising, but I get the following compile error:
!mplib : mp terminal: >> "\colored [r=" >> 0.74464 ! Not implemented: (string)&(known numeric). <to be read again>
You need to convert number to string first. Use "decimal(r)" instead of "r". (But I didn't test.)
Mojca ___________________________________________________________________________________ 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 ___________________________________________________________________________________
\starttext \startuseMPgraphic {1} numeric r, g, b ; r := uniformdeviate 1 ; g := uniformdeviate 1 ; b := uniformdeviate 1 ; label(textext("\colored[r=" & decimal(r) & ",g=" & decimal(g) & ",b=" & decimal(b) & "]{Test}"),origin); label(textext("r=" & decimal(r) & ",g=" & decimal(g) & ",b=" & decimal(b) ),origin+(0,-100)); \stopuseMPgraphic \useMPgraphic {1} \stoptext ( tested :-) ) Warning: default is preserve seed (every runs will have the same random number) if you don't purge temporary files *tuo, *tui etc. I'm sure that there is a switch/macros to avoid this, but I don't remember it now -- luigi