[Tex/LaTex] \bold in math environment

boldfontsmacros

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)?

Best Answer

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.