You can use more that 16 math groups (math alphabets, in particular) with XeLaTeX or LuaLaTeX; here's an example. One must also change the allocation mechanism, of course.
\documentclass{article}
\makeatletter
\def\new@mathgroup{\alloc@8\mathgroup\mathchardef\@cclvi}
\def\document@select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\ifmmode
\ifnum\csname c@mv@\math@version\endcsname<\@cclvi
\begingroup
\escapechar\m@ne
\getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
\globaldefs\@ne \math@fonts
\endgroup
\expandafter\extract@alph@from@version
\csname mv@\math@version\expandafter\endcsname
\expandafter{\number\csname
c@mv@\math@version\endcsname}%
#1%
\global\advance\csname c@mv@\math@version\endcsname\@ne
\else
\let#1\relax
\@latex@error{Too many math alphabets used
in version \math@version}%
\@eha
\fi
\else \expandafter\non@alpherr\fi
#1{#4}%
}%
}
\def\select@group#1#2#3#4{%
\ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi
{%
\ifmmode
\ifnum\csname c@mv@\math@version\endcsname<\@cclvi
\begingroup
\escapechar\m@ne
\getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3%
\globaldefs\@ne \math@fonts
\endgroup
\init@restore@version
\xdef#1{\noexpand\use@mathgroup\noexpand#2%
{\number\csname c@mv@\math@version\endcsname}}%
\global\advance\csname c@mv@\math@version\endcsname\@ne
\else
\let#1\relax
\@latex@error{Too many math alphabets used in
version \math@version}%
\@eha
\fi
\else \expandafter\non@alpherr\fi
#1{#4}%
}%
}
\makeatother
\DeclareMathAlphabet{\mA}{OT1}{pcr}{m}{n}
\DeclareMathAlphabet{\mB}{OT1}{pcr}{m}{it}
\DeclareMathAlphabet{\mC}{OT1}{pcr}{b}{n}
\DeclareMathAlphabet{\mD}{OT1}{pcr}{b}{it}
\DeclareMathAlphabet{\mE}{OT1}{ptm}{m}{n}
\DeclareMathAlphabet{\mF}{OT1}{ptm}{m}{it}
\DeclareMathAlphabet{\mG}{OT1}{ptm}{b}{n}
\DeclareMathAlphabet{\mH}{OT1}{ptm}{b}{it}
\DeclareMathAlphabet{\mI}{OT1}{pag}{m}{n}
\DeclareMathAlphabet{\mJ}{OT1}{pag}{m}{it}
\DeclareMathAlphabet{\mK}{OT1}{pag}{b}{n}
\DeclareMathAlphabet{\mL}{OT1}{pag}{b}{it}
\DeclareMathAlphabet{\mM}{OT1}{pbk}{m}{n}
\DeclareMathAlphabet{\mN}{OT1}{pbk}{m}{it}
\DeclareMathAlphabet{\mO}{OT1}{pbk}{b}{n}
\DeclareMathAlphabet{\mP}{OT1}{pbk}{b}{it}
\begin{document}
$
\mathbf{X}
\mathit{X}
\mathsf{X}
\mathtt{X}
\mA{X}
\mB{X}
\mC{X}
\mD{X}
\mE{X}
\mF{X}
\mG{X}
\mH{X}
\mI{X}
\mJ{X}
\mK{X}
\mL{X}
\mM{X}
\mN{X}
\mO{X}
\mP{X}
$
\end{document}
One could do without copying all that stuff with a simpler patch; the following code should replace all that in the previous one is between \makeatletter
and \makeatother
:
\usepackage{etoolbox}
\makeatletter
\def\new@mathgroup{\alloc@8\mathgroup\mathchardef\@cclvi}
\patchcmd{\document@select@group}{\sixt@@n}{\@cclvi}{}{}
\patchcmd{\select@group}{\sixt@@n}{\@cclvi}{}{}
\makeatother
Compiling the document with xelatex
or lualatex
will show the following horror; of course you'll have better use cases.

Important remark
As Khaled Hosny quite rightly observes, there is a very important limitation: this can work only for math alphabets; it's impossible to define \mathchar
values that use the extended set (the XeTeX or LuaTeX extensions should be used). Thus one has to be careful when using math symbol fonts which must be loaded in memory before the math alphabets. So, if , say, stmaryrd
is loaded, it's best to ensure that a formula using it is typeset before using the new math alphabets; a \sbox0{$\Ydown$}
in the preamble should be sufficient, because so a math group will be permanently allocated for stmaryrd
.
normal
there refered to\mathversion{normal}
as opposed to\mathversion{bold}
not the latex engine. As @egreg says you can use xe/lua latex but usually you can arrange not to use so many math alphabets in standard latex as well. In particular any alphabets such as \mathrm \mathit etc could usually instead be accessed as text fonts \textrm{} etc and avoid using up one of the math font slots.\mathfrak{A}
to denote a single structure, whereas use\mathsf{A}
to denote a structure class.