# undertilde package provides inconsistent vertical spacing between nucleus and accent

The `\utilde` command from the `undertilde.sty` package places different amounts of vertical space between the accent and the nucleus, depending on whether the equation is typeset in a single-line environment, (i.e., inline math, `equation`, or `displaymath`) or a multiple-line environment (i.e., `align`, `gather`, `multline`, and their associated `*-ed` environments).

In a single-line environment, the accent is given the proper amount of space, but in a multiple-line environment, the accent is too far away.

Below is an example:

• Have a look at my `accents` package. – Javier Bezos Jul 9 '12 at 16:57

Answering myself because it took me a while to discover the cause for this, and I think this would prove useful to others.

This is a bug in the `undertilde.sty` package, explained as follows:

Vertical spacing in *TeX is controlled by two glues and one dimension: `\baselineskip`, `\lineskip`, and `\lineskiplimit`.

`\baselineskip` controls the distance from the baseline of one line to the baseline of the following line -- to oversimplify, the bottom-to-bottom distance. If this value is small enough relative to the typeset text, there may be collisions between lines. To avoid this, the distance from the bottom of the upper line to the top of the lower line is monitored as well, and if the desired value of `\baselineskip` causes this bottom-to-top distance to be less than `\lineskiplimit`, then the `\lineskip` glue is substituted instead, which provides an absolute bottom-to-top interline separation.

The `\utilde` command from `undertilde.sty` creates the accent by creating a `\widetilde` over an empty box the width of the nucleus, then stacking the nucleus and the accented empty box in a `\vtop` command. To achieve the proper spacing, the package includes the line:

``````\baselineskip=1pt\relax
``````

which tightens up the space between the accent and the nucleus. However, this setting would cause the lines to be set atop one another, so at this point, the `\lineskip` setting takes over instead. In a single-line environment, we have `\lineskiplimit=0pt` and `\lineskip=1pt`, which gives the proper spacing. However, a multiple-line environment has, by default, `\lineskiplimit=3pt` and `\lineskip=4pt`. This means that the tilde is separated from the nucleus by 1/24th of an inch more in a multiple-line environment than it is in a single-line environment.

A fix to this would be to update the `undertilde.sty` file to replace the aforementioned line with the following:

``````\baselineskip=\z@\relax
\lineskiplimit=\z@\relax
\lineskip=1pt\relax
``````

which would set the proper distance for all math environments.

• Very thorough! It seems the package hasn't been updated in 12 years; you can find the documentation on CTAN though the package isn't in TeX Live, so if you are lucky, writing the author is an option. If not, you can try adopting the package :) – Ryan Reich Jul 9 '12 at 16:53
• This helped me a lot, thanks! Please try to adopt that package and release it under a open source license. – Lucas Soares Sep 13 '16 at 18:44
• @LucasSoares Unfortunately, I'm at a place where I have neither time nor energy to be a maintainer. There's nothing stopping you or anyone else from going for it though :-) – Tristan Sep 14 '16 at 14:15