633

To make Latin-letter variables bold I can use e.g. \mathbf{a}, but while putting Greek letters or symbols such as \nabla inside \mathbf doesn't cause any errors or warnings, it also doesn't do anything else.

What is the best way to make bold math symbols, in particular Greek letters and \nabla?

doncherry
  • 54,637
Michael Underwood
  • 21,356
  • 13
  • 52
  • 41
  • 21
    warning: if the default computer modern fonts are used, the weight of bold lowercase greek will not appear as bold as that of bold lowercase roman, and it isn't. default bold math (\mathbf} with computer modern fonts uses the font cmbx* which is an extended font. \boldsymbol or bm use the only cm font that is usually available in bold, cmmib10, which is not an extended font. thus the bold greek letters are indeed not as "bold" as the roman. – barbara beeton Aug 26 '12 at 21:45
  • 1
    bm{x} = [X_1, \dots, X_D] worked for me! instead of \bf. Seems I didn't have to import anything on my overleaf. The issues with \bf was that it bolded EVERYTHING inside my $$ which was too much. – Charlie Parker Oct 20 '21 at 16:40

14 Answers14

543

The AMS Short Math Guide recommends the \boldsymbol and \pmb commands (and suggests that you use the bm package for the former to get a more powerful version than provided by amsmath).

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Mark Meckes
  • 17,791
  • 41
    I would vote for the bm package surely! – yo' Aug 26 '12 at 11:11
  • 37
    It looks like that \boldsymbol (from amsbsy) is obsolete and \bm (package bm) should be used (ref). – Atcold Jul 26 '16 at 19:13
  • Maybe it's just me, and maybe it's just temporary, but the AMS Short Math Guide link is not working for me. – TMM Dec 06 '16 at 17:13
  • @TMM: I noticed that issue a few weeks ago and assumed at the time that it was temporary; I guess it wasn't. I've contacted the AMS webmaster, and I'll update the link if necessary once I hear back. – Mark Meckes Dec 06 '16 at 17:50
  • @TMM: It turns out that the link works for me in Safari, but not in Chrome or Firefox, presumably because of different browser security settings related to the fact that it's an ftp link instead of http (I haven't bothered to sort it out yet). So maybe it's the same issue for you. – Mark Meckes Dec 07 '16 at 14:35
  • @Mark Thanks for the clarification. I only use Chrome (and sometimes Firefox) though, and I suspect the same is true for many Windows users. So if the AMS wants people to use that guide, it would still be nice if they could somehow solve this problem. Anyway, if it gets solved, please tag me and I will remove these comments. – TMM Dec 07 '16 at 22:12
  • @TMM barbara beeton tells me AMS is planning to move everything currently on an ftp server to www sometime in the future, and also that eventually an updated version of the short math guide will be posted to ctan. – Mark Meckes Dec 07 '16 at 22:25
  • 18
    "It looks like that \boldsymbol (from amsbsy) is obsolete and \bm (package bm) should be used" — Though the poor souls that are using Mathjax e.g., in a Jupyter notebook, that implements all of AMS math and none of bm will find that they have no alternatives to \boldsymbol – gboffi Sep 01 '17 at 08:19
  • 10
    Please add a short summary of the link you provide, eg how to use \bm ? This prevents the answer from being useless when the link is dead (and it is now) – MappaM Feb 05 '19 at 15:03
  • 2
    can you gives us something we can just copy paste? – Charlie Parker Sep 25 '20 at 11:19
  • 6
    @CharlieParker I'm sure you got your answer by now, but for posterity's sake, add \usepackage{bm} before the start of your document and then \bm{the math you want to bold} – Matias Feb 08 '21 at 04:42
  • vote for \boldsymbol\sigma of package \usepackage{amsmath} – Mike22LFC May 10 '21 at 08:11
  • The "boldness" is much more evident with \pmb{} than with \boldsymbol{} – Andrea Araldo Sep 01 '22 at 12:31
  • I would like to mention that currently \pmb and \bf are the only working commands in markdown (that I am aware of), and \pmb works much more nicely than \bf. – zyy Mar 05 '24 at 03:27
294

In my experience, there is no single best way. Therefore Table 582 on page 270 of the Comprehensive LaTeX Symbol List comes in really handy. (Visited June 4, 2023)

bold math sym

glibg10b
  • 265
