For creating the graphics for my thesis (function graphs, flow charts, line art sketches) I've chosen to use the sans serif font by


However when I use mathematical symbols like $p_{s}$, they are still typeset in roman font and that looks weird:

screenshot of example

So I wonder:

  • how could I force mathematical expressions also be typeset in \sfdefault
  • if I do, are there any negative sideeffects to expect (with greek signs or other special symbols?)

  • OR should I typeset all "mathematical" graphs (axis labels etc.) in roman font, and only make the other graphics like flow charts and sketches with sans serif font?

  • Related: tex.stackexchange.com/questions/41497/…
    – Daniel
    Commented Dec 14, 2015 at 7:05
  • 2
    Interesting question. I have nearly the same problem: I am preparing slides with beamer and of course, the main font is Sans-Serif, but included TikZ and PGF plots have roman numbers. Mine show roman numbers everywhere, whereas your plot has at least Sans-Serif at the scales. So thank you for the question. :-)
    – Jan
    Commented May 24, 2021 at 7:31
  • 1
    @Jan sorry for the late reply - haven't been here for a long time. My graphs were created with a PDF printer out of my statistics software (JMP) and then imported and edited with the wonderful IPE ipe.otfried.org Commented Jan 13, 2022 at 10:57

8 Answers 8


I've been looking into this myself as well, but it seems a lot trickier to get it working for math fonts than for regular text font. Apparently the math fonts have some 'metric' used for kerning that is not present in regular fonts. Some (partial) solutions I found:

Like this:

\setboldmathrm[BoldFont={Optima ExtraBlack}]{Optima Bold}

However this does not change the italic math font for some reason (and there does not seem to be an option to do this(?)).

  • Use sfmath, which comes with a couple of pre-packaged fonts



This works fairly well, but the choice of fonts is limited.

For example:

\setmathfont{XITS Math}
%\setmathfont[range=\mathit/{latin,Latin}]{Adobe Garamond Pro}

Although this has the problem that \setmathfont{} gives a bug when used in combination with amsmath...

  • 1
    For sfmath: note that you don't need to use its pre-packaged fonts. E.g. if you load libertine, make sf the default family, then sfmath, you'll get Biolinum in math mode. I'd also suggest loading euler prior to any of the other font packages to get less "seriffy" symbols.
    – frabjous
    Commented Jan 6, 2015 at 18:02

For whole document:




See A Survey of Free Math Fonts for TeX and LaTeX

For only some letters and numbers in part of a document, use \mathsf.


The easiest way I've found to do this is to use \mathsf. So I write

$ 7\times \rho = \mathsf{c_1} $

I use the sansmath package. It has the advantage that I can switch back and forth between serif and sans math within a single document. Here http://dtrx.de/od/tex/sfmath.html#comparison is a comparison of the different methods of doing math in sans serif.

  • 6
    The page you quote clearly states: "After including the package sfmath.sty, all maths is displayed with sans serif fonts; there is no way to switch back to the original behavior." Can you please give more detail on how to switch back and forth?
    – Michaël
    Commented Apr 1, 2015 at 13:21
  • 2
    Use the command \sansmath inside curly brakets: {\sansmath Sans: $\alpha = Fml$}. It affects only the local environment. I create a whole example as a new answer.
    – Juha
    Commented Mar 9, 2016 at 23:27
  • I forgot to say: Include sansmath, not sfmath
    – Juha
    Commented Mar 9, 2016 at 23:36

Here is an example how to use sansmath package in a document and switch between sans and serif.


{\sansmath Sans: $\alpha = Fml$}
Serif: $\alpha = Fml$


The output is:

Example of sansmath command

You might be interested also in SI-units and latex rendering in python: https://stackoverflow.com/questions/2537868/sans-serif-math-with-latex-in-matplotlib


There's a new package, newtxsf. It would fine just to load it, but read its documentation for more options.


For me (with font set to \usepackage{helvet}), the packages mathastext and isomath did the job to get a consistent appearance (text in mathmode in same style as default text):

% 'isomath' sets upper case greek letters italic in accordance with 
% the International Standard ISO 80000-2

(copied from https://tex.stackexchange.com/a/268944/9075, but I had success with that, too)

  • To me the best suggested solution so far. Only two problems so far: the minus-sign looks different, when compared to the plus sign. (The horizontal line of both letters should be identical!) This could be considered harmless. The second problem is a major problem: the delimiters don't scale any more. So \right( will give the same result as (.
    – Jan
    Commented May 24, 2021 at 9:17

I would think twice about making sanserif the default math font. It's usually difficult to distinguish some letters from each other, like v and \nu or p and \rho. Here is a test file which has many packages with sans serif math and after the listing we can see what we could get with arev.



% Sans serif math, each with issues of readibility

% Good (IMO) Serif math fonts
% \usepackage[utopia,expert]{mathdesign}
% \usepackage[ebgaramond, expert]{mathdesign}
% \usepackage{mathpazo}
% \usepackage{kpfonts}

% I personally like this text-math combination the most
% \usepackage[utopia,expert]{mathdesign}
% \usepackage{venturis}

% This has best \gamma, but \rho^p is not acceptable IMO
% \usepackage{ebgaramond-maths}



Here is what we get with arev


You must log in to answer this question.

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