Using the \underline{} command and I'm getting very strange (and inconsistent) results. There randomly seems to be added spacing to one of the underlined words. Any suggestions/solutions would be much appreciated! Please see image below. (I've blanked out some private info btw)
- 757,742
- 315
2 Answers
I'd take egreg's advice, but if you're dead serious about using the underline, the ulem package is your thing:
\documentclass{article}
\usepackage[normalem]{ulem}
\begin{document}
\underline{Which} \underline{question}?
\uline{Which} \uline{question}?
\end{document}
- 6,920
-
3
-
-
ulemwith thenormalemoption is the way to go, because you can typeset your document properly, then drop in underlines if that's necessary for some reason that won't make it into the final print (such as indicating changes for reviewers) – Chris H Jan 04 '17 at 16:11
First some stylistic remarks.
There is no reason for using different types of emphasis for “vector space” and “vector addition”.
Underlining for emphasis is a method used with typewriters, where nothing better was available; it's not used in good typography.
Boldface type is good for making titles more visible; in the text body it's too heavy.
u, v and w are vectors, so they should be in math mode.
The technical reason for the different height of the underline is that the phrase “vector addition” has no letter with a descender, whereas “vector multiplication” does (the ‘p’). The underline is always at a fixed length from the bottom of the box to underline.
If you still want to underline, you can define
\newcommand{\appallingunderline}[1]{%
\underline{\smash{#1}\vphantom{T}}\vphantom{#1}%
}
so the underline will cross the descenders. Note that the underline adds to the depth of the line, so you're very likely to get uneven line spacing.
\documentclass{article}
\usepackage{dsfont}
\newcommand{\R}{\mathds{R}} % so you can change it more easily
\newcommand{\appallingunderline}[1]{%
\underline{\smash{#1}\vphantom{T}}\vphantom{#1}%
}
\begin{document}
\section{Lecture 17: Vector Spaces}
A \textbf{vector space} $V$ is a non-empty set equipped with a
\appallingunderline{vector addition} and \appallingunderline{vector multiplication}
operations such that, for all $\alpha,\beta\in\R$ and all
$\mathbf{u},\mathbf{v},\mathbf{w}\in V$,
\section{Lecture 18: Better Typography}
A \emph{vector space} $V$ is a non-empty set equipped with a
\emph{vector addition} and \emph{vector multiplication}
operations such that, for all $\alpha,\beta\in\R$ and all
$\mathbf{u},\mathbf{v},\mathbf{w}\in V$,
\end{document}
- 1,121,712
-
You could
\smashthe thing again after underlining, circumventing the uneven linespacing problem in favour of a possible overlapping line problem. Also, why do you usedsfont? In my opinion theamsfontsmatch CM much better. – Henri Menke Jan 04 '17 at 14:45 -
1@HenriMenke That would be even worse. I left the OP’s fancy bold, but hidden in a macro for easier redefinition. – egreg Jan 04 '17 at 14:48
-
I'm with you about bad versus good typography. Nevertheless, just a question about "Note that the underline adds to the depth of the line, so you're very likely to get uneven line spacing.". Wouldn't it be possible for the underline's depth to not be taken into account? – Denis Bitouzé Oct 31 '20 at 15:01
-
1



\emphrather than\underline: underlining was used at the time of typewriters and is a frowned upon method for emphasis. Also the phrase “vector space” should be with\emphrather than\textbf: there's no reason for emphasizing text in different ways. – egreg Jan 04 '17 at 14:18\in. the bold letter preceding it should be part of the same math expression:$\mathbf{u} ]in V$. – barbara beeton Jan 04 '17 at 14:20\documentclass{...}and ending with\end{document}. – Martin Schröder Jan 04 '17 at 14:21