# How to write an arrow xdashmapsto?

This is a continuation of this question about arrows needed for birational geometry, with the same basic premise as this question about xdashrightarrow etc.

I need an arrow like xmapsto but with the mapsto arrow dashed. I currently have

\def\dashmapsto{\mapstochar\dashrightarrow}


which gives the dashmapsto arrow. I would love it if I could have a xdashmapsto to go with it.

Thanks for any help you can offer.

## 1 Answer

I just combined the two answers that you cite, using David's technique applied to Heiko's code. The credit goes to them. Here was my addition to Heiko's code:

\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}}}


The only twist was to remember to employ arguments in the same manner as employed by \xdashrightarrow.

\documentclass{article}
\usepackage{amsfonts}
\usepackage{amsmath}
\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}}}

\makeatletter
\newcommand*{\da@rightarrow}{\mathchar"0\hexnumber@\symAMSa 4B }
\newcommand*{\da@leftarrow}{\mathchar"0\hexnumber@\symAMSa 4C }
\newcommand*{\xdashrightarrow}[2][]{%
\mathrel{%
\mathpalette{\da@xarrow{#1}{#2}{}\da@rightarrow{\,}{}}{}%
}%
}
\newcommand{\xdashleftarrow}[2][]{%
\mathrel{%
\mathpalette{\da@xarrow{#1}{#2}\da@leftarrow{}{}{\,}}{}%
}%
}
\newcommand*{\da@xarrow}[7]{%
% #1: below
% #2: above
% #3: arrow left
% #4: arrow right
% #5: space left
% #6: space right
% #7: math style
\sbox0{$\ifx#7\scriptstyle\scriptscriptstyle\else\scriptstyle\fi#5#1#6\m@th$}%
\sbox2{$\ifx#7\scriptstyle\scriptscriptstyle\else\scriptstyle\fi#5#2#6\m@th$}%
\sbox4{$#7\dabar@\m@th$}%
\dimen@=\wd0 %
\ifdim\wd2 >\dimen@
\dimen@=\wd2 %
\fi
\count@=2 %
\def\da@bars{\dabar@\dabar@}%
\@whiledim\count@\wd4<\dimen@\do{%
\advance\count@\@ne
\expandafter\def\expandafter\da@bars\expandafter{%
\da@bars
\dabar@
}%
}%
\mathrel{#3}%
\mathrel{%
\mathop{\da@bars}\limits
\ifx\\#1\\%
\else
_{\copy0}%
\fi
\ifx\\#2\\%
\else
^{\copy2}%
\fi
}%
\mathrel{#4}%
}
\makeatother

\begin{document}

$X \xdashmapsto{x} Y \xdashmapsto{\mathrm{longer}} Z \xdashmapsto[\mathrm{underset}]{\mathrm{longer}} W$

\end{document}


If one finds the spacing after the arrow too great, it could be redefined with a small negative space as

\newcommand\xdashmapsto[2][]{\mathrel{\mapstochar\xdashrightarrow[#1]{#2}\!}}

• Ok that seems obvious now! Thanks very much. – campbellC Apr 23 '15 at 16:30