How to Underline in LaTeX?

Adding underlines to text in LaTeX is a common formatting requirement in many documents, such as reports, academic papers, and presentations. It is used to emphasize and highlight content within your documents effectively. In this guide, we’ll walk you through the steps to underline text effectively, exploring not only the basic \underline{} command but also delving into the enhanced features offered by the ulem package.

Method 1: Use ‘\underline{}’ command

In LaTeX, you can underline text using the \underline{} command. Here’s a simple example of how to use it.

\documentclass{article}

\begin{document}

The \underline{curious cat} stealthily explored the sunlit garden, uncovering hidden treasures beneath the \underline{emerald leaves}.

\end{document}

Output

“curious cat” and “emerald leaves” are underlined in this example.

Method 2: Using “ulem” package

The first step is to include the ulem package in your LaTeX document. This package not only enhances the underlining capabilities but also introduces a variety of styles, allowing you to go beyond the basics. Add the following line to the preamble of your LaTeX document to load the ulem package.

\usepackage{ulem}

The ulem package provides additional commands to customize the style of underlining. For example:

  • \uline{}: This produces a simple underline (default).
  • \uuline{}: This creates a double underline.
  • \uwave{}: This creates a wavy underline.

Here’s an example using various styles

\documentclass{article}
\usepackage{ulem}

\begin{document}

For example:\\
This is an example of \uline{Simple underline}.\\
This is an example of \uuline{Double underline}.\\
This is an example of \uwave{Wavy underline}.

\end{document}

Output