25

Been using the \bfseries lately, instead of \textbf and those, because I learned that they were deprecated in newer versions.

Anyway, the \bfseries bolds the rest of my document, even though I'm using curly braces.

Example:

\bfseries{This is meant to be bolded}
While this is not meant to be bolded, yet still, it is.

It works just fine within other environments, like tabulars and such. It seems like an \end command stops it from bolding more, but if I use it regularly in the document, it just messes it up.

Anyone have any experience with this?

Ludovic C.
  • 8,888
Alec
  • 353
  • 18
    Welcome to TeX.SE! \bfseries is a switching command, i.e., it doesn't take an argument. If you input {\bfseries This is meant to be bolded} you'll get what you want. Incidentally, the command \textbf is not deprecated, though \bf is indeed deprecated. – Mico Sep 02 '13 at 09:24
  • 7
    \textbf is not deprecated, where have you learned that (we would like to know, such that that information can be fixed). \bfseries is a switch. It is in affect until the current group ends. In your case use \textbf instead – daleif Sep 02 '13 at 09:25
  • 1
    See now also David Carlisle’s great answer: Formatting text inside minipage (the title is misleading). – Speravir Feb 15 '14 at 17:50

1 Answers1

26

Here are some ways to bold a text (and only this text, not the following part of the document):

\textbf{Text to bold}
{\bfseries Text to bold}
\bfseries Text to bold \mdseries

One can also mention this one but it is not recommended since bfseries is not an environment. However it works...

\begin{bfseries} Text to bold \end{bfseries}

In math-mode, use the bm package:

\usepackage{bm}
\begin{document}
$\bm{f(x)=0}$
\end{document}
Ludovic C.
  • 8,888
  • @Aleksander Here you have all the types (in german...): http://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_Schriften Left column: switching command; middle column: local command; right column: deprecated command – LaRiFaRi Sep 02 '13 at 09:33
  • 1
    I may be wrong, but I think the last one only works by accident, there is no bfseries environment. – Torbjørn T. Sep 02 '13 at 09:38
  • @TorbjørnT. I think so too, but the fact is that it works... – Ludovic C. Sep 02 '13 at 09:39
  • Yeah, but if it isn't intended, I would perhaps not recommend using it. Edit: but then, I may be exaggerating, someone else would have say. – Torbjørn T. Sep 02 '13 at 09:41
  • @TorbjørnT. See my edit (and I agree with you concerning the "use" of this method) – Ludovic C. Sep 02 '13 at 09:46
  • 3
    @TorbjørnT. actually it is by design rather than by accident that commands may be used as environments. – David Carlisle Sep 02 '13 at 10:08
  • @DavidCarlisle You would know, bad choice of words on my part. Is there anything 'wrong' with using \bfseries and similar as environments though? – Torbjørn T. Sep 02 '13 at 10:28
  • 3
    @TorbjørnT. It's not really the best design in latex so your advice not to do it isn't bad, it was just an observation that it was definitely part of the original latex design.bfseries is safe enough actually but you have to be careful with say \begin{small} to include a \par at the end (same is true of {\small but somehow it is easier to forget in the environment form), which is why latex offers separate environments like sloppypar and flushleft instead of using the commands as environments \begin{sloppy} \begin{raggedright} even though they do work if used with care. – David Carlisle Sep 02 '13 at 11:44