[NTG-context] lua-widow-control module error in LMTX

Max Chernoff mseven at telus.net
Tue Apr 26 04:42:25 CEST 2022


On 2022-04-25 6:51 p.m., Eduardo Bohoyo wrote:
> First things first.  I want to acknowledge and thank you for the tough 
> mission that surely involves maintaining this module for the benefit of 
> the TeX community and, most especially, for LMTX in particular, due to 
> the very reasons you have just explained.

Well thanks :) These days I write most of my documents in LMTX, so the LMTX
support is pretty self-serving -- I'm admittedly surprised that there's
another lwc + LMTX user.

> Regarding your remarks, you are right in your assumptions: I didn't have 
> the required lua file installed in its corresponding folder. That's what 
> I was missing, and, logically, what made my compilation crash.

Yeah, it's a pretty easy mistake to make. For Knuth TeX, shared files go
in texmf/tex/generic and Plain-specific files go in texmf/tex/plain, but
with LuaTeX there's just texmf/tex/luatex so it gets a little confusing.

> Now I finally get the pdf. But unfortunately, this "new" pdf is the same 
> with the module uncommented as when I had it commented. There is no 
> difference at all. And you're right: even context --make doesn't solve 
> the problem. To give you an idea, although my dummy document has 78 
> pages, only 55 can really be said to be dummy text that can benefit from 
> the module. Well, only in those 55 pages I have 2 orphans, 5 widows and 
> 6 broken hyphens.

So the first step here is to check the log file. If you see lines like

     module          > lua-widow-control > Widow/orphan detected. Attempting to remove.
     module          > lua-widow-control > Widow/Orphan NOT removed on page X.

then that means that lwc found a widow/orphan, but gave up. This usually
only happens if the page has only really short paragraphs, but it can also
happen if there aren't any paragraphs that both start and finish on the page.
I've got some neat graphs for this (see the upcoming TUGboat issue), but with
default settings this should happen for much less than 10% of potential
widows/orphans, so it seems unlikely that this is happening for every page.

If this actually is the issue, then you can try raising the "emergencystretch"
value in "\setuplwc", but that's probably going to give terrible results. The real
solution is to rewrite something, but that should usually be pretty rare.

---

If you see lines like

     module          > lua-widow-control > Widow/orphan detected. Attempting to remove.
     module          > lua-widow-control > Widow/orphan successfully removed at paragraph X on page Y.

but the widows/orphans weren't actually removed, then something really weird
is going on and definitely means that there's a bug in lwc. Rerun the document with

     \setuplwc[debug=true]

immediately after "\usemodule[lua-widow-control]" and either reply with the log
or post a new issue on the lwc GitHub.

---

If you only see

     modules         > 'lua-widow-control' is loaded

but not any other lines mentioning lwc, then something weird is going on, and
lwc is loaded but not enabled. If this is the case, same as last time: enable
debug mode and reply with the log.

---

If you don't see

     modules         > 'lua-widow-control' is loaded

at all, then you're not actually loading lwc. This probably means that ConTeXt
can't find the file, there should hopefully be clues somewhere in the log file.

> Thanks again for your work and yours observations.

No problem; glad to help.

-- Max


More information about the ntg-context mailing list