TransWikia.com

Too many alphabets, how to avoid this error?

TeX - LaTeX Asked by Alba Crespo Pérez on October 1, 2020

I’m having a problem when I try to use too many different types of math symbols in LaTeX, such as in this example:

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
usepackage{latexsym}
usepackage{dsfont}
usepackage{gensymb}
usepackage{amssymb}
usepackage{authblk}
usepackage{amstext}
usepackage{amsfonts}
usepackage{amsthm}
usepackage{mathtools}
usepackage{upgreek}
usepackage{textcomp}
usepackage{bm}
usepackage[mathscr]{euscript}
leteuscrmathscr letmathscrrelax
usepackage[scr]{rsfso}
usepackage{siunitx}
usepackage[e]{esvect}
begin{document}
$mathbb{R}mathscr{P}euscr{B}mathcal{C}vv{x_0}$
end{document}

When I try to compile that, the following error message appears in the terminal:

! LaTeX Error: Too many math alphabets used in version normal.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.21 $mathbb{R}mathscr{P}
                           euscr{B}mathcal{C}vv{x_0}$
? 

What can I do to use more alphabets? I actually need all of those math symbols in my document.

4 Answers

First of all, remove latexsym and gensymb that add nothing really useful: the former is covered by amssymb and the latter’s symbols can easily be produced in a different way.

This already saves two math groups. Also loading dsfont is dubious, unless you want two different doublestroke fonts.

Probably also upgreek is inessential.

As a side note, amsfonts is automatically loaded by amssymb and amstext by amsmath.

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{amssymb}
usepackage{amsthm}
usepackage{upgreek}
usepackage{authblk}
usepackage{textcomp}
usepackage{bm}
usepackage{siunitx}

% more calligraphic fonts
usepackage[mathscr]{euscript}
leteuscrmathscr letmathscrrelax
usepackage[scr]{rsfso}

begin{document}

$mathbb{R}mathscr{P}euscr{B}mathcal{C}$

end{document}

With this, the last allocated math group is 14. If you get into troubles later on, the only feasible alternative is to define some of the calligraphic fonts in a different way.

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
usepackage{mathtools}
usepackage{amssymb}
usepackage{amsthm}
usepackage{upgreek}
usepackage{authblk}
usepackage{textcomp}
usepackage{bm}
usepackage{siunitx}

% more calligraphic fonts
DeclareRobustCommand{euscr}[1]{%
  text{usefont{U}{eus}{m}{n}#1}%
}
DeclareRobustCommand{mathscr}[1]{%
  text{usefont{U}{rsfso}{m}{n}#1}%
}

begin{document}

$mathbb{R}mathscr{P}euscr{B}mathcal{C}$

end{document}

No bold version, but I don't think you need it: it's already difficult to distinguish between euscr{C} and mathcal{C}.

Correct answer by egreg on October 1, 2020

enter image description here

The posted document runs without error if you use xelatex or lualatex which have 256 rather than 16 available math alphabets per math version.

Answered by David Carlisle on October 1, 2020

This new answer is there only to give an example, and a heads up to this previous answer.

A complementary solution to egreg's one (cleanup first) is to reduce the number of alphabets used by bm - which in turn is used by amssymb :

newcommandhmmax{0}
newcommandbmmax{0}

before usepackage{amssymb}

documentclass[a4paper,12pt]{article}
usepackage{amsmath}
usepackage{latexsym}
usepackage{dsfont}
usepackage{gensymb}

% put these before amssymb
% to avoid ``Too many math alphabets used in version normal.''
% cf. https://tex.stackexchange.com/a/243541/91665
newcommand{hmmax}{0}
newcommand{bmmax}{0}
usepackage{amssymb}

usepackage{authblk}
usepackage{amstext}
usepackage{amsfonts}
usepackage{amsthm}
usepackage{mathtools}
usepackage{upgreek}
usepackage{textcomp}
usepackage{bm}
usepackage[mathscr]{euscript}
leteuscrmathscr letmathscrrelax
usepackage[scr]{rsfso}
usepackage{siunitx}
usepackage[e]{esvect}
begin{document}
$mathbb{R}mathscr{P}euscr{B}mathcal{C}vv{x_0}$
end{document}

Answered by ederag on October 1, 2020

I ran into the same issue, and in my case, simply removing the package bm was sufficient to remove the error message.

Answered by GLemyre on October 1, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP