[luatex] Inserting a "dummy" node

Hans Hagen pragma at wxs.nl
Fri Oct 27 19:48:53 CEST 2017


On 10/27/2017 4:41 PM, Javier Bezos wrote:
> Is there a "canonical" way to insert a "dummy" node passing some
> data to the list, so that it can be used when processing it?
> 
> I'm writing a new feature for babel, and while I've discarded
> this approach (an attribute is clearly better), I'm still
> wondering if there is a preferred method. I thought a user
> whatsit was the solution, but if I've understood correctly,
> it cannot be added by TeX (only by lua).
there are user nodes that you can inject

     \def\dummynode#1{\directlua{
         local n = node.new("whatsit",node.subtype("user_defined"))
         n.type = 100
         n.value = #1
         node.write(n)
     }}%

     foo\dummynode{123}bar


-----------------------------------------------------------------
                                           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