# inclusion arrow in TikZ

How can I give shape to some arrow in tikz, to draw the inclusion arrow?

I read a similar question How to typeset inclusion arrow? with given answer, but the answer didn't really used tikz and I really need tikz in order to produce nice biggish diagrams.

For instance, in this diagram (taken from here ), I want, say, A to be included in A' :

\matrix (m) [matrix of math nodes, row sep=3em, column sep=3em]
{ 0 & A  & B  & C  & 0 \\
0 & A' & B' & C' & 0 \\ };
{ [start chain] \chainin (m-1-1);
\chainin (m-1-2);
{ [start branch=A] \chainin (m-2-2)
[join={node[right,labeled] {\eta_1}}];}
\chainin (m-1-3) [join={node[above,labeled] {\varphi}}];
{ [start branch=B] \chainin (m-2-3)
[join={node[right,labeled] {\eta_2}}];}
\chainin (m-1-4) [join={node[above,labeled] {\psi}}];
{ [start branch=C] \chainin (m-2-4)
[join={node[right,labeled] {\eta_3}}];}
\chainin (m-1-5); }
{ [start chain] \chainin (m-2-1);
\chainin (m-2-2);
\chainin (m-2-3) [join={node[above,labeled] {\varphi'}}];
\chainin (m-2-4) [join={node[above,labeled] {\psi'}}];
\chainin (m-2-5); }

-

For commutative diagrams I suggest using the tikz-cd package; it uses TikZ to facilitate the drawing of commutative diagrams (it has its own arrows library designed for diagrams and the arrow you are looking for is already buil-in); a little example with the requested inclusion (and some others just for illustration):

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}
0 \arrow[hookrightarrow]{r}
& A\arrow[hookrightarrow]{r}{\varphi}\arrow[hookrightarrow]{d}{\eta_1}
& B\arrow{r}{\psi}\arrow{d}{\eta_2}
& C\arrow{r}\arrow{d}{\eta_3}
& 0 \\
0 \arrow[hookrightarrow]{r}
& A'\arrow[hookrightarrow]{r}[swap]{\varphi'}
& B'\arrow{r}[swap]{\psi'}
& C'\arrow{r}
& 0
\end{tikzcd}
\end{document}


You can use the arrows library from TikZ, so for example, to use the -latex style from TikZ, you can say

\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{arrows}

\tikzset{
commutative diagrams/.cd,
arrow style=tikz,
diagrams={>=latex}}

\begin{document}

\begin{tikzcd}
0 \arrow[hookrightarrow]{r}
& A\arrow[hookrightarrow]{r}{\varphi}\arrow[hookrightarrow]{d}{\eta_1}
& B\arrow{r}{\psi}\arrow{d}{\eta_2}
& C\arrow{r}\arrow{d}{\eta_3}
& 0 \\
0 \arrow[hookrightarrow]{r}
& A'\arrow[hookrightarrow]{r}[swap]{\varphi'}
& B'\arrow{r}[swap]{\psi'}
& C'\arrow{r}
& 0
\end{tikzcd}
\end{document}


The above code changes the tip arrow style for all the diagrams, but you can select the -latex arrow tip just for some arrows (perhaps not really desirable to have two different arrow tips on the same diagram):

\arrow[hookrightarrow,-latex]{d}{\eta_1}

-
oh! thank you very much. This will help me a lot! the syntaxis looks like xymatrix. I like the most the other tips, e.g. with right hook-latex. How can I use those tips? –  c.p. Aug 26 '12 at 2:08
@JorgeCampos yes, the syntax is similar. Regarding the arrow tips, I updated my answer showing how to do it. –  Gonzalo Medina Aug 26 '12 at 2:19
Awsome...I'll definitely change to tkiz all diagrams I had already made in xymatrix! Thank you again. –  c.p. Aug 26 '12 at 16:57

You can use the right hook-latex , or right hook-> arrow (depending on the arrow type you want on the other side) from the arrows library:

## Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\draw [ultra thick, right hook-latex, red] (0, 0) -- (3, 0);
\draw [ultra thick, right hook->,    blue] (0,-1) -- (3,-1);
\end{tikzpicture}
\end{document}

-