I have this "Too many symbol fonts declared" that is different from the two other posts in the forum.
I am writing a book section where I have several subfiles with custom math symbols (from the open source cool jazz font). I can repeat up to 6 subfiles (6 different sections) but for the 7th I get the "too many symbol fonts declared" error and the subfile does not render the math part... Here is my MWE to reproduce the error:
Main.tex file:
%minimal example
\documentclass[11pt,portuguese, twoside,openright]{book}
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage{enumerate}
\usepackage[math-style=ISO, bold-style=ISO]{unicode-math}
%setting an environment for hand- solved examples
\newenvironment{coolj}{
%\defaultfontfeatures{Scale=MatchUppercase}
\setmonofont{CMU Typewriter Text}[Scale = .90]
\setmainfont{Cooljazz}[Scale = .85]
\setmainfont[Ligatures=TeX,BoldFont={Boogaloo Regular},Scale=.90]{Cool jazz}
\setmathfont[math-style=upright, range={"00-"FF,
"03C0, "2013-"2014, "2018-"201A, "201C-"201E, "2021-"2022,
"2026, "2030, "2039-"203A, "2044, "20AC, "20BA, "20BD,
"2113, "2122, "2126, "212E, "2202, "2206, "2208, "220F, "2211,
"2212, "2215, "221E, "222B, "2246, "2260, "2264, "2265,
"25CA, up/{Latin,latin,num,Greek,greek}},Scale=0.85]{cooljazz.ttf}
\setmathfont[range={"58-"60}]{Latin Modern Math}
}{\par}
\usepackage{subfiles} % to load independent chapters
\begin{document}
Main doc
%repeating several subfiles with coolj enviroment
\subfile{ex1}
\subfile{ex1}
\subfile{ex1}
\subfile{ex1}
\subfile{ex1}
\subfile{ex1}
\subfile{ex1}
\end{document}
As you can see I am inputting a subfile (here for simplicity always the same, but different files are used in the real scenario):´
ex1.tex:
\documentclass[main.tex]{subfiles}
\usepackage{enumerate}
\begin{document}
Some text...
\begin{coolj}{Example 1}
This is example 1 with text describing the problem
\begin{enumerate}
\item Some text
\item Some math with cooljaz.ttf font defined in the main tex doc coolj environment
\item[] $H^{}_0: \mu_{Baseline}=\mu_{M04}=\mu_{M08}=\mu_{M12} \quad vs.\\H^{M}_1: \exists i, j: \mu_i \neq \mu_j \quad i \neq j; \ i,j=(Baseline,M04, M08, M12)$
\item[]$H^{M\times G}_0\!:\gamma_{M\times G}\!=\!0 \quad vs. \quad H^{M\times G}_1:\!\gamma_{M\times G}\! \neq\! 0$
\item [] $S'^2_{\bar Y} \neq \sum_{i=1}^{n}(Y_i- \bar Y)^2$
\end{enumerate}
Some more text with free font cooljaz.ttf
\end{coolj}
\vspace{\baselineskip}
back to regular text!...
\end{document}
It works fine with 6 ex1.tex subfiles, but for the 7th it gives this error and does not render correctly:
Too many symbol fonts declared. \begin{coolj}
Symbol font __um_fam13 not defined. \begin{coolj}
\begin{coolj} Missing number, treated as zero. \begin{coolj}
Any idea on how to solve this problem? The full book will have more than 100 examples (I hope...using the cooljazz font. If you want to see the font the link is https://freefontsfamily.com/cool-jazz-font-family-free-download/
Thanks!
\setmainfontand\setmathfontdirectives repeatedly? From what you've reported, there would appear to be no need for that. – Mico Oct 31 '21 at 09:18Maths 'versions', of the user guide of theunicode-mathpackage? It mentions that "[setting a math version] is useful because it is more efficient than loading a complete maths font from scratch every time—especially with thousands of glyphs in the case of Unicode maths!" Hence, you may be better off setting up a mathversion called, say, "CoolJ" once, and then executing\mathversion{CoolJ}rather than\setmathfontat the start of eachcooljenvironment. – Mico Oct 31 '21 at 09:25\setmathfont[version=Coolj, ...but I am not seeing how to evoke this in the cool j environment. If I define the mathfont outside the environment, then all math (outside of the environment) will also be coolj no? – JPMD Oct 31 '21 at 09:35cooljenvironments? Is itLatin Modern Math? If so, just execute\setmathfont[version=Main,...]{Latin Modern Math}and\setmathfont[version=CoolJ,...]{cooljazz.ttf}once in the preamble and switch between theMainandCooljversions at the start and end of eachcooljenvironment. – Mico Oct 31 '21 at 09:46coolj,unicode-mathallocates a new math group, but using the legacy allocation mechanism with an upper bound of 16. But even if we raised the upper bound to 256, the problem would still be there: you'd just push the error forward. – egreg Oct 31 '21 at 22:10versionandrangedo not work together... If I delete therange=...that I can activate the coolj mathversion and the main (latin modern) mathversion as @Mico suggested. The problem is that for the cooljazz font that does not have a Math declaration, I need to set the greek letters and symbol with range.... – JPMD Oct 31 '21 at 22:19\usepackage[T1]{fontenc}with luatex or xetex, – David Carlisle Oct 31 '21 at 23:15unicode-mathpackage have worked on the imcompatibility ofversionandrange? – JPMD Oct 31 '21 at 23:18