5

I'm looking for a fat arrow, where I can write stuff above and below the arrow like with \xRightarrow[x]{y}, but I would like the arrow to be dashed like with \dashrightarrow like so:

Dashed arrow

I can't seem to find anything like this in any package.

EDIT (MWE):

\documentclass{article}
\usepackage{mathtools}

\begin{document}
I would love to have dashed lines on the following arrow:
$\xRightarrow[x]{y}$
\end{document}

1 Answers1

4

One way to get the symbol you want is to take a look at how mathtools creates any of those arrows.

For example, \xRightarrow is defined as

\providecommand*\xRightarrow[2][]{%
  \ext@arrow 0055{\Rightarrowfill@}{#1}{#2}}

amsmath defines \Rightarrowfill@ to produce a \cleaders with overlapping boxes.

Since we want space between them rather than overlapping, this approach doesn't quite work. Instead, we can modify the definition to use \xleaders and some positive space.

Here's a small suite of dashed, extensible arrows.

\usepackage{amsmath}
\usepackage{mathtools}

\makeatletter
\def\dasharrowfill@#1#2#3#4{%
        $\m@th
        \thickmuskip0mu
        \medmuskip\thickmuskip
        \thinmuskip\thickmuskip
        \relax
        #4#1\mkern2mu
        \xleaders\hbox{$#4\mkern2mu#2\mkern2mu$}\hfill
        \mkern2mu
        #3$%
}

\def\dashleftarrowfill@{\dasharrowfill@\leftarrow\relbar\relbar}
\def\dashrightarrowfill@{\dasharrowfill@\relbar\relbar\rightarrow}
\def\dashleftrightarrowfill@{\dasharrowfill@\leftarrow\relbar\rightarrow}
\def\dashLeftarrowfill@{\dasharrowfill@\Leftarrow\Relbar\Relbar}
\def\dashRightarrowfill@{\dasharrowfill@\Relbar\Relbar\Rightarrow}
\def\dashLeftrightarrowfill@{\dasharrowfill@\Leftarrow\Relbar\Rightarrow}

\providecommand*\xdashleftarrow[2][]{%
  \ext@arrow 0055{\dashleftarrowfill@}{#1}{#2}}
\providecommand*\xdashrightarrow[2][]{%
  \ext@arrow 0055{\dashrightarrowfill@}{#1}{#2}}
\providecommand*\xdashleftrightarrow[2][]{%
  \ext@arrow 0055{\dashleftrightarrowfill@}{#1}{#2}}
\providecommand*\xdashLeftarrow[2][]{%
  \ext@arrow 0055{\dashLeftarrowfill@}{#1}{#2}}
\providecommand*\xdashRightarrow[2][]{%
  \ext@arrow 0055{\dashRightarrowfill@}{#1}{#2}}
\providecommand*\xdashLeftrightarrow[2][]{%
  \ext@arrow 0055{\dashLeftrightarrowfill@}{#1}{#2}}
\makeatother

You can use them as normal. E.g., \xdashRightarrow[subscript]{superscript}.

enter image description here

The major downside to using \xleaders is the space between the boxes that make up the arrows will be spread evenly between them. Thus the dashing is inconsistent.

enter image description here

One solution would be to constrain the subscripts and superscripts to have an integral number of boxes necessary to make up the \xleaders, potentially by producing a modification of \ext@arrow.

TH.
  • 62,639