# [texhax] [XeTeX] When using more than 16 math alphabets, \mathtt uses italic font

Khaled Hosny khaledhosny at eglug.org
Sun Jun 24 14:17:19 CEST 2012

On Sun, Jun 24, 2012 at 02:41:21AM +0000, Vafa Khalighi wrote:
> I know that in TeX, you can only use 16 math alphabets but XeTeX
> extends this so I was curious to enlarge the number of my math
> alphabets and I had to redefine some internals of LaTeX. My minimal
> working example is attached.
>
> But this makes the word "Test" to apear in Italic. You can delete any
> of the \DeclareSymbolFont and then \mathtt worked as expected. This
> shows that this only happens when the number of math alphabets exceeds
> 16. Why does this happen and how should one fix this?
>
> I tried the same thing with luatex and I got expected result so it
> seems that something is wrong with XeTeX.

XeTeX's \fam primitive does not seem to have been extended to accept
higher values, and since the legacy mathcode format does allow higher
families as well, the only way to access higher math families for now is
through extended math primitives. A simpler test:

\tracingonline=1
\font\cmscten=cmcsc10 at 10pt
\font\dunhten=cmdunh10 at 10pt
\textfont15=\cmscten
\textfont16=\dunhten
\$\$
\fam15 a
\fam16 A
\XeTeXmathchar"0 16 `A
\showlists
\$\$
\bye

Regards,
Khaled