On Mon, Feb 28, 2022 at 1:02 PM Marcel Fabian Krüger <
tex@2krueger.de> wrote:
Hi,
one issue I regularly encounter with late_lua whatits is that they don't
allow the executed code to determine which node is currently executed.
Especially this means that attributes and properties can't be reliably
accessed and the code can't access related nodes next to the late_lua
node. This can be worked around by storing a closure in the data field
which captures a reference to the node, but this breaks in hard to debug
ways when the node is copied and the copied node has the same code but a
different identify.
Therefore it would be great if there would be a way to access the
currently evaluated late_lua whatsit node. I would have suggested
passing this as an argument to the executed function, but that could
break compatbility and it would appear odd due to LuaMetaTeX using the
second argument of lua functions is different ways. So the attached
suggested implemention instead adds a separate function which allows to
access this node: node.current_latelua (or node.direct.current_latelua)
Hans has made a patch, see revision 7504.