I read many things about people wanting math mode in sans-serif font and doing crazy things with packages and options to get that, but I did not find anything that would simply make my math mode font non-italic.
Is there an (easy) way to set math mode font to be non-italic?
And is there a way to do that globally for the whole document?
Best Answer
On a case-by-case basis, it is possible to typeset text within math mode using
\textrm{...}
or\mathrm{...}
, the latter being used predominantly for typesetting units or symbols and not pure text (since it gobbles spaces that are not escaped).\mbox{...}
is another alternative to\textrm{...}
, since it resets its contents to text mode by default. Here are some examples:The above font changes do not work that well in general, since switching to a different font when using sub- and superscripts, say, does not always scale as expected. There are ways around it though. For example, using
\text{...}
from theamstext
package (automatically loaded byamsmath
- see the AMS package dependencies), which switches to the appropriate font size via\mathchoice
: