107

I just got the error

Too many math alphabets used in version normal.

on a document I'm editing. What can I do to fix this, other than stop using an alphabet? All I've found online is instructions on what to do if you're using the bm.sty package, which I'm not calling (but maybe it's hidden in the AMS stuff?). I'll note, the thing that broke it was adding mathrsfs and using \mathscr.

Anyways, as you'll see in my preamble, I tried what they suggested anyways, and it didn't work.

My preamble:

\documentclass[11pt]{amsart}  
\newcommand{\bmmax}{0}  
\newcommand{\hmmax}{0}  
\usepackage{amsmath, amssymb, amsthm, latexsym, amscd, enumerate, MnSymbol,bbm, etex,nicefrac,mathrsfs}

I'm using

\mathbf
\mathcal
\mathfrak
\mathscr
\mathsf
\mathbb
\mathbbm %(for a lower case blackboard bold letter)

I recognize this is a lot of math fonts, but doesn't seem unreasonable.


EDIT: getting rid of MnSymbol fixed things...

Marco Daniel
  • 95,681
Ben Webster
  • 1,915
  • 3
  • 14
  • 15

5 Answers5

60

I had the same problem and I discovered another solution here. So things worked for me when I added

\newcommand\hmmax{0}
\newcommand\bmmax{0}

in the preamble before including the font packages.

alaferg
  • 1,079
39

I recently encountered this error when compiling a proceedings volume. Each paper by itself could be typeset without throwing this error, but when all of them were included in the same LaTeX document, the math alphabet limit was exceeded.

We were able to solve the issue by declaring a separate math version for one of the more alphabet-hungry papers. Concretely, we put the command \DeclareMathVersion{normal2} at the end of the preamble, and the commands \mathversion{normal2} and \mathversion{normal} just before and after respectively the \include for the alphabet-hungry paper. This gave that paper an alphabet allocation (managed by the \c@mv@normal2 counter) that is separate from that of the others (managed by the \c@mv@normal counter), and this allowed both to stay below the limit. One thing this trick relies upon is that new math versions are created with all settings of the old one in place, so all declarations previously made for math version normal will be in place also in math version normal2 (and normal3, and so on, if one needs to repeat the trick).

30

It looks like you've got some redundant packages in there which are using up math family slots (of which there are only 16 total). (Note that amsart also loads the amsfonts package which uses up several more for \mathfrak, \mathbb, etc.) For example, in the latexsym docs:

These fonts are not automatically included in the NFSS2/LATEX2ε since they take up important space and aren’t necessary if one makes use of the packages amsfonts or amssymb.

Furthermore, if you're using MnSymbol, doesn't that override much of the amssymb package? I could be wrong about that.

Finally, it looks the bbm family takes up five (or is it only three?) on its own—if you don't need that many you can copy out just the definitions you need, such as

\DeclareMathAlphabet{\mathbbm}{U}{bbm}{m}{n}

Bearing all this in mind, here's a minimal example that at least compiles: (I've removed a couple of unrelated packages)

\documentclass[11pt]{amsart}
\usepackage{amsmath, amssymb, amscd, MnSymbol,mathrsfs}
\DeclareMathAlphabet{\mathbbm}{U}{bbm}{m}{n}% from bbm.sty
\begin{document}
\[
\mathbf A
\mathcal A
\mathfrak A
\mathscr A
\mathsf A
\mathbb A
\mathbbm a
\]
\end{document}
  • Honestly, I have no idea why MnSymbol was there; my coauthor added it at some point. – Ben Webster Oct 02 '10 at 07:51
  • 2
    Interestingly, I must have forgotten at least one math alphabet I was using, since your example compiles on my computer, but using your trick in the actual file doesn't. As I mentioned in the edit to the question, removing MnSymbol does, though. – Ben Webster Oct 02 '10 at 07:53
  • 18
    MnSymbol might be used for an obscure glyph you otherwise can't access. It would be nice, huh, if LaTeX provided better logging of where all the math alphabets got used up :) – Will Robertson Oct 02 '10 at 08:05
  • 4
    A question, since both XeTeX and LuaTeX can have 256 math families (right?), is this LaTeX error still relevant or can we get ride of it? – خالد حسني Oct 02 '10 at 09:54
  • Funny, I never thought of that. I do increase the number of math families that can be allocated in unicode-math, but I haven't done any testing on it. I should add a test file that just defines, say, 50 math families to see what happens. If it works then perhaps this should be added to xltxtra & luatextra as well. – Will Robertson Oct 02 '10 at 10:01
  • is there something new on Will's last comment? – pluton Nov 14 '10 at 00:07
  • @pluton — nope; does the answer here help you? – Will Robertson Nov 14 '10 at 07:21
  • @Will -- not really. I'd like to see the mathematical alphabet limitation removed soon :) – pluton Nov 23 '10 at 04:47
  • What should be done to add \usepackage[bbgreekl]{mathbbol} and have the code compile with \bbsigma? – pluton Nov 23 '10 at 04:52
  • @pluton No time to look into this right now, sorry. There's more to it than just changing a couple of lines of code, and I haven't started hunting down where the relevant portions are in source2e. – Will Robertson Nov 23 '10 at 05:40
  • 2
    Sure, I can understand that! Hopefully, math fonts will be more flexible, one day. – pluton Nov 24 '10 at 11:10
5

Traditional TeX is limited to only sixteen eight-bit math alphabets, which turned out not to be enough. Some solutions include:

  • Upgrade to XeTeX or LuaTeX, if you are allowed to.
  • Remove alphabets you don’t need. If a package defines a lot of math alphabets, loading just one or two with mathalpha can help.
  • Insert symbols as text, for example
    • \newcommand\somesymbol{\mathrel{\text{\usefont{U}{foo}{m}{n}\symbol{"AB}}}} is another way to insert the slot in slot "AB of font foo in the U encoding as a relational operator. This does not use up a math alphabet, but also does not respect the current math version.
    • \newcommand\mathfoo[1]{\textnormal{\foo #1}} is a way to create a new math alphabet formatted with the text-mode command \foo.
  • Declare math alphabets as different math versions. For example, declaring \mathbfcal as \boldsymbol{\mathcal{#1}} (which you enable with \SetMathAlphabet or \SetSymbolFont for math version bold) does not use up a math alphabet.
  • The OML encoding contains the Latin alphabet as well as both uppercase and lowercase Greek, so you can switch to that instead of loading a different alphabet for Greek.
  • As others have mentioned, you can restrict how many new alphabets bm creates. In particular, very few fonts use \hm.
Davislor
  • 44,045
2

In my case the use of \usepackage{stmaryrd} was conflicting with other packages. So most likely you have such a conflicting package.

sepideha
  • 179