[luatex] Inspect last node without removing

Hans Hagen j.hagen at xs4all.nl
Fri Aug 3 09:57:20 CEST 2018


On 8/3/2018 2:47 AM, Henri Menke wrote:
> Dear list,
> 
> Sometimes I want to break out into Lua during typesetting and just 
> inspect the last node at the current point.  LuaTeX gives me the 
> opportunity to get the last node using node.last_node().  However this 
> pops the node from the list, i.e. it disappears from the output stream. 
> I don't want this.  I simply want to inspect the node and maybe insert 
> something in the current list.  I'm not even able to reinsert the node 
> because node.write(node.copy(last)) confuses the parbuilder.  Also, how 
> can I get the current list?  MWE below.

the confusion is because node.write appends immediate so probably in the 
wrong spot

anyway, you can do

a\directlua{print(tex.nest[tex.nest.ptr].tail)}

assuming of course that you ask for it at the right time and level

Hans

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


More information about the luatex mailing list