Re: Oddity in .../tex/context/base/mkxl/layo-ini.lmt

Wolfgang Schuster <[email protected]> Tue, 2 Jun 2026 22:30:02 +0200
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Am 02.06.2026 um 13:46 schrieb Jim via ntg-context:
> Hi all,
> 
> someone (who may or may not wish to remain nameless) wanted to create a
> two-sided version of ANSS-CE, so he added/changed a couple of lines in the
> environment file and ran context.
> 
> His changes causes context to spit out this error:
> 
>    tex error       > tex error on line 90 in file 00_FrontMatter/a02_Preface.tex:
> 
>    lua error:
> 
> 	  registered function call [272]: ...ods/tex/texmf-context/tex/context/base/mkxl/layo-ini.lmt:69: attempt to perform arithmetic on a boolean value
> 
> This line is
> 
>          return not (r or texgetcount(c_realpageno)) % 2 == 0
> 
> If I change the line to
>          return not ((r or texgetcount(c_realpageno)) % 2 == 0)
> everything works (apparently) fine.
> 
> 
> Regardless of whether the statements added to the ANSS-CE environment file
> were correct, I think the function has an issue which should be fixed.
> I don't know whether this is the "correct" fix or not, but FWIW, here it is.
> 
> I am surprised by two things here:
> 
> (1) The file layo-ini.lmt in my ConTeXt standalone is the same as the one
>      in TL2025, so the file hasn't changed recently.  And yet surely this is
>      not the first time someone tried to create a double-sided document.
>      What peculiarity of ANSS-CE causes this function to get called with a
>      nil argument when apparently it isn't a problem for other documents?
> 
> (2) In a document of 357 pages, this function is only called 31 times.
>      I might have guessed it would be called for every page.  If it is
>      called only when some other combination of "unusual" things happens,
>      this might (partially) explain (1).  But I wonder what this unusual
>      combination is.
> 
> Sadly, ANSS-CE is not a MWE for anyone's idea of "minimal".  I could send
> along the changes to the environment file which reveals this problem, if
> anyone is interested.

Your minimal example:

\setuppagenumbering[alternative=doublesided]

\setupuserpagenumber[number=2]

\starttext
\inmargin{ }
\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________