Text formatting is essential for emphasizing important information and improving readability. LaTeX provides several commands for making text bold, italic, underlined, and more.
Quick reference: \textbf{bold}
, \textit{italic}
, \underline{underline}
Basic Text Formatting
Bold Text
Use \textbf{}
to make text bold:
\documentclass{article}
\begin{document}
This is \textbf{bold text} in a sentence.
\textbf{This entire sentence is bold.}
You can \textbf{nest other commands like \textit{italic} inside bold}.
\end{document}
Italic Text
Use \textit{}
for italics:
\documentclass{article}
\begin{document}
This is \textit{italic text} in a sentence.
\textit{This entire sentence is italicized.}
LaTeX uses \textit{emphasis} for semantic meaning.
\end{document}
Underlined Text
Use \underline{}
for underlining:
\documentclass{article}
\begin{document}
This is \underline{underlined text} in a sentence.
\underline{This entire sentence is underlined.}
% Note: Underlining can look messy with descenders
The letters \underline{g, j, p, q, y} have descenders.
\end{document}
Avoid overusing underline: In professional typography, underlining is rarely used. Consider bold or italic for emphasis instead.
You can combine multiple formatting commands:
\documentclass{article}
\begin{document}
% Bold and italic
\textbf{\textit{Bold and italic text}}
% Italic and underlined
\textit{\underline{Italic and underlined}}
% All three
\textbf{\textit{\underline{Bold, italic, and underlined}}}
% Alternative nesting order (same result)
\underline{\textbf{\textit{Also all three formats}}}
\end{document}
Emphasis Command
The \emph{}
command provides semantic emphasis:
\documentclass{article}
\begin{document}
% Normal emphasis (produces italic)
This is \emph{emphasized text}.
% Nested emphasis (toggles back to normal)
\emph{This is italic with \emph{nested} emphasis.}
% Emphasis is semantic - it adapts to context
\textit{In italic text, \emph{emphasis} becomes upright.}
\end{document}
Use \emph{}
when you want to emphasize meaning. Use \textit{}
when you specifically want italic style.
Additional Text Styles
Small Caps
\documentclass{article}
\begin{document}
% Small capitals
\textsc{Small Capitals Look Like This}
% Useful for names and acronyms
\textsc{nasa} announced the launch.
Written by \textsc{John Smith}, \textsc{phd}.
\end{document}
Typewriter (Monospace)
\documentclass{article}
\begin{document}
% Monospace font for code
Type \texttt{latex document.tex} to compile.
% File paths
Save your file as \texttt{/home/user/document.tex}
% Inline code
The \texttt{\\textbf} command makes text bold.
\end{document}
Sans Serif
\documentclass{article}
\begin{document}
% Sans serif text
\textsf{This is sans serif text.}
% Useful for modern look
\textsf{\textbf{Bold Sans Serif Heading}}
\end{document}
Slanted Text
\documentclass{article}
\begin{document}
% Slanted is different from italic
\textsl{This is slanted text.}
Compare: \textit{italic} vs \textsl{slanted}
\end{document}
Font Size Commands
Combine with text formatting:
\documentclass{article}
\begin{document}
{\large \textbf{Large Bold Text}}
{\Large \textit{Even Larger Italic}}
{\small \texttt{Small monospace text}}
% Size commands from smallest to largest:
{\tiny tiny}
{\scriptsize scriptsize}
{\footnotesize footnotesize}
{\small small}
{\normalsize normalsize}
{\large large}
{\Large Large}
{\LARGE LARGE}
{\huge huge}
{\Huge Huge}
\end{document}
Color Text (Optional Package)
Add color to your formatting:
\documentclass{article}
\usepackage{xcolor}
\begin{document}
% Basic colors
\textcolor{red}{Red text}
\textcolor{blue}{\textbf{Bold blue text}}
\textcolor{green}{\textit{Italic green text}}
% Custom colors
\definecolor{myorange}{RGB}{255, 96, 55}
\textcolor{myorange}{Custom orange color}
% Highlighting
\colorbox{yellow}{Highlighted text}
\end{document}
Strikethrough
\documentclass{article}
\usepackage{soul}
\begin{document}
% Strikethrough
\st{This text is struck through}
% Highlighting with soul package
\hl{This text is highlighted}
% Letter spacing
\so{SPACED OUT TEXT}
\end{document}
Better Underlines
\documentclass{article}
\usepackage{ulem}
\begin{document}
% Normal underline
\uline{Better underline with ulem}
% Double underline
\uuline{Double underlined text}
% Wavy underline
\uwave{Wavy underline for errors}
% Strike out
\sout{Struck out text}
\end{document}
For longer passages:
\documentclass{article}
\begin{document}
% Bold environment
\begin{bfseries}
This entire paragraph is bold. You can write multiple sentences
and they will all be bold. This is useful for longer passages.
\end{bfseries}
% Italic environment
\begin{itshape}
This entire paragraph is in italics. Every sentence here
will be italicized until we close the environment.
\end{itshape}
% Typewriter environment
\begin{ttfamily}
This looks like computer code.
All text here is monospaced.
\end{ttfamily}
\end{document}
Declaration Commands
Alternative syntax using declarations:
\documentclass{article}
\begin{document}
% Declarations affect all following text
{\bfseries Bold text using declaration}
{\itshape Italic text using declaration}
{\bfseries\itshape Bold and italic together}
% Limiting scope with braces
Normal text {\sffamily sans serif text} normal again
\end{document}
Common Use Cases
Document Structure
\documentclass{article}
\begin{document}
\textbf{\large 1. Introduction}
This section introduces the topic with \emph{emphasis} on key concepts.
\textbf{Key Terms:}
\begin{itemize}
\item \textbf{LaTeX:} A typesetting system
\item \textbf{Markup:} Text with formatting codes
\item \textbf{Compiler:} Processes \texttt{.tex} files
\end{itemize}
\end{document}
Academic Writing
\documentclass{article}
\begin{document}
According to \textit{Smith et al.} (2023), the results were
\textbf{statistically significant} (p < 0.05).
\emph{Note:} These findings contradict earlier work by
\textsc{Johnson} (2020).
\end{document}
Best Practices
Formatting guidelines:
- Use sparingly - Too much formatting reduces impact
- Be consistent - Use the same style for similar elements
- Semantic meaning - Use
\emph
for emphasis, not just italics
- Avoid underlines - Use bold or italic instead
- Consider readers - Some formats don’t work well in all media
Common Mistakes
Avoid these errors:
- Over-formatting - Don’t combine too many styles
- Underline with descenders - Looks messy with g, j, p, q, y
- All caps - Use
\textsc{}
for small caps instead
- Forgetting braces -
\textbf{text}
not \textbf text
- Wrong nesting - Close commands in reverse order
Quick Reference Table
Command | Output | Usage |
---|
\textbf{text} | text | Bold |
\textit{text} | text | Italic |
\underline{text} | text | Underline |
\emph{text} | text | Emphasis |
\textsc{text} | TEXT | Small caps |
\texttt{text} | text | Monospace |
\textsf{text} | text | Sans serif |
\textsl{text} | text | Slanted |
Troubleshooting
Text Not Formatting
Check for:
- Missing braces:
\textbf{text}
not \textbf text
- Typos in commands
- Missing packages for special formatting
Nested Commands Not Working
Ensure proper nesting:
% Correct
\textbf{\textit{text}}
% Incorrect
\textbf{\textit{text}}
Next: Learn how to create Lists for organizing information effectively, or explore Advanced text formatting for more sophisticated typography options.