0

I would like to have a command \simrightarrow, that is, a \rightarrow with a \sim over it. Stealing code from @egreg, I got:

\documentclass{article}

\usepackage{unicode-math}

  \newcommand{\simrightarrow}{\mathrel{\ooalign{
     $\to$\cr
     \hidewidth\raise.3em\hbox{$\sim\mkern3mu$}\cr
    }
  }
}


\begin{document}
\( M \simrightarrow N \)
\end{document}

However, the tilde is still too big. How can I scale it down?

  • see also https://tex.stackexchange.com/questions/489465/how-can-i-force-resized-mathmode-symbols-to-respect-fontsize-changes/489467#489467 – David Carlisle May 18 '19 at 05:38
  • 2
    or from what you have perhaps $\scriptstyle\sim ? but as you are using unicode-math anyway then using \similarrightarrow seems most natural as that is a single glyph not an oalign construct – David Carlisle May 18 '19 at 05:39
  • @DavidCarlisle I will check your recommendations. Unfortunately many fonts (including Latin Modern) don't contain \similarrightarrow. That's why I got into \ooalign. –  May 18 '19 at 05:42
  • @DavidCarlisle I did not try out \scriptstyle because I did not expect it to behave correctly under scaling (\simrightarrow_{\simrightarrow}) but it seems, it actually does. Thank you! –  May 18 '19 at 05:47

1 Answers1

1

I have used this approach: the use of the scalerel package with the option \scaleobj{.5}{\sim} to decrease the size of \sim. I have searched a good compromise between the dimension of \sim and \to. After I have edited a little your code. Here there is the output and the MWE.

enter image description here

\documentclass{article}
\usepackage{unicode-math}
\usepackage{scalerel}
  \newcommand{\simrightarrow}{\mathrel{\ooalign{
     $\to$\cr
     \hidewidth\raise.3em\hbox{$\scaleobj{.5}{\sim}\mkern7mu$}\cr
    }
  }
}
\begin{document}
\( M \simrightarrow N \)
\end{document}

Addendum: 12-april-2020

With stix package there is the exact symbol without to use \ooalign if you prefer like suggested by @David Carlisle.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{stix}
\begin{document}
$a \similarrightarrow n$
\end{document}

enter image description here

Sebastiano
  • 54,118