# fake math alphabet

in order to go over the "too many alphabets" usual error, I am creating fake math commands somehow.

\documentclass[fleqn,a4paper,12pt,twoside]{book}
\usepackage[top=3.2cm,bottom=3.2cm,left=3.3cm,right=3.3cm,a4paper]{geometry}
\usepackage[MnSymbol]{mathspec}
\usepackage{xltxtra}
\usepackage{esvect}
\renewcommand{\vec}{\vv}
\defaultfontfeatures{Numbers=OldStyle,Scale=MatchLowercase}
\setmainfont[Mapping=tex-text]{Minion Pro}
\setmathfont(Digits,Latin,Greek)[Uppercase=Regular,Lowercase=Italic]{Minion Pro}

% correct commands yielding the math alphabet error messages when uncommented
\setmathrm{Minion Pro}
\DeclareMathOperator{\dive}{div}

\begin{document}
$$\mathcal{A}=\cos \pi\quad\vec{e}=3\vec{\dive}(u)\mathfrak{B}$$
\end{document}


This code as such will not compile. As a work-around, when the two lines defining the Math Alphabet of the document are replaced (you have to comment them) by :

% fake cosinus and divergence commands to get similar results without the error message
\renewcommand{\cos}{\text{cos}\,}
\newcommand{\dive}{\text{div}\,}


the code will compile with very similar results: what is wrong then, with this trick?

Thank you

-

I don't know about the math alphabets MnSymbol and Minin Pro, but look here “Too many math alphabets” error. They don't use XeTeX but apparently it has something to do with MnSymbol. If you replace

\usepackage[MnSymbol]{mathspec}


by

\usepackage{amssymb,amsmath}
\usepackage{mathspec}


your example compiles without problems. It may not be the right font though...

But concerning the wrong of the trick: If your use this construction inside of some environment that changes the text font, this won't work. Inside a theorem the text will be italic and so will your \text{cos}.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\itshape
$\cos \neq \text{cos}$
\end{document}


Also, if you decide at a later point to change fonts and not use the same for text and math, you will probably see that the cos will be in the text font and therefore somewhat out of place in the middle of the formula.

-
yes for the italic example. I'm not using such environments, so it should not be a problem but you are correct. –  pluton Dec 6 '10 at 21:28
Well, you never know where you or someone else uses it again. It's just no good practise. And for the math alphabets - your are not the first, see above. –  Carsten Thiel Dec 6 '10 at 21:35
yes, I know it is not good practice and I know that I am not the first. I was just experimenting a possible trick. –  pluton Dec 6 '10 at 21:49
Also, there are some implications on spacing around the MathOperator, especially in conjunction with parentheses around the following argument. –  Carsten Thiel Dec 6 '10 at 21:54
Removing the MnSymbol option could be a solution. I am not using so many items of the list. –  pluton Dec 6 '10 at 22:00