# Why is the \bf command applied to more than I asked?

MWE:

\documentclass{article}

\usepackage{bm}

\begin{document}
$$x(t), \bf{x}(t), \bf{x(t)}$$
\end{document}


Result:

Question:

Why are the second and third x(t) typeset the same? In the second expression, it was asked to apply \bf to only x.

EDIT:

I had not payed attention to it when asking the question, but I would like to have a bold and italic x.

• Because \bf is a declaration that applies to everything until the end of the current group. Use \mathbf{x}(t) instead. Nowadays (=the last thirty years) one doesn't use \bf anymore. – gernot Apr 10 '17 at 17:15
• You probably intended to write \bm instead of \bf. – gernot Apr 10 '17 at 17:17
• Better to avoid $$...$$. Use $...$ instead. Why is [ … ] preferable to $$…$$? – gernot Apr 10 '17 at 17:18

Use \bm instead of \bf. And $...$ instead of $$...$$.

\documentclass{article}
\usepackage{bm}
\begin{document}
$x(t), \bm{x}(t), \bm{x(t)}$
\end{document}

• I think the OP wants \mathbf{x} rather than \bm{x} – egreg Apr 10 '17 at 17:38
• @egreg It depends on what you mean by "want". Loading the bm package and adding the bm tag indicates that the OP wants to use the bm package, so it seems that \bf is just \bm with a typo. If by "want" you mean "should want" then I have no opinion. I'm neither able to read the OP's subconscious mind, nor am I aware of typographic conventions that dictate \mathbf instead of \bm. – gernot Apr 10 '17 at 17:46
• @egreg No, I wanted \bm{x} (x italic), but it is true that I had not mentioned it in the question. – Karlo Apr 11 '17 at 9:22
• @Karlo Well, you mentioned it in the question. You can hardly be more explicit than\usepackage{bm} and adding the tag bm. – gernot Apr 11 '17 at 9:24
• @egreg Ah yes, it was a typo apparently. – Karlo Apr 11 '17 at 9:27

Because \bf is a (deprecated) switch that is turned on. It doesn't take an argument in the form \bf{x}, but should rather be used {\bfseries x} (instead of {\bf x}. See Does it matter if I use \textit or \it, \bfseries or \bf, etc. and Will two-letter font style commands (\bf, \it, …) ever be resurrected in LaTeX?

Instead, use \boldsymbol (from amsmath) or \mathbf:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$x(t), \boldsymbol{x}(t), \mathbf{x}(t), \boldsymbol{x(t)}, \mathbf{x(t)}$

\end{document}

• Note the use of $...$ (as opposed to $$...$$). See Why is $$ preferable to ? – Werner Apr 10 '17 at 17:20
• The documentation of amsbsy (automatically loaded by amsmath) explicitly tells to prefer \bm from the bm package. – egreg Apr 10 '17 at 17:37
• I'm not sure it's right to call the switches like \bf and \it deprecated: they may be deprecated in LaTeX (not fitting with its philosophy of logical structure), but AFAIK they are still the way to go in plain TeX, and one could argue there is something pleasing about transparently getting exactly the font you asked for: not getting bold italics because of accidental nesting or whatever. – ShreevatsaR Apr 11 '17 at 3:01
• @ShreevatsaR they're are not deprecated in Plain and ConTeXt but they are in LaTeX. Since the question clearly is about a LaTeX document it would be rather misleading (IMHO) not to call them deprecated under these circumstances. – cgnieder Apr 11 '17 at 9:44