[luatex] a problem with luatexUmathcode

jfbu jfbu at free.fr
Sun Oct 14 12:47:36 CEST 2012

Le 14 oct. 2012 a 12:25, Taco Hoekwater <taco at elvenkind.com> wrote:

> On 10/12/2012 10:01 PM, jfbu 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.
> Somehow I misinterpreted what XeTeX did, so the current version
> of \Umathcodenum in luatex remembers what the defining command was.
> I can easily revert that to be compatible with XeTeX (after all,
> that was the goal) but you will have to wait for the next release.
> And at the moment, I do not see an easy solution for your problem,
> sorry.
> Best wishes,
> Taco

Thanks for the information. I bumped into this problem
because I wanted to check all occurrences of \mathcode in my
package mathastext and make sure the code would be
compatible with Unicode engines. This I partially had done
already in 2011, but the other day after returning to the
package I saw that there were some parts which still needed
to be fixed, and this time it was not a matter of assigning
a known Unicode mathcode to a character, but rather of
querying first its value.

The solution retained at this moment (in the version which
has been uploaded to CTAN yesterday and will appear in
mirrors in a few days) is that for the LuaLatex part the
package does as if the mathcodes it cares about (the ones of
\-, \=, \|, and also for a and 1) have their default values;
whereas in the XeTeX part, it does query the value for
compatibility with packages which might have altered them. I
need these things because I change the mathcodes of -, =, |,
but they are used in \relbar and \Relbar for arrows (or in
the \models macro) so obviously I need to maintain \relbar
and \Relbar to act as if nothing had been done to - and =.

As you tell me that in a later release the
\luatexUmathcodenum will, as \XeTeXmathcodenum, always
return a Unicode mathcode, this is good news to me as I have
just have to wait until this is done, and then making
mathastext finally compatible with Lualatex will be

Thanks a lot, best regards

More information about the luatex mailing list