What is the proper markup for a Math operator in boldface?

I'd like to render the string Id as a Math Operator in upright boldface. What is the proper markup for that? \mathbf{\operatorname{Id}}? \operatorname{mathbf{Id}}? \mathop{\mathbf{Id}}?

Note; this is for code in a macro, not inline.

• \operatorname{\mathbf{Id}} Jun 27, 2019 at 15:06

Comparison:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\mathbf{\operatorname{Id}}$ is wrong

$\operatorname{\mathbf{Id}}$ seems good

$\mathop{\mathbf{Id}}$ seems good

$\displaystyle\operatorname{\mathbf{Id}}_{X}$ seems good

$\displaystyle\mathop{\mathbf{Id}}_X$ is wrong

\end{document}


Thus the right one is \operatorname{\mathbf{Id}}. Of course, if you use it more than a couple of times, you should do

\DeclareMathOperator{\Id}{\mathbf{Id}}


in your document preamble and use \Id.

• This is for a macro, not inline. I've edited the question to clarify that. Jun 27, 2019 at 18:18
• Why should \operatorname{\mathbf{Id}} be preferred to \mathop{\mathbf{Id}}? Mar 2 at 13:40
• @Patricio Try \mathop{\mathbf{x}} Mar 2 at 16:07
• I just have, but I'm unable to tell the difference. Mar 3 at 7:12
• Now I see, it's its handling of subindices in displays, isn't it? Sorry for bothering you with this Mar 3 at 7:14