In a previous question Gonzalo Medina and Peter Grill gave a solution to replace the \to
arrow by an arrow generated by TikZ
.
For some people using TikZ in commutative diagrams, it would be perhaps desirable to uniformize the tips of some common arrows (\to
, \leftarrow
, \mapsto
,\rightsquigarrow
,etc.)
One can extend Peter Grill's solution in the question above (Gonzalo Medina's solution provides an arrow that resizes, but since arrows other than \to
are less commonly used in super- or subindices, here the simplest solution is used) to obtain a\leftarrow
as in the code show bellow. The problem is with the \mapsto
arrow, for I cannot produce it: its vertical part is too large, as shown in the picture bellow.
\documentclass{article}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
% Tikz part
%********************************************************************
\usepackage{tikz}
\usetikzlibrary{mindmap,trees}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}
\makeatletter
\tikzset{join/.code=\tikzset{after node path={%
\ifx\tikzchainprevious\pgfutil@empty\else(\tikzchainprevious)%
edge[every join]#1(\tikzchaincurrent)\fi}}}
\makeatother
%
\tikzset{>=stealth',every on chain/.append style={join},
every join/.style={->}}
\tikzstyle{labeled}=[execute at begin node=$\scriptstyle,
execute at end node=$]
\usepackage{tikz-cd}
\usetikzlibrary{arrows}
\tikzset{
commutative diagrams/.cd,
arrow style=math font,
diagrams={>=stealth}}
%*******************************************************
%redefining the arrows
%*******************************************************
\newcommand{\MyOt}[1][]{\mathbin{\tikz \draw [#1, stealth-] (0,0) (0,0.5ex) -- (1.0em,0.5ex);}}
\newcommand{\MyTo}[1][]{\mathbin{\tikz \draw [-stealth, #1] (0,0) (0,0.5ex) -- (1.0em,0.5ex);}}
\newcommand{\MyMapsto}[1][]{\mathbin{\tikz \draw [|-stealth, #1] (0,0) (0,0.5ex) -- (1.0em,0.5ex);}}
\let\OldTo\to
\let\OldOt\leftarrow
\let\OldMapsto\mapsto
\renewcommand{\to}{\MyTo}%
\renewcommand{\leftarrow}{\MyOt}
\renewcommand{\mapsto}{\MyMapsto}
\newcommand{\where}{\quad\mbox{where}\quad}
%**************************************************
\begin{document}
\begin{align*}
f: A\to B & \quad \rightsquigarrow \quad f^*:A^*\leftarrow B^*\where f^*:\phi \mapsto \phi\circ f\qquad&\mbox{(with TikZ)} \\
f: A\OldTo B &\quad \rightsquigarrow \quad f^*:A^*\OldOt B^* \!\!\where f^*:\phi \OldMapsto \phi\circ f\qquad &\mbox{(ordinary)}\\
\end{align*}
\end{document}
The result is:
\mathrel
, not\mathbin
\mathbin
by\mathrel
: same result.\mathrel
or\mathbin
influence the spacing around the arrows, not the arrows themselves. By the way, if I had to express a preference, I'd point to the second row.mapsto
, you could draw the vertical line yourself:\newcommand{\MyMapsto}[1][]{\mathbin{\tikz \draw [-stealth, cap=round, #1] (0,0) (0,0.97ex) -- (0,0.035ex) (0,0.50ex) -- (1.0em,0.50ex);}}
. Might still need some more tweaking of the vertical line though. I am not sure what you want to change regarding the\rightsquigarrow
.