Woah, nice! I was trying to pass some values to MetaPost via Lua (usual
laziness to learn macro languages). Thank you a lot, especially because I
was looking at the wrong functions in the token namespace. I'll upload a
more specific example soon while I polish some code. Very thankful.

Jairo :)

El lun, 18 de ene. de 2021 a la(s) 05:02, Taco Hoekwater (t...@bittext.nl)
escribió:

>
>
> > On 18 Jan 2021, at 10:45, Hans Hagen <j.ha...@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
> >> \starttext
> >> \the\dimexpr\availablehsize\relax %say, 426pt
> >> \stoptext
> >> 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
>    \startluacode
>    function availablehsize()
>       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
>       end
>       return l
>    end
>    \stopluacode
>
> 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)
>
> Best wishes,
> Taco
>
> —
> Taco Hoekwater              E: t...@bittext.nl
> genderfluid (all pronouns)
>
>
>
>
>
>
>
>
___________________________________________________________________________________
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 via email to