Am 12.07.2011 16:39, schrieb Taco Hoekwater:
On 07/12/2011 04:33 PM, Taco Hoekwater wrote:
On 07/12/2011 04:22 PM, Ulrike Fischer wrote:

With xetex I can at least use

\XeTeXmathcharnumdef\test=\XeTeXmathcodenum`\x

but none of the various combination of \Umathchardef + \Umathcode
etc seems to work in luatex.

NYI, see:

Actually, that does not mean I think it is a good idea. The
conceptual problem is that \XeTeXmathcodenum (and therefore
also \Umathcodenum) can return a signed int to represent an
unsigned value, with is pretty horrible.

Yes, and the bit-packed structure of the mathcodenum isn't quite elegant either. The Lua table representation is fine, but unfortunately there is no way to represent that in TeX.


Why is it so important to be able to do a mathcharnumdef
(instead of a macro definition or straight \Umathchardef?)

Because of the pattern that Ulrike mentioned:

\Umathcodenum `a = \Umathcodenum `b
\Umathcharnumdef \foo = \Umathcodenum `b

The second pattern is used to save a math code and restore it later. You could save the math code in an integer register or macro, but then you couldn't use that as a mathematical character shorthand. I don't know what reasons Knuth had to introduce special syntax for \chardefs/\mathchardefs, but I think most TeX users expect this syntax to be present.

Reply via email to