StartLaTeX faqLaTeX for Beginners F.A.Q.LaTeX topicsLaTeX courseSearch

The ulem package significantly improves the capabilities of underlining in LaTeX. If you've ever tried to underline an entire paragraph using the normal underline command, you may have noticed that it's not as straightforward. When using the standard underline command, the text within the braces is written on a single line. If the text exceeds one line, it extends beyond the page margin. Not only does this result in an undesired outcome, but it also doesn't generate an error message; instead, it issues a warning.

The example demonstrates what happens when you attempt to underline a whole paragraph in LaTeX using the underline command. However, with the uline command from the ulem package, it works flawlessly.

1. Including the Package

The ulem package does not require additional packages to be included. It can be included in the document as follows:

\usepackage{ulem}

2. Options

The package theoretically offers four options: normalem, ULforem, normalbf, and UWforbf.

3. Commands

The package provides seven commands, which work in both text and math environments. However, it's important to note that the \sout command, which strikes through text in the text environment, underlines text in the math environment.

CommandOutput
\uline{simple underline}Simple underline
\uuline{double underline}Double underline
\uwave{wave underline}Wave underline
\sout{strike through}Strike through
$\sout{strike through?}$Strike through?
\xout{cross out}Cross out
\dashuline{dashed underline}Dashed underline
\dotuline{dotted underline}Dotted underline

3.1 Creating Custom Commands

The package also provides instructions on how users can create custom commands. Depending on the symbol, it may be necessary to adjust the height using a Raisebox. Note: The \textbrokenbar command requires the textcomp package to be included (\usepackage{textcomp}).

\newcommand\cmd{\bgroup \markoverwith{}\ULon}
\newcommand\sterne{\bgroup \markoverwith{\raisebox{-2mm}{\textasteriskcentered}}\ULon}
\newcommand\broken{\bgroup \markoverwith{\textbrokenbar}\ULon}
\newcommand\zensur{\bgroup \markoverwith{\textasteriskcentered}\ULon}
\sterne{Underline with stars}
\broken{Vertical strike through}
\zensur{Cover with stars}

4. Other Packages

Another package that deals with underlining and striking through text is the Soul package. In addition to underlining and striking through, it also offers simple color usage.

Contact   Privacy Policy   disclosures

accept decline

This website uses cookies and pixel tags to ensure you get the best experience on our website. By using this website, you consent to the use of cookies.learn more about cookies see also our privacy policy