I feel like this question has probably already been asked, but I cannot find it...
I am using the default article
class.
I want to create a macro \ab
which does the following: it simply prints "ab" in upright, Roman font in math mode
. However, I want to be able to use this in settings where the current font is Sans Serif (\sffamily
) and/or where the font is bold (using \bfseries \boldmath
).
Just writing \newcommand{\ab}{\textup{ab}}
does almost all of this: the only issue is that it obviously doesn't do anything with the font; so it's sometimes Sans Serif. I don't know how to change the font other than \normalfont
or \textnormal
, but these both destroy any bold information. So if I do \newcommand{\ab}{\textnormal{ab}}
then I never get bold.
Any help would be most appreciated!
\mathrm{ab}
?\textrm
didn't work (I must have been doing something wrong). Sorry to have posted such a trivial question!