18

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?

  • 13
    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 2 '13 at 9:24
  • 6
    \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 2 '13 at 9:25
  • See now also David Carlisle’s great answer: Formatting text inside minipage (the title is misleading). – Speravir Feb 15 '14 at 17:50
19

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}
| improve this answer | |
  • @Aleksander Here you have all the types (in german...): de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_Schriften Left column: switching command; middle column: local command; right column: deprecated command – LaRiFaRi Sep 2 '13 at 9: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 2 '13 at 9:38
  • @TorbjørnT. I think so too, but the fact is that it works... – Ludovic C. Sep 2 '13 at 9:39
  • 2
    @TorbjørnT. actually it is by design rather than by accident that commands may be used as environments. – David Carlisle Sep 2 '13 at 10:08
  • 2
    @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 2 '13 at 11:44

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.