[luatex] incompatible change to mathcode

Khaled Hosny khaledhosny at eglug.org
Wed May 9 13:24:38 CEST 2012

On Wed, May 09, 2012 at 10:16:50AM +0200, Taco Hoekwater wrote:
> Hi all,
> On 05/08/2012 09:11 PM, David Carlisle wrote:
> >
> >Luatex has changed mathcode to allow a larger numeric range however
> >changing TeX primitives without giving them new names seems suspect and
> >in this particular case, since \mathcode has changed but \mathchardef
> >has not the essential link between these two commands has been broken.
> Not quite. You get the results below because the math code for `a
> has been set using \Umathcode, not the TeX82 \mathcode. In fact,
> assignment to \mathcode is not extended in LuaTeX at all.

Right, TeX Live's luatex.ini loads luatex-unicode-letters.tex which
unconditionally sets the mathcode for all characters using \Umathcode.

The following example gives an error when run with luatex, but no error
if -ini is passed:

\input plain

That is the second issue I have with this luatex-unicode-letters.tex
files, which makes me wounder if it is really a wise idea to preload it
into the format.

> The output of \mathcode is indeed extended, and the value you get
> uses the same format as the input for \Umathcodenum (with that
> somewhat unusual XeTeX-invented format explained by Kazuki Maeda).
> The reason for this is that math character objects in luatex remember
> how they were defined. So if you do not want incompatibilities with
> TeX82, it would help if you did not use extended primitives to define stuff.
> That said, probably the result of (\the)\mathcode can be reverted
> back to compatibility with TeX82, and output a warning (and zero)
> if the actual value is out-of-range (like XeTeX does).

Attached a patch that does this (with the added bonus of fixing the
damage of luatex-unicode-letters.tex), what do you think? if it is OK,
I'll commit it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathchar_compat.diff
Type: text/x-diff
Size: 3808 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20120509/ed7d285b/attachment.bin>

More information about the luatex mailing list