[luatex] Dimensions of sub-boxes?

Henri Menke henrimenke at gmail.com
Thu Mar 7 04:38:00 CET 2019



On 7/03/19 4:15 PM, Eduardo Ochs wrote:
> Hi list,
> 
> sorry, I know that this _should_ be trivial but I can't figure out how
> to do it from the manual...
> 
> Suppose that I set the box 0 by running this:
> 
>   \setbox0\hbox{%
>     \hbox{a}%
>     \hbox{bcde}%
>     \hbox{fg}%
>   }
> 
> How do I get - from Lua - number of sub-boxes of box0 and the width,
> the height and the depth of each one?

Units are sp.  To get pt, divide by 2^16.

\setbox0\hbox{%
  \hbox{a}%
  \hbox{bcde}%
  \hbox{fg}%
}

\directlua{
for hlist in node.traverse_id(node.id"hlist", tex.box[0].list) do
    print(hlist.width, hlist.height, hlist.depth)
end
}

\bye

> 
>   Thanks!
>     Eduardo Ochs
>     http://angg.twu.net/dednat6.html
>     http://angg.twu.net/math-b.html
> 




More information about the luatex mailing list