17

How can I label $\rightleftarrows$ above the top arrow and below the bottom arrow?

doncherry
  • 54,637
j4fj49
  • 415

5 Answers5

20

I don't know which package defines \rightleftarrows but this shows how to get labels over and under one of the standard arrows.

Edit updated to use the requested arrow

\documentclass{article}

\usepackage{amssymb}

\begin{document}

\[a \mathrel{\mathop{\rightleftarrows}^{\mathrm{over}}_{\mathrm{under}}} b\]

\end{document}

enter image description here

David Carlisle
  • 757,742
  • 1
    That would be amssymb. – percusse Apr 08 '12 at 11:01
  • 1
    @percusse ah thanks I should have known that:-) updated answer – David Carlisle Apr 08 '12 at 11:10
  • Is there a way to this not in amssymb? Because my work is on Wordpress, and I either use their built-in Latex or mathurl.com, neither of which support amssymb I am sure. Sorry to trouble you. – j4fj49 Apr 08 '12 at 12:23
  • the code for the under and over label does not use any package at all, \mathrel and \mathop are primitives and \mathrm is standard LaTeZ (or you could use \rm in plain TeX) So if you can use the arrow in wordpress you should be able to use labels too. But you need something to define the arrow as it is not built in to latex. – David Carlisle Apr 08 '12 at 12:27
  • I guess that means that Wordpress supports some sort of package because that arrow showed up. – j4fj49 Apr 08 '12 at 12:31
  • It didn't parse, either with \mathrm or \rm. – j4fj49 Apr 08 '12 at 12:35
  • well it is correct TeX, so you must be using a non-Tex system, which makes it bordering being off topic for this site you might do better at http://wordpress.stackexchange.com/ – David Carlisle Apr 08 '12 at 12:48
  • 1
    In trying this, I see that it requires displaymath mode; using inline $...$ puts the super/subscripts after the operator. What is the reason for this; I thought displaymath mode just affected the spacing around the maths? – Stuart Rossiter Mar 04 '13 at 11:58
  • 1
    Using \stackrel instead does allow it to be used within inline maths, but obviously that won't allow the arrow, superscript and subscript (since \stackrel only supports a top and a bottom). – Stuart Rossiter Mar 04 '13 at 12:21
  • Just a side note. In order to display as expected in in-line math mode, don't forget to use \displaystyle before it. – Ahmed Nassar Jul 04 '16 at 00:06
  • @StuartRossiter Using the \overset{}-\underset{} approach explained here might do the trick, then. It did for me for another issue, at least. – Olivier Mar 03 '24 at 15:27
9

I found a simple solution that works for me:

A \overset{F}{\underset{G}\rightleftarrows} X 
j4fj49
  • 415
6

If you want an extensible arrow, you can use the trick found in Herber Voß's Mathmode (texdoc mathmode or http://texdoc.net/pkg/mathmode):

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand\xleftrightarrow[2][]{\ext@arrow 0099{\longleftrightarrowfill@}{#1}{#2}}
\def\longleftrightarrowfill@{\arrowfill@\leftarrow\relbar\rightarrow}
\makeatother
\begin{document}
$a\xleftrightarrow[under]{over}b$
\end{document}

enter image description here

doncherry
  • 54,637
egreg
  • 1,121,712
  • I added a link to texdoc.net because I didn't seem to be able to get Mathmode on my MiKTeX 2.9, hope that's alright. – doncherry Apr 08 '12 at 13:10
  • And congratulations to your answer No. 2000! I'll be lucky if I can keep my own rep to about a tenth of yours :) – doncherry Apr 08 '12 at 14:31
1

I experienced a similar problem and wasn't getting a satisfying answer. The problem is that the length of the arrows should "grow" with the text, or, at least, it should be possible to set the length manually. Finally, I found a solution for the last option (the first one not yet solved).

\stackrel[\mathrm{discharge}]{\mathrm{charge}}{\overrightarrow{\underleftarrow{\hspace{2cm}}}}

The 2 cm can be changed as needed, the word above the arrow are "charge" and below "discharge"

-2

You can also consider using \stackrel

\stackrel{\rm{1:1}}{\rightarrow}