# Function definition diagram

I'm wondering if it exists a canonical/natural/smooth/economical way of drawing such a diagram for the definition of a function. The best I managed to do with tikz and align is very poor. I'm a beginner with Latex, hence I apologize in advance in case the question had a trivial answer.

Welcome to TeX.SE! If you want just this alignment, you only need an array.

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathrsfs}
\begin{document}
$\begin{array}{ccc} \mathscr{A}(B,C)\times\mathscr{A}(A,B) & \to & \mathscr{A}(A,C)\;,\\ (g,f) & \mapsto & g\circ f\;, \end{array}$
\end{document} Here is a solution based on align* and eqparbox. I added two variants which look nicer, from my point of view. The last one doesn't require eqparbox:

    \documentclass{article}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[M]{\eqmakebox[#1]{$\displaystyle#2$}}

\begin{document}

\begin{align*}
\eqmathbox{\mathscr{A}(B,C)\times\mathscr{A}(A,B)} & \longrightarrow \eqmathbox[R]{\mathscr{A}(A,C)}\;,\\
\eqmathbox{(g,f)} & \longmapsto \eqmathbox[R]{g\circ f}\;,
\end{align*}

\begin{align*}
\mathscr{A}(B,C)\times \eqmathbox[L]{\mathscr{A}(A,B)} & \longrightarrow \eqmathbox[R]{\mathscr{A}(A,C)}\;,\\
\eqmathbox[L]{(g,f)} & \longmapsto \eqmathbox[R]{g\circ f}\;,
\end{align*}

\begin{align*}
\mathscr{A}(B,C)\times\mathscr{A}(A,B) & \longrightarrow \mathscr{A} (A,C)\;,\\
(g,f) & \longmapsto g\circ f\;,
\end{align*}

\end{document} 