On 10/27/11 13:05, Hans Hagen wrote:
With “tex.dimen[…]” you get the value in scaled points but util-dim.lua provides some functions to convert the value in points, centimeter etc.
\starttext \startluacode context.blackrule{ width = number.topoints(tex.dimen["textwidth"]/2) } \stopluacode \stoptext
Thank you Wolfgang, that's exactly what I was looking for!
or just tex.dimen["textwidth"]/2 .. "sp"
Wait, just so I understand: your solution would imply that tex.dimen["textwidth"] holds a number, not a dimension, right? (Because you simply concatenate it with a dimension unit). Which makes sense when I think of it because lua has no concept of dimensions, only of strings, functions, tables, numbers... Whereas the Wolfgang implies that the result is already in sp. So who's right? Thomas