# Bijection, arrow position

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?

• Do you mean the length of the stems? The arrow heads are the same. – egreg Sep 18 '17 at 15:04
• I mean that the arrow heads should be exactly one above the other. That means, longmapsto should be positioned such that its arrow head should be in the same horizontal position as the right arrow head of longleftrightarrow, and analogously for the other arrow. – Thrash Sep 18 '17 at 15:13

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}


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}


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

\begin{document}

\begin{align*}
A &\longleftrightarrow B\\
\end{align*}

\end{document}


• Is there a way without shortening the stem? – Thrash Sep 18 '17 at 15:17
• @Thrash By lengthening the stems in \longmapsto. – egreg Sep 18 '17 at 15:18
• And without lengthening? I just want to place \longmapsto a little bit more to the right, nothing more. – Thrash Sep 18 '17 at 15:19
• @Thrash I'm not seeing sense in that. – egreg Sep 18 '17 at 15:20
• In my example, the third arrow is in accordance with the first one, but the second arrow is not. – Thrash Sep 18 '17 at 15:21

Here is a simple way to align the right-hand side arrowheads. However I propose another solution, to centre \longmapsto/from w.r.t. \longleftrightarrow, which looks nicer, from my point of view:

\documentclass{article}
\usepackage{mathtools}
\usepackage{stmaryrd}
\usepackage{old-arrows}
\usepackage{makebox}

\newcommand{\centredlmapsto}{ \mathrel{\makebox*{$\longleftrightarrow$}{$\longmapsto$}}}
\newcommand{\centredlmapsfrom}{ \mathrel{\makebox*{$\longleftrightarrow$}{$\longmapsfrom$}}}

\begin{document}

\begin{alignat*}{2}
A & \longleftrightarrow B & \qquad A & \longleftrightarrow B \\
a & \:\longmapsto b & a & \centredlmapsto b \\
a & \longmapsfrom\: b & a & \centredlmapsfrom b
\end{alignat*}

\end{document} [![enter image description here][1]][1]

• Okay, but in the left part the bs are not well adjusted. But one can use \begin{alignat*}{2} A &\longleftrightarrow{}&& B\\ a &\:\longmapsto&& b \\ a &\longmapsfrom&& b \end{alignat*} – Thrash Sep 18 '17 at 17:50
• @Thrash: Right. I didn't even think of checking this alignment, as I focused on the arrows alignments. It's enough to add a \: before the b in the last row. Pleasesee the modified code and result. – Bernard Sep 18 '17 at 17:58
• Thanks! So the most easiest way (for non-centering) would be \begin{align} A & \longleftrightarrow B \\ a & \:\longmapsto b \\ a & \longmapsfrom\: b \end{align} – Thrash Sep 18 '17 at 18:01

Thanks to @egreg I've found a solution.

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

\begin{document}

\begin{alignat*}{2}
A &\longleftrightarrow{}&& B\\
% a &\:\longmapsto&& b \\ % alternatively
a &\longmapsfrom&& b
\end{alignat*}

\end{document}


It seems that \newcommand{\bijpad}{\mathrel{\mkern4mu}} is not necessary. Instead one can simply add \: before \longmapsto.

Probably the easiest way:

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

• What's the purpose of repeating the same solution I gave? – egreg Sep 18 '17 at 17:35
• That's not your solution, but based on yours, a modification. You didn't use alignat. I had to use it so that the terms/variables beside the arrows are well positioned above each other. – Thrash Sep 18 '17 at 17:38