[luatex] Behavior of node lists.

Hans Hagen pragma at wxs.nl
Thu Nov 8 23:34:49 CET 2012

On 11/8/2012 10:34 PM, Stephan Hennig wrote:

> Come-on!  There might be umpteen TeX and LaTeX files, but no Lua code
> files that use node.insert_after.

Are you joking? 40 files on my machine, and over 250 calls to 
insert_before and insert_after, but I must admit that they're not latex 
files and probably do a-typical things.

> I think inserting a node at the end of a given head node is something
> different than inserting a node exactly after a given node.  I you want
> to do the former, you could always say
>    insert_after(node.tail(head), new)

that inserts a node at the end of a list starting with head which is not 
always the same as inserting after head

quite some callbacks expect a head to be returned and get a head passed, so

head = node.insert_after(head,somenode,newnode)

is pretty standard and catches the cases where head == somenode which 
saves some testing. Of course you can always do it the manual way: by 
assigning next/prev fields.


(ps. Sorry for being persistent, normally I don't follow this list as I 
filter all messages but have to reinstall the filter)

                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the luatex mailing list