56

How do I get a really wide tilde?

I need to cover at least abcdefghijklmnopqrstuvwxyz

The \widetilde command does not work. Nor using \stackrel with \sim.

10
  • 4
    Welcome to TeX.SX! There's no such thing: the result would be appalling.
    – egreg
    Commented Jul 16, 2012 at 20:27
  • Couldn't resist implementing Paulo's attempt from meta.tex.stackexchange.com/questions/2605/… ;). @Lilia, please don't take this personally in any way!
    – doncherry
    Commented Jul 16, 2012 at 21:02
  • 1
    @Mico: I'm fine with the sign being taken down, but I'm not sure if we should perhaps preserve our comments as basis for discussion on meta?
    – doncherry
    Commented Jul 16, 2012 at 22:03
  • 1
    @doncherry I did not comment on any aesthetic implied by the question, merely on the result of my proposed solution (which is depressingly flat in the middle) (there is some parallel discussion in the chat session). Commented Jul 16, 2012 at 22:34
  • 6
    wouldn't it be better to present this as (...)^{\sim} ? Commented Jul 19, 2012 at 21:05

5 Answers 5

43

You could load the mtpro2 (Mathtime Pro 2) to generate superwide tildes. An MWE (minimum working example) that shows how to do this is given below. First, though, some comments about this package: In addition to letting you do lots of really cool and useful things, this package also allows you create a summation symbol that's a full two inches (5 centimeters) [!!] tall. The font's creator issues the following warning regarding the use of such a symbol:

