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

### References:

http://elevatorlady.ca/doc/refcard/expressions.html