[texhax] Underscoring

Donald Arseneau asnd at triumf.ca
Wed Nov 21 01:47:42 CET 2007


Matthew Leingang <leingang at math.harvard.edu> writes:

> As for the first question, there are some underlining packages  available.
> The \ul macro underlines text, but doesn't adjust for  descenders (it's just
> as high as possible below the text without  overlapping any possible
> descenders).  The ulem package provides a  \uline macro that makes sure the
> underlines are the same height  throughout.  But that doesn't do what you
> want, it just makes all the  underlines below the descent, regardless of
> whether a descender is  present.

By default the underline is placed below the typical descenders.
Set the length \ULdepth to place the line at any depth (or height!)


\usepackage[normalem]{ulem}
\usepackage{color}
\makeatletter
\newcommand\brokenuline{\bgroup 
 \UL at pixel.3\p@ \ULdepth .25ex
 \let\UL at putbox\UL at brokenputbox \ULset}

\def\UL at brokenputbox{\ifx\UL at start\@empty \else % not inner
  \vrule\@width\z@ \LA at penalty\@M
  {\UL at skip\wd\UL at box \UL at leaders \kern-\UL at skip}%
  \textcolor{white}{%
   \kern-3\UL at pixel\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\raise.4\p@\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\lower.4\p@\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\raise.4\p@\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\lower.4\p@\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\raise.4\p@\copy\UL at box\kern-\wd\UL at box
   \kern  \UL at pixel\copy\UL at box\kern-\wd\UL at box
   \kern-3\UL at pixel}\box\UL at box  \fi}
\makeatother

See also:

http://groups.google.com/group/comp.text.tex/msg/434d4b58e7306abb



-- 
Donald Arseneau                          asnd at triumf.ca


More information about the texhax mailing list