# Difference between \xrightarrow and \overset\to

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.)

• \xrightarrow is extensible, in function of what is above the arrow (or under, with the optional argument). Dec 26 '19 at 20:28
• Try \xrightarrow{x\to0} versus \overset{x\to0}{\to} to see the difference. Dec 26 '19 at 20:34
• OK, yes, I know that \xrightarrow gets longer while \to does not. I guess I was asking about other differences. Will edit the question. Dec 26 '19 at 20:39

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}


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}.

• "Awkward to read" is very much a matter of opinion, I think. I find that blizzards of {}s in TeX make it harder to read, not easier. Dec 27 '19 at 19:27