[Tex/LaTex] How to write a two line function definition? (With domain/codomain on one line, and element/mapsto/element on the other.)


How can I write this to look as neat as this:

enter image description here

Edit: What I have tried so far

M_f : \pi_1(S \backslash \{y_1, \cdots, y_n\}, y) &\rightarrow& \text{Bij}(f^{-1}(y)) \\
\gamma &\mapsto& M_f(\gamma) = \sigma_\gamma^{-1}

which yields

enter image description here

This does not align nicely like the upper formula.

(BTW, how to get the better looking \pi in the first picture?)

Best Answer

Here are two possibilities (inline or not). Don't use eqnarray, which has bad horizontal spacing around the alignment points, and replace it with align* or aligned. Also, for set difference, use \(small)setminus:

\usepackage{amsmath, amssymb}


  M_f \colon \pi_1(S \smallsetminus \{y_1, \dots, y_n\}, y) & \longrightarrow \Bij(f^{-1}(y)) \\
  \gamma & \longmapsto M_f(\gamma) = \sigma_\gamma^{-1}

Or this:\medskip

Let $ S' =S \smallsetminus \{y_1, \dots, y_n\} $. Define
$ \begin{aligned}[t]
M_f \colon \pi_1(S', y) &\longrightarrow \Bij(f^{-1}(y)) \\
\gamma &\longmapsto M_f(\gamma) = \sigma_\gamma^{-1}
\end{aligned} $

enter image description here