Bold, Italics and Underline in LaTeX
Three commands cover almost everything: \textbf for bold, \emph for emphasis and \textit for italics. This guide shows them, their math equivalents, and the packages to use when you need underlining that breaks across lines.
Bold
\textbf{...} sets its argument in bold. For a longer passage, the declaration \bfseries switches to bold until the end of the current group (a pair of braces or an environment).
This word is \textbf{bold}.
{\bfseries This whole sentence is bold.}
\begin{center}
\bfseries
Everything in this centred block is bold.
\end{center}Italics and emphasis
\textit{...} always gives italics. \emph{...} means "stress this": it gives italics in normal text, and switches back to upright inside text that is already italic, so the stressed word still stands out.
This is \emph{important}.
\textit{In an italic passage, \emph{this word} comes out upright.}
The term \textit{in situ} is Latin.
{\itshape A whole italic sentence, using the declaration form.}Use \emph when you mean emphasis and \textit for things that are italic by convention: foreign words, book and journal titles, species names. A class or template can then restyle emphasis in one place without touching the rest.
Bold and italic together
\textbf{\textit{Bold italic}}
{\bfseries\itshape Also bold italic.}Nesting \emph inside \emph does not add more emphasis: the inner one switches back to upright. Combine \textbf and \textit when you want both.
Underline
Typeset documents rarely underline: emphasis is usually italic. When you do need it, the built-in \underline{...} works for a word or two, but it never breaks across lines, so a long phrase runs into the margin.
\underline{Short phrase} % fine
% For anything that may wrap, use soul or ulem:
\usepackage{soul} % in the preamble
\ul{This underline can wrap onto the next line without overflowing.}The soul package
\usepackage{xcolor} % needed for \hl
\usepackage{soul}
\ul{Underlined}
\st{Struck through}
\hl{Highlighted}
\so{Letterspaced}\so adds the spacing between letters itself, so write the word normally. soul can stumble on arguments that contain other commands; wrap those in braces, for example \ul{{\textbf{bold}} text}.
The ulem package
\usepackage[normalem]{ulem}
\uline{Single underline}
\uuline{Double underline}
\uwave{Wavy underline}
\dashuline{Dashed underline}
\dotuline{Dotted underline}
\sout{Struck through}
\xout{Crossed out}Always load ulem with [normalem]. Without it, ulem turns every \emph in your document into an underline.
In math
Math has its own font commands. \textbf does work in math, but it sets its argument as ordinary text, which is wrong for symbols. Use these instead:
| Command | Gives | Typical use |
|---|---|---|
\mathbf{x} | Bold upright | Vectors and matrices |
\boldsymbol{\alpha} | Bold, keeps the italic shape | Bold Greek letters and symbols (amsmath) |
\bm{\alpha} | Same as boldsymbol | From the bm package, usually more robust |
\mathrm{d} | Upright | Units, the d in dx, chemical symbols |
\mathit{rate} | Italic, as a word | Multi-letter variable names |
\mathcal{L} | Calligraphic | Lagrangians, families of sets |
\mathbb{R} | Blackboard bold | Number sets (amssymb) |
$\mathbf{F} = m\mathbf{a}$
$\boldsymbol{\sigma} = \mathbf{C} : \boldsymbol{\varepsilon}$
$x \in \mathbb{R}$, \quad $\mathrm{pH} = -\log[\mathrm{H}^+]$\mathbf has no effect on lowercase Greek letters: \mathbf{\alpha} prints a normal alpha. Use \boldsymbol or \bm for those.
Quick reference
| You want | In text | In math |
|---|---|---|
| Bold | \textbf{...} | \mathbf, \bm |
| Emphasis | \emph{...} | n/a |
| Italic | \textit{...} | default for letters; \mathit for words |
| Upright | \textup{...} | \mathrm{...} |
| Underline that wraps | \ul (soul), \uline (ulem) | \underline{...} |
| Strike through | \st (soul), \sout (ulem) | \cancel (cancel package) |
Where to go next
- Colours for coloured text and highlighting
- Writing math for the rest of math typesetting
- Common LaTeX mistakes in PFE reports