Archive for April, 2010

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
\Leftarrow \Leftarrow
\rightarrow \rightarrow
\Rightarrow \Rightarrow
\leftrightarrow \leftrightarrow
\Leftrightarrow \Leftrightarrow
\longleftarrow \longleftarrow
\Longleftarrow \Longleftarrow
\longrightarrow \longrightarrow
\Longrightarrow \Longrightarrow
\longleftrightarrow \longleftrightarrow
\Longleftrightarrow \Longleftrightarrow
\leadsto \leadsto
\implies \implies
\iff \iff
\to \to
\gets \gets

Generic stacking commands

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

  1. \stackrel{top}{bottom}: stack top (script style) over bottom. Example:
    a\stackrel{\epsilon}{\longrightarrow}b gives a\stackrel{\epsilon}{\longrightarrow}b
    but a\stackrel{\rm{this is very long text}}{\longrightarrow}b gives a\stackrel{\text{this is very long text}}{\longrightarrow}b which is not what we want.
  2. Using \overset{top}{main-symbol} and \underset{bottom}{main-symbol}: examples
    a\overset{x}{\longrightarrow}b gives a\overset{x}{\longrightarrow}b
    a\underset{x}{\longrightarrow}b gives a\underset{x}{\longrightarrow}b
    but a\overset{\text{this is very long text}}{\longrightarrow}b gives ugly result a\overset{\text{this is very long text}}{\longrightarrow}b.
  3. 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{\epsilon}b

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

Another use of these commands

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




Read Full Post »