67

I am currently using \underline{...} to underline text.

However, I want the underline to be closer to the letters (as of now, there's too much whitespace between the letters and the line). Is there a simple way to do this?

2
  • I try to use \ul{български} - with cyrillic letters under utf8 but it does not work. Any suggestions?
    – user22362
    Nov 20, 2012 at 20:44
  • 1
    @NikolayKirov I converted the non-answer to a comment. Perhaps consider to post a fresh question.
    – Stefan Kottwitz
    Nov 20, 2012 at 20:47

1 Answer 1

78

\underline{<stuff>} underlines a box containing <stuff>. However, this also implies that <stuff> with descenders pushes the underline lower. \smash{<stuff>} removes any depth (and height) from <stuff>, allowing for the regular non-descender depth of the underline:

\underline{\smash{<stuff>}}

Alternatively, the soul package provides underlining features. Here's a minimal example:

enter image description here

\documentclass{article}
\setlength{\parindent}{0pt}% Just for this example
\usepackage{soul}% http://ctan.org/pkg/soul
\begin{document}
The quick brown fox jumped over the lazy dog. \par
\underline{The quick brown fox jumped over the lazy dog.} \par
\underline{\smash{The quick brown fox jumped over the lazy dog.}}

\setul{5pt}{.4pt}% 5pt below contents
\ul{The quick brown fox jumped over the lazy dog.} \par
\setul{1pt}{.4pt}% 1pt below contents
\ul{The quick brown fox jumped over the lazy dog.} \par
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

See the soul package documentation (section 4 Underlining, p 11 onward) for more information regarding settings and underlining control.

4
  • 8
    soul's also recommendable because it allows for hyphenation, as opposed to \underline. All apart from the fact that underlining is usually frowned upon as a remnant of typewriter "typography".
    – doncherry
    Apr 3, 2012 at 21:16
  • Is there a way to determine the default underline spacing with regards to \setul? For example, I want to \setul{5pt}{.4pt} for one paragraph and then return to the default for the next paragraph. Is there a way to do this without trial and error?
    – nukeguy
    Jan 30, 2017 at 20:59
  • Ah, never mind. The \resetul command does what I need. (It doesn't tell me what the default spacing is, but I guess I don't really need that.)
    – nukeguy
    Jan 30, 2017 at 21:09
  • 1
    Thanks! This works beautifully. I am also stumped that only after 12 years of intensive latex use this is my first time using underline. Heh?
    – dorien
    Feb 26, 2017 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .