13

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

3
  • 2
    \xrightarrow is extensible, in function of what is above the arrow (or under, with the optional argument).
    – Bernard
    Dec 26 '19 at 20:28
  • Try \xrightarrow{x\to0} versus \overset{x\to0}{\to} to see the difference.
    – egreg
    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
14

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

1
  • 1
    "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.
    – LSpice
    Dec 27 '19 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.