Text above and below of arrow in LaTeX

In this tutorial, I will show you how to get text above and below an arrow. I will show you different types of arrows with different packages.

Text above and below of right arrow

To get text above and below a right arrow you can use the \xrightarrow command provided by the mathtools package. You have to use like.

\xrightarrow[<below-text>]{<above-text>}

Multiple packages provide commands to get text above and below different types of right arrows. I listed all of them.

PackageCommandOutput
mathtools\xrightarrow[b]{a}\xrightarrow[b]{a}
mathtools\xhookrightarrow[b]{a}\xhookrightarrow[b]{a}
mathtools\xmapsto[b]{a}\xmapsto[b]{a}
chemarrow\autorightarrow{a}{b}\autorightarrow{a}{b}
extarrows\xlongrightarrow[b]{a}\xlongrightarrow[b]{a}
extpfeil\xtwoheadrightarrow[b]{a}\xtwoheadrightarrow[b]{a}
extpfeil\xmapsto[b]{a}\xmapsto[b]{a}
\documentclass{article}
\usepackage{mathtools}
\usepackage{chemarrow}
\usepackage{extpfeil}
\begin{document}

$$ \xrightarrow[\text{xyz}]{\text{abc}} $$

$$ 	\autorightarrow{abc}{xyz} $$

$$ \xhookrightarrow[\text{xyz}]{\text{abc}} $$

$$ \xtwoheadrightarrow[\text{xyz}]{\text{abc}} $$

\end{document}

Output:
Text above and below of right arrow symbol

Text above and below of left arrow

The mathtools package also provides a \xleftarrow command to get a left arrow symbol. In order to get the text above and below a left arrow symbol, you have to use this.

\xleftarrow[<below-text>]{<above-text>}

Here all the left arrow symbols are with different packages.

PackageCommandOutput
mathtools\xleftarrow[b]{a}\xleftarrow[b]{a}
mathtools\xhookleftarrow[b]{a}\xhookleftarrow[b]{a}
chemarrow\autoleftarrow{a}{b}\autoleftarrow{a}{b}
extarrows\xlongleftarrow[b]{a}\xlongleftarrow[b]{a}
extpfeil\xtwoheadleftarrow[b]{a}\xtwoheadleftarrow[b]{a}
\documentclass{article}
\usepackage{mathtools}
\usepackage{chemarrow}
\usepackage{extpfeil}
\begin{document}

$$ \xleftarrow[\text{xyz}]{\text{abc}} $$

$$ 	\autoleftarrow{abc}{xyz} $$

$$ \xhookleftarrow[\text{xyz}]{\text{abc}} $$

$$ \xtwoheadleftarrow[\text{xyz}]{\text{abc}} $$

\end{document}

Output:

Text above and below of left arrow symbol.

Text above and below of left-right arrow

You can use the \xleftrightarrow command provided by mathtools or you can use the \xlongleftrightarrow command provided by the extarrows packages.

\documentclass{article}
\usepackage{mathtools}
\usepackage{extarrows}
\begin{document}

$$ \verb|\xleftrightarrow[\text{xyz}]{\text{abc}}|\rightarrow\; \xleftrightarrow[\text{xyz}]{\text{abc}} $$

$$ \verb|\xlongleftrightarrow[\text{xyz}]{\text{abc}}|\rightarrow\; \xlongleftrightarrow[\text{xyz}]{\text{abc}} $$

\end{document}

Output:

Text above and below of left-right arrow symbol.

Text above and below of double arrow

Multiple packages provide commands to get different types of double arrow symbols. You will get them in the table below.

PackageCommandOutput
mathtools\xRightarrow[b]{a}\xRightarrow[b]{a}
mathtools\xLeftarrow[b]{a}\xLeftarrow[b]{a}
mathtools\xLeftrightarrow[b]{a}\xLeftrightarrow[b]{a}
extarrows\xLongrightarrow[b]{a}\xLongrightarrow[b]{a}
extarrows\xLongleftarrow[b]{a}\xLongleftarrow[b]{a}
extarrows\xLongleftrightarrow[b]{a}\xLongleftrightarrow[b]{a}
\documentclass{article}
\usepackage{mathtools}
\usepackage{extarrows}
\begin{document}

$$ \xRightarrow[\text{xyz}]{\text{abc}} \quad \xLeftarrow[\text{xyz}]{\text{abc}} \quad \xLeftrightarrow[\text{xyz}]{\text{abc}} $$

$$ \xLongrightarrow[\text{xyz}]{\text{abc}} \quad \xLongleftarrow[\text{xyz}]{\text{abc}} \quad \xLongleftrightarrow[\text{xyz}]{\text{abc}} $$

\end{document}

Output:

Text above and below of double arrow symbol.

Text above and below of harpoon arrow

PackageCommandOutput
mathtools\xleftrightharpoons[xy]{ab}\xleftrightharpoons[xy]{ab}
mathtools\xrightleftharpoons[xy]{ab}\xrightleftharpoons[xy]{ab}
mathtools\xrightharpoonup[xy]{ab}\xrightharpoonup[xy]{ab}
mathtools\xleftharpoonup[xy]{ab}\xleftharpoonup[xy]{ab}
mathtools\xrightharpoondown[xy]{ab}\xrightharpoondown[xy]{ab}
mathtools\xleftharpoonup[xy]{ab}\xleftharpoonup[xy]{ab}
chemarrow\autoleftrightharpoons{ab}{xy}\autoleftrightharpoons{ab}{xy}
chemarrow\autorightleftharpoons{ab}{xy}\autorightleftharpoons{ab}{xy}
\documentclass{article}
\usepackage{mathtools}
\usepackage{chemarrow}
\begin{document}

  $$ \xleftrightharpoons[\text{xyz}]{\text{abc}} \quad \xrightleftharpoons[\text{xyz}]{\text{abc}} $$
  
  $$ \autoleftrightharpoons{abc}{xyz} \quad \autorightleftharpoons{abc}{xyz} $$

\end{document}

Output:

Text above and below a harpoon arrow.

Leave a Reply

Your email address will not be published. Required fields are marked *