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.
Allocating a new math alphabet is handy, but can lead to the infamous "Too many math alphabets" error. However, if only text size for Fraktur letters is needed, one can quite well get away by
\newcommand\mathfrak[1]{\mbox{\usefont{U}{euf}{m}{n}#1}}
which won't waste a math alphabet.
I really don't think that MnSymbol goes along finely with Kp fonts. If only a restricted number of symbols from MnSymbol
are needed, it's possible to use them without allocating a math group. But one should know what symbols you're using for giving precise advice.
Best Answer
That definition of
\bsf
and\bsfh
produces many more errors, not only the "Too many math alphabets" one.Actually the error is caused by your definition of
\bsfh
, that causes a loop which is stopped by the "Too many math alphabets" error and at the end prints the required symbol correctly (but doing so it exhausts the number of math families in the\boldmath
version).A more sensible definition for
\bsf
and\bsfh
can bethat shouldn't cause the problem with math alphabets (I checked and only 9 out of 16 are used). In this way
\bsf{x}
will give correct results also in subscripts and superscripts. Shouldn't you need them in such positions, a simpler definition can be used:Don't load
latexsym
, which is obsolete (so doing you'll reduce the math alphabet usage); the symbols it provides are available throughamssymb
.