5

My question is related to: "Too many math alphabets" error but I think it is sufficiently different that it warrants a new thread.

Suppose two things:

  1. In my preamble, I have already done a great deal of work to setup the "normal" mathversion in various ways.

  2. Also, in my preamble, I have written: \DeclareMathVersion{normal2}

Here's my issue: In the main body of the LaTeX document, I want to do the following:

\mathversion{normal}
\input chapter1.tex
\input chapter2.tex
\input chapter3.tex
\input chapter4.tex
\input chapter5.tex
\input chapter6.tex
\input chapter7.tex
\input chapter8.tex
\input chapter9.tex

(It is actually much more than 9 chapters. I have approximately 200 chapters, which constitute more than 5000 pages of mathematics, for the collected papers of a colleague.)

Unfortunately, let's say that chapter 3 requires several math fonts. (Also suppose that a few of the other chapters require a few math fonts of their own too... but chapter 3 requires the most math fonts.) We know that the limit on the number of math fonts in LaTeX is 16. So if chapter 3 uses quite a few fonts, then I might run out of space for math fonts in other chapters. For instance, by the time I get down to (say) chapters 4, 5, 6, etc., I get this dreaded error:

"Too many math alphabets used in version normal."

I read this thread many times in recent days (as well as many other related threads):

"Too many math alphabets" error

In Lars Hellström's reply, Lars says:

"We were able to solve the issue by declaring a separate math version for one of the more alphabet-hungry papers. Concretely, we put the command \DeclareMathVersion{normal2} at the end of the preamble, and the commands \mathversion{normal2} and \mathversion{normal} just before and after respectively the \include for the alphabet-hungry paper."

So I gave a try to the advice from Lars, as follows:

\mathversion{normal}
\input chapter1.tex
\input chapter2.tex
\mathversion{normal2}
\input chapter3.tex
\mathversion{normal}
\input chapter4.tex
\input chapter5.tex
\input chapter6.tex
\input chapter7.tex
\input chapter8.tex
\input chapter9.tex

Lars said: "One thing this trick relies upon is that new math versions are created with all settings of the old one in place, so all declarations previously made for math version normal will be in place also in math version normal2 (and normal3, and so on, if one needs to repeat the trick)."

but I do not see this happening. When I run pdflatex, I do not see all of the good attributes from \mathversion{normal} to be taking effect in chapter 3. For instance, the math font for the symbols, which works great with the "normal" math version in chapters 1 and 2, as well as chapters 4, 5, 6, ...., BUT the attributes are messed up in chapter 3.

I am pretty desperate to figure this out.

I am wondering (for instance) if I can fully copy the attributes of "normal" into "normal2", and then modify (only) the "normal2" within chapter 3 (without changing "normal"). That way, when I get to chapters 4, 5, 6, .... , I will be back to my regular "normal" math font settings.

Is this possible? I basically want to copy all of the properties from "normal" into "normal2", so that I may use "normal2" for (only) chapter 3 (without modifying "normal" at all), and then finally come back to using "normal" again for chapters 4, 5, 6, ....

Thank you very much for considering my questions!

Please note: I do not want to move to XeTeX or LuaTeX because I have been working on these Collected Papers for many years, and I am nearing the end of the long process. I can make each individual chapter work on its own, but when I try to wrap all of the chapters into one document, the chapters that are using a lot of math fonts (like chapter 3 here) are preventing me from effectively moving onwards to the rest of the document (e.g., to chapters 8 and 9) and to simultaneously keep the nice properties from the "normal" math font throughout.

Here is a full Minimal Working Example:

