Currently I have to reduce math fonts used in an article. In spite of this, I do not want to lose these features. Hence I have found a method: replace math version by text version.

E.g. assume we used \mathsf. Add a code in the head: \renewcommand{\mathsf}{\textsf}. Then one room of mathalphabet will be vacated.

However what are differents between \mathsf and \textsf? They look the same, moreover \mathsf can be used in math mode only whereas \textsf can also be used in text mode; but \textsf can be used in math mode too, so what is the necessity for \mathsf? Moreover, why not replace all \math* to \text*?

  • 1
    I think the following is a duplicate: Difference between \textrm{} and \mathrm{}
    – Werner
    Mar 2, 2013 at 5:47
  • 2
    The question linked to by Werner is not really a full duplicate; if you change your question to be more "how can I fully replace \mathsf without using a math alphabet", it won't be a duplicate any more.
    – egreg
    Mar 2, 2013 at 10:58

1 Answer 1


The main problem is that \textsf only changes the current family to \sfdefault (which corresponds to whatever the class or loaded packages set, the default out of the box is cmss for Computer Modern Sans), as explained in Difference between \textrm{} and \mathrm{} for \textrm and \mathrm, but the same concepts apply here.

By loading amsmath, all \textXY commands can be used in math mode and they automatically change size according to the current math style (\displaystyle and \textstyle in the current font size, \scriptstyle and \scriptscriptstyle reduced size, depending on the current font size).

On the contrary, \mathsf is usually set up for choosing sans serif upright medium, in the current font size (or reduced in subscripts and superscripts). This is much more efficient in terms of processing time than using \textsf, but in cases when one is short of math groups, a good alternative is to avoid using up one of them just for a little number of cases.

One can do with

\usepackage{amsmath} % for enabling reduced size in sub/superscripts
\let\mathsf\relax    % just to avoid a message in the log file

that ensures the same font selection as made by \mathsf, independently of the context. This redefinition should be made after loading font packages that can issue a \DeclareMathAlphabet{\mathsf} command.

If \mathsf has not been used in advance for typesetting (usage in definitions are not important), a math group will be effectively saved at the expense of processing time (some milliseconds, probably, with fast machines).

You must log in to answer this question.

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