105

I'm typing a bold vector small x with a tilde sign above it. Now when I want to write its derivative, I'm putting a dot on top of everything. This is giving me problems and I found one solution:

\overset{\mathrm{\textbf .}}{\boldsymbol{\mathrm{\tilde{x}}}}

after I read this post: How to make a larger "\dot" . This post has a solution for a similar problem: \overset{\bm .}{a}

To write bold mathematical symbols, such as vectors is \boldsymbol better or do you recommend using the bm package? I have always been using \boldsymbol.

Janosh
  • 4,042

2 Answers2

227

The \bm command from package bm has both advantages and drawbacks over the \boldsymbol command from package amsbsy (loaded by amsmath). The first advantage of \bm is that it keeps the italic correction, so that something like \bm{T}_1^2 will look better than \boldsymbol{T}_1^2 (if you want to compare the two in a document, you must be careful that bm redefines \boldsymbol):

bm vs. boldsymbol: italic correction

The second advantage is that \bm does not disrupt the spacing, whereas \boldsymbol does, even though it works correctly for binary operations (like +) and for relations (like =). As an example, here's the comparison between \boldsymbol{[}-1;1] and \bm{[}-1;1]:

bm vs. boldsymbol: spacing

However, \bm sometimes requires the user to add braces to avoid problems. For example, \bm{\dots} will provoke an error with amsmath, the solution being to type \bm{{\dots}}. Double accents also need to be enclosed in braces to work properly:

\documentclass{article}
\usepackage{amsmath,bm}
\begin{document}
%$\bm{\dots}$% causes an error
$\bm{\mathinner{\dots}}$% works
$\bm{\hat{\dot{\phi}}}$% does not work correctly
$\bm{{\hat{\dot{\phi}}}}$% works correctly
\end{document}

bm double accents: with and without braces

Finally, math alphabet nesting works better with \boldsymbol than with \bm. For example, here's the result of \mathrm{g\boldsymbol{g}} and \mathrm{g\bm{g}}:

bm vs. boldsymbol: font nesting

Hendrik Vogt
  • 37,935
  • @Philippe: instead of \boldsymbol{T}_1^2 one can use \boldmath${T}_1^2$\unboldmath instead of \bm –  Feb 08 '11 at 22:47
  • @Herbert: Yes, but that will also put the 1 and the 2 in bold (which may not be wanted) and will not work if you want it to appear inside a longer formula, e.g. $C+\int_a^b\bm{T}_1^2(t)dt$, where nothing else is in bold. – Philippe Goutet Feb 09 '11 at 09:20
  • @Philippe: I have everything in bold here: \boldmath$C+\bm{\int}_a^bT_1^2(t)dt$ –  Feb 09 '11 at 09:55
  • 3
    @Herbert: if you want to put all the formula in bold, using \boldmath is fine, but if you want only one of the symbols of the formula to be in bold, you must use \bm or \boldsymbol (or \mathbf) on it and not touch anything else. It's in that case that the lack of italic correction is problematic with \boldsymbol. – Philippe Goutet Feb 09 '11 at 12:56
  • @Philippe: I already know ;-) It was you, who said that \bm has the italic correction. And it was me who said, that boldmath can do it, too ... –  Feb 09 '11 at 13:00
  • @Herbert: the point I was making is that \bm has italic correction whereas \boldsymbol hasn't. Although \boldmath has it too, I wouldn't compare it to the other two since you can't use it for the same things. – Philippe Goutet Feb 09 '11 at 13:26
  • 21
    This excellent comparison is underrated and should be the accepted answer. I've bumped it by some minor grammar fixes. – Hendrik Vogt Feb 21 '11 at 14:04
  • @badp: boldsymbol works perfectly with Times, unless you're using a defective package like mathptm or mathptmx. It will work fine with, for example, \usepackage{newtxmath,newtxtext} instead. – Philippe Goutet Feb 25 '14 at 20:22
  • Years later, but I'm just now seeing this and I agree, it's much better than my answer! – TH. Jul 09 '17 at 06:04
  • And then there is \mathbold. So many options! Such a wealth of variety! – Reb.Cabin Nov 02 '18 at 15:32
  • I'd like to add a question: why does \bm default to italics? Is this the correct behaviour for equations? – Henrique Ferrolho May 30 '19 at 18:31
  • 1
    @HenriqueFerrolho: since the aim is to put the argument in bold and most symbols are already italic, defaulting to italic seems the most logical choice. If need be, you can always use \mathbf for upright bold math letters. There's no correct behaviour, it depends on what you want to achieve. Typographically speaking, putting widely used symbols in bold has never been a great practice as it can harm the color of the page if there are too many of them on a given page. – Philippe Goutet May 31 '19 at 10:30
  • 1
    For anyone who cannot use bm and wants to solve the \boldmath{[} problem you aptly pointed out, a workaround is: \mathopen{\boldsymbol{[}}-1;1] – Davislor Sep 10 '21 at 22:22
47

If you take a look at the documentation for bm, it says that if the bold fonts are not allocated, it will use the correct symbol—if it exists—by using \boldmath, but that this is slower. If there is not a bold version of the symbol, it uses poor man's bold.

I think that in most cases, you want to use \bm.

TH.
  • 62,639
  • Thanks. If bm is slower, then I guess sticking to \boldsymbol may be a better choice. Using \boldsymbol I guess will be better than a poor man's bold? Is this correct? – yCalleecharan Sep 19 '10 at 09:46
  • @yCalleecharan: No, you misunderstood. As I understand the documentation, \bm will use the appropriate symbol if the symbol exists in the font and it's loaded. If the symbol exists in a font that isn't loaded, then it will still be used via \boldmath which is slower than the previous case. If there is no symbol, then it uses poor man's bold. – TH. Sep 19 '10 at 10:05
  • Ok thanks. I only use the computer modern fonts in TeXLive. I will take a better look at the bm documentation. – yCalleecharan Sep 19 '10 at 12:33