# How to use more than 16 math symbol fonts in XeTeX?

Roughly speaking, XeTeX (and LuaTeX) extends number of math fonts from 16 to 256, but currently (texlive 2019) latex2e only allowa math alphabets in full range 0-255, and restrict symbol fonts 0-15 (changed in this commit, in 2015).

As a XeTeX user, how can I use the full 0-255 symbol fonts?

Related info:

An extension to more than 16 symbol fonts needs more extensive changes replacing all uses of \mathchardef \mathaccent \radical etc by \U... versions.

David Carlisle Mar 12 '15, from this comment

Maybe I should learn the usage of \U... primitives, documented in texdoc xetex, sec. 2.3.

• usually with xetex extended math font support you would use an opentype math font via unicode-math which typically only uses one family, so having 16 available symbol families is more than enough, – David Carlisle Aug 4 '19 at 20:41
• @DavidCarlisle Yes, for personal use, I load unicode-math. The above question is raised in a Chinese latex template, where the template already used up 16 fonts, but user wants to load extra math font package. – Johannes Z Aug 5 '19 at 0:58

The problem with using more than 16 isn't really anything you need to change within the core xetex support code, but if you then make the \newfam allocation go past 16, any "normal" math font package will not work as all the \mathchardef will give errors if used with family number greater than 15.

However if you keep the allocated families low you could could take a "safe" family that you know will never be reached via the normal allocations, say 100 and use it as follows

\documentclass{article}

% abc from dunhill in family 100

\font\cmdx =cmdunh10
\font\cmdvii =cmdunh10 at 7pt
\font\cmdv =cmdunh10 at 5pt
\textfont 100 = \cmdx
\scriptfont 100 = \cmdvii
\scriptscriptfont 100 = \cmdv
\Umathchardef \da 0 100 a
\Umathchardef \db 0 100 b
\Umathchardef \dc 0 100 c

\begin{document}

$abc\da\db\dc$

\end{document}
`