TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer
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 '12 at 7:52
@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 '12 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 '12 at 9:37
@Denis You should load the package bm and say \newcommand{\tv}[1]{\bm{\mathcal{#1}}}. – egreg Mar 19 '12 at 9:43
ok, thank you very much! – Denis Mar 19 '12 at 10:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.