2

I need a \tilde which is a little more noticeable, why I tried this answer in combination with scalebox. However, together with the vertical scaling, also the vertical distance between the symbol and the accent increases. How can I avoid that? I tried \smash and raisebox which had no effect.

MWE

\documentclass{article}

\usepackage{amsmath} \usepackage{accents} \usepackage{graphicx}

\DeclareRobustCommand*{\vartilde}[1]{\accentset{\smash{\scalebox{0.8}[1.4]{\ensuremath{\sim}}}}{#1}}

\begin{document}

$ \tilde{q}^{,+|-}_j $ \quad vs. \quad $ \vartilde{q}^{,+|-}_j $

\end{document}

enter image description here

Thank you very much!

3 Answers3

2

The problem is the vertical white space around \sim. You can use the \trimbox command from the trimclip package to make the adjustment:

enter image description here

If you want more space between the \sim and the letter below, decrease the value .3ex in the \trimbox command.

Here is the code:

\documentclass{article}

\usepackage{amsmath} \usepackage{accents} \usepackage{graphicx} \usepackage{trimclip}

\DeclareRobustCommand*{\vartilde}[1]{\accentset{\scalebox{0.8}[1.4]{\trimbox{0pt .3ex}{\ensuremath{\sim}}}}{#1}}

\begin{document}

$ \tilde{q}^{,+|-}_j $ \quad vs. \quad $ \vartilde{q}^{,+|-}_j $

\end{document}

Note that the accent will not scale if it appears in scriptstyle or scriptscriptstyle. If you need those, you can use \mathchoice:

\DeclareRobustCommand*{\vartilde}[1]{\mathchoice
{\accentset{\scalebox{0.8}[1.4]{\trimbox{0pt .3ex}{\ensuremath{\sim}}}}{#1}}
{\accentset{\scalebox{0.8}[1.4]{\trimbox{0pt .3ex}{\ensuremath{\sim}}}}{#1}}
{\accentset{\scalebox{0.6}[1]{\trimbox{0pt .3ex}{\ensuremath{\sim}}}}{#1}}
{\accentset{\scalebox{0.4}[.7]{\trimbox{0pt .3ex}{\ensuremath{\sim}}}}{#1}}
}

enter image description here

You can adjust the scaling and spacing for each style however you like.

Sandy G
  • 42,558
1

Simply use \widetilde:

\documentclass{article}

\usepackage{amsmath} \usepackage{accents} \usepackage{graphicx}

\DeclareRobustCommand*{\vartilde}[1]{\accentset{\smash{\scalebox{0.8}[1.4]{\ensuremath{\sim}}}}{#1}}

\begin{document}

$ \tilde{q}^{,+|-}_j $ \quad vs. \quad $ \vartilde{q}^{,+|-}_j $\quad vs. \quad $ \widetilde{q}^{,+|-}_j $

\end{document}

enter image description here

Bernard
  • 271,350
  • Thanks, but it does not really answer the question. \widetilde is better than nothing, but still too close to \overline. I have to avoid that the reader oversees the difference between these two at a glance. That is why I stretched it quite a bit. – Robert Seifert Dec 12 '20 at 19:33
1

You can use \vbox{\hbox{...}\kern-1pt} construction:

\DeclareRobustCommand*{\vartilde}[1]
    {\accentset{\scalebox{.8}[1.4]{\vbox{\hbox{$\sim$}\kern-1pt}}}{#1}}
wipet
  • 74,238