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