6

Having forgotten the command to make text bold in math mode I naively tried

$\bold{bold var goes here} these maths symbols are not bold$

and it worked! I became immediately suspicious as I know LaTeX font commands are never that `nice'. I haven't been able to find anything about this command online. By experimentation I found that amsfonts or amssymb are responsible.

My main question is to please explain where this command came from: where in which package. The additional question is how can one find out where any given command comes from using just his computer (if not possible, then the easiest way with the internet)?

3
  • 2
    \boldmath for steady bold font and \bm for local changes (or \mathbf{}). There's an outdated command also, but I can't never remember which one it is.
    – user31729
    Apr 18 '16 at 12:17
  • 1
    The syntax \bold{...} works with AMS-TeX, not with LaTeX.
    – egreg
    Apr 18 '16 at 12:19
  • 1
    \boldmath must be stipulated outside of math mode.
    – Bernard
    Apr 18 '16 at 12:23
6

Before answering your main question, I’ll deal with the additional one: at least in TeX Live, there is a command-line utility program called texdef by means of which you can easily see how, and sometimes where, a command is defined, or, more generally, what is its meaning.

The basic syntax is

texdef -t <format> <cs>

where <format> is the name of a TeX format, e.g., latex, and <cs> is any control sequence (not necessarily a command or a macro name). There are also a full bunch of command-line options, among which I’d recall:

  • -c <class>, for specifying a <class> different from the default article class;

  • -p <package>, or more generally -p [<options>]{<package>}, to load a certain <package>, possibly with <options>;

  • -s, to (try to) show an extract of the source file where a certain command is defined;

  • -h (help) is very useful too, of course!

For example—and I am coming, now, to your main question—if you try

texdef -t latex -p amssymb -s \bold

the answer you get, namely

% amsfonts.sty, line 115:
\DeclareRobustCommand{\bold}[1]{%
  {\@subst@obsolete{amsfonts}\bold\mathbf{#1}}}

tells you that \bold is defined on line 115 of the file amsfonts.sty, as syntactic sugar to support an old, and now deprecated, command, effectively converting it into \mathbf.

6

Some options, but not all, I think, to use bold math in LaTeX:

\boldmath is your friend if there's a longer portion of bold math fonts needed, not just a few symbols. Don't forget to use \unboldmath later on.

\mathbf{...} is the math bold version of \textbf, i.e. the font is roman and upright letters usually.

The package bm provides the \bm command, amongst other features.

The \boldsymbol command keeps the usual italic shaped letters of the math environments.

The \bold command is from AMS-TeX and works if the package amsfonts or amssymb is loaded, but there's a warning that \bold is deprecated:

Package amsfonts Warning: Obsolete command \bold; \mathbf should be used instea
d on input line 24


\documentclass{article}


\usepackage{amsfonts}

\usepackage{bm}

\newcommand{\foo}{E=mc^{2}}


\begin{document}
Not bold: $\foo$

From now on all bold with \verb!\boldmath!: \boldmath $\foo$ 

or $E^{2} = p^{2}c^{2} + m^{2}c^{4}$\unboldmath 

-- from here the enduring effect of \verb!\boldmath! has been removed with \verb!\unboldmath!

Local bold math with font change by \verb!\mathbf!: $\mathbf{\foo}$

Local bold math with \verb!\bm! from package \texttt{bm}: $\bm{\foo}$


With \verb!\bold! command:  $\bold{\foo}$ 

\end{document}

There's also \boldsymbol from amsmath and \pmb("poor man's bold"), the latter being a last resort method for symbols which have no true bold version in the font.

2
  • 4
    +1. You may want to state more explicitly that (a) \mathbf generates bold-upright letters whereas \bm and \boldsymbol generate bold-italic letters, and also (b) \mathbf has no effect on math symbols (e.g, \sigma and \sum) whereas \bm and \boldsymbol do have an effect. Finally, it may be worth noting that this is specific to "TeX math mode". With other systems, such as French math mode and ISO math mode, different conventions may apply
    – Mico
    Apr 18 '16 at 14:40
  • @campa: Actually, I missed the bold somehow. I will add
    – user31729
    Apr 18 '16 at 15:32
0

The unicode-math package is partly backward-compatible, but the rules are slightly different.

The \mathbf command still works, but is meant for words in math mode. The recommended way to get individual math symbols is \symbfup or \symbfit. The amsmath command \bold will therefore still work.

IF you load an OpenType math font that has a bold version (as of 2019, XITS, Libertinus or Minion), unicode-math will switch to it when you select \boldmath or \mathversion{bold}. You can also do something like \setmathfont[version=bold]{MinionMath-Semibold.otf}. The \boldsymbol command from amsmath still works and is a very convenient way to switch to the bold math version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.