3

I have been using xelatex plus unicode-math for too long, and I forgot how to use pdflatex. As far as I heard, the STIX fonts are proposed as a free replacement of the fonts of Times family. They have a variety of styles and a large number of symbols. However, I recurrently fall in the same trap, namely, I do not know how to call different styles properly.

  • Just today I've asked how to access the bold calligraphic style and got this excellent answer. I thought my problems were over, but then I discovered that \mathbfit as well as \bm does not produce bold slanted greek letters. I remember, I have see the solution already. There are also a lot of discussion here for different fonts.

  • I found that last year I had a similar problem with STIX, and indeed got many useful answers. But then again, after re-reading the probably expert answer of Davislor I understood that I do not understand anything. Why it has to be sooooo difficult to make lambda bold!? Why, as a user, not developer I have to worry about the font ranges, fake bolds and isomath?

But I would like to narrow my question as much as possible in order to get a comprehensive answer. I would like to know how to access all possible 17 styles of math stix fonts and how this syntax is different from accessing all possible 9 styles of cm fonts. Furthermore, I am interested only in the pdflatex compatible answer. No font substitution is allowed.

Below is my minimal non working example

\documentclass[]{article}
\usepackage{stix}
\usepackage{amssymb,amsmath}
\newcommand{\symb}{aA\psi\Psi12}
\begin{document}
\begin{align}
%\mathup{\symb}\\
%\mathbfup{\symb}\\
\mathit{\symb}\\
\mathbfit{\symb}\\
%\mathsfup{\symb}\\
\mathsfit{\symb}\\
%\mathbfsfup{\symb}\\
\mathbfsfit{\symb}\\
\mathtt{\symb}\\
\mathbb{\symb}\\
\mathbbit{\symb}\\
\mathscr{\symb}\\
\mathbfscr{\symb}\\
\mathcal{\symb}\\
\mathbfcal{\symb}\\
\mathfrak{\symb}\\
\mathbffrak{\symb}
\end{align}
\end{document}

It gives me a strange error

! LaTeX Error: Too many math alphabets used in version normal.

Summary for making it a bountied question

  1. My ultimate goal is to make as many as possible commands presented above to work in one document in a predictive fashion.

  2. Naturally, no one will ever need to have all the styles in one document. So the error quoted above is not essential. But a reasonable subset of styles would be nice. An example would be in addition to regular variables, vectors (bold-italic, possibly calligraphic), matrices, tensors (bold serifless and sometimes calligraphic), sets (mathbb), codes (mathtt).

  3. I would like an explanation why in order to use \mathbfcal (not even in the alphabet table) DeclareMathAlphabet is needed, whereas in order to use \mathbfit{\psi} for greek letters the option lcgreekalpha is needed. Especially for the latter, I was assuming that a font selection command is a low level command, unlike for instance \emph, which takes other considerations into account. But why then one needs lcgreekalpha to overwrite.

16
  • 1
    as in your last question Package amssymb Warning: The 'amssymb' package is redundant when you are using the 'stix' package, so I'm not going to load amssymb. You can/should remove amssymb (it doesn't fix the problem but a cleaner log helps debugging issues) Jan 28, 2021 at 23:20
  • 2
    xelatex allows 256 math fonts and each of those can cover the entire Unicode range of tens of thousands of characters. Then you switch to pdflatex and that allows 16 math fonts each has at most 256 characters. Something has to give..... Jan 28, 2021 at 23:33
  • the lcgreekalpha is simply a design choice. no one other than the package designer can really say "why". Classically in tex \alpha uses a fixed font and is not affected by math alphabet commands. stix.sty chooses to keep to that behaviour, but offers the option to have a behaviour more like unicode-math where \alpha works like a and does follow the math alphabets. Feb 1, 2021 at 20:14
  • @DavidCarlisle Because bold italic greeks are super dangerous, one needs a trigger guard in the form of cgreekalpha.
    – yarchik
    Feb 1, 2021 at 20:22
  • 1
    as I mentioned in my answer latex has symbol fonts \DeclareSymbolFont{...}... which are allocated at the point of declaration, this is used for things like \sum or \rightarrow or \langle etc these need a known slot to work with \mathchardef an math alphabets declared with \DeclareMathAlphabet these are only allocated if used so you can declare as many as you like but can only use at most 16 minus however many symbol fonts are declared. Feb 1, 2021 at 21:19

