Octree LogoOctree

Bold, Italics and Underlining in LaTeX

Text formatting is fundamental to creating readable, well-structured documents in LaTeX. Whether you need to emphasise a key term, highlight a definition, or draw attention to important information, LaTeX provides a rich set of commands for bold, italic, and underlined text. This guide covers every method available, from basic commands to advanced packages.

Bold Text in LaTeX

Making text bold in LaTeX is straightforward. The most common command is \textbf{}, which wraps the text you want to appear in bold. LaTeX also provides a declaration form that affects all subsequent text within its scope.

Using \textbf{}

The \textbf{} command is the standard way to make text bold in LaTeX. It takes one argument — the text to be bolded — and can be used anywhere in your document.

\documentclass{article}
\begin{document}

This is \textbf{bold text} in a sentence.

You can also make \textbf{entire phrases bold} easily.

\end{document}

Using \bfseries

The \bfseries declaration switches all following text to bold within the current group or environment. This is useful when you need a longer passage of bold text without wrapping everything in \textbf{}.

% \bfseries as a declaration
{\bfseries This entire sentence is bold.}

% Within an environment
\begin{center}
  \bfseries
  This centred paragraph is entirely bold.
  It continues on the next line, still bold.
\end{center}

Bold in Math Mode

The \textbf{} command does not work inside math mode. Instead, use \mathbf{} for bold math symbols and letters.

% Bold letters in math mode
$ \mathbf{F} = m \mathbf{a} $

% Bold Greek letters require \boldsymbol from amsmath
\usepackage{amsmath}
$ \boldsymbol{\alpha} + \boldsymbol{\beta} = \boldsymbol{\gamma} $

Italic Text in LaTeX

Italic text is commonly used for emphasis, book titles, foreign words, and variable names. LaTeX offers several ways to produce italic text, each with slightly different behaviour.

Using \textit{}

The \textit{} command is the most direct way to set text in italics. It switches the font shape to italic for the enclosed argument.

\documentclass{article}
\begin{document}

This is \textit{italic text} in a sentence.

The word \textit{ad hoc} is a Latin phrase.

\end{document}

Using \emph{}

The \emph{} command provides semantic emphasis rather than just visual formatting. In normal (upright) text, \emph{} produces italics. But inside already-italic text, it switches back to upright — making it context-aware.

% \emph in normal text produces italics
This is \emph{emphasised text}.

% \emph inside italic text reverts to upright
\textit{This is italic and \emph{this is upright} again.}

% Nested emphasis
\emph{This is emphasised and \emph{this is doubly emphasised}.}

Using \itshape

Similar to \bfseries for bold, the \itshape declaration switches all subsequent text within the current scope to italic.

{\itshape This entire sentence is in italics.}

\begin{quote}
  \itshape
  This quoted passage appears entirely in italics,
  spanning multiple lines.
\end{quote}

Italic vs Emphasis

While \textit{} and \emph{} often produce the same visual result, they serve different purposes:

  • \textit{} – Forces italic shape regardless of context. Use for foreign words, titles, and stylistic choices.
  • \emph{} – Applies semantic emphasis that adapts to context. Use when you want to stress the meaning of a word or phrase.

Underlining in LaTeX

Underlining is less common in typeset documents than in handwritten or typewritten text. LaTeX provides a basic underlining command, but it has limitations. For more flexible underlining, specialised packages are recommended.

Using \underline{}

The built-in \underline{} command adds a line beneath the enclosed text. However, it has notable limitations: it does not break across lines, and it does not adjust for descenders (letters like g, p, and y).

\documentclass{article}
\begin{document}

This is \underline{underlined text} in a sentence.

% Problem: \underline does not break across lines
% This will NOT work well for long passages:
\underline{This is a very long underlined text that you might
want to span across multiple lines but it will not break.}

\end{document}

Using the soul Package

The soul package provides the \ul{} command, which supports line breaking and offers better typographic results than \underline{}.

\documentclass{article}
\usepackage{soul}
\begin{document}

This is \ul{underlined text that can break across
multiple lines without any problems}.

% soul also provides other commands:
\st{This text is struck through.}
\hl{This text is highlighted.}   % requires color package
\caps{Small Caps Text}

\end{document}

Using the ulem Package

The ulem package replaces \emph{} with underlining by default. Load it with the [normalem] option to prevent this behaviour. It provides several underlining styles.

\documentclass{article}
\usepackage[normalem]{ulem}
\begin{document}

