0

I wish to write the composition of two maps in a single equation. Since there are multiple places to be aligned, I tried with alignat, but cannot get the align points correct. Below is my current result, as you can see, there is some empty space before the second \to arrow. How can I get the alignment correct?

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
    \begin{alignedat}{2}
        \text{something} &\to \text{some other thing} &&\to \text{something else}\\
        x &\mapsto y & a &\mapsto b
    \end{alignedat}
\]
\end{document}

enter image description here

2
  • it isn't clear what you want. the space is from the a on the 2nd row. Your arrow chains have no natural alignment: the first row only has one item between the arrows, the second row has two (y and a) Oct 6, 2022 at 16:53
  • @DavidCarlisle I would like the two elements between the two \mapsto arrows in the second row two be aligned on the left and right, respectively. Now I'm doing this by adding a & between them, but as you said, this would leave an empty space for the a in the first row.
    – Jinwen
    Oct 6, 2022 at 17:20

2 Answers 2

0

You could do this, although beware it may over-print without warning if the first row item is not sufficiently long.

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
    \begin{alignedat}{2}
        \text{something} &\to \text{some other thing} &&\to \text{something else}\\
        x &\mapsto y   &&\mathllap{a}\mapsto b
    \end{alignedat}
\]
\end{document}
0

You can use IEEEeqnarray (fixing a small glitch).

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}

\begin{document}

\begin{IEEEeqnarray*}{r C l r C l}
\text{something} & \to &
  \IEEEeqnarraymulticol{2}{c}{\text{some other thing}\mkern-\thickmuskip} & \to &
  \text{something else} \\
x & \mapsto & y & \mathrm{g} & \mapsto & b
\end{IEEEeqnarray*}

\end{document}

I used \mathrm{g} to show that there is the right alignment, with the fix.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .