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}}
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityHo 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}}
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.
Try this:
\DeclareMathOperator{\Div}{\mathbf{Div}}
\DivB
as a bold version of \Div
for use as required, but that may not necessarily meet the OP's use case. The general question of why \mathbf{\SomeMathOperator}
doesn't have the desired effect (and what to do about it) may be more interesting.
An alternative approach is to use \boldsymbol
:
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\Div}{Div}
\newcommand{\Divxk}{\mathop{\boldsymbol{\Div}}_{X/k}}
\begin{document}
\( \Div \)
\( \Divxk \)
\end{document}
$a\Divxk b$
, where the operator nature is lost. It should be \mathop{\mathbf{Div}}_{X/k}
.