TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


% Tikz part
\tikzset{join/.code=\tikzset{after node path={%
edge[every join]#1(\tikzchaincurrent)\fi}}}
\tikzset{>=stealth',every on chain/.append style={join},
         every join/.style={->}}
\tikzstyle{labeled}=[execute at begin node=$\scriptstyle,
   execute at end node=$]
commutative diagrams/.cd,
arrow style=math font,
%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);}}



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)}\\


The result is: enter image description here

share|improve this question
The arrows should be declared by \mathrel, not \mathbin – egreg Oct 22 '12 at 21:16
I just substituted \mathbin by \mathrel: same result. – c.p. Oct 22 '12 at 21:23
Well, \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. – egreg Oct 22 '12 at 21:24
Though, I'm a loyal TikZ foot soldier, I think such a replacement is only justified if the arrows are unquestionably prettier than the usual ones since it will bring a large overhead (unless you protocol or use the basic layer drawing commands etc.) – percusse Oct 22 '12 at 23:08
To fix the height of the 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. – Peter Grill Oct 23 '12 at 1:03
up vote 1 down vote accepted

Does this help? I put together a composite \mapsto, by adding a vertical rule to a stealth arrow (outside of tikz) EDIT: Now it works in \scriptstyle

% See http://tex.stackexchange.com/questions/14386/importing-a-
%            single-symbol-from-a-different-font
% Setup the matha font (from mathabx.sty)
      <5> <6> <7> <8> <9> <10> gen * matha
      <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12

% Define a subset character from that font (from mathabx.dcl)
% to completely replace the \subset character, you can replace
% \varsubset with \subset



A \mapsto B \qquad A \newmapsto B \scriptstyle \qquad 
A \mapsto B \qquad A \newmapsto B

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.