I understand a bit how the nfss work for text fonts, but I have a hard time following the code in latex.ltx
for math fonts (and the documentation in source2e.pdf
is a bit sparse there). Hence I have some questions:
If I recursively look at the definition of eg \mathcal
via latexdef
I get
\mathcal : macro:->\relax \ifmmode \else \non@alpherr \mathcal \fi \use@mathgroup \M@OMS \symsymbols
\use@mathgroup: macro:#1#2->\relax \ifmmode \math@bgroup \expandafter \ifx \csname M@\f@encoding \endcsname #1\else #1\fi \mathgroup #2\relax \expandafter \math@egroup \fi
\mathgroup: \fam
From my understanding \T@OMS
and \M@OMS
respectively are the loading code specified in
\DeclareFontEncoding {encoding} {text-settings} {math-settings}
and by default do nothing.
So essentially in math mode \mathcal
switches to \M@OMS
is OMS
was not the current encoding already and uses the math family encoded by \symsymbols
, which makes sense because \mathcal
is defined via
\DeclareSymbolFontAlphabet{\mathcal}{symbols}
.
For \mathit
this is essentially the same once it has been used, before it is
\select@group \mathit \M@OT1 \OT1/cmr/m/it
and a mathgroup with this font is created when \mathit
is first used.
But I am missing something. For instance in \mathrm{ab-de}
the -
is still typeset as an operator rather than in the rm
font. So I am guessing \mathrm
only change the mathcode of some letters to use the corresponding symoprators
math family, but not all of them, and I cannot find where in the source.
Second question: since \mathrm
is defined via \DeclareSymbolFontAlphabet{\mathrm}{operators}
what happen if we do both a \SetSymbolFont{operators}{bold}...
and a \SetMathAlphabet\mathrm{bold}...
?
Are these equivalent, both changing the \symoperators
math group in math version bold?