[Tex/LaTex] how to select math font in document

fontsmath-mode

I want to show in one document different font examples of math fonts, for example Latin Modern, Times and Charter.

I know the command \usefont{T1}{lmr}{m}{n}, but have no idea how to combine that with a math environment.

Best Answer

That's a bit complex in LaTeX. Note that the definitions of math symbols are complex. Math fonts are quite different with text fonts.

You may want to read the document of NFSS: LaTeX2𝜀 font selection, section 3; and the documented source code of LaTeX2e: The LaTeX 2𝜀 Sources, section 42.

For examples, any math font package is OK. I suggest mathptmx.sty, it is typical and relatively simple. e.g.

\DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it}

This (re)defines the letter math family. And the command

\DeclareSymbolFontAlphabet{\mathnormal}{letters}

in LaTeX2e kernel makes letters family to be default alphabet font.

People usually don't use many font families in one document. For an example of mixed math fonts, see also my previous answer.

It is not only annoying, but also impossilbe to define many math fonts in one document. In TeX, the number of math alphabet fonts is limited to 16. As Ulrike Fischer said, if you just want to show the results of a few math font packages, just produce some graphics and import them into the document. It is much easier.