9

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}}

3 Answers 3

12

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.

8

Try this:

\DeclareMathOperator{\Div}{\mathbf{Div}}
1
  • That works, so you could define \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.
    – Chris H
    Sep 24, 2013 at 14:10
4

An alternative approach is to use \boldsymbol:

Sample output

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator{\Div}{Div}
\newcommand{\Divxk}{\mathop{\boldsymbol{\Div}}_{X/k}}

\begin{document}
\( \Div \)

\( \Divxk \)
\end{document}
2
  • The spacing is wrong; try $a\Divxk b$, where the operator nature is lost. It should be \mathop{\mathbf{Div}}_{X/k}.
    – egreg
    Sep 24, 2013 at 14:55
  • @egreg Of course! Thanks for pointing that out. Answer updated. Sep 24, 2013 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .