5

What is the best way of typing an equation like this? enter image description here

(The vertical red lines indicate three different alignment axes.)

I have tried the following:

\begin{alignat*}{3}
    \phi: Z^{X \times Y} &\to (Z^Y)^X\\
                   f     &\mapsto \phi(f): X &&\to Z^Y\\
                                           x &&\mapsto \phi(f)(x): Y &&&\to Z\\ 
                                                                    y &&&\mapsto \phi(f)(x)(y) = f(x,y)
\end{alignat*}

But it doesn't work well.

Moriambar
  • 11,466
João Alves Jr.
  • 261
  • 1
  • 8

2 Answers2

6

Here's with alignat and a small trick with mathtools. The codomain of the top map is too wide, so we suppress its width in order to keep the alignment.

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\begin{alignat*}{3}
\phi\colon Z^{X \times Y} &\to \mathrlap{(Z^Y)^X}\\
                    f     &\mapsto \phi(f)\colon &X &\to Z^Y\\
                          &                      &x &\mapsto \phi(f)(x)\colon &Y &\to Z\\ 
                          &                      &  &                         &y &\mapsto \phi(f)(x)(y) = f(x,y)
\end{alignat*}
\end{document}

enter image description here

David Carlisle
  • 757,742
egreg
  • 1,121,712
3

If a brute-force is acceptable...

\documentclass{article}

\begin{document}

\[\arraycolsep0.1667em
\begin{array}{rlll}
 \phi: Z^{X \times Y} &\to (Z^Y)^X&&\\ 
f &\mapsto \phi(f): X &\to Z^Y&\\ 
&\multicolumn{1}{r}{x} &\mapsto \phi(f)(x): Y &\to Z\\ 
&&\multicolumn{1}{r}{y} &\mapsto \phi(f)(x)(y) = f(x,y) 
\end{array}
\]

\end{document} 

enter image description here