One common composition in typesetting mathematical formulas in LaTeX is stacking mathematical symbols, sometimes quite long, over an arrow. Standard LaTeX provides several commands for this purpose, however sometimes they do not satisfy our need, especially when we typeset long arrows. In this post, I will review several commands that will help you to typeset all kinds of math-symbol-over-arrows.

It is assumed that the *amsmath* package is included.

### Typeset arrows in LaTeX

Most types of arrows are provided in LaTeX. The most commonly used are summarized in the following table.

\leftarrow | |

\Leftarrow | |

\rightarrow | |

\Rightarrow | |

\leftrightarrow | |

\Leftrightarrow | |

\longleftarrow | |

\Longleftarrow | |

\longrightarrow | |

\Longrightarrow | |

\longleftrightarrow | |

\Longleftrightarrow | |

\leadsto | |

\implies | |

\iff | |

\to | |

\gets |

### Generic stacking commands

To stack mathematical symbols over or under other mathematical symbols, not necessarily arrows, you can use the following commands.

- \stackrel{top}{bottom}: stack top (script style) over bottom. Example:

a\stackrel{\epsilon}{\longrightarrow}b gives

but a\stackrel{\rm{this is very long text}}{\longrightarrow}b gives which is not what we want. - Using \overset{top}{main-symbol} and \underset{bottom}{main-symbol}: examples

a\overset{x}{\longrightarrow}b gives

a\underset{x}{\longrightarrow}b gives

but a\overset{\text{this is very long text}}{\longrightarrow}b gives ugly result . - Using \mathop{main-symbol}_{bottom}^{top} to typeset mathematical operators with top and bottom symbols. Example:

a\mathop{\sum\sum\sum}_{a=\frac12}^{\text{some text}}b gives

a\mathop{\longrightarrow}^{\epsilon}b gives

but a\mathop{\longrightarrow}^{\text{this is very long text}}b gives

.

### Stack mathematical symbols over sizable arrows

When the top or bottom symbols are too long, the above commands give unsatisfying results. Amsmath provides two commands to typeset sizable arrows, i.e. arrows whose lengths extend to the lengths of the top and/or bottom matters. These commands are \xleftarrow[bottom]{top} and \xrightarrow[bottom]{top}. Examples:

a\xrightarrow[\alpha]{\epsilon}b gives

a\xrightarrow{\text{This is very long text}}b gives

Another use of these commands

a\xrightarrow{\hspace*{3cm}}b gives

on September 6, 2010 at 8:45 am |AnonThank you – awesome 🙂 Had very hard time finding \xrightarrow until I found this page ! Thanks again..

on May 7, 2011 at 7:47 pm |Luigi MorinoYou have been very helpful

I have been using \stackrel to write “above”.

I was missing something to work below

I did not know the existence of \underset

I used it: it worked

Thank you

Luigi Morino

on September 2, 2011 at 11:57 pm |Tips & Troubles with Thesis II « Beleaguered Apprentice[…] reading this blog post, I feel like I can stack anything above/below an […]

on June 4, 2012 at 7:16 pm |ChrisThanks, your post was helpful to me! I was looking for a nice way to have a \stackrel with descriptions above and below the relation…