[Tex/LaTex] Difference between \xrightarrow and \overset\to

arrowsoversetspacingxrightarrow

What is the difference between \xrightarrow h and \overset h\to? The output seems to differ ever so slightly. Is one to be preferred over the other? Is one less likely to create unsightly gaps between lines because it is too tall? (I know that \xrightarrow adjusts the length of the arrow to accomodate the length of what is being put above it, making it preferable to \to for long texts above the arrow. My question is whether there is any reason to prefer one or the other in the specific situation of a short symbol over the arrow.)

Best Answer

With a slim superscript, such as i, the result is almost identical; only the superscript is positioned slightly differently.

With h the difference is more sensible, because \xrightarrow extends the arrow a bit.

\documentclass{article}
\usepackage{amsmath,color}

\begin{document}

\makebox[0pt][l]{\color{red}$A\overset{i}{\to}B$}$A\xrightarrow{i}B$

\makebox[0pt][l]{\color{red}$A\xrightarrow{i}B$}$A\overset{i}{\to}B$

\makebox[0pt][l]{\color{red}$A\overset{h}{\to}B$}$A\xrightarrow{h}B$

\makebox[0pt][l]{\color{red}$A\xrightarrow{h}B$}$A\overset{h}{\to}B$

\end{document}

enter image description here

Note, however, that the height of the superscript is the same.

If you need horizontal alignment across lines, say for align or split, then \overset might be preferable, provided the superscript doesn't clash with the arrow.

Side note: avoid input such as \overset h\to. It's awkward to read and much less clearer than \overset{h}{\to}.

Related Question