ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Henning Hraban Ramm <texml@fiee.net>
Subject: Re: expansion problem: random location
Date: Sat, 14 Sep 2019 08:47:31 +0200	[thread overview]
Message-ID: <290eb1a6-5b22-be54-7467-7f48ec672787@gmail.com> (raw)
In-Reply-To: <8DF4936F-9457-48AB-9A49-AE6284B20DA0@fiee.net>

Henning Hraban Ramm schrieb am 13.09.2019 um 20:41:
>> Am 2019-09-13 um 19:44 schrieb Wolfgang Schuster <wolfgang.schuster.lists@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

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2019-09-14  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 16:51 Henning Hraban Ramm
2019-09-13 17:44 ` Wolfgang Schuster
2019-09-13 18:41   ` Henning Hraban Ramm
2019-09-14  6:47     ` Wolfgang Schuster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=290eb1a6-5b22-be54-7467-7f48ec672787@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).