# [Tex/LaTex] Dynamically size arrow \mapsto in function definition

horizontal alignmentmath-modesymbols

I have the following diagram:

However, this looks a bit ugly, I would like a version that looks a little bit better. For example, size the last arrow such that the T_\phi is moved to the right.

This is the code which I am using to do this:

\begin{align*}
\xi \colon &\lb \to \mathcal{L}(\hh)\\
&\phi \mapsto T_\phi.
\end{align*}


Where \lb and \hh just give the names for those spaces. Does anybody have a suggestion how I would improve the look of this function definition?

Personaly, I think it is better to use:

\begin{align*}
\xi \colon L^\infty(T) &\to \mathcal{L}(H^2)\\
\phi &\mapsto T_\phi.
\end{align*}


Anyway, you can obtain what you want through

\documentclass{article}

\usepackage{amsmath}

\newcommand\phantomarrow[2]{%
\setbox0=\hbox{$\displaystyle #1\to$}%
\hbox to \wd0{%
$#2\mapstochar \cleaders\hbox{$\mkern-1mu\relbar\mkern-3mu$}\hfill \mkern-7mu\rightarrow$}%
\,}

\begin{document}

\begin{align*}
\xi \colon &L^\infty(T) \to \mathcal{L}(H^2)\\
&\phantomarrow{L^\infty(T)}{\phi} T_\phi.
\end{align*}

\end{document}