[NTG-context] Getting dimensions in Lua
taco at bittext.nl
Mon Jan 18 11:02:09 CET 2021
> On 18 Jan 2021, at 10:45, Hans Hagen <j.hagen at xs4all.nl> wrote:
> On 1/18/2021 1:58 AM, Jairo A. del Rio wrote:
>> Hi, list.
>> I want to get some dimensions in Lua. See, for instance
>> \the\dimexpr\availablehsize\relax %say, 426pt
>> Is there an equivalent in ConTeXt for Lua, i.e. without passing values from TeX or, at least, using only Lua commands? Thank you in advance.
> tex being tex, there is always a way ...
There is also this option:
% function returns scaled points
local l = tex.dimen.hsize - tex.skip.leftskip.width - tex.skip.rightskip.width
if tex.count.hangafter<0 then
local h = tex.dimen.hangindent
if h>0 then l = l - h else l = l + h end
But I suspect that there are multiple cases where this does not work
(like when used in horizontal mode, for example if the par setting changes
before the \par is seen, or when there is data in the local par node)
Taco Hoekwater E: taco at bittext.nl
genderfluid (all pronouns)
More information about the ntg-context