[comp.text.tex] undertilde

oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA) (10/04/90)

How can I define a macro (with \def or \newcommand)
in Latex to to something like \tilde{a} but I want
the tilde to be at the bottom. I guess you could
called it \undertilde . I looked at the macro
for \underbrace but couldn't get my \undertilde to
work in a similar way.

Thanks for any help.

   Roque Oliveira
   oliveria@caen.engin.umich.edu

rouben@math13.math.umbc.edu (Rouben Rostamian) (10/04/90)

In article <1990Oct4.014728.29527@caen.engin.umich.edu> oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA) writes:
>How can I define a macro (with \def or \newcommand)
>in Latex to to something like \tilde{a} but I want
>the tilde to be at the bottom. I guess you could
>called it \undertilde. I looked at the macro
>for \underbrace but couldn't get my \undertilde to
>work in a similar way.

% The command \undertilde puts a `tilde' under the corresponding character.
% It is an adaptation of the TeX command \underbrace (TeXbook, page359)
\def\undertilde#1{\mathop{\vtop{\ialign{##\crcr
    $\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern2pt\nointerlineskip}
    $\scriptscriptstyle\sim$\crcr\noalign{\kern2pt}}}}\limits}


Rouben Rostamian                               Telephone: (301) 455-2458
Department of Mathematics and Statistics       e-mail:
University of Maryland Baltimore County        rostamian@umbc.bitnet
Baltimore, MD 21228,  U.S.A.                   rostamian@umbc3.umbc.edu

lgy@phys.washington.edu (Laurence G. Yaffe) (10/04/90)

oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA) writes:

>How can I define a macro (with \def or \newcommand)
>in Latex to to something like \tilde{a} but I want
>the tilde to be at the bottom. I guess you could
>called it \undertilde . I looked at the macro
>for \underbrace but couldn't get my \undertilde to
>work in a similar way.

>   Roque Oliveira
>   oliveria@caen.engin.umich.edu

    Here's what I use:

    \def\undertilde #1%
	{%
	\setbox0=\hbox {$#1$}%
	\setbox1=\hbox {$\tilde {\phantom {\copy0}}$}%
	\setbox2=\vtop {\offinterlineskip\box0\kern 1pt \box1}%
	\dp2 = 2.8 pt \box2%
	}%

    I'm sure this could be greatly improved; it doesn't cope well with
    putting tildes under things with big descenders (but then such use
    will always look terrible).

--
--------------------------------------------------------------------------
Laurence G. Yaffe		Internet: lgy@newton.phys.washington.edu
University of Washington	Bitnet:   yaffe@uwaphast.bitnet

dorai@datura.rice.edu (Dorai Sitaram) (10/04/90)

In article <1990Oct4.014728.29527@caen.engin.umich.edu> oliveria@caen.engin.umich.edu (ROQUE DONIZETE DE OLIVEIRA) writes:
$How can I define a macro (with \def or \newcommand)
$in Latex to to something like \tilde{a} but I want
$the tilde to be at the bottom. I guess you could
$called it \undertilde . I looked at the macro
$for \underbrace but couldn't get my \undertilde to
$work in a similar way.

\def\undertilde#1{{\mathop{#1}\limits_{\smash{\widetilde{\hphantom{#1}}}}}}

$Thanks for any help.

De nada.

--d

raymond@math.berkeley.edu (Raymond Chen) (10/04/90)

In article <1990Oct4.014728.29527@caen.engin.umich.edu>, oliveria@caen (ROQUE DONIZETE DE OLIVEIRA) writes:
>I looked at the macro for \underbrace but couldn't get my \undertilde to
>work in a similar way.

You really want to study the \b \c \d macros to see how to place
accent marks under characters.  Using those as a springboard, I
designed these macros quite some time ago, at the request of a chemist
friend...

   % underacc.tex -- allow for placement of accents under characters
    \def\mathunderaccent#1{\let\theaccent#1\mathpalette\putaccentunder}
    \def\putaccentunder#1#2{\oalign{$#1#2$\crcr\hidewidth
      \vbox to.2ex{\hbox{$#1\theaccent{}$}\vss}\hidewidth}}
   % the truly paranoid may wish to rename \putaccentunder to
   % \putacc@ntunder.

the resulting gizmo is a \mathord.  Season to taste if you really
wanted a \mathbin or whatever.

An important subtlety that many people miss is that the object being
accented might be appearing in a display, a superscript or subscript,
and hence the macro must be careful to do the right thing.  Hence the
\mathpalette.

Here's a sample usage:

% \ttilde puts a double tilde over its argument.
\def\ttilde#1{\tilde{\tilde{#1}}}

% "x" with double tilde underneath, superscript "y" with tilde underneath.
$\mathunderaccent\ttilde x ^ {\mathunderaccent\tilde y}$
\end