"Correct" way to bold/italicize text?
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 use the 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.
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}
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.