Details on latex' math alphabets

All the work of \mathrm eventually boils down to do \fam=n, where n stands for a one-byte integer (from 0 to 15), in a group. The default is 0, because \mathrm is defined via

\DeclareSymbolFontAlphabet{\mathrm}{operators}

and fontmath.ltx has

\DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}

as its first declaration of a symbol font. Such declarations can later be overridden by font packages, but operators will always point to math family 0.

During the execution of \mathrm there is no mathcode change. It's a primitive feature of TeX that if a character has a mathcode "7xyz (the most significant byte is 7), then TeX will typeset the character in slot "yz of the font in the current math family, if the current value of \fam is between 0 and 15. Otherwise the character will use the font in math family "x.

Side note: LaTeX defines \mathgroup as an alias for \fam.

Indeed, we have in fontmath.ltx

\DeclareMathSymbol{a}{\mathalpha}{letters}{`a}

and similarly for the other letters. This is LaTeX lingo for the corresponding declaration in plain TeX

\mathcode`a="7197

because the declaration for letters is the second in fontmath.ltx, so corresponding to math family 1.

Since no math code is changed and - is declared as

\DeclareMathSymbol{-}{\mathbin}{symbols}{"00}

which corresponds to \mathcode`-="2300, it will not be affected by the current value of \fam.

The \operatorname macro of amsmath does indeed change math codes so that - appears as a real hyphen.

Tags:

Math Mode