\uline{Single underline that breaks across lines.}

\uuline{Double underline.}

\uwave{Wavy underline.}

\sout{Strikethrough text.}

\xout{Crossed-out text with slashes.}

\dashuline{Dashed underline.}

\dotuline{Dotted underline.}

\end{document}

Combining Formatting

LaTeX allows you to nest formatting commands to apply multiple styles simultaneously. You can combine bold, italic, and underline in any combination.

% Bold and italic
\textbf{\textit{Bold and italic text}}

% Italic and bold (same result, different nesting)
\textit{\textbf{Also bold and italic text}}

% Bold and underlined
\textbf{\underline{Bold and underlined}}

% Italic and underlined
\textit{\underline{Italic and underlined}}

% All three combined
\textbf{\textit{\underline{Bold, italic, and underlined}}}

% Using soul package with bold and italic
\textbf{\textit{\ul{Bold, italic, and underlined with soul}}}

You can also use declaration forms together inside a group:

% Declaration forms combined
{\bfseries\itshape This text is bold italic.}

% Inside an environment
\begin{center}
  \bfseries\itshape
  This centred text is bold and italic.
\end{center}

Formatting in Math Mode

Math mode uses its own set of font commands. The standard text formatting commands (\textbf, \textit) do not work inside math environments. Instead, use the dedicated math font commands.

\usepackage{amsmath}
\usepackage{amssymb}

% Bold in math
$ \mathbf{A} \mathbf{x} = \mathbf{b} $

% Italic in math (default for variables, but explicit:)
$ \mathit{diff} $

% Bold italic (for vectors, tensors)
$ \boldsymbol{\sigma} = \boldsymbol{C} : \boldsymbol{\varepsilon} $

% Roman (upright) in math — for operators, units
$ \mathrm{pH} = -\log[\mathrm{H}^+] $

% Sans-serif in math
$ \mathsf{T} $

% Calligraphic
$ \mathcal{L} $

% Blackboard bold
$ \mathbb{R}, \mathbb{Z}, \mathbb{N} $

% Bold symbol — works with Greek and symbols
$ \boldsymbol{\nabla} \times \boldsymbol{E} = -\frac{\partial \boldsymbol{B}}{\partial t} $
CommandResultUse Case
\mathbf{x}Bold uprightVectors, matrices
\mathit{x}Italic (math italic)Multi-letter variables
\boldsymbol{x}Bold italicBold Greek letters, symbols
\mathrm{x}Upright (roman)Units, operators, chemical formulae
\mathsf{x}Sans-serifCategories, tensors
\mathcal{L}CalligraphicLagrangians, sets
\mathbb{R}Blackboard boldNumber sets

Using the emph Command

The \emph{} command deserves special attention because it provides semantic emphasis rather than purely visual formatting. This distinction matters for accessibility, maintainability, and correct typographic practice.

Context-Aware Behaviour

Unlike \textit{}, which always produces italic text, \emph{}adapts to its surrounding context:

% In normal (upright) text, \emph produces italics
This is normal text with \emph{emphasis}.

% In italic text, \emph produces upright text
\textit{This is italic with \emph{emphasis} back to upright.}

% In bold text, \emph produces bold italics
\textbf{Bold text with \emph{bold italic emphasis}.}

Why Prefer \emph Over \textit

  • Semantic meaning\emph conveys that the text is being stressed, not just styled.
  • Context adaptation – It automatically toggles between italic and upright depending on surrounding text.
  • Customisability – Packages and class files can redefine what \emph does (e.g., use bold instead of italic).
  • Accessibility – Screen readers and assistive tools can interpret semantic emphasis more meaningfully.

Redefining \emph

You can customise how \emph behaves by redefining it:

