![](https://secure.gravatar.com/avatar/413051f5ef37416e8bd7c228ea721eb9.jpg?s=120&d=mm&r=g)
Hi list,
I've been playing around with some of the Lua callbacks in LuaMetaTeX,
and I have a few questions/comments.
Context: I'm writing a Plain/LaTeX/ConTeXt module called
"lua-widow-control" that uses Lua callbacks to automatically remove
widows and orphans from documents. The relevant Lua code is at:
https://github.com/gucci-on-fleek/lua-widow-control/blob/master/source/lua-w...
in case you're curious about how I'm using these callbacks, but you
shouldn't need to look there since this email is self-contained.
1. In LMTX, calling "tex.linebreak" produces a
luatex warning > tex: left parfill skip is gone
warning. I don't get this warning in Plain LuaTeX, LuaLaTeX, or MkIV,
so I think that it's specific to LuaMetaTeX. The LuaMetaTeX manual
hardly mentions "left parfill skip"/"parfillleftskip", so I'm not too
sure what to do to avoid this warning.
You can reproduce the warning with this code (but any call to
"tex.linebreak" also works):
\startluacode
function test(head)
tex.linebreak(node.copylist(head))
return head
end
nodes.tasks.appendaction("processors", "after", "test")
\stopluacode
\starttext
Hello!
\stoptext
2. The LuaMetaTeX manual says that "pre_linebreak_filter" is called
after the parfillskip glue has been added, but this doesn't seem to
be the case. With LuaLaTeX/Plain LuaTeX, this is true, but the node
list passed to the callback in MkXL is missing the parfillskip. (I
don't have an MkIV installation to test here.)
This MkXL code:
\startluacode
function test(head)
local last = node.slide(head)
print "START"
for i=1,3 do
print(last)
print(
node.type(last.id),
node.subtypes(last.id)[last.subtype],
last.width,
last.stretchorder,
last.stretch
)
last = last.prev
end
print "STOP"
return head
end
nodes.tasks.appendaction("processors", "after", "test")
\stopluacode
\starttext
Hello!
\stoptext
produces:
START
![](https://secure.gravatar.com/avatar/413051f5ef37416e8bd7c228ea721eb9.jpg?s=120&d=mm&r=g)
Hi list,
I haven't had any luck solving any of the issues from my previous email:
[NTG-context] Callbacks in LuaMetaTeX
https://mailman.ntg.nl/pipermail/ntg-context/2022/105566.html
Admittedly, my problems are fairly obscure (and likely self-inflicted),
but any suggestions would be greatly appreciated. I've updated my
ConTeXt installation to the latest version (mkxl 2022.05.11 11:36), but
this doesn't seem to have changed anything.
Further to the previous email, I have one (semi-related) additional
question:
6. The LuaTeX manual says that the subtype of "ins" nodes is a number
corresponding to the insert class. This appears to work correctly.
The LuaMetaTeX manual says the same thing about "insert" nodes;
however, the subtype of "insert" nodes appears to always be zero.
Using this code:
\startluacode
local traverse_id = node.traverse_id or node.traverseid
local insert = node.id"insert" or node.id"ins"
function test(head)
for n in traverse_id(insert, head) do
inspect(n)
print(n.subtype)
end
return head
end
nodes.tasks.appendaction("finalizers", "after", "test")
\stopluacode
\starttext
One \footnote{Two} \insert123{Three} Four.
\stoptext
In MkIV I get:
participants (1)
-
Max Chernoff