[luatex] node missing
Paul Isambert
zappathustra at free.fr
Sun Jan 22 19:43:54 CET 2012
Andreas Matthias <andreas.matthias at gmail.com> a écrit:
>
> Paul Isambert wrote:
>
> > Andreas Matthias <andreas.matthias at gmail.com> a écrit:
> >>
> >> In the following example I expected \mybox to contain `abc'
> >> eventually. Instead it only contains `bc'. Why is the `a'
> >> missing?
> >
> > You must assign n1 to box.head, as in
> >
> > [...]
> > n1.next = box.head
> > box.head = n1
> > tail = node.slide(n1)
> > [...]
> >
> > otherwise the box still points to its former head as its first node
> > (which has indeed n1 as its prev node, but it is ignored because scanning
> > begins at the former head).
>
>
> Hmm. I see it's working now but I still don't understand why.
>
> Function foo creates and returns an hlist `h' and I thought this
> hlist would be assigned to mybox with
>
> tex.setbox(mybox, foo(tex.box.mybox))
>
> Hlist `h' does not contain the original box but the interior of
> the box, does it? Then why do I have to set box.head?
Sorry, I didn't pay enough attention. I thought it was the usual error
(forgetting to reassign to a list's head being quite common).
Actually,
tex.setbox(mybox, foo(tex.box.mybox))
doesn't mean anything, it should be:
tex.setbox("mybox", foo(tex.box.mybox))
Consequently:
n1.next = box.head
should be:
n1.next = node.copy_list(box.head)
Otherwise LuaTeX will be stuck in a loop (I have no time to investigate
why, but it does so).
Best,
Paul
More information about the luatex
mailing list