Christian
  • 19,238
  • 2
    ehm bm ehm. Can you underline "experience" with facts about problems of bm? – yo' Feb 21 '13 at 17:32
  • 3
    @tohecz No, unfortunately not. I don't have the particular example anymore. I just happened to stumble on this old question and I thought I'd add this list since I did encounter tricky cases where it was helpful to be able to try different approaches. bm should surely be the first package to try though. I will add examples where it doesn't work when it ever happens again. – Christian Feb 21 '13 at 17:48
  • 3
    You can always use \boldsymbol{}, but this will only work if there exists a bold version of the symbol in the current font. – sinner Jan 15 '15 at 04:44
  • In my personal experience, \pmb (the faked bold) is the most universal – Dr_Zaszuś May 11 '15 at 16:57
  • 9
    @Szczypawka Most universal ... probably. But also a measure of last resort. – Christian May 11 '15 at 18:06
  • 2
    @Christian How to make bm work in titles (section, article, etc.) ? – Cyriac Antony Sep 27 '19 at 07:05
  • When used in titles (e.g. section title), \boldmath and \mathbf works. In constrast, \bm is giving errors. – Cyriac Antony May 08 '21 at 06:16
  • \langle and \rangle don't seem to get any bolder with \bm. – Roly May 19 '22 at 08:04
74

With unicode-math you can use \symbf{<characters>} which works for both Greek and Latin letters. (In versions of unicode-math older than 0.8 the \symXXX macros didn't exist, but you could \mathbf{<characters>} directly.)

Compile with xelatex or lualatex.

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITSMath-Regular.otf}
% or a different font:
%\setmathfont{texgyrepagella-math.otf}
\begin{document}
\( AaBb∇αβγ \) \par
\( \symbf{AaBb∇αβγ} \) \par
\( \symrm{AaBb∇αβγ} \)
\end{document}

enter image description here

Torbjørn T.
  • 206,688
  • 1
    Does not work for me. Bold latin symbols appear OK, but greek ones (from nabla onwards) don't show. I have XITS Math font correctly installed on my system (linux), and I compiled this MWE with both xelatexand lualatex, with no luck. What am I doing wrong? – Orestes Mas May 31 '16 at 16:44
  • 1
    Update to my previous comment: I managed to make it work doing the following. 1) Specify math font as \setmathfont{XITS Math} (I'm on a linux system and that is the name of the font my system reports) and 2) Adding \usepackage{bm} AFTER setting the math font. Without step 2), greek bold characters don't show up and latin bold appears to be typeset in Latin Modern Bold – Orestes Mas May 31 '16 at 17:07
  • 5
    @OrestesMas There were some updates to unicode-math recently, use \symbf instead of \mathbf. – Torbjørn T. May 31 '16 at 18:25
  • neither \symbf or \mathbf worked for me. bm package suggested below works smoothly. – relG Mar 26 '20 at 00:04
  • 1
    @relG I guess that could be caused by how you've set up up your document. If you want to know why it didn't work, I suggest posting a new question with a minimal working example. – Torbjørn T. Mar 26 '20 at 06:09
  • @TorbjørnT. I'm not really motivated to do that when there's a simpler option, especially when others have also experienced problems with this solution. – relG Mar 28 '20 at 17:16
  • 1
    @relG Of course that's entirely up to you. (The problem mentioned in previous comments were caused by an update to the unicode-math package I think, the answer has been updated since. I do see that the latest version of XITS on CTAN doesn't actually have a file called xits-math.otf, so I think I'll update the answer with different file names. Apart from that, the code in the answer works fine.) – Torbjørn T. Mar 28 '20 at 17:43
50

Another possibility is \boldmath, though I would prefer \boldsymbol of amsmath as well. \unboldmath switches back to the normal math font.

doncherry
  • 54,637
Stefan Kottwitz
  • 231,401
  • 8
    Why is \boldsymbol preferred over \boldmath? – drs May 18 '13 at 01:18
  • 7
    @drs \boldsymbol is included in the package amsmath, which is ubiquitous, while \boldmath is not. – glarrain Jan 09 '14 at 19:24
  • 2
    I don't know why but $\boldmath{\phi}$ does not work for me, yet $\boldsymbol{\phi}$ does. – Stefan Falk Apr 12 '17 at 15:26
  • 3
    @displayname \boldmath is a declaration, so you want to use it like this: {\boldmath $\phi$}. Also \(\phi\) is recommended. See https://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode – L. F. Feb 26 '19 at 12:45
  • Not sure whats special, but I consistently have issues bolding \mu in Overleaf, while other greek characters seem to work with almost all of the suggestions here. \boldsymbol is the only function that consistently works across characters I've tried. – bhan Jan 29 '20 at 19:19
  • 1
    The comment by @glarrain appears to be wrong as \boldmath is provided by LaTeX itself (it simply does \mathversion{bold}) so is always available, but must be used outside of math mode. And amsmath's \boldsymbol is a math-mode only command which exits math mode temporarily to execute \mathversion{bold} then re-enters math mode. And limits its action to the duration of its argument. – user691586 Dec 18 '23 at 13:04
36

If you use the package bm you can do $\bm{a}=\bm{\alpha}$ etc.

doncherry
  • 54,637
26

While \bm and \boldmath are some good options in LaTeX, modern packages for XeLaTex can give a lot more control over the fonts from the very beginning, without the need to use commands different from the standard \mathbf that every one expects naively to work the first time one tries to write bold italic characters.

In XeLaTeX (part of TeXLive), the package fontspec gives a lot of freedom when dealing with fonts. If you want even more flexibility for mathematical input, you can try using the package unicode-math (that is built on fontspec). Nevertheless you will find the \bm and \boldsymbol traditional commands don't work. You can nonetheless specify how you want it to deal with your bold math symbols using an option while loading the unicode-math package. \usepackage[bold-style=ISO]{unicode-math} will give the recommended italic bold math symbols for both greek and latin characters, while \usepackage[bold-style=TeX]{unicode-math} will give upright latin characters. This is explained in the unicode-math documentation .

This minimal working example:

%run this with XeLaTeX!!
\documentclass{article}
\usepackage[bold-style=ISO]{unicode-math}
%\usepackage[bold-style=TeX]{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}


\begin{document}

This is common math $O(\log n)+O(\lambda,\,\epsilon)$

This is bold and italic $\mathbf{O(\log n)}+\mathbf{O(\lambda,\,\epsilon)}$ where it must :)
\end{document}

