Paul Isambert wrote: > Andreas Matthias <[email protected]> a écrit: >> >> Paul Isambert wrote: >> >>> Andreas Matthias <[email protected]> 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))
Yes, I see. That was nonsense. Are there any use cases of tex.setbox(nil, ...) at all? Or wouldn't a warning be more appropriate than silently accepting nil? > 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). What a nice loop! My notebook completely stalled! Ciao Andreas
