% und[er]tilde.sty
% From: lgy@phys.washington.edu (Laurence Yaffe)
\def\Undertilde{\let\@undertildesymbol\widetilde\@undertilde}
\def\undertilde{\let\@undertildesymbol\tilde\@undertilde}
%
\def\@undertilde#1%
    {%
    \setbox0=\hbox {$#1$}%
%    \setbox1=\hbox {$\tilde {\phantom {\copy0}}$}% <-- original
    \setbox1=\hbox {$\@undertildesymbol {\phantom {\copy0}}$}%
    \setbox2=\vtop {\offinterlineskip\box0\kern 1pt \box1}%
    \dp2 = 2.8 pt \box2%
    }%
%
\endinput
%
\documentstyle[undtilde]{article}
\begin{document}

This is \underline{X}, \underline{XY} and \underline{XYZ}.

This is \undertilde{X}, \undertilde{XY} and \undertilde{XYZ}.
This is \Undertilde{X}, \Undertilde{XY} and \Undertilde{XYZ}.
We have
\begin{eqnarray}
\underline{X} \times \underline{XY} = \underline{XYZ} \\
\undertilde{X} \times \undertilde{XY} = \undertilde{XYZ} \\
\Undertilde{X} \times \Undertilde{XY} = \Undertilde{XYZ}
\end{eqnarray}
in equations.
\end{document}
