# "Too many symbol fonts declared" error

I've had this problem for a while. When I try to add a new package, it says

! LaTeX Error: Too many symbol fonts declared.

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

l.88 \DeclareSymbolFont{stmry}{U}{stmry}{m}{n}

I had to give up using some of the packages that I wanted to use. I've searched for the problem, and what I understood was that there are some limitations to the fonts declaration. I wanted to know what exactly the problem is and if there are any solutions to the problem.

\documentclass[openany,english]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{newtxtext}
\usepackage[nonewtxmathopt]{newtxmath}
\usepackage{bm}
\usepackage{esvect}

%With verbatim package, using \wcheck from mathabx package
\usepackage{verbatim}

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<5> <6> <7> <8> <9> <10>
<10.95> <12> <14.4> <17.28> <20.74> <24.88>
mathx10
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\wcheck}{0}{mathx}{"71}
\DeclareMathAccent{\wideparen}{0}{mathx}{"75}

\def\cs#1{\texttt{\char\\#1}}
%

%Using \bigtimes,\bigoplus from mathabx
\DeclareMathSymbol{\bigplus}{1}{mathx}{"90}
\DeclareMathSymbol{\bigtimes}{1}{mathx}{"91}
%

\usepackage{amsmath, amssymb, graphicx}
\usepackage{stmaryrd}       % \lightning

\begin{document}
hey
\end{document}


I use stmaryrd package for \lightning. The usage of verbatim package was copied from other tex.stackexchange question and modified slightly(I think I added one more \DeclareMathAccent). The last two \DeclareMathSymbol do not affect this problem, but I added them for their relationship with mathx. esvect is the package I tried to add this time.

I'm not an expert, so I usually search for my problems and use the corresponding packages. So I'm really not sure if my usage of packages has become inefficient or not. My guess is that I tried avoiding mathx from changing all the fonts but it brought limitations. What is the best solution in this case?

If you are not particular about which \lightning symbol you use, you can substitute

\usepackage{stmaryrd} %\lightning


for

\usepackage{marvosym} %\Lightning
`

Or for another one with a lightning symbol, you can check page 101 from The Comprehensive LaTeX Symbol List to see other similar symbols. I don't know what other packages you need to add so this might not be a complete solution, but I did add a bunch of random packages to the document and using marvosym worked for me.

• I did know the existence of other packages with lightning, but didn't think some would cause problems and others would not... Thank you very much. Jan 20, 2016 at 7:37
• This doesn't answer the question, though. Nov 17, 2016 at 20:37