Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a document I was writing, I had some really long captions and I wanted to emphasize the important parts in them. I tried to use \underline{} but no hyphenation was used at both the caption and at the list of figures. So I switched to \textbf{}.

So, as the title states, is it possible to have hyphenations in underlined text? If not, why is that so?

share|improve this question
2  
Usually text is emphasized with italics. Underlining is not a recommended practice in good typography. –  egreg Oct 14 '11 at 12:33
    
@egreg: I know, it was not my choice though. At the end I used boldface. But I found it peculiar. So I asked :) –  pmav99 Oct 14 '11 at 12:54
add comment

2 Answers 2

up vote 13 down vote accepted

As Herbert was implying, it's not possible with \underline{}, use either the package soul and its \ul{foo} command, or the package ulem, which changes \emph{foo} to use underlining. There's more information on hyphenating underlined text on the TeX FAQ:

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, contained within the file itself.) 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}

Documentation of ulem is in the package itself.

(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=underline)

I can only second that: If you know why you want to use underlining, go ahead; but if not, consider another way of emphasizing your text.

share|improve this answer
    
documentation of ulem has been separated out, and is available in pdf form, like that of most other packages. (it's probably still in the package, that being the no-effort alternative...) –  wasteofspace Oct 14 '11 at 18:26
    
@anon: Thanks for pointing out! You can notify the maintainers of the TeX FAQ at faq-devel@tex.ac.uk (tex.ac.uk/cgi-bin/texfaq2html?label=noans+newans). –  doncherry Oct 14 '11 at 18:32
add comment
\documentclass{article}
\usepackage{soul}
\begin{document}

\hspace*{0.8\textwidth} foo \ul{hyphenation} bar

\end{document}

enter image description here

share|improve this answer
    
thank you very much! –  pmav99 Oct 14 '11 at 12:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.