2

This question arose from a comment on this question, stating that stix2 does not offer a bold \mathcal. Since I prefer the default \mathcal anyway, I would like to change the alphabet.

I found a solution here using mathalpha. Unfortunately, in combination with bm this uses too many math fonts. I was thinking about switching to unicode-math since font selection is really easy there (and no font limitation). But (as far as I know) there is no unified boldening command like bm and one has to use \symbf, \smybfcal etc., i.e. it is not possible to do something like \bm{ A \mathcal{A} \mathscr{A} }. For this reason I would like to stick to pdflatex.

I am currently using the following MWE to fix the problem with too many math fonts

\documentclass[preview]{standalone}

\usepackage{stix2}
\usepackage[cal=cm]{mathalpha}
\usepackage{amsmath,amsthm}
\newcommand\bmmax{0}
\usepackage{bm}

\newcommand{\ABC}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

\begin{document}
\begin{gather*}
\ABC\\
\bm{\ABC}\\
\mathcal{\ABC}\\
\bm{\mathcal{\ABC}}\\
\mathscr{\ABC}\\
\bm{\mathscr{\ABC}}
\end{gather*}

\end{document}

with output

enter image description here

besides the already mentioned warnings in the other question this works. But I am not sure if this is the ideal way to do this.

My Question:

What would be the "best" way of replacing the stix2 font while using bm?

  1. Use the \newcommand\bmmax{0} workaround, or is the \newcommand\bmmax{0} command problematic and should be avoided if possible?
  2. Is there another way to replace one or more sitx2 fonts without defining too many alphabets, maybe with a different way then mathalfa?
  3. Can I edit a local copy of the stix2.sty file? (I already tried replacing the stix2 alphabet in question with the one used by stix. Besides the fact that I do not really like the stix version of \mathcal either, I also replaced the integral symbols while doing so, which I would like to avoid.)
  4. Should I perhaps purge the bm package at all and use boldsymbol instead?

2 Answers 2

1

As I commented on your previous question, there is no point in using bm with stix(2).

bm tries to add fonts from the bold math version into the normal math version, but stix has no additional fonts in the bold version, and already has more than the 16 available font slots, so there are no free slots for bm to use, and no fonts for it to add even if there were free slots.

Simply declare the computer modern fonts for calligraphic:

enter image description here

\documentclass[preview]{standalone}

\usepackage{stix2}
%\usepackage[cal=cm]{mathalpha}
\usepackage{amsmath,amsthm}
%\newcommand\bmmax{0}
%\usepackage{bm}
\DeclareMathAlphabet      {\mathcmcal}{OMS}{cmsy}{m}{n}
\DeclareMathAlphabet      {\mathcmbfcal}{OMS}{cmsy}{b}{n}
\newcommand{\ABC}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

\begin{document}
\begin{gather*}
1 \ABC\\
2 \mathbfit{\ABC}\\
3 \mathcal{\ABC}\\
4 \mathcmcal{\ABC}\\
5 \mathcmbfcal{\ABC}\\
6 \mathscr{\ABC}\\
7 \mathbfscr{\ABC}
\end{gather*}

\end{document}

Note that stix declares about 18 math fonts and this adds two more so way above the 16 allowed by TeX. If you have an old LaTeX release this is OK but you can not use more than 16 in the document. Since last year that has been relaxed and you can use all declared fonts so long as you do not use more than 16 in each math expression.

2
  • I am not quite sure if i actually need bm or if this is an overkill. But what i want is a unified way to access boald versions of a variable. Background: I am writing a large document with many different variables, since i do not know if i have to change the name of some of those variables later one, i defined all with macros i.e. \newcommand{\myA}{A}. If i would like tho change A to e.g B in the whole document i only need to change the command \myA. Within the document i always use the normal font to denote a operator and bold mode to denote its matrix representation...
    – moro11
    Jun 22, 2022 at 14:12
  • Since some of those variables are in basic math font and some in \mathcal i would like to have a unified way to access the bold version of each variable, keeping in mind that the variable could change during process and even switch to another font, i.e. i would like to keep the possibility to change \myA above to \newcommand{\myA}{\mathcal{A}} and still be to print the bold matrix representation of \myA without changing every \mathbf{\myA} to \mathbfcal{\myA} in the whole document. This is possible whit bm since \bm{A} and \bm{\mathcal{A}} both works.
    – moro11
    Jun 22, 2022 at 14:18
1

A combination of this answer to another question and the answer from David Carlisle did the trick: If i use LuaLaTex or XeLaTex with

\documentclass[preview]{standalone}

\usepackage{stix2}
\usepackage{amsmath,amsthm}
\usepackage{bm}

\DeclareMathAlphabet{\mathcal}      {OMS}{cmsy}{m}{n}
\SetMathAlphabet    {\mathcal}{bold}{OMS}{cmsy}{b}{n}

\newcommand{\ABC}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

\begin{document}
\begin{gather*}
\ABC\\
\bm{\ABC}\\
\mathcal{\ABC}\\
\bm{\mathcal{\ABC}}\\
\mathscr{\ABC}\\
\bm{\mathscr{\ABC}}
\end{gather*}

\end{document}

outputs

enter image description here

Alternatively i could use \DeclareMathAlphabet{\mathcmcal}{OMS}{cmsy}{m}{n} and \SetMathAlphabet{\mathcmcal}{bold}{OMS}{cmsy}{b}{n} to declare a complete new alphabet and leave stix2 unchanged.

You must log in to answer this question.

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