% Make \emph produce bold instead of italic
\renewcommand{\emph}[1]{\textbf{#1}}

% Make \emph produce bold italic
\renewcommand{\emph}[1]{\textbf{\textit{#1}}}

% Make \emph underline text
\usepackage{soul}
\renewcommand{\emph}[1]{\ul{#1}}

Common Packages for Advanced Formatting

Beyond the basic commands, several packages extend LaTeX's text formatting capabilities.

PackageCommandsDescription
soul\ul{}, \st{}, \hl{}, \caps{}Underline, strikethrough, highlight, small caps with line-breaking support
ulem\uline{}, \uuline{}, \uwave{}, \sout{}Multiple underline styles, strikethrough, wavy underline
contour\contour{}Outlines text with a coloured contour for visual emphasis
xcolor\textcolor{}{}Coloured text formatting
bm\bm{}Bold math symbols (better than \boldsymbol in some cases)
% soul package examples
\usepackage{soul}
\ul{Underlined text that wraps across lines.}
\st{Strikethrough text.}
\so{L e t t e r s p a c i n g.}

% ulem package examples
\usepackage[normalem]{ulem}
\uline{Underline}
\uuline{Double underline}
\uwave{Wavy underline}
\dashuline{Dashed underline}
\dotuline{Dotted underline}

% xcolor for coloured text
\usepackage{xcolor}
\textcolor{red}{Red text}
\textcolor{blue}{\textbf{Bold blue text}}
\colorbox{yellow}{Highlighted text}

% bm package for bold math
\usepackage{bm}
$ \bm{\alpha} + \bm{\beta} = \bm{\gamma} $

Quick Reference Table

Here is a summary of all the key formatting commands covered in this guide:

CommandResultNotes
\textbf{text}Bold textStandard bold in text mode
\bfseriesBold (declaration)Affects all text in current scope
\textit{text}Italic textStandard italic in text mode
\itshapeItalic (declaration)Affects all text in current scope
\emph{text}Emphasised textContext-aware; toggles italic/upright
\underline{text}Underlined textBuilt-in; does not break across lines
\ul{text}Underlined textFrom soul package; supports line breaks
\uline{text}Underlined textFrom ulem package; supports line breaks
\uuline{text}Double underlineFrom ulem package
\uwave{text}Wavy underlineFrom ulem package
\sout{text}StrikethroughFrom ulem package
\mathbf{x}Bold (math mode)Bold upright letters in math
\boldsymbol{x}Bold (math mode)Bold italic, works with Greek letters
\mathrm{x}Upright (math mode)Roman text in math for operators/units

Common Mistakes

Here are frequent errors that LaTeX beginners make with text formatting, along with their fixes:

Using \textbf in Math Mode

The \textbf{} command is designed for text mode. Using it in math mode will either produce an error or incorrect output. Use \mathbf{} instead.

% Wrong — \textbf in math mode
$ \textbf{F} = m \textbf{a} $     % May cause errors

% Correct — \mathbf in math mode
$ \mathbf{F} = m \mathbf{a} $     % Produces bold upright

Double Emphasis

Nesting \emph inside \emph does not produce "more emphasis." Instead, it toggles back to upright text due to the context-aware behaviour of \emph.

% This does NOT produce bold or extra emphasis
\emph{This is emphasised \emph{and this is NOT doubly emphasised}.}

% The inner \emph reverts to upright text.
% If you want bold italic, combine commands explicitly:
\textbf{\textit{Truly bold and italic text}}

Forgetting [normalem] with ulem

Loading the ulem package without the [normalem] option replaces\emph{} with underlining throughout your entire document. This is almost never what you want.

% Wrong — \emph now underlines instead of italicising
\usepackage{ulem}

% Correct — preserves normal \emph behaviour
\usepackage[normalem]{ulem}

Underline Not Breaking Across Lines

The built-in \underline{} command does not support line breaking. If your underlined text is long, it will overflow into the margin.

% Problem — overflows the margin
\underline{This is a very long piece of underlined text that will
not break across lines and will overflow.}

% Solution — use soul or ulem
\usepackage{soul}
\ul{This is a very long piece of underlined text that will
break across lines correctly.}

Bold Greek Letters in Math

The \mathbf{} command does not work with Greek letters. Use \boldsymbol{} from amsmath or \bm{} from the bm package instead.

% Wrong — \mathbf does not affect Greek letters
$ \mathbf{\alpha} $    % Produces normal (non-bold) alpha

% Correct — use \boldsymbol or \bm
\usepackage{amsmath}
$ \boldsymbol{\alpha} $  % Produces bold alpha

\usepackage{bm}
$ \bm{\alpha} $          % Also produces bold alpha

Next Steps

Now that you know how to format text in LaTeX, explore more topics:

  • Learn LaTeX – Complete beginner tutorial covering all the basics
  • Learn TikZ – Create diagrams and graphics programmatically
  • Learn PGFPlots – Generate publication-quality plots and charts

Free LaTeX Tools

Ready to start writing?

Try Octree – the AI-powered LaTeX editor that makes writing faster and easier.

Try Octree Free →