Labeling arrows with tikzpicture

I'm having trouble labelling the arrows. This is my code:

\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,minimum width=2em] {
\underleftarrow{lim}A_{i} &  \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge (m-2-1) []
edge (m-2-2)
(m-2-1.east|-m-2-2) edge  (m-2-2);

\end{tikzpicture}


How can I label the arrows?

Thank you.

Use the powerful tikz-cd package:

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

\begin{document}

$\begin{tikzcd} \varprojlim A_i \arrow[d,swap,"\pi_j"] \arrow[dr,"\pi_k"] \\ A_j \arrow[r,swap,"\alpha_j^k"] & A_k \end{tikzcd}$

\end{document}


By default, the label is placed on the left of the arrow (like left and right of a river are defined). With swap you exchange side.

You want to put something below the lim operator with its arrow? Then it can/should be done in the math expression, \mathop turns the \underleftarrow expression to a math operator again:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\mathop{\underleftarrow{lim}}\limits_{\text{label}}A_{i} &  \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge (m-2-1) []
edge (m-2-2)
(m-2-1.east|-m-2-2) edge  (m-2-2);

\end{tikzpicture}
\end{document}


And labels for the other arrows can be inserted with node:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\underleftarrow{lim}A_{i} &  \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge node[left] {label A} (m-2-1) []
edge node[above right] {label B} (m-2-2)
(m-2-1.east|-m-2-2) edge node[below] {label C} (m-2-2);

\end{tikzpicture}
\end{document}


And a sloped variant:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=3em,column sep=4em,
minimum width=2em] {
\underleftarrow{lim}A_{i} &  \\
A_j & A_k \\};
\path[-stealth]
(m-1-1) edge node[sloped, below] {label A} (m-2-1) []
edge node[sloped, above] {label B} (m-2-2)
(m-2-1.east|-m-2-2) edge node[below] {label C} (m-2-2);
\end{tikzpicture}
\end{document}


• Thank you, your commet is useful. I think I did not ask my question properly. I would like to know how I can label the maps, for example the map going from the limit to the $A_i$ or the map $A_j \rightarrow A_k$. – Tyche Jun 28 '15 at 13:56
• @Guest Then I have misunderstood the question, see the updated answer for labeling the other arrows. – Heiko Oberdiek Jun 28 '15 at 14:17