\Mapsto in tikz-cd
I’ve taken a look at the \Mapsto
arrow from the stmaryrd
package which I have used as the model for the redefinition of the cm |
arrow that obeys a double
line.
The 3.3
value is approximated so that the vertical line is as wide as the implies
arrow (similar to how \Mapsto
looks). The original maps to
arrow as seen in the example has a rather short bar.
Code
\documentclass[tikz]{standalone}
\usepackage{tikz-cd}
\expandafter\let\csname pgf@arrow@code@cm |\endcsname\relax
\makeatletter
\pgfarrowsdeclare{cm |}{cm |}{%
\[email protected]\pgflinewidth
\ifdim\pgfinnerlinewidth>0pt\relax
\pgfmathaddtolength\pgfutil@tempdima{-.5*\pgfinnerlinewidth}%
\fi
\pgfarrowsleftextend{+-\pgfutil@tempdima}%
\pgfarrowsrightextend{+\pgfutil@tempdima}%
}{%
\ifdim\pgfinnerlinewidth=0pt\relax
\pgfutil@tempdima4\pgflinewidth
\else
\pgfutil@tempdima\pgflinewidth
\advance\pgfutil@tempdima-\pgfinnerlinewidth
\pgfsetlinewidth{\pgfutil@tempdima/2}%
\multiply\[email protected]\relax
\fi
\pgfsetdash{}{+0pt}%
\pgfsetroundcap
\pgfpathmoveto{\pgfqpoint{0pt}{-\pgfutil@tempdima}}%
\pgfpathlineto{\pgfqpoint{0pt}{\pgfutil@tempdima}}%
\pgfusepathqstroke
}
\makeatother
\pgfqkeys{/tikz/commutative diagrams}{
Maps to/.style={
/tikz/commutative diagrams/Rightarrow,
/tikz/commutative diagrams/maps to},
Maps from/.style={
/tikz/commutative diagrams/Leftarrow,
/utils/exec=\pgfsetarrowsend{cm |}}
}
\begin{document}
\begin{tikzcd}
M \rar[Maps from] \dar[maps to] & N \dar[Maps to] \\
M' \rar[Maps to] & N'
\end{tikzcd}
\end{document}
Output
As of version 0.9c (if not earlier), tikz-cd now provides a Mapsto
arrow.