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}.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.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}.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.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}.Pitfalls
- Not every font has every combination. The default Computer Modern has no bold small capitals:
\textbf{\textsc{...}}prints plain bold text and the log shows the warning Font shape `OT1/cmr/bx/sc' undefined. - The old forms
{\bf text}and{\it text}do not combine:{\bf\it text}is italic only. The KOMA-Script classes reject them with "undefined old font command". - Bold symbols in a formula need
\mathbfor\bm, see Bold math symbols in LaTeX.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
ulem - Package
soul - How-to Change the font size in LaTeX
- How-to Change the font in LaTeX
- How-to Strikethrough text in LaTeX