The aim is to define `\overmapsto` which takes in an argument and produces a result similar to `amsmath`'s command `\overleftrightarrow` and friends. But, of course, the arrow type should be `\mapsto`.

> 
> for convenience: amsmath [documentation](https://www.texlive.info/CTAN/macros/latex/required/amsmath/amsldoc.pdf) and [code implementation](https://www.texlive.info/CTAN/macros/latex/required/amsmath/amsmath.pdf))
> 
> 
> 

---

I tried my best to define it on my own; but I do not know how to fix a certain spacing problem (to look better, and be automatic). And it doesn't stretch nicely. Here is the MWE; my attempt is called `\overmapsto` and is based on amsmath's code:

```
\documentclass[12pt]{article}
\usepackage{amsmath}

\newcommand{\ray}[1]{\overset{\mapsto}{#1}} % <- this is just \mapsto with \overset
\newcommand{\sline}[1]{\overleftrightarrow{#1}} %<- just a renaming of amsmath's \overleftrightarrow
\newcommand{\rline}[1]{\overrightarrow{#1}} %<- just a renaming of amsmath's \overrightarrow

%%vv my attempt vv%%

\makeatletter
\def\maptstoarrowfill@{\arrowfill@\relbar\relbar\mapsto}
\newcommand{\overmapsto}{%
\mathpalette{\overarrow@\maptstoarrowfill@}}
\makeatother

%%^^ my attempt ^^%%

\begin{document}

    ray: $\ray{r}$

    sline: $\sline{r}$

    rline: $\rline{r}$ (also ugly)

    -----------------

    ugly spacing: $\overmapsto{r}$

    better but not automatic: $\overmapsto{r\,}$

    doesn't stretch nicely: $\overmapsto{rrrrr}$

\end{document}

```

---

Here is the output:

[![output of MWE](https://i.stack.imgur.com/3ILd8.png)](https://i.stack.imgur.com/3ILd8.png)

---

As we can see, the `\mapsto` arrow in `\overmapsto` just *gets too close* to the argument, in this case the letter *r*. Also streching does not work: the vertical line is misplaced.

* ***Q:*** How would one improve the output? Perhaps center the argument a bit more (i.e move the `\mapsto` arrow to the right a teeny-veeny bit)? How to make it stretch correctly?

Notice that `amsmath`'s `\overrightarrow` suffers the same spacing problem as "my" `\overmapsto`, so I could not parrot my way into a better spacing.