# [luatex] incompatible change to mathcode

David Carlisle davidc at nag.co.uk
Wed May 9 03:55:50 CEST 2012

```Thanks for your reply,

> We extend other primitives as well, e.g. \char (XeTeX does, too).

\char is less problematic as it doesn't return a value unlike \mathcode.

>
> IMO, I think we should just extend \mathchardef in a similar way, so
> that \mathchardef\matha\mathcode`a works again.

That would at least make the changes consistent, so would be an
improvement but they would still be dreadfully incompatible with TeX.

It wouldn't for example be enough to fix the latex bug report referenced
in my previous mail. It would move the error to somewhere else.

bm uses \mathchardef\matha\mathcode`a followed by \meaning\matha to get
the hex mathcode which it then splits up to extract the components.

even if the \mathchardef did not generate an error the code will fail
completely, and to be honest after reading the luatex reference I
couldn't see how to fix it. Perhaps it's just because it is late but....

with latex

\mathcode`a gives hex 7161

so that's mathalpha, letters  char 61

with lualatex I get

1E00061

but apart from the obvious 61 at the end I have no idea where that
number comes from?

David

```