1

I want to to show a two-way relations between A and B, where the arrow from A to B should have some text on top of it, while the relation (arrow) from B back to A should have some text on its bottom.

Which symbols are available that could be used for that?

Werner
  • 603,163
Antonello
  • 235

4 Answers4

5

Some low level programming:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\rightleftarrows}[2]{%
  \mathrel{\mathop{%
    \vcenter{\offinterlineskip\m@th
      \ialign{\hfil##\hfil\cr
        \hphantom{$\scriptstyle\mspace{8mu}{#1}\mspace{8mu}$}\cr
        \rightarrowfill\cr
        \vrule height0pt width 2em\cr
        \leftarrowfill\cr
        \hphantom{$\scriptstyle\mspace{8mu}{#2}\mspace{8mu}$}\cr
        \noalign{\kern-0.3ex}
      }%
    }%
  }\limits^{#1}_{#2}}%
}
\makeatother

\begin{document}

\begin{gather*}
A\rightleftarrows{}{}B \\
A\rightleftarrows{f}{g}B \\
A\rightleftarrows{\text{top}}{\text{bottom}}B
\end{gather*}

\end{document}

The minimum width is 2em, set using the \vrule in the middle of the alignment. This won't scale in subscripts or superscripts, but such a complicated structure should not appear there.

enter image description here

egreg
  • 1,121,712
4

In case one prefers to use full arrows instead of harpoons, a new command \xrightleftarrows can be defined based on the command \xrightleftharpoons from mathtools.

\documentclass{article}
\usepackage{mathtools}

\makeatletter
\MHInternalSyntaxOn
\def\MT_leftarrow_fill:{%
  \arrowfill@\leftarrow\relbar\relbar}
\def\MT_rightarrow_fill:{%
  \arrowfill@\relbar\relbar\rightarrow}
\newcommand{\xrightleftarrows}[2][]{\mathrel{%
  \raise.55ex\hbox{%
    $\ext@arrow 0359\MT_rightarrow_fill:{\phantom{#1}}{#2}$}%
  \setbox0=\hbox{%
    $\ext@arrow 3095\MT_leftarrow_fill:{#1}{\phantom{#2}}$}%
  \kern-\wd0 \lower.55ex\box0}}
\MHInternalSyntaxOff
\makeatother

\begin{document}

\[
A \xrightleftarrows[\text{bottom}]{\text{top}} B
\]

\end{document}
Vincent
  • 20,157
3

I'd suggest using extensible harpoons:

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\[
  A \xleftrightharpoons[\text{bottom}]{\text{top}} B \qquad
  A \xrightleftharpoons[\text{bottom}]{\text{top}} B
\]

\end{document}
Werner
  • 603,163
3

Another suggestion using tikz-cd to make the same images of the other users related to your question. You can see my previous answer here: 1-1 correspondence in Category Theory.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
A \arrow[r,leftharpoonup, yshift=0.2ex, "\mathrm{up}"] \arrow[r,rightharpoondown, yshift=-0.2ex, "\mathrm{down}"']
& B ,\quad C \arrow[r, rightharpoonup, yshift=0.2ex, "\mathrm{up}"] \arrow[r,leftharpoondown, yshift=-0.2ex, "\mathrm{down}"']
& D 
\end{tikzcd}

\begin{tikzcd}
A \arrow[r,rightarrow, yshift=0.3ex, "\mathrm{up}"] \arrow[r,leftarrow, yshift=-0.3ex, "\mathrm{down}"']
& B ,\quad C \arrow[r, leftarrow, yshift=0.3ex, "\mathrm{up}"] \arrow[r,rightarrow, yshift=-0.3ex, "\mathrm{down}"']
& D 
\end{tikzcd}
\end{document}
Sebastiano
  • 54,118