[Tex/LaTex] DeclareMathOperator in bold

math-modemath-operators

Ho can I declare a math operator which will appear in bold font?

I tried the following, but it didn't work:

\DeclareMathOperator{\Div}{Div}
\newcommand{\Divxk}{\mathbf{\Div}_{X/k}}

Best Answer

The \mathbf around \Div does nothing, because \Div is translated internally to something like "choose the \mathrm font and typeset ‘Div’”. Math fonts don't inherit features from the context: \mathrm always corresponds to the upright text font in medium weight (or boldface) if \boldmath is in force.

You can check that

$\mathbf{\mathrm{x}}$

produces a medium weight ‘x’.

So you have to define

\DeclareMathOperator{\Div}{\mathbf{Div}}
\newcommand{\Divxk}{\Div_{X/k}}

The definition of \Div becomes “choose the \mathrm font and typeset ‘\mathbf{Div}’”, so, for the same reason as before, the boldface font will be chosen.

Related Question