Is there a way to "unbold" the default text font (namely, sans serif) when written in math mode? Consider this example:

Hello World$\qquad\textsf{Hello World}$

The first instance of "Hello World" is just plain text; the second is obtained inside math mode using the \textsf command.


1 Answer 1


You can tell MathJax to use the same font as is used for the surrounding text by the following command:

$\style{font-family:inherit;}{\text{Some text}}$

This gives: $\style{font-family:inherit;}{\text{Some text}}$

This assumes that what you want is to have the same font as the text, which happens to be a sans-serif font at the moment. In case this main font should change in the future or somebody changes it locally via using a custom style-file the text above will also change.

If the intent would be to "force" a sans-serif font, just one that usually is less bold, then this can be done using:

$\style{font-family:sans-serif;}{\text{Some other text}}$

This gives: $\style{font-family:sans-serif;}{\text{Some other text}}$

I learned this from an answer by regret on math.se, and the comments below.

  • $\begingroup$ Or just $\style{font-family:"sans-serif";}{\text{Hello!}}$ to ensure sans serif regardless of the inherited font family. $\endgroup$
    – Asaf Karagila Mod
    Nov 27, 2015 at 22:23
  • $\begingroup$ Strangely it seems not to work $\style{font-family:"sans-serif";}{\text{Hello!}}$ maybe like so $\style{font-family:sans-serif;}{\text{Hello!}}$. // The quotation marks need to go. But thanks regardless. $\endgroup$
    – user9072
    Nov 27, 2015 at 22:50
  • $\begingroup$ Well, it's not the same sans serif font as used on MO, but it is sans serif. (Both work for me, with the same output.) $\endgroup$
    – Asaf Karagila Mod
    Nov 27, 2015 at 22:52
  • $\begingroup$ No, for me it is a serif-font. I am not sure you saw the updated comment. I think there should be no quotes. $\endgroup$
    – user9072
    Nov 27, 2015 at 22:54
  • $\begingroup$ On another device it is sans-serif for me too. One more test $\text{Test}$ $\style{font-family:"serif";}{\text{serifquote}}$ $\style{font-family:serif;}{\text{serifnoquote}}$ $\style{font-family:"sans-serif";}{\text{sanserifquote}}$ $\style{font-family:sans-serif;} {\text{sanserifnoquote}}$ Very weird. $\endgroup$
    – user9072
    Nov 27, 2015 at 23:20
  • 4
    $\begingroup$ The standard says (w3.org/TR/CSS2/fonts.html, 15.3) that "generic font family names are keywords and must NOT be quoted", so quid is right. If you put "sans-serif" in quotes, it selects an actual font with this exact name rather than the generic sans-serif font. This happens to work in SOME system configuration (e.g., based on fontconfig) because of the way they implement generic families (namely, by providing a font name alias), but this is unreliable and fails on other systems. $\endgroup$ Nov 28, 2015 at 9:23
  • $\begingroup$ @EmilJeřábek This explains it nicely. I update the answer a bit. Thanks to both of you for the additional information. $\endgroup$
    – user9072
    Nov 28, 2015 at 12:35

You must log in to answer this question.

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