[Tex/LaTex] Long Dashed Right Arrow

amsmatharrows

Is there a

\dashrightarrow

equivalent of:

\xrightarrow{\hspace*{4mm}} or \longrightarrow 

or a similar way to fudge it?

Best Answer

Here is an option:

enter image description here

\documentclass{article}

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\makeatletter
\newcommand{\xleftrightarrow}[2][]{\ext@arrow 3359\leftrightarrowfill@{#1}{#2}}
\newcommand{\xdashrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@@{#1}{#2}}
\newcommand{\xdashleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@@{#1}{#2}}
\newcommand{\xdashleftrightarrow}[2][]{\ext@arrow 3359\leftrightarrowfill@@{#1}{#2}}
\def\rightarrowfill@@{\arrowfill@@\relax\relbar\rightarrow}
\def\leftarrowfill@@{\arrowfill@@\leftarrow\relbar\relax}
\def\leftrightarrowfill@@{\arrowfill@@\leftarrow\relbar\rightarrow}
\def\arrowfill@@#1#2#3#4{%
  $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip
   \relax#4#1
   \xleaders\hbox{$#4#2$}\hfill
   #3$%
}
\makeatother

\begin{document}
$A \xrightarrow{\text{something}} B$

$A \xdashrightarrow{\text{something}} B$

$A \xleftarrow{\text{something}} B$

$A \xdashleftarrow{\text{something}} B$

$A \xleftrightarrow{\text{something}} B$

$A \xdashleftrightarrow{\text{something}} B$

\end{document}

The above defines a new \arrowfill@@ style (analogous to the original \arrowfill@ already defined by amsmath. The new style removes any negative \mkern between elements used to build the extensible arrow. Also, instead of \cleaders, it uses \xleaders to spread out the dashes as best possible (see Want to fill line with repeating string).

Strange, by amsmath does not define \xleftrightarrow, even though it provides a fill for the arrow through leftrightarrowfill@...

Related Question