[NTG-context] Code Called Twice?

Marco Patzer lists at homerow.info
Fri Oct 11 09:27:42 CEST 2013


On 2013–10–10 Thangalin wrote:

> I noticed something unexpected with the following code:
> 
> \enabletrackers[metapost.showlog]
> 
> \startuseMPgraphic{heading:ThemeTitleStyle}
>   show "HEADING:THEMETITLESTYLE";
>   show \MPstring{heading:title};
> 
>   draw textext( \MPstring{heading:title} ) rotated 5
>     withcolor blue;
> \stopuseMPgraphic
>
> […]
> 
> It appears as though heading:ThemeTitleStyle is being called twice:

If I'm not mistaken that's the way MP works when text is involved,
it's a two-pass approach. In graphics without text MP has all
information it needs to create the image. The text in MP graphics is
typeset using TeX. After it's typeset MP picks it up in a second
run.

> I am trying to produce a random number that is not equal to the
> previous random number. However, if the code is called twice, then I'd
> have to add code to ignore one of the calls.

Maintain a vector with the last two elements to check against.

Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20131011/2a3908f5/attachment.pgp>


More information about the ntg-context mailing list