[luatex] node.insert_before

Paul Isambert zappathustra at free.fr
Tue Jul 27 18:01:21 CEST 2010


Hello all,

I'm trying to understand how node.insert_before works when <current> is the
head.

I think I understand insert_after:

\setbox0=\vbox{\hbox{a}\hbox{b}}
\setbox1=\hbox{x}

\directlua{%
   mybox = node.new(0)
   mybox = node.hpack(tex.box[1].list)
   node.insert_after(tex.box[0].list, tex.box[0].list, mybox)
   }

\box0
\bye

This correctly inserts "x" just below "a". If I replace the insertion by

node.insert_before(tex.box[0].list, tex.box[0].list.next, mybox)

the same thing occurs, which makes sense: "x" is inserted before "a"'s next,
i.e. before \baselineskip. However this doesn't work:

node.insert_before(tex.box[0].list, tex.box[0].list, mybox)

the intended output being "x" on top of "a". It doesn't work either when
inserting "manually", i.e. by reassigning prev's and next's. Does this mean that
one can't insert before a list's head? And if so, how should one achieve a
similar effect?

Best,
Paul


More information about the luatex mailing list