Text Emphasis: Bold, Italic, and Underlining
Use \textbf, \textit, and \underline to emphasize text; they can be nested. When expressing “semantic emphasis,” prefer using \emph.
EasyLaTeX compiler setting: pdfLaTeX; no additional packages are required for these examples.
Introduction
The following excerpt simultaneously uses bold, underlining, and italics:
The important \textbf{conclusion} should be supported by \underline{reliable evidence},
not by \textbf{\textit{chance observations}}.
The text within curly braces is the scope of the command. Commands can be nested, so the last word is both bold and italic.
Italic
Use \textit{...} to set a section of text to italic:
The term \textit{ad hoc} often describes a temporary solution.
Most text fonts provide a true italic face. Use italics for terms, titles, or semantic emphasis, and prefer bold or clear headings when stronger visual hierarchy is needed. Check the log for font-substitution warnings if a chosen font lacks italics.
Bold
Use \textbf{...} to bold a segment of text:
Read \textbf{the first compilation error}, before addressing later messages.
Bold is suitable for short, key terms, conclusions, or interface names. Continuously bolding large sections will weaken the hierarchy and make the page difficult to read.
Underline
Use \underline{...} to add an underline to the text:
Before submission, check \underline{the filename and compiler}.
Underlining is not suitable for long passages: it usually cannot wrap automatically at appropriate positions and easily conflicts with letter descenders, link styles, or mathematical symbols. For emphasis in body text, prioritize using \emph or \textbf.
Emphasis Commands
\emph{...} expresses “this should be emphasized here,” rather than specifically requiring it to “be displayed in italics”:
This is an \emph{important} detail.
\textit{Within italic text, \emph{emphasis} switches to upright text.}
In ordinary text, \emph usually appears in italics; in a context that is already italicized, it reverses the style to keep the emphasis visible. Certain document classes or packages can change this appearance, so when the intended meaning is “emphasis,” \emph is safer than \textit.
Composition and Boundaries
Combined Styles
Nesting commands allows you to combine effects:
\textbf{\textit{Bold italic text}}
Braces must be paired. If the compiler reports Runaway argument or File ended while scanning use of ..., first check whether the most recently added command is missing a closing brace }.
Do not use old-style font declarations
Old-style \bf, \it, and other declarations may still take effect in some documents, but they affect subsequent text and are not easy to combine or limit in scope. New documents use \textbf{...}, \textit{...}, and \emph{...}.
Text in Math Mode
The content within $...$ is in math mode, so text formatting commands cannot be used as math font tools. Text in formulas should use commands specifically recommended for math, such as \text{...} (which requires amsmath).
Complete Example
\documentclass[a4paper,12pt]{article}
\begin{document}
\section{Text Emphasis}
The important \textbf{conclusion} should be supported by \underline{reliable evidence},
not by \textbf{\textit{chance observations}}.
This is an \emph{important} detail.
\textit{Within italic text, \emph{emphasis} uses a different style.}
\end{document}