Given a simple paragraph, how do I underline a word in that paragraph?
(Note: I post this here because it wasn't really obvious using google or this site and my TexNicCenter is somehow missing this highlighting option.)
Use \usepackage[normalem]{ulem}
and then \uline{...}
. It allows line breaks in the underlined text. Other forms of underlining (double, waves) or emphasis (crossed out, ...) are also supported. See the image in Url with fragments in bold for examples.
\uline
draws the line at the maximum distance independent of the content while \underline
directly uses the bounding box of the content. Test it again with content which has a depth, like the word gym
. Note that \underline
is AFAIK designed for math and will not break around lines. So it might be fine for single words but not for longer texts.
Commented
May 18, 2015 at 21:04
g
. See Comparsion between both (Image, 10kb). \uline
is always at the same height, whereas \underline
on different heights.
Easy enough: \underline{...}
Note that this is the simplest form. See the answer by Martin Scharrer for some advanced info.
\underline
is that it doesn't supports line breaks i.e. hyphenation in its content, e.g. like \mbox
or better \fbox
. For smaller words this might be ok, but not for longer ones or multiple words.
Commented
Mar 14, 2011 at 14:00
Beside \underline
you can also use the packages soul and ulem.
@
syntax uses the first three characters after it, so@M.Scharrer
doesn't work. Because out both usernames start the same you need to use at least@MartinS
(the space can be dropped).