[NTG-context] xml and lua again

Hans Hagen pragma at wxs.nl
Fri Oct 28 10:59:26 CEST 2011


On 28-10-2011 10:35, Wolfgang Schuster wrote:
>
> Am 28.10.2011 um 08:55 schrieb Thomas A. Schmitz:
>
>> Luigi, Patrick,
>>
>> thanks for your explanations! The point of my question was: can I feed the content of tex.dimen["textwidth"] directly back to TeX, and the answer to this appears to be "no"; you need to add some unit to it (otherwise, you get an error message). Which was a bit confusing to me at first, because the name tex.dimen implies that it holds a "real" dimension, like \newdim does.
>
>
> You can get the same value in TeX when you print the value of a dimension with \number:
>
> \starttext
>
> \scratchdimen=3pt
>
> \number\scratchdimen
>
> \ctxlua{context(tex.dimen["scratchdimen"])}
>
> \stoptext

which also means that you can say \scratchcounter=\scratchdimen and test 
dimens as if they are numbers ... this is why we can have

\let\ifzeropt\ifcase

which probably no one ever noticed in the source.

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list