# [luatex] incompatible change to mathcode

Keith J. Schultz schultzk at gmx.net
Wed May 9 09:17:45 CEST 2012

```Hi All,

From the bug report:
Description of bug:
LuaTeX's \mathcode is extended to allow for a 21-bit character argument.
This seems to cause errors when using bm.sty with LuaLaTeX.
A 21-bit character argument! That would mean that it is stored in  bit field!
If so, then the manipulation of the bit field could be flawed.

If it is store in 3 Byte (24-bit), then there could be encoding problems.
In others one of the highest/lowest byte might contain junk!

Also, depending on how the values are assigned this could cause problems.

My assumption is that somebody has either his/her math wrong or the
algorithm(s) used are flawed.

regards
Keith.

Am 09.05.2012 um 03:55 schrieb David Carlisle:

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20120509/99096625/attachment.html>
```