\documentclass{article}
\newcommand{\nptime}{\ensuremath{\sf NP}}
\newcommand{\bnptime}{\ensuremath{\sf\bf NP}}
\begin{document}
\nptime\\
\bnptime
\end{document}
I'm trying to make a macro to typeset "NP" in boldface sans-serif font, but as demonstrated by my MWE, it's not working. BF seems to force a serif font.
Alternatively, I'd be happy to find an opposite to \ensuremath, but I can't seem to find one. I tried \text{} to no avail.
The following similar MWE does the same thing.
\documentclass{article}
\newcommand{\nptime}{{\sf NP}}
\newcommand{\bnptime}{{\sf\bf NP}}
\begin{document}
\nptime\\
\bnptime
\end{document}
\newcommand{\bnptime}{\textsf{\textbf{NP}}}that works both in text and math. Notice that\bfand\sfare deprecated commands. – egreg Feb 14 '13 at 23:03