The ulem package
Underlines and strikes out text in several styles that break across lines: \uline, \uuline, \uwave, \sout, \xout, \dashuline and \dotuline.
Loading the package
\usepackage[normalem]{ulem}\underline cannot break across lines and has only one style. The commands of ulem break between words and offer a double, wavy, dashed and dotted line, and two ways of striking text out.
Loaded without options, the package redefines \emph to underline instead of italic. The option normalem keeps \emph as it is, which is what most documents want.
Main commands
\uline{text} | Single underline. |
\uuline{text} | Double underline. |
\uwave{text} | Wavy underline. |
\sout{text} | Strikes the text out with a horizontal line. |
\xout{text} | Crosses the text out with slashes. |
\dashuline{text}, \dotuline{text} | Dashed and dotted underline. |
\normalem, \ULforem | Switch \emph between italic and underlining inside the document. |
Complete example
\documentclass{article}
\usepackage[normalem]{ulem}
\begin{document}
\uline{Single}, \uuline{double} and \uwave{wavy} underline.
\dashuline{Dashed} and \dotuline{dotted} underline.
\sout{Struck out} and \xout{crossed out}.
\emph{Emphasis stays italic because of the option normalem.}
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- Without
normalem, every\emphin the document is underlined, including titles in the bibliography. - Underlined text breaks between words but is not hyphenated automatically. Mark a hyphenation point by hand with
\-, or usesoul, which hyphenates.
Related pages
- How-to Strikethrough text in LaTeX
- How-to Bold, italic and underlined text in LaTeX
- Package
soul