gives

enter image description here

darthbith
  • 7,384
7

Use the command \boldsymbol{YOUR_SYMBOL}

Stefan Pinnow
  • 29,535
Mehdi
  • 79
6

In order to have just one command for both bold text and bold math, one can use the solution suggested on LaTeX Community. Editing this solution slightly in order to incorporate the bm package, one could use the following.

\usepackage{bm}
\newcommand*{\B}[1]{\ifmmode\bm{#1}\else\textbf{#1}\fi}
mdeff
  • 125
Betohaku
  • 1,637
  • Wonderful answer. I would like to point out the following, in case anyone deals with the same situation: I have been using \mathbf{} throughout a project only to find out that it does not work with greek letters. I modified your solution to: \renewcommand*{\mathbf}[1]{\ifmmode\bm{#1}\else\textbf{#1}\fi} (notice the renew rather than new) and everything worked perfectly without any other changes. I am relatively novice with LaTex, so if what I am describing is worthless or trivial or anything, feel free to edit or remove. – kyriakosSt Jul 07 '19 at 21:16
4

My solution (the one that I use) is the \mathversion{bold} and \mathversion{normal} commands.

This piece of code is not a MWE —however, it shows how to use them:

\mathversion{bold}
\section{Behavior of $f$ as a function of $\lambda$}\label{sec:1}
\mathversion{normal}

And now, imagine that \mathversion{bold}\textbf{we want to put some
text in bold, and that this text contains some inline equation such as
$\sum_{j=0}^{t-1}{{p_\mathrm{y}(\lambda=2)}^j}$.}\mathversion{normal}

Hope it helps.

Vicent
  • 1,960
  • 3
  • 17
  • 25
4

Another option:

\documentclass{article}
\newcommand{\boldm}[1] {\mathversion{bold}#1\mathversion{normal}}
\begin{document}

There is a normal symbol, $p_1$. Now, a bold symbol: {\boldm $p_2$}. It works!

\end{document}

Output:

Rendered example of using bold and math in LaTeX

  • $\boldsymbol{x_0}$ was not working for me in either \chapter{title} or \section{title} (but did in \subsection{title}, go figure) but your {\boldm $x_{0}$} saved my day. And no need for any additional package. Totally amazing. – schremmer Nov 11 '18 at 04:44
  • Just one bit of trouble: $x_{0}$ is now bold in the toc. Oh well. – schremmer Nov 11 '18 at 04:55
  • These cant’t be nested. Perhaps wrap in a \mbox? – Davislor Jan 24 '19 at 22:33
4

You can use physics package and write any math symbol in boldface by using command \vb{} inside mathmode, e.g. $\vb{\Psi}$ will yield Ψ.

Cragfelt
  • 4,005
Bilal Azam
  • 71
  • 4
4

Observe how ugly \pmb is in the following example, compared to \bm:

\documentclass{article}
\usepackage{amsmath, bm}
\begin{document}
$$\Psi_n \pmb{\Psi_n} \bm{\Psi_n} \boldsymbol{\Psi_n} \Psi_n$$
\end{document}

enter image description here

ahorn
  • 673
  • Thanks for the minimal example that works, but in a complicated thesis template, I only get the 2nd type irrespective of the command used. How to identify the conflicting pkg that causes this? – Elod Jul 12 '22 at 14:11
  • You need to copy all your code to a new .tex file, then start recursively deleting all the unnecessary text (starting with the rest of the body of your thesis). When you have only one paragraph of writing, start removing the packages, while still compiling the file to check the output. There may be one package that swings it. Feel free to share code at pastebin.com , excluding intellectual property. – ahorn Jul 19 '22 at 07:04
3

The unicode-math package supports several commands for bold symbols beyond what have been mentioned in previous answers, including \mathbf, \symbf, \symbfup, \symbfit and \boldsymbol. It requires LuaLaTeX or XeLaTeX.

If you load a math font that has a bold version, unicode-math will load it as version=bold. There are now several, including XITS Math, Libertinus Math, and KP Math. It is also possible to load any math font with \setmathfont[version=bold].

Here’s a brief MWE that uses \boldmath, \symbf and \boldsymbol. Note that \mathbf will use the bold weight of the main text font, \symbf will use the mathematical bold letters and numerals defined in the Unicode Mathematical Alphenumeric Characters block, and \boldmath, \mathversion{bold} and \boldsymbol will use the bold math font (if there is one).

\documentclass[varwidth = 10cm, preview]{standalone}
\usepackage{mathtools}
\usepackage[math-style=ISO]{unicode-math}
\usepackage{microtype}

\defaultfontfeatures{ Scale = MatchUppercase } \setmainfont{Libertinus Serif}[Scale = 1.0, Ligatures = Common] \setsansfont{Libertinus Sans} \setmonofont{Libertinus Mono} \setmathfont{Libertinus Math}

\begin{document} \section*{\boldmath Reasoning from (\symbf{A} \vee \symbf{B})}

If we have (\symbf{A} \vee \symbf{B}) and (\symbf{A}), disjunctive syllogism (classically known as \textbf{\textit{modus ponendo tollens}}, and also known as \textbf{disjunction elimination} or {\boldmath (\vee E)}) is the rule that lets us conclude (\boldsymbol\therefore \symbf{B}).

\end{document}

Font sample

There are several ways to tweak this behavior. By default, \mathbf renders bold capital letters upright and bold lowercase letters italic, but [math-style=ISO] makes italic the default for everything, including regular-weight uppercase Greek. You can change only the behavior of bold uppercase letters with bold-style=ISO] or [bold-style=upright]. You can also specify \symbfup for bold upright or \symbfit for bold italic.

Davislor
  • 44,045
  • Requires LuaLaTeX or XeLateX. – Benjamin McKay Nov 01 '20 at 09:49
  • @BenjaminMcKay Looking back, I saw some things I said had gotten out of date, so I revised that paragraph. It now mentions LuaTeX and XeTeX, in case someone doesn’t already know. – Davislor Nov 01 '20 at 16:30
  • Huh, I left out a \neg in my example. – Davislor Nov 01 '20 at 16:33
  • I am getting warnings which (probably) say that the bold font was not found. Can you please look in to this? I am using an updated TeX Live 2022. This is the image link to warnings and the output: https://imgur.com/a/bidrDN9 – Apoorv Potnis Dec 13 '22 at 11:17
  • For some reason, instead of defining fonts manually, if I use \usepackage[libertinus]{fontsetup}, then I get the correct output. (ignoring the mathtools warnings) – Apoorv Potnis Dec 13 '22 at 11:24
0

Like in some other answers, I use \mathversion{bold}, but I've never had to use \mathversion{normal} to reset the font. In particular, I use the following commands:

\newcommand{\allbf}[1]{\textbf{\mathversion{bold}#1}}

to get bold characters for both text and math.

And with the article class, to get bold math in addition to the usual bold text in any section title (at any section level):

\let\B@startsection\@startsection
\renewcommand{\@startsection}[6]{\B@startsection
{#1}{#2}{#3}{#4}{#5}{\mathversion{bold}#6}}
vinc17
  • 331