[luatex] lua equivalent of vbox...ht

Patrick Gundlach patrick at gundla.ch
Sun Sep 13 21:21:03 CEST 2009


Hello all,

>> what would be the lua equivalent of
>>
>> \setbox0\vbox{hello world}
>> \the\ht0
>>
>> ? That is, what would I write inside \directlua{ ... } to get the  
>> same
>> effect?
>>
>> Pseudo code appreciated.
>>
>> Patrick
>>
>
> download last source
> luatex-beta-0.43.0/manual/luatexref-t.pdf
> and see  4.1.5 Box registers

OK, let's start with a simple hbox. This very naive approach does not  
work:

\directlua{
% create to glyph nodes
a=node.new(37)
a.char=144
a.font=1

b=node.new(37)
b.char=145
b.font=1

h,n=node.insert_after(nil,a,b)

% turn it into an hbox:
p=node.hpack(h)

tex.setbox(0,p)

texio.write_nl(tex.wd[0])
% result: 0
}


What should I do? Any idea? Probably this would be obvious if I knew  
TeX internals. But I don't.

Patrick



More information about the luatex mailing list