The \text{}
command inherits the formatting of the surrounding text. If you’re in a sans-serif bold header, the sans-serif bold will bleed through. If you’re in an italicized theorem statement, the italics will bleed through.
You can also use \textrm
, \textup
, \textbf
and so on. These will set only one font axis (family, shape, weight) and leave the others the same as the surrounding text. Sometimes, this is what you want: you might want a math formula inside a bold header to be bold, so you could use \textup
or \text{\upshape\rmfamily #1}
to leave the weight unchanged.
If you want to reset all text formatting, use \textnormal
or \mathrm
. It is possible to set \textnormal
and \mathrm
to different fonts or encodings, but by default, they should both work.
If you do want the entire formula inside the header to be bold, format your header with \bfseries\boldmath
and use \textup
or \textit
. In unicode-math
, you could use \symup
or \symit
for math letters. You will need to load a bold math font for this to work.
\mathrm
the\text...
commands by design pick up the current text font and shouldn't normally be used in math.