[luatex] \mathchardef\foo=\mathcode`\x

Hans Hagen pragma at wxs.nl
Fri Dec 18 23:19:46 CET 2015


On 12/18/2015 10:27 PM, David Carlisle wrote:
> The idiom
>
> \mathchardef\foo=\mathcode`\x
>
> is commonly used to  save a mathcode of some character while you
> temporarily change it for some reason.
>
> Notably it's used (4 times) during the loading of the AMS package
> amsmath, the main math support in latex.
>
> this breaks in 0.87 as \mathcode returns a number suitable for
> \Umathcharnumdef which is too large for \mathchardef.
>
> I'm not (necessarily) suggesting that the luatex behaviour change but
> if anyone is wanting to test latex math support with the new engine
> they may want to patch a local copy of amsmath.sty for testing as at
> the end of this message.
>
> Since \mathchardef is mainly for legacy use anyway, I wonder if luatex
> could keep this working, specifically \mathchardef if given a number
> bigger than hex 8000 could perhaps (instead of giving an error) act
> like \Umathcharnumdef.. An alternative would be to try to do the same
> test  via a macro redefinition of \mathchardef probably using the lua
> token scanner to get the integer) but emulating all the primitive
> behaviour in a compatible way might be hard.

changing the meaning of \mathchardef is also kind of incompatible (who 
knows who depends on the error message for whatever reason)

anyway, i'll add that fallback but there is no way back and it will not 
be under some 'option' control


Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list