\documentclass[letterpaper,12pt]{article}
\usepackage[margin=1in,vmargin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{mathrsfs}
\usepackage{yfonts}
\usepackage{txfonts}
\usepackage[mathscr]{euscript}
\usepackage{mathtime}

\DeclareMathVersion{normal2}

\begin{document}

%% CHAPTER 1
Ch~1: My favorite fonts are $\mathrm{A} + (\mathfrak{B} + \mathcal{C}) = \mathscr{D}$.

\vskip 24pt
%% CHAPTER 2
Ch~2: I also like bold faced types like $\mathbb{BBB}$.
Here is an interesting math equation:

$(\mathnormal{E} + \textfrak{F}) + \textswab{G} + \textgoth{H} = \varmathbb{I}$

\vskip 24pt
\mathversion{normal2}
%% CHAPTER 3

Ch~3: We can try some more font math.  This Chapter is using mathversion ``normal2''.

PROBLEM \#1:  This equation is strange, because the left-and-right
parens appear as triangles, and the equal sign appears as a script D:

$(\mathsf{J} + \mathtt{K}) = \mathit{L}$

PROBLEM \#2:  Also, the following equation, which worked in Ch.~2, does not
work anymore!

$(\mathnormal{E} + \textfrak{F}) + \textswab{G} + \textgoth{H} = \varmathbb{I}$
\mathversion{normal}

\vskip 24pt
Ch~4: Now I am ready to move onwards with more math.  For instance,
the math parentheses and equal sign work again,
because this chapter uses mathversion ``normal'' again.
$(\mathbf{Q} + \mathbf{R}) = \mathbf{S}$

Fortunately, the equation from Ch.~2 works again:
$(\mathnormal{E} + \textfrak{F}) + \textswab{G} + \textgoth{H} = \varmathbb{I}$


\end{document}
13
  • 3
    I am embarrassed that this is my first question on StackExchange, despite having using LaTeX for perhaps 20 years! I usually am able to figure things out myself, and I have many friends who use LaTeX (including Don Knuth himself), but I finally got stumped by this one. I guess I am a bit fatigued, and I guess it is rare to manage such a large project in LaTeX. Many thanks (in advance) for any gentle help that can be offered here.
    – mdw
    Commented Jun 27, 2019 at 9:06
  • 3
    Could you make an small example that shows which symbol is messed up by the mathversion change? Commented Jun 27, 2019 at 9:24
  • 1
    I don't think that creating a MWE is hard: You only need to grab math declarations and some math uses. But it is very hard to answer your question without such a MWE. Commented Jun 27, 2019 at 9:58
  • 2
    Sorry but I even don't know what you mean by "attributes". That's why I asked for an example. Commented Jun 27, 2019 at 10:21
  • 1
    is it possible to do the MWE without the use of commercial fonts others might not have access to?
    – daleif
    Commented Jun 27, 2019 at 14:50

1 Answer 1

7

This is a problem specific to mathtime. Normally a new math version is "initialised with the defaults for all symbol fonts and math alphabets declared so far". But mathtime doesn't use \DeclareSymbolFont to declare its fonts, but \SetSymbolFont and so the new math version gets the original defaults. You will have to reset the math fonts for the new version:

\documentclass[letterpaper,12pt]{article}
\usepackage[margin=1in,vmargin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{mathtime}

\DeclareMathVersion{normal2}

\makeatletter %needed: (we are setting the symbol font for normal2 here:)
\SetSymbolFont{operators}   {normal2}{\operator@encoding}{ptm}{m}{n}
\SetSymbolFont{letters}     {normal2}{MY1}{mtt}{m}{it}
\SetSymbolFont{symbols}     {normal2}{MY2}{mtt}{m}{n}
\SetSymbolFont{largesymbols}{normal2}{MY3}{mtt}{m}{n}
\makeatother

\begin{document}
$(a=b)$
\mathversion{normal2}
$(a=b)$
\end{document}
10
  • I implemented this fix last night, and it worked excellently on the full 5000 pages of the document. Thank you! I made a new mathversion for each chapter, and I did what you suggested. I even went a little further than that: I copied several relevant lines from the mathtime.dtx so that the lines to declare the mathversion and to SetSymbolFont are even a little more comprehensive. Thank you again!
    – mdw
    Commented Jun 28, 2019 at 21:15
  • 1
    @Raaja thank you for the suggestion. Done!
    – mdw
    Commented Jul 2, 2019 at 7:03
  • 1
    @mdw thanks for the consideration :) Commented Jul 2, 2019 at 7:06
  • I am curious how to also reset the \mathcal fonts so that they work properly! In the mathversion "normal2" the \mathcal font is showing up in bold, but I do not want it to be bold.
    – mdw
    Commented Nov 24, 2019 at 18:38
  • 1
    @mdw Please edit your original question or perhaps better ask a new one, but do not edit answers to point out problems with the solution.
    – siracusa
    Commented Nov 24, 2019 at 18:57

You must log in to answer this question.

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