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

Max Chernoff mseven at telus.net
Mon Apr 25 22:00:49 CEST 2022

(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
 > 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 
     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 

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

More information about the ntg-context mailing list