Extend \mapsto to exhaust space between the column elements of a given table

\mapsto can be made into an extensible arrow in the same way that the \x...arrows are extended by amsmath, also drawing on the definition of \mapsto in plain.tex.

Here is an example, comparing it with \longmapsto as defined in plain.tex and provided natively by any LaTeX setup.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\xmapsto}[2][]{\mapstochar \ext@arrow 0359\rightarrowfill@{#1}{#2}}
\makeatother

\begin{document}
some text
\[
 x \overset{a very long modifier}{\longmapsto} y
\]
more text
\[
 x \xmapsto{a very long modifier} y
\]
more text

\end{document}

output of example code

To use it in a table as requested, the modifier can be replaced by an \hspace* and the whole expression buried in a \mathclap (defined in mathtools). This does require an explicit choice of the length but maybe someone else can adapt this to be more automatic.

Update:
As reminded by @Schrödinger's cat, \xmapsto already exists in mathtools, so it doesn't need to be redefined. (But I'll leave the definition since seeing how it's constructed might be found interesting by someone who likes to explore details.)


You can define \mapstofill in a similar way as \rightarrowfill.

I used array in order to reduce the number of $ symbols; this has the consequence that \mapstofill has to be between $ symbols so as to close math mode and to reopen it at the end.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareRobustCommand\mapstofill{%
  $\m@th
  {\mapstochar}%
  \smash-\mkern-7mu
  \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
  \mkern-7mu
  \mathord\rightarrow
  $%
}
\makeatother

\begin{document}

\[
\begin{array}{ccccc}
        & A(e_0,\dots,\widehat{e_i},\dots,e_p) &         & A(v_0,\dots,v_p)           \\
e_0     & $\mapstofill$                        & e_0     & $\mapstofill$    & v_0     \\
\vdots  & \vdots                               &         & \vdots                     \\
e_{i-1} & $\mapstofill$                        & e_{i-1} & $\mapstofill$    & v_{i-1} \\
e_i     & $\mapstofill$                        & e_{i+1} & $\mapstofill$    & v_{i+1} \\
\vdots  & \vdots                               &         & \vdots                     \\
e_{p-1} & $\mapstofill$                        & e_p     & $\mapstofill$    & v_p     \\
\end{array}
\]

\end{document}

enter image description here