LaTeX Basics

2. Text Formatting

Learn how to bold, italicize, and underline text in LaTeX.

4 min read Share

LaTeX gives you granular control over how your text looks. Let's start with the essentials.

Level 1: The Basics

Source Code
Example OutputStatic
Sometimes you need to match \textbf{Bold} statements with \textit{Nuance}. \underline{Underlining} is also possible, but used less often. For code or variable names, we often use \texttt{Typewriter font}.

Sometimes you need to match Bold statements with Nuance. Underlining is also possible, but used less often.

For code or variable names, we often use Typewriter font.

Level 2: Font Families & Sizes

You can change the size and shape of text independent of the document defaults.

LaTeX
\tiny This is tiny text
\small This is small text
\normalsize This is normal text
\large This is large text
\Huge This is huge text

\textrm{Roman (Serif) Font}
\textsf{Sans-Serif Font}
\texttt{Monospace Font}

Level 3: Colors

Using the xcolor package allows for vibrant documents.

Source Code
Example OutputStatic
\usepackage{xcolor} \textcolor{red}{Important Error!} \textcolor{blue}{Blue Text} \colorbox{yellow}{Highlighted Text}

Important Error!

Blue Text

Highlighted Text
Emphasis vs Italics
It is best practice to use \emph{text} instead of \textit. Why? Because \emph is smart: if you use it inside an already italicized sentence, it will un-italicize it for contrast.