3

I have discovered a new package newtxmath which is sad to be better than mathptmx. I also want to use the bm package for bold Greek letters.

It works just fine with mathptmx, but causes an error with newtxmath.

Here is my document (use LuaLaTex to compile).

\documentclass[10pt,a4paper]{book}

\usepackage{bm}

\usepackage{lscape}
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{yfonts}
\usepackage{mathtools}
\usepackage{comment}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{mathabx}
\usepackage{wasysym}
\usepackage{wrapfig}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usepackage{skull}
\usepackage{faktor}
\usepackage{xfrac} 
\usepackage{enumitem}
\usepackage{lipsum}

\usepackage[russian]{babel}
\usepackage{polyglossia}    
\defaultfontfeatures{Ligatures=TeX}

\usepackage{mathptmx}
%\usepackage{newtxmath}


\setmainfont{Georgia}
\newfontfamily\cyrillicfont{Georgia}

\usepackage{fontspec}
\setmainlanguage{russian}

\begin{document}

$$
\bm{\Phi}
$$

\end{document}

I am sorry for posting so many packages here, but I wasn't able to figure it out which package conflicts with newtxmath, because mathptmx also loads a math font, so they should both cause, or both not cause a problem (obviuosly, I am wrong here).

Searching through this site I found all answers to be too personal and too specific. Unfortunately, I couldn't apply any of those solutions to me.

12
  • 1
    Just a question: Why don't you use fontspec in combination with e.g. unicode-math to set a math font?
    – TeXnician
    Feb 24 '17 at 21:36
  • Which TeX distribution and which version of Lua(La)TeX do you use? I have MacTeX and LuaTeX 0.95; your code doesn't generate an error if I comment out the directive \usepackage{skull}, which I have to do as I don't seem to have a package named "skull" on my system.
    – Mico
    Feb 24 '17 at 21:36
  • @TeXnician - The OP may prefer the appearance of the integral symbols provided by the newtxmath package to those provided by, say, the XITS Math or TeX Gyre Termes math fonts...
    – Mico
    Feb 24 '17 at 21:38
  • Is the "skull" package proprietary?
    – Mico
    Feb 24 '17 at 21:38
  • 1
    I get no math alphabet error (just error about missing font skull) but do you have an old (pre-2015) latex? That would explain the error. Note also that you are loading bm first but as explained in its documentation you need to load it after any package that loads math fonts. Feb 24 '17 at 21:44
5

Your preamble is a bit messy.

Loading mathabx and amssymb along with newtxmath is useless: if you load mathabx before newtxmath, most of the symbols will be redefined; in the other order, mathabx will override most of newtxmath symbols.

Also skull allocates a math symbol font just for one symbol. It doesn't seem worthy it and it's easy to do without wasting a math group.

The package loading order is very important; in some cases you get conflicts. In particular, bm should be loaded after math font packages and after amsmath.

Don't load both babel and polyglossia: they fight each other.

\documentclass[10pt,a4paper]{book}

\usepackage{fix-cm}% just to avoid some spurious messages

\usepackage{amsmath}
\usepackage{mathtools}

\usepackage{amsthm}
\usepackage{thmtools}

\usepackage{wasysym}
%\usepackage{skull} % see later
\usepackage{newtxmath}
%\usepackage{amssymb} % not with newtxmath
%\usepackage{mathabx} % not with newtxmath
\usepackage{bm}

\usepackage{lscape}
\usepackage{ragged2e}

\usepackage{faktor}
\usepackage{xfrac} 
\usepackage{enumitem}

\usepackage{yfonts}
\usepackage{comment}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\usepackage{lipsum}

%\usepackage[russian]{babel} % either babel or polyglossia
\usepackage{polyglossia}    

\setmainlanguage{russian}

\setmainfont{Georgia}
\newfontfamily\cyrillicfont{Georgia}

%%% Loading a math symbol font for just one symbol is a big waste
%%% The following lines do the same as skull.sty
\DeclareFontFamily{U}{skulls}{}
\DeclareFontShape{U}{skulls}{m}{n}{ <-> skull }{}
\newcommand{\skull}{\text{\usefont{U}{skulls}{m}{n}\symbol{'101}}}


\begin{document}

\[
\bm{\Phi}+\skull
\]

\end{document}

Finally, update your TeX system: with XeLaTeX and a properly crafted preamble it's quite rare to incur in the “Too many math fonts” error.

enter image description here

3
  • Since you're on a mission to clean up and simplify the preamble: Since mathtools loads amsmath automatically, one may also omit the directive \usepackage{amsmath}. :-)
    – Mico
    Feb 24 '17 at 23:33
  • @Mico I will never do it. ;-)
    – egreg
    Feb 24 '17 at 23:36
  • Thanks! Everything works perfectly now. In case of the order of loading the packages you always should apply some magic. Feb 25 '17 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.