1 Answer 1

9

latex math alphabets (unlike math symbol fonts) are assigned on demand as they are used. This means that you can declare any number of math alphabets but you may only use a total of 16 math fonts (math symbol fonts and math alphabets). This 16 is a hard limit of the TeX program.

Apart from test documents that are trying to use every possible font in a single document it is highly unusual to need that many alphabets. So I am tempted to say that this is a feature.

If you really need to access that many fonts you can (with some constraints) declare the fonts as text fonts or (possibly better) declare different math versions (cf normal and bold math versions) and arrange that different subsets of the fonts are available in each version with no more than 16 in each.

That said the stix documentation answers your question and shows all the available math alphabet commands It also warns you that you can not use them all at once.

enter image description here

It is probably advisable to use the stix2 package (based on Stix Two Math font) but the commands are essentially the same and its documentation has essentially the same table.

enter image description here


Note that the hard limit of 16 math fonts is per version not per document, in your original example you have to comment out 3 math alphabet commands to keep below the limit but you can declare another math version with the same initial declarations but in which you use a different set of 16 so I could uncomment the final three math alphabets as long as I comment out some others.

enter image description here

\documentclass[]{article}
\DeclareMathVersion{normal2}
\usepackage{amsmath}
\usepackage[lcgreekalpha]{stix}
\DeclareMathAlphabet\mathbfcal{LS2}{stixcal}{b}{n}
\newcommand{\symb}{aA\psi\Psi12}
\begin{document}
\begin{align}
\mathrm{\symb}\\
\mathbf{\symb}\\
\mathit{\symb}\\
\mathbfit{\symb}\\
\mathsfit{\symb}\\
\mathbfsfit{\symb}\\
\mathtt{\symb}\\
\mathbb{\symb}\\
\mathbbit{\symb}\\
\mathscr{\symb}\\
\mathbfscr{\symb}\\
\mathcal{\symb}\\
\mathbfcal{\symb}\\
\mathfrak{\symb}\\
%\mathsf{\symb}\\
%\mathbfsf{\symb}\\
%\mathbffrak{\symb}
\end{align}

\mathversion{normal2}
\begin{align}
\mathrm{\symb}\\
\mathbf{\symb}\\
\mathit{\symb}\\
\mathbfit{\symb}\\
\mathsfit{\symb}\\
\mathbfsfit{\symb}\\
\mathtt{\symb}\\
\mathbb{\symb}\\
\mathbbit{\symb}\\
\mathscr{\symb}\\
%\mathbfscr{\symb}\\
\mathcal{\symb}\\
%\mathbfcal{\symb}\\
%\mathfrak{\symb}\\
\mathsf{\symb}\\
\mathbfsf{\symb}\\
\mathbffrak{\symb}
\end{align}


\end{document}

Note that some alphabets are not complete eg Fraktur doesn't have Greek not surprisingly so you get nonsense if switching to Fraktur for the Greek. Without the lcgreekalpha option the lowe case greek stays unstyled, but stays Greek:

enter image description here

8
  • 1
    My ultimate goal is not to simultaneously access all possible font variations. As you can see, I even commented some rare ones, only 13 are left. But I would like to have a good reference how to call them when needed.
    – yarchik
    Jan 28, 2021 at 23:37
  • @yarchik you can not have 13 math alphabets there are already 4 or 5 symbol fonts allocated. any font used for a symbol font used to define a symbol like say \rightarrow has to be pre-allocated because the underlying \mathchardef command needs to know the slot number of the allocated font. Jan 28, 2021 at 23:39
  • @yarchik a good reference for the available commands would be texdoc stix page 3 which lists the available math alphabets and the ranges they cover. (note by the way there is a stix2 package for the stix2 fonts as well these days but the commands are essentially identical and the same table is on page 4 of texdoc stix2) Jan 28, 2021 at 23:46
  • I see, however, \mathbfit{\psi} does not produce the desired symbol even though according to the document it is in the available range. Maybe there are more cases, but I have just tested this one.
    – yarchik
    Jan 28, 2021 at 23:54
  • @yarchik \usepackage[lcgreekalpha]{stix} so the greek follows the alphabets (but then you use up even more slots) see section 2.1 of the manual. Jan 29, 2021 at 0:08

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.