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?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI 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?
\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:
\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.
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".
Apr 3, 2012 at 21:16