Am 12.07.2011 16:22, schrieb Ulrike Fischer:
Hm. I understand \mathcode and \Umathcode actually look at the same
value and so are not independent. But I have the impression the
problem is less with \mathcode (which after all gives a value) but
with \mathchardef which doesn't accept it if the \mathcode is too
large.
This is not an issue of a \mathcode being too large, but about
overlapping representations. Say you have a character with class 0,
family 0 and code point U+1111; its \Umathcodenum is 0x1111. But the
\mathcode of a character with class 1, family 1, and code point U+11 is
0x1111 as well---how should \mathchardef distinguish between the two?
But looking at the luatex manual I didn't actually understand how to
replace \mathchardef/\mathcode. What is the luatex equivalent of
\mathchardef\test=\mathcode`\x?
I think there is none because \Umathcharnumdef is missing (see
http://tracker.luatex.org/view.php?id=620). In the lualatex-math package
I do
\Umathchardef \test
\directlua {
print_class_fam_slot( \number \numexpr `\x \relax )
}
function print_class_fam_slot(char)
local code = tex.getmathcode(char)
local class, family, slot = unpack(code)
local result = string.format("%i %i %i ", class, family, slot)
tex.sprint(cctb.string, result)
end