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

equations

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

enter image description here

Edit: What I have tried so far

\begin{eqnarray*}
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}
\end{eqnarray*}

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:

\documentclass{article}
\usepackage{amsmath, amssymb}
\DeclareMathOperator\Bij{Bij}

\begin{document}

\begin{align*}
  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}
\end{align*}

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} $
\end{document} 

enter image description here