Question: I'm LaTeXing some category theory, and typeset the names of my categories in boldface (**Set**, **Rel**, ...). Since I might want to change that, I put

```
\newcommand{\catname}[1]{\textbf{#1}}
\newcommand{\Set}{\catname{Set}}
\newcommand{\Rel}{\catname{Rel}}
...

```

in my document header. But `textbf` very kindly respects the italics elsewhere in the document, so that if I try to typeset a category inside a definition (say) I get ***Set***. I don't want this -- I'd like the categories to be upright.

I tried

```
\newcommand{\catname}[1]{{\bf #1}}
\newcommand{\catname}[1]{\ensuremath{\boldsymbol{\operatorname{#1}}}}

```

but these both ruin the spacing after the category name. Help! =)

Answer: 
You can wrap it in a group and add `\normalfont` to it; this will localize the font change initiated by `\normalfont`. This way it will revert back to the default before setting it in **bold**:

![enter image description here](https://i.stack.imgur.com/LvQhD.png)

```
\documentclass{article}
\newcommand{\catname}[1]{{\normalfont\textbf{#1}}}
\newcommand{\Set}{\catname{Set}}
\newcommand{\Rel}{\catname{Rel}}
\begin{document}
Here is \Set. \par
\itshape Here is \Set. \par
\sffamily Here is \Set.
\end{document}

```

If you wish to maintain the current font family as well yet only print it upright, use

```
\newcommand{\catname}[1]{\upshape{\textbf{#1}}}

```

Note the difference in the last entry when using the above definition:

![enter image description here](https://i.stack.imgur.com/yBQQo.png)
Replacing `\textbf` by `\mathbf` seems to work fine.

```
\documentclass{article}

\newcommand{\catname}[1]{\mathbf{#1}}

\begin{document}

    \emph{\dots in the category $\catname{Set}$.}

\end{document}

```