... thereby assuring yourself (as well as the designer of the MathTime fonts) the lasting enmity of journal editors everywhere. [Direct quote from p. 14 of the package's user guide]

This warning applies not only to using super-tall summation symbols; it certainly applies to super-wide tilde and hat symbols as well. Put differently: Just because the mtpro package lets you create certain questionable things (such as super-tall summation symbols and super-wide tildes) doesn't mean that you have to do them.

Here, then, is an MWE that uses the mtpro2 package to place a ridiculously wide tilde over both abcdefghijklmnopqrstuvwxyz and abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (ooooh!).

\documentclass{article}
\usepackage[lite]{mtpro2}
\begin{document}
$\widetilde{\mathit{abcdefghijklmnopqrstuvwxyz}}$

$\widetilde{\mathit{abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz}}$
\end{document}

enter image description here

Addendum: The full mtpro2 package is not free. However, its so-called lite subset -- which is all that's required to produce the rather dubious effects shown above, is free. This package is not on the CTAN, but it may be downloaded from this site.

Second addendum (March 2013): The mtpro2 package can also be used to produce super-wide "hat" symbols, by using its \widehat command.

3
  • 16
    I stand corrected: there is such a thing. But the result is appalling, so I wasn't completely wrong.
    – egreg
    Commented Jul 16, 2012 at 20:47
  • @egreg - I fully agree with you that the effect is appalling. I suspect that the availability of these super-wide accents in the mtpro2 package is merely a by-product of having some truly useful capabilities such as "real" tall curly braces (both vertical as well as horizontal -- the latter for overbrace and underbrace constructions, I suppose). I would certainly hope that any author who actually submitted a paper containing such appalling wide-accented constructs to a journal would indeed earn the immediate and lasting enmity of all editors.
    – Mico
    Commented Jul 16, 2012 at 21:00
  • Mico:I will download now the mtpro2 package that you suggest. Thank you indeed for your help. Commented Jul 17, 2012 at 15:41
28

REVISED SOLUTION (with \AC from wasysym)

\documentclass{article}
\usepackage{scalerel}
\usepackage{stackengine,wasysym}

\newcommand\reallywidetilde[1]{\ThisStyle{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{-.1\LMpt}{$\SavedStyle#1$}{%
    \stretchto{\scaleto{\SavedStyle\mkern.2mu\AC}{.5150\wd0}}{.6\ht0}%
  }{O}{c}{F}{T}{S}%
}}

\def\test#1{$%
  \reallywidetilde{#1}\,
  \scriptstyle\reallywidetilde{#1}\,
  \scriptscriptstyle\reallywidetilde{#1}
$\par}

\parskip 1ex
\begin{document}

\test{abcdefghijklm}
\test{abcdefghijk}
\test{abcdefghi}
\test{abcdefg}
\test{abcde}
\test{abc}
\test{ab}
\end{document}

enter image description here


ORIGINAL SOLUTION (with \sim)

Given the year since this solution was posted, I have learned quite a bit, and so I REEDIT this answer to correct deficiencies like "wrong vertical axis", "does not scale with mathstyle", "extra dead-zone width", etc. This new result uses the 10 MAR 2014 version of scalerel, so you may have to update.

At the end of the MWE, I show how I determined the .2mu and .5467 parameters used in the new macro. A user doesn't need to pay attention to it, but if one wanted to adapt this to a different top decoration, a similar procedure would come in handy. In a nutshell, I kerned away the space on the sides of \sim and determined the kern trim mismatch of .2mu. This was added into the macro, so that the tilde would not be offset left or right relative to the argument. I also calculated the aspect ratio of the trimmed \sim as .5467. In the macro, this is multiplied by \wd0, the argument width, to indicate how tall a scaled \sim would have to be to horizontally stretch over the width of the argument. I then squash it down to vertically to the desired height.

\documentclass{article}
\usepackage{scalerel}[2014/03/10]
\usepackage{stackengine}

\newcommand\reallywidetilde[1]{\ThisStyle{%
  \setbox0=\hbox{$\SavedStyle#1$}%
  \stackengine{-.1\LMpt}{$\SavedStyle#1$}{%
    \stretchto{\scaleto{\SavedStyle\mkern.2mu\sim}{.5467\wd0}}{.7\ht0}%
%    .2mu is the kern imbalance when clipping white space
%    .5467++++ is \ht/[kerned \wd] aspect ratio for \sim glyph
  }{O}{c}{F}{T}{S}%
}}

\def\test#1{$%
  \reallywidetilde{#1}\,
  \scriptstyle\reallywidetilde{#1}\,
  \scriptscriptstyle\reallywidetilde{#1}
$\par}

\parskip 1ex
\begin{document}

\test{abcdefghijklm}
\test{abcdefghijk}
\test{abcdefghi}
\test{abcdefg}
\test{abcde}
\test{abc}
\test{ab}

How .55 multiplier in scaleto was determined:
\fboxsep=0pt\fboxrule=.1pt
\setbox0=\hbox{$\mkern-.86mu\sim\mkern-1.06mu$}

kerned width: \the\wd0, height: \the\ht0, 

kerned sim glyph: \fbox{\box0}

Net kern imbalance: $-0.86\mu - (-1.06\mu) = 0.20\mu$

aspect ratio: height/width = 0.5467

\end{document}

enter image description here

3
  • 1
    This is the most elegant solution out of the several above that I tried. Incidentally, I had vertical alignment problems (the tilde in tension with the text below it) until I edited as #1\\ <CR> \rule{-1ex}{0ex} before \end{array} as in tex.stackexchange.com/questions/100574/really-wide-hat-symbol/…
    – MarkWayne
    Commented Mar 19, 2014 at 20:43
  • @MarkWayne Thanks so much. Glad to help. You are right on the vertical alignment. With what I've learned this last year, I'll work on an improvement. Commented Mar 19, 2014 at 23:18
  • @MarkWayne Please see improved revision. Commented Mar 20, 2014 at 1:09
17

It's sort of horrible, but it does stretch:

enter image description here

\documentclass{article}

\makeatletter
\def\oversortoftilde#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
      \sortoftildefill\crcr\noalign{\kern3\p@\nointerlineskip}%
      $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}

\def\sortoftildefill{$\m@th \setbox\z@\hbox{$\braceld$}%
  \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}

\makeatother

\begin{document}

\[ \widetilde{abcdefghijklmnopqrstuvwxyz}\]
\[ \oversortoftilde{abcdefghijklmnopqrstuvwxyz}\]

\end{document}
1
  • 1
    Actually, this to me would be the preferred form! Old manuscripts that needed long tildes for abbreviations did it in this way. Commented Nov 2, 2016 at 16:14
7

I tried some of these except the {mtpro2} since for submitting articles that might not be acceptable by publishers!

As I was not satisfied by the previous methods mentioned above, I tried to tailor another method, you can apply the following code, play with the scale factors and positions and choose which one you prefer. The last two I recommend but I myself prefer the last, which I am going to use myself:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[ngerman]{babel}
\usepackage{stackengine}
\usepackage{scalerel}

\begin{document}

\[\widetilde{ABCDEF}\]

\[\stackon[0pt]{ABCDEF}{\hstretch{7.0}{\sim}}\]

\[\stackon[-8pt]{ABCDEF}{\vstretch{1.5}{\hstretch{9.0}{\widetilde{\phantom{\;}}}}}\]

\[\stackon[-8pt]{ABCDEF}{\vstretch{1.5}{\hstretch{2.4}{\widetilde{\phantom{\;\;\;\;\;\;\;\;}}}}}\]

\end{document}

The result would be something like this:

enter image description here

Have fun

Ehsan Tavakoli

2

I had a similar problem: I needed a good looking argmin with wide tilde on top.

I settled on $\stackrel{\resizebox{6mm}{1mm}{$\ \sim$}}{\argmin}$.

Result: enter image description here

Note: the 3rd argument of \resizebox is interpreted as text mode, so you need to put in the $ signs explicitly. The extra space (\ ) before the tilde (\sim) is a hack to make it look centered.

I think it looks worse edge-to-edge: enter image description here

\stackrel{\resizebox{11mm}{1mm}{$\sim$}}{\argmin}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .