Hi, Max:

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.

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.

To make my confusion even worse, I had done a strict search inside the mkxl code. It wouldn't take me to line 63 because I had added the extension (lua-widow-control.lua, not just lua-widow-control).

Anyway, a mess only due to my ignorance.

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.

I have read several times all the options of the module in the /lua-widow-control.pdf/ document, but I don't even dare to mess with those options because it seems to me very radical that my output pdf is the same with the module uncommented in my code.

Of course, mtxrun --find-file lua-widow-control.lua yields what you would expect:


Thanks again for your work and yours observations.


El 25/4/22 a las 22:00, Max Chernoff escribió:
(Please keep me CC'd as I'm not subscribed to the list)

Hi, I'm the lua-widow-control author.

> lua error > lua error on line 74 in file
> /opt/luametatex/texmf-modules/tex/context/third/lua-widow-control/t-lua-widow-control.mkxl
> The odd thing is that line 75 of the t-lua-widow-control file is empty.

The \setuplwc command ends on line 74, which then triggers \everysetuplwc which then calls \ctxlua{lwc.enable_callbacks()}. This fails since lwc is undefined because the Lua file isn't loaded because ConTeXt can't seem to find the file.

In Plain LuaTeX and LuaLaTeX, a missing Lua file is a fatal error:

    $ luatex "\nonstopmode\directlua{require 'not-a-real-file'}\bye"

    This is LuaTeX, Version 1.13.2 (TeX Live 2021/W32TeX)
     restricted system commands enabled.

    [\directlua]:1: module 'not-a-real-file' not found:
            no field package.preload['not-a-real-file']
            [kpse lua searcher] file not found: 'not-a-real-file'
    stack traceback:
            [C]: in function 'require'
            [\directlua]:1: in main chunk.
    <*> \nonstopmode\directlua{require 'not-a-real-file'}
    (see the transcript file for additional information)
    warning  (pdf backend): no pages of output.
    Transcript written on texput.log.

so I'm a little surprised that ConTeXt just issues a warning here when it can't find the file:

   resolvers > lua > unknown file 'lua-widow-control.lua'

> when it says it doesn't know the lua-widow-control.lua file. I don't see
> any mention of this file within the t-lua-widow-control module.

lua-widow-control.lua is loaded at line 63 of the .mkxl:

> Could it be that this module is not yet mature for lmtx

Lua-widow-control is certainly more stable with Plain/LaTeX, but it usually runs fine with LMTX. The entire lwc manual is written in ConTeXt/LMTX so I (usually) notice pretty quickly when things break.

The only real "issue" with LMTX is that the engine changes pretty quickly, so lwc may sometimes be broken for a few days between an engine update and whenever I push out a fix. This doesn't happen with Plain/LaTeX since the LuaTeX engine is mostly frozen.

Interestingly, the MkXL version of lwc actually predates the MkIV version, although only by a few months.

> I have \usemodule[lua-widow-control] in my tex document, and
> I haven't forgotten to do the prescribed mtxrun --generate after
> including the module in my third-party folder of my luametatex
> installation on Arch.

Hmm, that's odd then. I'm not entirely sure why this is happening, so I'm going to take a random guess:

Maybe you installed lwc using a zipfile from either GitHub or the ConTeXt Garden modules site, then you copied the files into your texmf-modules/ folder, *but* you only copied the "tex/context/" folder and not all of the folders in the "tex" folder. The "lua-widow-control.lua" file is in the "tex/luatex/" folder, so if you didn't also copy that across you're going to have problems.

Again, just a random guess.  If that doesn't work, you could maybe try running
    context --make
but I doubt that that would fix anything here. You could also try deleting the filename cache files at:
then rerunning
    mtxrun --generate
I've never deleted those files before, but it's in a folder called "cache" so it's _probably_ safe to delete (make a backup just in case though).

If none of that works, then the issue could be something else on your end, or I could have screwed something up in lwc. In that case, try running
    find /opt/luametatex/texmf-modules/ -path '*widow*' -print
    mtxrun --find-file lua-widow-control.lua
and reply with the output.

Oh, and one more note. ConTeXt version "2022-04-11 19:20" renamed some of the engine Lua functions, so make sure to update to lwc v2.0.6 (if you're using a recent ConTeXt version). Otherwise after you fix the "unknown file" error, you would get an "attempt to call a nil value" error which isn't any better.

Let me know if you have any other issues.

 -- Max
If your question is of interest to others as well, please add an entry to the 

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net

Reply via email to