Paul Isambert wrote:

> Andreas Matthias <[email protected]> a écrit:
>> 
>> What is the lua equivalent of a void box? I.e. how to
>> create a void box in lua?
> 
> I'm not sure that it can be done, strictly speaking. By a void box, I
> suppose you mean an unassigned box register (i.e. \voidb@x);

Yes, I was thinking of \voidb@x.

> now that
> I think of it, it is strange that \unhbox\voidb@x is allowed in the
> first place (if nothing is assigned to the register, how can you unhbox
> it?).

That's what amazed me too.

> On the Lua side, an unassigned box register (e.g. tex.box["voidb@x"])
> returns nil (unlike an unassigned count register, which returns 0), so
> I'd say the Lua equivalent of a void box is nil. 

Yes, but you can neither append a node to nil nor pack nil with
node.hpack. So, it is not too equivalent, is it?

> Of course, if you're
> just looking for an empty box, that's easy (except you have to specify
> if it's an horizontal or vertical box): node.new(node.id"hlist", 2) or
> node.new(node.id"vlist", 2) (the second argument is optional but later
> it might be useful to know that this is a handmade box).

Oh yes! Of course! One can create hlist nodes directly. I didn't
remember that. I was trying something like node.hpack(nil) which
didn't work.


Actually I was just looking for a simple node as a starting point
for a list of nodes which are generated in some kind of loop.
I think an hlist node is very suitable for this:


list = node.new(node.id('hlist'))
curr = list

for i=0,5 do
    n = node.new(node.id('glyph'))
    n.font=1
    n.char=97+i

    curr.next = n
    curr = n
end



Ciao
Andreas

Reply via email to