[Tex/LaTex] Bijection, arrow position

positioning

How can I adjust the following arrows such that the arrow heads of longmapsto and longmapsfrom are in accordance with those ones of longleftrightarrow?

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}

\begin{document}

\begin{align*}
    A &\longleftrightarrow B\\
    a &\longmapsto b \\
    a &\longmapsfrom b
\end{align*}

\end{document}

I just want to place \longmapsto a little bit more to the right. The third arrow is in accordance with the first one, but the second arrow is not. I would like to try out a solution without changed arrow lengths. I just want the output almost as in my example, with the only difference that the second arrow should be positioned a little bit more to the right such that the arrow head is exactly below the arrow head above.

Alternatively, I can define

\begin{align*}
A \longleftrightarrow{}& B\\
a \longmapsto{}& b \\
a \longmapsfrom{}& b
\end{align*}

but then I get the roles interchanged. The second arrow is now in accordance with the first one, but the third is not.

How can I solve this problem?

Best Answer

The arrow heads are the same; the stems have different length, though.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}

\let\longleftrightarrow\relax % undefine the command to avoid a warning
\DeclareRobustCommand{\longleftrightarrow}{\leftarrow\bigjoinrel\rightarrow}
\newcommand\bigjoinrel{\mathrel{\mkern-7mu}}

\begin{document}

\begin{align*}
  A &\longleftrightarrow B\\
  a &\longmapsto b \\
  a &\longmapsfrom b
\end{align*}

\end{document}

enter image description here

A more refined definition, so that the difference in length is negligible also in subscripts/superscripts

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}

\let\longleftrightarrow\relax
\DeclareRobustCommand{\longleftrightarrow}{\leftarrow\bigjoinrel\rightarrow}
\newcommand\bigjoinrel{\mathrel{\mkern-6.78mu\nonscript\mkern-0.22mu}}

\begin{document}

\begin{align*}
  A &\longleftrightarrow B\\
  a &\longmapsto b \\
  a &\longmapsfrom b
\end{align*}

\end{document}

Alternatively, use some padding:

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}

\newcommand{\bijpad}{\mathrel{\mkern4mu}}

\begin{document}

\begin{align*}
  A &\longleftrightarrow B\\
  a &\longmapsto\bijpad b \\
  a &\bijpad\longmapsfrom b
\end{align*}

\end{document}

enter image description here