# [Tex/LaTex] Define a function

math-mode

Is it correct to define a function as follows?

 \documentclass[12pt,a4paper]{report}
\usepackage{mathtools, nccmath}
\usepackage{amssymb, amsthm, mathrsfs}

\begin{document}

\begin{align*}
\psi\colon&\mathbf{G}(p+q,d)\longrightarrow\mathbf{G}(q,d)\times \mathbf{G}(p,d)\\
&\phantom{+++++}g\mapsto\left(\psi_1(g),\psi_2(g)\right),
\end{align*}
with $\psi_1(g)(j)=g(j)$ for all $1\leq j\leq q$ and $\psi_2(g) (j)=g(j+q)$
for all $1\leq j\leq p$.
\end{document}


I obtain

You should set the alignment point at the arrow and use \longmapsto.

However, I find much better to use \rightarrow and \mapsto.

\documentclass[12pt,a4paper]{report}
\usepackage{mathtools, nccmath}
\usepackage{amssymb, amsthm, mathrsfs}

\begin{document}

\begin{align*}
\psi\colon \mathbf{G}(p+q,d) & \longrightarrow\mathbf{G}(q,d)\times \mathbf{G}(p,d)\\
g&\longmapsto (\psi_1(g),\psi_2(g)),
\end{align*}
with $\psi_1(g)(j)=g(j)$ for all $1\leq j\leq q$ and $\psi_2(g) (j)=g(j+q)$
for all $1\leq j\leq p$.

\begin{align*}
\psi\colon \mathbf{G}(p+q,d) & \rightarrow\mathbf{G}(q,d)\times \mathbf{G}(p,d)\\
g&\mapsto (\psi_1(g),\psi_2(g)),
\end{align*}
with $\psi_1(g)(j)=g(j)$ for all $1\leq j\leq q$ and $\psi_2(g) (j)=g(j+q)$
for all $1\leq j\leq p$.

\end{document}