I know this is a common problem, but I searched for a solution and can't find one. I tried to play with bmmax/hmmax but it does not help. Below is the minimum part of the code to reproduce the problem. I would be grateful for any advice/help.






\def\bsf  #1{           \mbox{\boldmath $\sf #1$}}
\def\bsfh #1{\widehat  {\mbox{\boldmath $\sf #1$}}}


\bsf x ~ \bsfh x


P.S. I have a 70-pages document which compiles fine but as soon as I delete some first 40 pages with formulas I encounter that error. That's something I can't explain to myself.

1 Answer 1


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 be


that 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:

\newcommand{\bsf}[1]{\mbox{\normalfont\sffamily\bfseries #1}}

Don't load latexsym, which is obsolete (so doing you'll reduce the math alphabet usage); the symbols it provides are available through amssymb.

  • Thank you for your corrections. Frankly, I have a lot of similar 'wrong' definitions with '\rm' '\mit' '\cal' and without any font change. Could you roughly say how DeclareMathAlphabet will look like?
    – Denis
    Mar 19, 2012 at 7:52
  • 1
    @Denis Never underestimate error messages, even if the output looks right. Never use \rm, \sf, \it and similar two letter commands in math mode; use \mathcal{A} and not \cal A.
    – egreg
    Mar 19, 2012 at 7:58
  • ok. so is this \newcommand{\tv}[1]{\mbox{\boldmath $\mathcal{#1}$}} a proper way to write or should I do it somehow with \DeclareMathAlphabet ?
    – Denis
    Mar 19, 2012 at 9:37
  • @Denis You should load the package bm and say \newcommand{\tv}[1]{\bm{\mathcal{#1}}}.
    – egreg
    Mar 19, 2012 at 9:43

You must log in to answer this question.

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