1

The question arose eversince I learnt about \textbf{} and I couldn't quite spot any differences against \bf.

5
  • 1
    Actually \bf is more akin to \bfseries than \textbf. But there are good reasons to stick with the latter constructs, as many will point out. Oct 2, 2021 at 13:44
  • @StevenB.Segletes Rookie question, How do you highlight (if that's the right word in this case) like you did the aforementioned commands?
    – Lambert
    Oct 2, 2021 at 13:46
  • 1
    \bf is not defined by default in latex and has not been since 1993, so unless you are using a very old format it is best to stick to the standard commands. Oct 2, 2021 at 13:51
  • @Lambert Use backticks `` to format code. By placing "\bf" between single backticks you will get \bf. Oct 2, 2021 at 13:51
  • 1
    The answer to "Correct" way to bold/italicize text? may also be worth having a look at.
    – leandriis
    Oct 2, 2021 at 13:52

1 Answer 1

5

\bf has not been defined by default since LaTeX2e was introduced in 1993. Some classes may define it for compatibility with old documents but that can not be assumed.

enter image description here

\documentclass{minimal}

\begin{document}

this \textbf{that}

\end{document}

But

\documentclass{minimal}

\begin{document}

this {\bf that}

\end{document}

produces the error

! Undefined control sequence.
l.5 this {\bf
              that}
? 

Even when it is defined, the behaviour is not the same as \textbf as it ignores the current font settings:

Note that that is not italic here, but \textbf gives bold italic in an italic context.

enter image description here

\documentclass{article}

\begin{document}

\itshape


this {\bf that} \textbf{the other}

\end{document}

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.