I use \uuline command from ulem package to make double-underlined text. I would like to know if it is possible to control space length between lines? I drew below what I mean. If not, how to make custom double-underline with space length controlled? 
Asked
Active
Viewed 1,541 times
4
Heiko Oberdiek
- 271,626
myshon
- 307
- 1
- 8
1 Answers
7
The space between the double lines is hard-coded: 1.2pt, see the definition of \uuline in package ulem.
The following example changes the definition in two ways:
The hard-coded space is replaced by dimen register
\uulinesep.Also the top line is aligned, not the bottom line. This avoids that the top line overprints the descenders or even moves above the base line, when
\uulinesepis increased too much.
The depth of the whole double line can be changed by setting \ULdepth as shown in the second and third line of the example. The default is \maxdimen. Then package ulem uses the depth of j().
Full example:
\documentclass{article}
\usepackage{ulem}
\newdimen\uulinesep
\setlength{\uulinesep}{1.2pt}
\makeatletter
\renewcommand*{\uuline}{%
\bgroup
\UL@setULdepth
\markoverwith{%
\lower\ULdepth\hbox{%
\kern-.03em%
\vtop{%
\hrule width.2em%
\kern\uulinesep
\hrule
}%
\kern-.03em%
}%
}%
\ULon
}
\makeatother
\begin{document}
\newcommand*{\test}[1]{%
\begingroup
\renewcommand*{\uulinesep}{#1}%
\uuline{#1}%
\endgroup
}
\test{0pt} \test{0.6pt} \uuline{1.2pt}\,\uline{(default)}
\test{2pt} \test{1ex}
\newcommand*{\testA}[1]{%
\begingroup
\setlength{\ULdepth}{#1}%
\addtolength{\ULdepth}{.4pt}% line width
\uuline{#1}%
\endgroup
}
\newcommand*{\testB}[1]{%
\begingroup
\settodepth{\ULdepth}{#1}%
\addtolength{\ULdepth}{.4pt}% line width
\uuline{#1}%
\endgroup
}
\testA{0pt} \testA{1.5pt} \testA{1pt} \testA{2pt} \testA{4pt}
\testB{j} \testB{()} \testB{x} \testB{$\int_0^\infty$}
\end{document}
Heiko Oberdiek
- 271,626
