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.

  • 2
    You would have to define math versions. But depending on the fonts involved this can be quite complex. Better make external graphics/documents and import them. Commented Sep 30, 2011 at 12:20

2 Answers 2


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.


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


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 impossible 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.

  • To be fair you can use more than 16, just not within the same math formula, but you may need to tinker with low level TeX commands. Within the same math formula you can still do something with \mathchoice/\hbox if you try hard enough.
    – user202729
    Commented Nov 6, 2022 at 17:32

Update Aug. 2013: Since posting the initial version of this answer back in Sept. 2011, (at least) two more Unicode math fonts have joined the TeX/LaTeX scene: TeX Gyre Termes Math (to go with TeX Gyre Termes, a Times Roman clone) and Tex Gyre Pagella Math (to go with TeX Gyre Pagella, a Palatino clone). I've edited the example code below to include these two math fonts; the total of math fonts shown is now up to six 1.

Update May 2018: Over the past five years or so, several additional Unicode math font families have become available. I've updated the code and screenshots shown below to include the following, additional math fonts: Stix, Stix Two, Libertinus, and DejvaVu. I have deliberately not included Neo Euler as its development status is "abandoned". I also haven't included Minion Math since it is a commercial font that's not available free of charge.

As the other answers and comments have already pointed out, it's not easy in pdfLaTeX to switch from one math font group (say, Computer/Latin Modern) to another. The packages I'm familiar with which have matching text and math fonts are the default Computer/Latin Modern group (loaded if no other font group is specified), mathptmx (Times Roman look), and mathpazo (Palatino). There are also the txfonts and pxfonts packages, which give you Times and Palatino, but the hinting and glyph substitution isn't as good as with mathptmx and mathpazo. Within just the last few months, the newtxmath (and newtxtext) packages have come along; they correct virtually all of the shortcomings of the txfonts package and add quite a bit of new functionality as well. I'm not familiar with math fonts designed specifically to go with Charter text fonts.

Even though it's not straightforward (or even possible?!) to switch between entire math font families within the same document if you use pdfLaTeX, it's actually quite easy to do so in XeLaTeX and LuaLaTeX. The following MWE gives a demonstration of ten different matched text and math fonts: Latin Modern, XITS/XITS Math, TeXGyre Termes, TeXGyre Pagella, Palatino/Asana Math, and Cambria Math, as well as (addition 2018-May) Stix, Stix Two, Libertinus, and DejaVu.

See also the web page A Survey of Free Math Fonts for TeX and LaTeX for a comparison of various free math fonts available for (pdf)LaTeX users.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

% !TeX program = lualatex

%% Load 10 math fonts; 1 of them with and without some "stylistic sets"
\setmathfont{Latin Modern Math}[version=lm]
\setmathfont{XITS Math}[version=xits]
\setmathfont{Stix Math}[version=stix]
\setmathfont{Stix Two Math}[version=stix2]  % https://github.com/stipub/stixfonts/
\setmathfont{Stix Two Math}[StylisticSet={1,2,8}, version=stix2_128] 
\setmathfont{TeX Gyre Termes Math}[version=termes]
\setmathfont{Cambria Math}[version=cambria]
\setmathfont{TeX Gyre Pagella Math}[version=pagella]
\setmathfont{Asana Math}[version=asana]
\setmathfont{Libertinus Math}[version=libertinus]
\setmathfont{TeX Gyre DejaVu Math}[version=dejavu]
%%\setmathfont{Neo Euler}[version=euler] % status: "abandoned"

\setlength\parindent{0pt} % just for this example
\newcommand{\ligs}{\ ff fi fl ffi ffl}
\newcommand{\abctextrm}{Text roman:  \abc\ligs}
\newcommand{\abctextit}{Text italic: \ \ \textit{\abc\ligs}}
\newcommand{\abcmathit}{Math italic: \ $\abc$}
   \int_{0}^{1}\! x^{2}\,\mathrm{d}x = \sfrac{1}{3} 
   \sum_{k=0}^{\infty} \frac{1}{k^{2}}=\frac{\pi^{2}}{6}
   \mathcal{ABC}\ \mathfrak{ABC}\ \mathbb{CNQR}$}


%% Latin Modern (the default on most systems)
\setmainfont{Latin Modern Roman}
\section*{Latin Modern Roman, Latin Modern Math}

%% Various Times Roman clones
\section*{XITS, XITS Math}

\section*{STIX, STIX Math}

\setmainfont{Stix Two Text}
\section*{Stix Two Text, Stix Two Math}

\setmainfont{Stix Two Text}
\section*{Stix Two Text, Stix Two Math w/ stylistic sets 1, 2 \& 8}

\setmainfont{TeX Gyre Termes}
\section*{Termes, Termes Math}

%% Palatino clones
\setmainfont{TeX Gyre Pagella}
\section*{Pagella, Pagella Math}

\setmainfont{Palatino nova}[UprightFont=*-Regular,
             BoldFont=*-Bold, ItalicFont=*-Italic]
\section*{Palatino nova, Asana Math}

%% Others

\section*{Cambria, Cambria Math}

\setmainfont{Libertinus Serif}
\section*{Libertinus Serif, Libertinus Math}

\setmainfont{DejaVu Serif}
\section*{DejaVu Serif, DejaVu Math}

%%  Neo Euler Math has status "abandoned"
%\setmainfont{Palatino Linotype}
%\section*{Palatino Linotype, Neo Euler Math}
  • 1
    It's been already pointed out that unicode-math has the concept of \mathversion that's more efficient than stating \setmathfont anew. You may wish to update your answer after looking at page 8 of the documentation.
    – egreg
    Commented Sep 30, 2011 at 13:50
  • @egreg: Thanks for this suggestion. I've updated the code and provided an additional paragraph to highlight the use of this facility.
    – Mico
    Commented Sep 30, 2011 at 14:04
  • 1
    Now there are only a few opentype math fonts. Only 4 for free: Latin Modern Math, XITS Math, Asana Math, Neo Euler; 2 commercial: Cambria Math, Minion Pro; and some in development: Lucida Math, TeX Gyre(?).
    – Leo Liu
    Commented Sep 30, 2011 at 14:16
  • 2
    The concept of math versions is in LaTeX2e's NFSS, say, normal and bold. You can use \mathversion in pdfLaTeX. unicode-math inherits the concept and makes it easier to use.
    – Leo Liu
    Commented Sep 30, 2011 at 14:23
  • 1
    See this Community Wiki question: tex.stackexchange.com/questions/425098/…
    – Davislor
    Commented Nov 2, 2019 at 3:33

You must log in to answer this question.

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