29

I just want to place a tilde over $\mathcal{W}$, and $\tilde\mathcal{W}$ is too small while $\widetilde{\mathcal{W}}$ is too big.

Is there a simple way to produce an in-between?

2 Answers2

19

It's a bit hacky, but does

\usepackage{amsmath}
$\overset{\sim}{\mathcal{W}}$

(which gives mathcal W with overset sim) do what you're after?

Edit:

An alternative with adjustable height is

\newcommand\Wtilde{\stackrel{\sim}{\smash{\mathcal{W}}\rule{0pt}{1.1ex}}}

where you can change 1.1ex to whatever you like.

Note, however, that in this implementation the tilde height is entirely independent of the size of the original W, so you may need to define several versions if you want to do this to lots of different letters.

Ant
  • 7,568
  • That's much better. Can one lower the tilde with \raisebox or the like? – Glen Wheeler Aug 04 '11 at 10:29
  • 1
    Following @HendrikVogt at http://tex.stackexchange.com/q/12579/6984 : \newcommand\simcal[1]{\stackrel{\sim}{\smash{\mathcal{#1}}\rule{0pt}{1.1ex}}} lets you write $\simcal{W}$ or whatever, and you can adjust the 1.1ex to suit your spacing preferences. – Ant Aug 04 '11 at 11:08
  • PS - a meta-comment: anyone know how I can get the @ syntax to work with Hendrik's username above? Ta. – Ant Aug 04 '11 at 11:09
  • On second thoughts, \newcommand\Wtilde{\stackrel{\sim}{\smash{\mathcal{W}}\rule{0pt}{1.1ex}}} is better. In this implementation the spacing is entirely independent of the size of the original letter, so making the letter an argument is not a brilliant idea. – Ant Aug 04 '11 at 11:15
  • This is much better (the comments version), could you add it to the answer? It is also much simpler than the (otherwise excellent) suggestion of Leo Liu. – Glen Wheeler Aug 17 '11 at 14:42
  • It would be really useful to have a solution that automatically adapts to the size of the character. Unfortunately, my tex skills are not sufficient to provide one. :( – Eike P. May 05 '20 at 15:02
  • Unfortunately, this also significantly changes the behavior w.r.t superscripts, i.e., $\overset{\sim}{X}^T$ looks very differently from $\widetilde{X}^T$. (In the former case, the T is set very high.) – Eike P. May 05 '20 at 15:07
  • The alternative solution makes a nice looking symbol, but the spacing around the symbol no longer works correctly: sometimes there is too much space around the symbol and sometimes too little. – Sam Buss Sep 20 '23 at 04:19
7

Follow Ant's solution:

\documentclass{article}
\usepackage{accents}
\begin{document}

$\tilde W \widetilde W$

$\accentset{\sim}{W} \accentset{\textstyle\sim}{W}$

\end{document}

That's not very good. For more complicated solution, see How can I manually choose the size of a wide accent? (math mode)

Leo Liu
  • 77,365
  • 1
    Could you elaborate on what's "not very good" about this solution? It actually looks quite nice to me. – Eike P. May 05 '20 at 15:16