Math & ScienceProblem with uuline (package ulem)

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
snowflake
Posts: 2
Joined: Thu Feb 09, 2012 12:46 pm

Problem with uuline (package ulem)

Post by snowflake »

Hi,

I'd like to double underline in math-mode. I'm using uuline (package ulem) for this, but I have troubles with it. There is far too much free space below double-underlined characters. I don't have these problems with uline btw.
Here's a comparison of non-underlined, uline and uuline:
Image

Code: Select all

\documentclass[a4paper]{article} 
\usepackage{color}
\usepackage{ulem}  
\begin{document}
		\colorbox{green}{$r$}
		\colorbox{green}{$\uline{r}$}
		\colorbox{green}{$\uuline{r}$}
		\colorbox{green}{$r_I$}
		\colorbox{green}{$\uline{r}_I$}
		\colorbox{green}{$\uuline{r}_I$}
\end{document}
As you can see, it's even uglier with subscripts.
Do you know what is causing this problem and how to solve it?
Thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

snowflake
Posts: 2
Joined: Thu Feb 09, 2012 12:46 pm

Problem with uuline (package ulem)

Post by snowflake »

The problem is solved now (more or less). ulem is not designed to work in math mode. The author says:
The various underlining commands are essentially textual, and will not
work quite the same in math mode. But since some font commands, in
the old-LATEX style (‘oldlfont’) serve both for text and math, math mode is
handled (in an approximate way). Generally, you should avoid using ulem’s
commands within math, but math may appear in the text argument to
ulem’s commands.
source: http://mirror.ctan.org/macros/latex/con ... m/ulem.pdf

So the obvious solution is to use \underline{\underline{}} instead.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Problem with uuline (package ulem)

Post by Stefan Kottwitz »

If nested \underline works, great!
For underlining, also the soul package could be useful.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Problem with uuline (package ulem)

Post by cgnieder »

Board rules (4.1) state that crosspostings have to be mentioned as such.

Regards
site moderator & package author
Post Reply