Closed hpvd closed 2 years ago
I don't know much about this package, but from what I saw in the source code, one possible issue is that both of these packages sets the hpack_quality
callback. Linebreaker uses it to record badness, but lua-widow-control
adds empty callback, which removes the overfull box warning.
I've tried to use \usepackage{lua-widow-control}
in the documentation both before, and after \usepackage{linebreaker}, and seems that it doesn't have a negative impact on Linebreaker. I don't know about the impact on the widow control, as I don't have an example for testing.
many thanks for having a first look on this! Maybe @gucci-on-fleek could also look in this.
this is the corresponding issue at lua-widow-control package: https://github.com/gucci-on-fleek/lua-widow-control/issues/18
Yeah, I think that it should be fine. The only callbacks that lua-widow-control and linebreaker
share are hpack_quality
and post_linebreak_filter
. Lua-widow-control only activates the hpack_quality
callback while processing the pre_linebreak_filter
filter, so there shouldn't be any interference there. linebreaker
and lua-widow-control
both register the post_linebreak_filter
, but neither package does anything "interesting" there, so luatexbase
should handle that just fine, regardless of the package load order.
I've done some quick tests and the packages seem to work together fine. It is quite tricky to test them together since lua-widow-control fails pretty badly with really narrow \hsize
s and linebreaker
works the best with narrow \hsize
s.
Once linebreaker
is added to TeX Live (probably about ~1 week), I'll make sure to add it to lua-widow-control's automated tests.
Ok, so it looks like lua-widow-control + linebreaker
failed pretty bad when in an align
environment:
warning (node filter): error: .../texlive/2021/texmf-dist/tex/latex-dev/base/l
tluatex.lua:110:
Module luatexbase Error: Cannot add second callback to exclusive function
(luatexbase) `hpack_quality' on input line 66
.
\start@align ...urrenvir }{}\@gobble }\fi \else $$
\let \split \insplit@ \DN@...
l.66 \begin{align*}
gucci-on-fleek/lua-widow-control@c4e96ee fixes this by making making sure that lua-widow-control only registers the callback if no one else has. I don't think that there should be any other issues, but let me know if I break anything else.
Ah, good catch. I expect that there will be lots of issues with Linebreaker when users try it on real-world documents, as I tested it mostly on text-only documents.
both packages seem to work flawlessly together -> this issue could be closed
Yeah, you are right. Thanks for the reminder.
Since linebreaker and lua widow control package both work on optimizing typesetting results in fully automated fashion, it would be great if one could take care to keep them compatible/playing well with each other.