Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is either of these considered better/more readable/more "proper"/more conventional than the other for making text bold? If so, what is the reason?

I like my text \textbf{bold}

versus:

I like my text {\bf bold}
share|improve this question
27  
It is very simple: DO NOT USE \bf IN MODERN LaTeX DOCUMENTS! It is deprecated. Use \bfseries instead, which will work properly under the New Font Selection Scheme (NFSS) of LaTeX2e. About \textbf vs. \bfseries: There is no real difference, except that the latter will not read the text as argument and therefore work with verbatim content, but there you hardly use bold font anyway. See Does it matter if I use \textit or \it and Will two-letter font style commands (\bf , \it , …) ever be resurrected in LaTeX?. –  Martin Scharrer Jan 20 '12 at 11:36

3 Answers 3

up vote 140 down vote accepted

Marc van Dongen gave a great answer. I'll throw in another reason:

\it and \bf do not play well together. That is, they do not nest as one would intuitively expect:

Whereas \textit and \textbf do play well together:

This is nice. However, you may notice that it still fails to handle nested style adjustments to small caps, since the Computer Modern fonts do not contain slanted or bold small caps:

If this is a problem for you, then what I recommend—and I just happened to learn about this yesterday—is the wonderful slantsc package in combination with the lmodern package. slantsc provides, among other things, \rmfamily (roman), \ttfamily (typewriter/​teletype), \sffamily (sans-serif), \bfseries (boldface), \itshape (italics), \slshape (slant/​oblique), and \scshape (small caps). With these, small caps can obtained in slanted form:

As a bonus, slantsc fixes \textsl to behave properly with \textsc, so you can continue using those if you like.

Alas, I haven't yet found a package which fixes the behavior of nested instances of \textit. In typesetting, when you nest italics, you're supposed to come back out of italics to roman. For example, the word "Titanic" below is in nested italics (which should ideally render as roman, not italics):

Tanaka, Shelly. On Board the Titanic: What It Was Like When the Great Liner Sank. New York, NY: Hyperion/​Madison Press, 1998.

As a workaround, one can usually write \textrm to temporarily return to non-italics in those cases, but of course this is only valid if you know the exact number of nested italic levels, which may not always be the case, especially inside a macro.

Update:

As others have pointed out, \textit and \textsl do automatic italic correction, whereas \it, \itshape, \sl, and \slshape do not. Thus, you can write \textit{stuff}, but you must write {\it stuff\/} or {\itshape stuff\/} to get the same effect.

share|improve this answer
6  
See above: Don't use \bf or \it. –  Martin Schröder Jan 20 '12 at 12:57

In general the command (\textbf/\textit) approach is more useful if the text is followed by more text on the same line and isn't followed by a small punctuation symbol. If the text is in a paragraph on its own or is followed by a small punctuation symbol, it doesn't matter really. In that case the declarations (\bf/\bfseries and \it/\itshape) are equivalent to the commands. As pointed out be others, the declarations \bf and \it are deprecated and should be avoided.

To see why the commands should be preferred, notice that \textit inserts an italic correction at the end, which adds a small horizontal compensation if the text ends in letters with long ascenders that would otherwise run into the next character. The declarations (\it and \itshape) don't insert an italic correction.

The fourth, fifth, and sixth row in the following shows why the commands may differ from the declarations. In the fourth row you get a proper italic correction, in the fifth and the sixth you don't and this results in the ff ligature running in to the h.

\documentclass{article}

\usepackage{booktabs}

\begin{document}
  \Huge
  \begin{tabular}{lll}
    \toprule
    \verb|\textbf{fluff} hair|    & \textbf{fluff} hair
  \\\verb|{\bf fluff} hair|       & {\bf fluff} hair
  \\\verb|{\bfseries fluff} hair| & {\bfseries fluff} hair
  \\\midrule
    \verb|\textit{fluff} hair|    & \textit{fluff} hair
  \\\verb|{\itshape fluff} hair|  & {\itshape fluff} hair
  \\\verb|{\it fluff} hair|       & {\it fluff} hair
  \\\bottomrule
  \end{tabular}
\end{document}

bold and italic text

EDIT: Undeleted at 2012-12-09.

share|improve this answer
2  
\documentclass{memoir}\begin{document}\bf bold results in an error. Classes are not required to support the two letter commands, so I think it's better to avoid them altogether. –  egreg Jan 20 '12 at 9:57
1  
See above: DONT USE \bf - they come from LaTeX 2.09, which is OBSOLETE. –  Martin Schröder Jan 20 '12 at 12:56

First of all you should not use the obsolete \bf or \it macros from LaTeX2.0. They do not use the new font selection scheme (NFSS) of LaTeX2e. So \bf will do bold and bold only, but will not mix with an italic setting, which makes bold-italic impossible. Use the new \bfseries macro instead.

There is not much practical difference between \textbf{<content>} and {\bfseries <content>}. I would say most people use (for short texts) the first usage because it follows the common \somemacro{<content>} LaTeX style. The latter should be used if you want to make the rest of an environment/group bold, of course.

You should note that \textbf uses \bfseries internal, so the latter is a more fundamental macro. The definition of \textbf is:

\ifmmode
  \nfss@text {\bfseries #1}%
\else
  \hmode@bgroup
  \text@command {#1}%
  \bfseries \check@icl #1\check@icr
  \expandafter
  \egroup
\fi

So \textbf switches to text mode inside math mode, while \bfseries apparently doesn't. It also adds checks for italic correction before and after the content, which is a great feature of LaTeX2e.

One benefit of \bfseries is that it doesn't read the content as an argument, which would interfere with catcode changes required by verbatim content and other special code.

In summary I recommend \textbf for smaller texts, mainly because of the italic correction, and in math mode. \bfseries is IMHO more intended for environments and larger texts. One notable exception is if you have bold and italic (etc.) combinations, then you could write \textit{\bfseries <content>}, to avoid two sets of braces, but this is more a fashion choice. You should not use \bf in modern LaTeX documents.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.