92

In mathematics, a letter, say, g, can stand for a scalar, while a letter in bold, e.g., g stands for a vector.

Here is my question:

How can one turn the letter into bold in the math mode?

For example, how can I turn g here into bold?

$$-\nabla p+\mu\nabla^2u+g\delta(x-x_0)=0 $$
1
  • 3
    It is preferrable to use \[ and \] as discussed here. Also see this for more on bold math symbols. Jul 9, 2011 at 2:31

4 Answers 4

100

Using the bm package. The \mathbf command can only be used for non-italic symbols, instead the amsmath package defines the \boldsymbol command that can be used with every literal symbol or math operator. The bm package redefines the \boldsymbol command providing the \bm command and is independent from amsmath. So you can use:

\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
\[ \boldsymbol{g} \qquad \bm{g} \]
\end{document}
1
  • 1
    For non-italics, it is \mathrm{\mathbf{j}}
    – khaverim
    May 25, 2019 at 15:00
59

Use \mathbf{g} for bold in math mode.

4
  • 4
    \mathbf doesn't work for everything
    – pratnala
    Feb 16, 2016 at 4:01
  • 2
    @pratnala That's true, but that also wasn't what the question was asking. See the accepted answer for a more general solution.
    – godbyk
    Feb 18, 2016 at 18:31
  • 2
    I think mathbf will turn italic letters into normal letters
    – High GPA
    May 31, 2022 at 22:52
  • As the accepted answer and also this tex.stackexchange.com/a/14400/192743 suggests, if you need bold italic, use \bm.
    – Paloha
    Oct 4, 2022 at 12:38
3

An update: if you use unicode-math, it provides \symbfup and \symbfit commands for bold upright and italic letters, respectively. There are similar bold sans-serif, calligraphic and script alphabets. There are also \mathbfup and \mathbfit commands, intended for whole words in math mode, but I’ve honestly never had cause to use them. Finally, traditional math commands are supported for backward-compatibility.

The \boldsymbol command still works, including for symbols other than letters, if you load one of the math fonts that comes in bold (such as XITS Math) or if you declare a bold math font with \setmathfont[version=bold]. This can be a FakeBold version of the math font, for instance,

\setmathfont{NewCMMath-Regular}
\setmathfont{NewCMMath-Regular.otf}[
   version=bold,
   FakeBold = 1.2 ]

It can also be useful to add \bfseries\boldmath to your header formatting, to make your math match the weight of the text.

The one disadvantage of this is that, as of 2021, you cannot use version= and range= together. Your bold symbol font will only work if you do not mix-and-match different math fonts with range=.

If you stick to legacy math fonts, isomath adds a bold italic \mathbfit alphabet, and optionally bold sans-serif math alphabets for tensors. The mathalpha package adds bold versions of several other math alphabets, such as a heavy blackboard bold and a bold calligraphic.

0

Another option is to use the statmath package, which defines a number of commands related to statistics, including bold-face versions of the Latin and Greek letters --- \bfg, \bfbeta, \bfOmega and so on. I've found this a very useful package if many of the symbols in your formulas should be bold to begin with: it really cuts down on typing.

\documentclass{article}
\usepackage{statmath}
\begin{document}
$$-\nabla p + \mu\nabla^2 u + \bfg\delta(x - x_0) = 0$$
\end{document}

FWIW, the package uses \mathbf and \boldsymbol by default, but can be configured via a package option to use bm's \bm command instead.