Bold, italic and underlined text in LaTeX (textbf, textit, underline)

\textbf{...} sets text bold, \textit{...} italic and \underline{...} underlined. For emphasis use \emph{...}, which picks italic or upright depending on the surrounding text.

Preamble

The snippets on this page need these lines before \begin{document}:

\usepackage[normalem]{ulem}

Bold, italic, underlined

Each command changes the text in its braces. After the closing brace the normal font is back. All three are part of LaTeX.

This is \textbf{bold}, this is \textit{italic}
and this is \underline{underlined}.
Result
The compiled example

Open in the editor

Emphasis

\emph{...} prints italic text inside upright text and upright text inside italic text. A nested \emph therefore still stands out.

An \emph{emphasised sentence with a \emph{nested} word} in it.
Result
The compiled example

Open in the editor

Combine styles

Nest the commands to combine them. \textsc{...} prints small capitals, \texttt{...} typewriter text and \textsl{...} slanted text.

\textbf{\textit{Bold italic}}, \underline{\textbf{bold underlined}},
\textsc{Small Capitals} and \texttt{typewriter}.
Result
The compiled example

Open in the editor

Switches for longer passages

\bfseries and \itshape have no argument. They change all text up to the end of the current group, here the closing brace. Use them in your own commands and environments.

{\bfseries This sentence is bold up to the closing brace.}
{\itshape This one is italic.} Normal again.
Result
The compiled example

Open in the editor

Underline across a line break

\underline puts its text into a box that cannot be broken at the end of a line. \uline{...} from the ulem package underlines text that wraps; \uuline draws a double line and \uwave a wavy line. Load the package with the option normalem, otherwise it changes \emph to underlining.

\uline{This underlined sentence is long enough to reach the end of the line
and continues on the next one.} \uuline{Double} and \uwave{wavy}.
Result
The compiled example

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages