# Placing \sim above \to, with correct spacing

In an answer to a previous question, it is explained that

\xrightarrow{\sim}


will produce an arrow pointed to the right with the \sim symbol above it (e.g., to indicate that a map is an isomorphism). However, I'm not satisfied with the spacing of this symbol, as it appears too high above the arrow:

Is there a way to move it down? Potentially the arrow would have to be widened a little, to prevent \sim from touching the arrowhead.

• You could do sth like \xrightarrow{\,\raisebox{-0.4ex}{$\sim$}\,}.
– user121799
Mar 21 '19 at 18:12
• Duplicate?? tex.stackexchange.com/questions/479322/… Mar 21 '19 at 19:47
• @marmot: I think you need \raisebox{-.4ex}[0ex][0ex]{$\sim$} Mar 21 '19 at 19:57

You could do this with \stackrel and \smash.

\documentclass{article}

\newcommand\isomto{\stackrel{\sim}{\smash{\longrightarrow}\rule{0pt}{0.4ex}}}

\begin{document}

$f\colon X\isomto Y$

\end{document}


Adjust the height as you wish by changing the 0.4ex. Note also the use of \colon for proper spacing of functions.

Or if you prefer a larger \sim, try

\newcommand\isomto{\stackrel{\textstyle\sim}{\smash{\longrightarrow}\rule{0pt}{0.4ex}}}


1st proposal:

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

$f\colon X\overset{\raise-.5ex\hbox{\sim}}{\longrightarrow}Y$

\end{document}


2nd proposal:

Using tikz-cd package:

\documentclass[12pt]{article}
\usepackage{tikz-cd,relsize}
\tikzset{close/.style={outer sep=-1.2pt}}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
$\begin{tikzcd}[column sep=.3in] f: X \arrow[r, close,"\mathlarger{\sim}"] & Y \end{tikzcd}$
\lipsum[2]
\end{document}


Addendum of the 2020/04/29: Using stix font where exists a specific symbol named \similarrightarrow. But there is an inconvenience. The stix font change the fonts of the characters and you not have the CM default font.

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\usepackage{stix}
\begin{document}
$f\colon X \similarrightarrow Y$
\end{document}