Le 13 oct. 2012 a 13:14, jfbu <[email protected]> wrote : > > Le 12 oct. 2012 22:01, jfbu <[email protected]> wrote : > >> Hi, [I just posted on c.t.tex, but figured here could be better] >> >> the following code gives dissimilar results for XeTeX >> and LuaLatex. >> >> \documentclass{article} >> \usepackage{ifxetex} >> \begin{document} >> \ifxetex >> >> \the\mathcode`\- % 8704="2200 >> \the\XeTeXmathcodenum`\- % 37748736=2.2^{24} + 2.2^{21} + 0 >> >> \else >> >> \the\mathcode`\- % 8704 = "2200 >> >> \the\luatexUmathcodenum`\- % 8704, if interpreted as Unicode >> % mathcode 0.2^{24} + 0.2^{21} + 8704 >> \fi >> \end{document} >> >> This is a bit strange. The problem with this behavior of LuaLaTeX >> is that I need to know *in advance* if I have to interpret the >> number resulting from \luatexUmathcodenum as a legacy mathcode >> or as a Unicode mathcode ! ... >> >> best wishes, >> Jean-Francois > > > Hi again > > \documentclass{article} > \usepackage{ifxetex} > \begin{document} > \ifxetex > \the\XeTeXmathcodenum`\a % 31457377 > \the\XeTeXmathcodenum`\1 % 14680113 > \the\XeTeXmathcodenum`\- % 37748736 > \else > \the\luatexUmathcodenum`\a % 31457377 > \the\luatexUmathcodenum`\1 % 28721 > \the\luatexUmathcodenum`\- % 8704 > \fi > \end{document} > > Why the difference between querying the mathcode of a and 1? > > This makes it impossible for me to use \luatexUmathcodenum to > query the family number for 1 or -, as I can not know in advance > if it will return a legacy mathcode (as here) or a Unicode mathcode > (if 1 or - have been assigned Unicode mathcode). > > Jean-Francois
How do I know that a package did not do something like \mathcode`\a="161\relax? If this happens \the\luatexUmathcodenum`\a will be a legacy mathcode 353 and not a Unicode mathcode like 31457377. The family number is not on the same bits, and my code will be broken. Is there some primitive (not some Lua code that I don't want to have to learn) from Lualatex which gives me a safe way to extract the family number of a math character? regards Jean-Francois
