I would like a double-headed extensible right-arrow similar to \xrightarrow from amsmath.

I tried using \xtwoheadrightarrow from extpfeil, but the result differs from \xrightarrow in three respects:

• the arrow head has a different style
• the arrow itself is longer than I would like it
• the text above the arrow is too high

What's the most straightforward way of achieving a two-headed version of \xrightarrow?

\documentclass{article}
\usepackage{extpfeil}

\begin{document}
\begin{align*}
& \xrightarrow{ABCD} \\
\end{align*}
\end{document}


I'd typeset \xrightarrow, back up a little and add \rightarrow:

\documentclass{article}
\usepackage{amsmath,amssymb}

\newcommand{\rightarrowdbl}{\rightarrow\mathrel{\mkern-14mu}\rightarrow}

\newcommand{\xrightarrowdbl}[2][]{%
\xrightarrow[#1]{#2}\mathrel{\mkern-14mu}\rightarrow
}

\begin{document}
$A \rightarrowdbl B$

$A \xrightarrow[\beta]{\alpha} B$

$A \xrightarrowdbl[\beta]{\alpha} B$

$A \xrightarrowdbl{\text{overlong text}} B$
\end{document}


Same principle as in egreg's answer, only using the low level command \ooalign to place the arrows.

\documentclass{article}
\usepackage{amsmath,amssymb}

\newcommand\dhrightarrow{%
\mathrel{\ooalign{$\rightarrow$\cr%
$\mkern3.5mu\rightarrow$}}
}

\newcommand\dhxrightarrow[2][]{%
\mathrel{\ooalign{$\xrightarrow[#1\mkern4mu]{#2\mkern4mu}$\cr%
\hidewidth$\rightarrow\mkern4mu$}}
}

\begin{document}
\begin{alignat*}{3}
A \rightarrow B    &&\qquad A \xrightarrow[C]{D} B    &&\qquad A \xrightarrow{\text{long text}} B    & \\
A \dhrightarrow B  &&\qquad A \dhxrightarrow[C]{D} B  &&\qquad A \dhxrightarrow{\text{long text}} B  &
\end{alignat*}
\end{document}


• I think I fractionally prefer this answer, as the text seems to be centered with respect the arrow as a whole. Thanks. – Roly Aug 9 '15 at 20:09
• Apologies, I've changed my mind (again) and after some experimentation prefer the positioning of the text in @egreg's answer. – Roly Aug 9 '15 at 20:27
• @Roly Thanks for pointing out the issue with text placement. I've implemented a fix, so that the text is placed correctly above and below the arrow, as well as corrected the spacing before and after the arrows. – sodd Aug 9 '15 at 20:42
• Actually it wasn't obvious to me that there was a problem (I preferred yours originally) but after some experimentation I realised it makes more sense for the text to be centred along the arrow shaft. Thanks. Both answers are good. – Roly Aug 9 '15 at 20:44