I use an edited version of the \\uline
command from the ulem
package to get a nice compact double underline to denote tensor variables. The used code comes from this question. My problem is that the macro leaves a very large space below any line with a tensor. I would like this vertical space to be the same as for a simply underlined letter, or even the same as for a standard letter without underlines. How would I do that?
Full example:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[normalem]{ulem}
\makeatletter
\renewcommand*{\uuline}{%
\bgroup
\UL@setULdepth
\markoverwith{%
\lower\ULdepth\hbox{%
\kern-.03em%
\vtop{%
\hrule width.2em%
\kern 0.6pt % distance between the two underlines
\hrule
}%
\kern-.03em%
}%
}%
\ULon
}
\makeatother
\setlength{\ULdepth}{1pt} % distance from double underline to letter
\newcommand{\mat}[1]{\uuline{#1}{}}
\begin{document}
This is some text with $\mat A$ in it. The problem is that the next line of
text leaves a very big vertical space. The same problem occurs in displayed
maths:
\begin{align*}
A & = B \\
\mat A & = \mat B \\
A & = B
\end{align*}
\end{document}
Best Answer
You can
\smash
the underline, i.e., set the height and the depth of the box around the underlined letter to 0.Code:
Result: