Welcome to the UK List of
TeX Frequently Asked Questions
on the Web

Searching

The index of Frequently Asked Questions about TeX is searchable.

Please enter your keyword here:   then press here: ,    or:
Google

Underlined text won’t break

Knuth made no provision for underlining text: he took the view that underlining is not a typesetting operation, but rather one that provides emphasis on typewriters, which typically offer but one typeface. The corresponding technique in typeset text is to switch from upright to italic text (or vice-versa): the LaTeX command \emph does just that to its argument.

Nevertheless, typographically illiterate people (such as those that specify double-spaced thesis styles) continue to require underlining of us, so LaTeX as distributed defines an \underline command that applies the mathematical ‘underbar’ operation to text. This technique is not entirely satisfactory, however: the text gets stuck into a box, and won’t break at line end.

Two packages are available that solve this problem. The ulem package redefines the \emph command to underline its argument; the underlined text thus produced behaves as ordinary emphasised text, and will break over the end of a line. (The package is capable of other peculiar effects, too: read its documentation.) The soul package defines an \ul command (after which the package is, in part, named) that underlines running text.

Beware of ulem’s default behaviour, which is to convert the \emph command into an underlining command; this can be avoided by loading the package with:

\usepackage[normalem]{ulem}

ulem.sty
macros/latex/contrib/ulem (or browse the directory); catalogue entry
soul.sty
macros/latex/contrib/soul (or browse the directory); catalogue entry


Go to previous question, or next question

Go to FAQ home.

URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline

Comments, suggestions, or error reports? - see “how to improve the FAQ”.

This is FAQ version 3.28, released on 2014-06-10.