Math alphabets are loaded "on demand"; so, your \let\mathpzc\mathcal
doesn't cause LaTeX to allocate a new math alphabet, since the meaning assigned with \DeclareMathAlphabet
is forgotten (and the math alphabet has not yet been assigned a "math group").
However, once a math alphabet has been used in a formula, its association to a math group is permanent (the actual font will be recomputed based on the current font size).
You can see what math groups are allocated at a particular spot in the document with \PrintMathFonts
defined as
\newcommand{\PrintMathFonts}{%
\count255=0
\loop\ifnum\count255<16
(\the\count255:~\fontname\textfont\count255)
\advance\count255 by 1
\repeat}
There are only 16 math groups available (the limit is raised by XeTeX and LuaTeX, but one has to change the allocating macros). If I use it immediately after \begin{document}
I get
(0: nullfont) (1: nullfont) (2: nullfont) (3: nullfont) (4: nullfont) (5: nullfont) (6: nullfont) (7: nullfont) (8: nullfont) (9: nullfont) (10: nullfont) (11: nullfont) (12: nullfont) (13: nullfont) (14: nullfont) (15: nullfont)
After a trivial formula, $a$
, I get
(0: jkpmn7t) (1: jkpmi) (2: jkpsy) (3: jkpex) (4: jkpmia) (5: jkpsya) (6: jkpsyb) (7: jkpsyc) (8: jkpexa) (9: matha10) (10: nullfont) (11: nullfont) (12: nullfont) (13: nullfont) (14: nullfont) (15: nullfont)
After the big formula I get
(0: jkpmn7t) (1: jkpmi) (2: jkpsy) (3: jkpex) (4: jkpmia) (5: jkpsya) (6: jkpsyb) (7: jkpsyc) (8: jkpexa) (9: matha10) (10: jkpbn7t) (11: pzcmi7t at 11.99997pt) (12: nullfont) (13: nullfont) (14: nullfont) (15: nullfont)
If I also add the formula $\mathsf{A}$
, I get
(0: jkpmn7t) (1: jkpmi) (2: jkpsy) (3: jkpex) (4: jkpmia) (5: jkpsya) (6: jkpsyb) (7: jkpsyc) (8: jkpexa) (9: matha10) (10: jkpbn7t) (11: pzcmi7t at 11.99997pt) (12: jkpssmn7t) (13: nullfont) (14: nullfont) (15: nullfont)
Note that some math groups are allocated as soon as a formula is typeset, others aren't (they correspond to math alphabets as opposed to math symbol fonts).
So you see that 10 math groups are already allocated, so you are free to use only up to 6 different math alphabets that don't use letters from the symbol fonts already available (look for \DeclareSymbolFontAlphabet
in fntguide.pdf
).
EDIT
A variant of the code above will show in the log file the list, together with the font's symbolic name:
\newcommand{\PrintMathFonts}{%
\typeout{*** Math fonts list ***}
\count255=0
\loop\ifnum\count255<16
\typeout{(\the\count255: \the\textfont\count255 = \fontname\textfont\count255)}
\advance\count255 by 1
\repeat
\typeout{***}}
For example, what's printed after the big formula is
*** Math fonts list ***
(0: \OT1/jkp/m/n/10 = jkpmn7t)
(1: \OML/jkp/m/it/10 = jkpmi)
(2: \OMS/jkp/m/n/10 = jkpsy)
(3: \OMX/jkp/m/n/10 = jkpex)
(4: \U/jkpmia/m/it/10 = jkpmia)
(5: \U/jkpsya/m/n/10 = jkpsya)
(6: \U/jkpsyb/m/n/10 = jkpsyb)
(7: \U/jkpsyc/m/n/10 = jkpsyc)
(8: \U/jkpexa/m/n/10 = jkpexa)
(9: \U/matha/m/n/10 = matha10)
(10: \OT1/jkp/b/n/10 = jkpbn7t)
(11: \OT1/pzc/m/it/10 = pzcmi7t at 11.99997pt)
(12: \nullfont = nullfont)
(13: \nullfont = nullfont)
(14: \nullfont = nullfont)
(15: \nullfont = nullfont)
***
There's no "global registry", I'm afraid, so you have to sort out the fonts according to the packages you're using. Look for the commands
\DeclareSymbolFont
\DeclareMathAlphabet
The first command declares a math group that is always allocated; the second one causes the math group to be allocated on demand, as said before. For example, the entry
(10: \OT1/jkp/b/n/10= jkpbn7t)
is caused by \mathbf
and in kpfonts.sty
you can find a line
\DeclareMathAlphabet{\mathbf}{OT1}{jkp\kp@famillem\kp@fligm\kp@stylem}{b}{n}
that defines it.
Best Answer
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.
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
:Compiling the document with
xelatex
orlualatex
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 forstmaryrd
.