You want to underline a phrase, or strike it through to mark it as deleted — this page sorts out the tools for that. LaTeX’s built-in \underline{...} works in any document, but it is really a math command: it cannot break across lines and looks crude. For long running text use the line-breaking underlines and strike-outs of the ulem package; for letterspacing and a marker-pen highlight use the soul package. Note that underlining is generally avoided as a means of emphasis in Western typesetting — for emphasis, reach for \emph (see the separate page).
The built-in `\underline` and its limits
Write \underline{the phrase to underline} and a rule is drawn under the argument. It needs no package and works in both text and math. In fact this command’s native home is math mode — it is the tool that draws a line under a variable, as in $\underline{x}$. When you use it in text, it helps to picture LaTeX underlining a box whose contents it has treated as math; that explains how it behaves.
This word is \underline{underlined} in running text.Two weaknesses follow from this. First, \underline produces a single unbreakable box, so it cannot break at the end of a line: if the underlined phrase does not fit the line width, it overflows into the right margin instead of wrapping. A single short word is fine, but underline a long phrase or a whole sentence and it falls apart. Second, it does not adjust the rule’s thickness or position to the glyphs (especially descenders like g and p), so the line can appear to cut into the letters, looking coarse.
In short, \underline is enough for “draw a line under a symbol in math” and “quickly underline a very short word,” but it is not suited to underlining running text. For underlines and strike-outs in body text that must break across lines, or that you want to look tidy, turn to ulem or soul below.
`ulem` — line-breaking underlines and strike-outs
Donald Arseneau’s **ulem package provides underlines that break properly at line ends**. It also offers double and wavy underlines, a strike-out (horizontal line), a cross-out (diagonal hatching), dashed and dotted underlines — the full set of lines used for deletions and proofreading. Load it with \usepackage{ulem} and use each as a command taking one argument.
| Command | Effect |
|---|---|
\uline | Underline (breaks across lines) |
\uuline | Double underline |
\uwave | Wavy underline |
\sout | Strike-out (line through the word) |
\xout | Cross-out (diagonal hatching over the text) |
\dashuline | Dashed underline |
\dotuline | Dotted underline |
\uline{important} \uuline{urgent} \uwave{boat}
\sout{wrong} \xout{removed}
\dashuline{dashing} \dotuline{dotty}You can tune the line with two parameters. The depth (the distance from the text baseline down to the rule) is the length \ULdepth, and the thickness is \ULthickness. Note that \ULthickness is a macro, not a length, so you set it with \renewcommand, not \setlength (\renewcommand{\ULthickness}{1pt}). \ULdepth is an ordinary length, set with \setlength; by default it adjusts itself to the current font.
The package is also extensible. With \markoverwith you can define new kinds of lines by repeatedly overstriking with any shape, and a \useunder{underline-command}{font-declaration}{font-command} declaration substitutes underlining for a given font-selection command.
The crucial gotcha — `ulem` makes `\emph` underline
This one trips up everyone who does not know it. When you load ulem, **\emph (and, to some extent, \em) underlines by default instead of italicizing**. In the package’s own words, “ulem normally replaces italics with underlining in text emphasized by \emph.” Every time you mark emphasis, a rule is drawn under your text, and you are startled to find the manuscript full of underlines. Worse, nesting \emph no longer gives \emph’s usual alternation between italic and upright — it just stacks up more underlines.
The remedy is standard: **load it with the [normalem] option.** Then \emph keeps its proper italic behavior, and underlining happens only where you explicitly write \uline and friends. To switch mid-document you can also use the declaration \normalem (and \ULforem to restore the default). Unless you have a specific reason otherwise, it is safest to load ulem with [normalem] every time.
\usepackage[normalem]{ulem}
% \emph stays italic; underline only where you ask:
This is \emph{emphasis}, and this is \uline{underlined}.`soul` — letterspacing and a highlighter
Melchior Franz’s **soul package is a different family of tools. Using TeX’s hyphenation machinery, it picks the text apart character by character and acts between them, so it can do letterspacing (spacing out), underlining, striking out, and a marker-pen highlight** — all breaking across line ends. Its very name is a blend of its two central commands, \so (space out) and \ul (underline). It offers five commands, by purpose:
| Command | Effect |
|---|---|
\so | Letterspacing (space out the letters) |
\caps | Spacing for caps and small-caps runs |
\ul | Underline |
\st | Strike-out (overstrike) |
\hl | Highlight (marker pen) |
For color, set the underline with \setulcolor, the strike-out with \setstcolor, and the highlight with \sethlcolor. By default the highlight is yellow and the underline and strike-out are black. The important point: **\hl only colors if the color (or xcolor) package is loaded** — without it, \hl falls back to underlining instead of filling. You can build your own color with \definecolor and pass it in.
\usepackage{color,soul}
\definecolor{lightblue}{rgb}{.90,.95,1}
\sethlcolor{lightblue}
% ...
\so{letterspacing} \ul{underlining} \st{overstriking}
\hl{this is highlighted in light blue color}To handle non-Latin scripts such as Japanese, or accented characters, you need UTF-8 support. This used to live in a separate package, soulutf8, but **the current soul (v3 and later) merges soulutf8 in and supports UTF-8 input** (the old core was renamed soul-ori and is loaded internally). So on a recent TeX Live or MiKTeX, just loading soul lets it cope with UTF-8 characters.
Because its commands analyze the argument one character at a time, however, there are limits on what may go inside them. The main rules are:
- Math works if wrapped in
$...$, but the LaTeX form\(...\)does not work. - No nesting. Do not nest one
soulcommand inside another. If you truly need it, put the inner material in a box (e.g.\mbox) first and pass that. - To treat text as one unit, wrap it in
{...}— but it must not contain a hyphenation point. To group a word that does contain hyphenation, use\mbox{...}, which letssoulsee it as a single item even with hyphenation inside. - To break up a ligature inside
\ul,\st, or\hl, insert{}or\null(e.g.\ul{Auf{}lage}). \verb, LaTeX environments, and command definitions** and other “fancy stuff” may not appear in the argument. Stay with plain horizontal text to be safe.
Which to choose — and a word on underlining itself
A rough guide: for a line under a symbol in math, the built-in \underline. For line-breaking underlines, strike-outs, and proofreading marks in body text, ulem (always with [normalem]). For a marker-pen highlight or letterspacing, soul. The \uline of ulem and the \ul of soul are both breakable underlines and look similar, but soul — sitting on top of its letterspacing engine — restricts its argument more, while in return it also handles highlighting and letterspacing in one place.
Underlining Japanese body text comes with an extra caveat. ulem and soul were designed for Western text, and in paragraphs with much Japanese the underline is known not to break cleanly at line ends (a recurring topic on Haruhiko Okumura’s forum). For underlines that span multiple lines of Japanese, dedicated packages such as jumoline and udline exist (they may not ship by default and can require separate installation).
One last typographic note. Underlining is a holdover from the typewriter and from handwriting, and in Western body text it is generally not favored as a means of emphasis. The typesetting tradition shows emphasis with italics, (restrained) letterspacing, or a bold face. If you only want to stress something, use \emph rather than an underline, and keep underlines and strike-outs for cases where the line itself carries meaning — marking a deletion in proofs, or showing a link or a fill-in blank.