# Left/right harpoon arrow with text?

I'd like a left/right harpoon arrow with text above the arrow.

This is the best I have so far, but I'd like the size of the arrow to be dynamic according to the text size.

\documentclass[12pt]{article}
\usepackage{amsmath, amssymb}
\usepackage{stackrel}
\newcommand{\lrhup}[2]{\ooalign{$#1\leftharpoonup$\cr$#1\rightharpoondown$\cr}}
\newcommand{\hpn}{\mathrel{\mathpalette\lrhup\relax}}
\begin{document}
$\stackrel{ABC}{\hpn}$
\end{document}


EDIT: I'm also interested in creating this double sided harpoon, but with fixed width, so "ABC" and "A" above the arrow would produce the same arrow, like the above example, but still somewhat wider.

• mathtools already comes with an extended version \xrightleftharpoons[...]{...}. There are two horizontal lines, though. If you just want one, maybe you could look up the definitions of these things and modify them. – user121799 Oct 5 '18 at 17:46

Here is an overlay from mathtools's extensible harpoons:

\documentclass{article}

\usepackage{mathtools}

\newcommand{\xlrharpoonud}[1]{
\mathrlap{\xleftharpoonup{\phantom{#1}}}%
\xrightharpoondown{#1}
}
\newcommand{\xlrharpoondu}[1]{
\mathrlap{\xleftharpoondown{\phantom{#1}}}%
\xrightharpoonup{#1}
}

\begin{document}

$\xlrharpoonud{abc}\ \xlrharpoondu{abc}\ \xlrharpoonud{\text{something}}\ \xlrharpoondu{\text{something else}}$

\end{document}

• Thanks! Do you perhaps know how to create the arrow with fixed width of my choosing? I'd like to put on the arrows, in some cases, $A$, $A'$, $A'''$, but not have different widths? I will indeed also use this solution, but with the pictures I'd like to have also fixed widths, but for text, variable is better! – Jake B. Oct 6 '18 at 16:02
• @JakeB.: Have a look at this paste. – Werner Oct 6 '18 at 16:45

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand\hpn[2][]{%
\ext@arrow 9999{\hpnfill@}{#1}{#2}}
\newcommand\hpnfill@{%
\arrowfill@\leftharpoonup\relbar\rightharpoondown}
\makeatother

\begin{document}

\begin{gather*}
F \hpn{A} G
\\
F \hpn{ABC} G
\\
F \hpn{\text{overlong text}} G
\\
F \hpn[q]{p} G
\\
F \hpn[q]{\text{overlong text}} G
\end{gather*}

\end{document}


Here is a solution, adapted from codes in mathmode § 38, Extensible Arrows, pp.78-79:

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\makeatletter%
\newcommand\xluprdownharpoon[2][]{%
\ext@arrow 0099{\luprdownharpoonfill@}{#1}{#2}}
\def\luprdownharpoonfill@{%
\arrowfill@\leftharpoonup\relbar\rightharpoondown}
\makeatother

\begin{document}

$\xluprdownharpoon[abcdef]{ABCD}$%

\end{document}