# Changing Font _Without_ Changing Weight (Bold)

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).


Any help would be most appreciated!

• Please add a minimal example of code showing your font setup. – egreg May 28 at 21:41
• \mathrm{ab} ? – David Carlisle May 28 at 21:44
• @DavidCarlisle Yes, that works, thank you :) -- I thought that was one of the first things I tried, but obviously not! (as evidenced by my forgetting to include it in the question text above). If you want to make an answer, I'll accept; otherwise I'll make one citing your comment :) -- whichever you prefer. I remember being surprised that \textrm didn't work (I must have been doing something wrong). Sorry to have posted such a trivial question! – Sam T May 28 at 22:04
• Ah, I see, it doesn't remove italics (which is, of course, not what I was asking). I think I accidentally tested it with italics, rather than bold. Thanks again, and sorry again! – Sam T May 28 at 22:08

\mathrm{ab} will give the math Roman font (and math Roman bold font in \boldmath) note that isn't by default Times Roman, but you can chose a Times Roman clone style for your document with for example \usepackage{newtxtext,newtxmath}