17

In LaTeX, \tilde{x} puts a ~ on top of the x.
How can I put a ~ below the x?

doncherry
  • 54,637
JuanPablo
  • 2,689

2 Answers2

17

Use the command \utilde from the undertilde package.

Added by the crowd: This package is not part of TeX Live, so you may have to install it manually. This having been done, using the package is simple:

\documentclass{article}
\usepackage{undertilde}
\begin{document}
$\utilde{x}$
\end{document}

This produces the following output.

enter image description here

Ryan Reich
  • 37,958
  • 2
    Interestingly, the \utilde command does not work properly in any sort of multi-line environment -- it inserts too much space between the tilde and the argument. – Tristan Jul 04 '12 at 04:48
  • @Tristan: What specifically multiline environments? Like, say, align? I wonder if it's an issue with \everycr (which would be weird)? – Ryan Reich Jul 04 '12 at 05:29
  • It gave extra space in every multiline environment I tried. I'm not really sure what causes it -- I'm looking into it, but it seems the \utilde command really only depends on \fontdimen5. I wonder if that dimension is redefined in a multiline environment.... – Tristan Jul 06 '12 at 03:32
  • I should also add that I'm using the mathptmx package – Tristan Jul 06 '12 at 03:42
  • Looks like in a normal equation environment, the original \baselineskip is 12pt, while in an aligned environment, the original \baselineskip is 15pt. The \utilde command uses a \baselineskip=1pt command to stack the symbols. – Tristan Jul 06 '12 at 05:36
  • Ok, found the problem: the undertilde package adjusts \baselineskip but does nothing to \lineskiplimit and \lineskip, which are 3pt and 4pt respectively in a multiline environment, but 0pt and 1pt in a single line environment. – Tristan Jul 07 '12 at 00:17
  • @Tristan: It seems increasingly as though this package can be duplicated using a two-line \halign that sets things up right... – Ryan Reich Jul 07 '12 at 00:27
  • Just to make my discovery easier to find, I'm going to post and answer it as a question on here, since I can't possibly be the only person who would have experienced this. – Tristan Jul 09 '12 at 16:07
  • 1
    Which is at http://tex.stackexchange.com/questions/62747/undertilde-package-provides-inconsistent-vertical-spacing-between-nucleus-and-ac/62748#62748 – chmullig Nov 06 '13 at 02:45
3

Or just copy the 4 lines of code:

\def\undertilde#1{\mathord{\vtop{\ialign{##\crcr
$\hfil\displaystyle{#1}\hfil$\crcr\noalign{\kern1.5pt\nointerlineskip}
$\hfil\tilde{}\hfil$\crcr\noalign{\kern1.5pt}}}}}

from

undertilde.sty 

and use the command

\undertilde{x}
Blairg23
  • 223
  • this will not work for some cases, e.g. (\mu_{\undertilde{A}}(x)) will cause A to be printed in full size, rather than scriptsize. – sfranky Feb 10 '17 at 10:47