105

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...

3
  • 1
    got the same problem when I used \mathsf{}
    – Noix07
    Jul 6, 2015 at 20:07
  • 1
    Removing MnSymbol worked for me too. (see: OP's edit and the answers and discussion below)
    – BarkleyBG
    Jan 20, 2017 at 18:27
  • None of these answers worked for me. If anyone else has the same issue, the only thing that work for me was switching from pdflatex to xelatex. Based on this link.
    – TomCho
    Sep 14, 2021 at 14:02

5 Answers 5

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.

7
  • 2
    Awesome! Works perfectly for me.
    – ಠ_ಠ
    Jan 30, 2016 at 8:57
  • 19
    Why is this working?
    – gbernardi
    Feb 24, 2016 at 8:28
  • 6
    @gbernadi: Seems the bm package uses a lot of alphabets and these commands tell bm to limit its use. tex.ac.uk/FAQ-manymathalph.html
    – jcai
    Feb 27, 2016 at 23:00
  • 3
    I'm just getting an error message saying "\hmmax already defined". Apr 3, 2018 at 2:37
  • 1
    It gives me the same errors as before. :(
    – jdc
    Feb 5, 2019 at 1:20
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).

1
29

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}
11
  • Honestly, I have no idea why MnSymbol was there; my coauthor added it at some point. Oct 2, 2010 at 7: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. Oct 2, 2010 at 7: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 :) Oct 2, 2010 at 8: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 2, 2010 at 9:54
  • 2
    Sure, I can understand that! Hopefully, math fonts will be more flexible, one day.
    – pluton
    Nov 24, 2010 at 11:10
4

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.
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .