http://texblog.net/latex-archive/maths/pgf-tikz-commutative-diagram/
The chains library is very useful for writing exact sequences. Yet there's no feature for labeling the edges of a chain. Besides arrows, we might need to write symbols for maps over, under, or just next to it.
This example shows a way by modifying the join method of the chains library. Its original syntax is join=with<node> by <options>, here the syntax is changed to join={node[options] {label}}.
Furthermore, we define a style for the labels, so that all are in math mode and typeset in scriptstyle.
Edit and compile if you like:
% TikZ chains with labeled edges % Author: Stefan Kottwitz , http://texblog.net \documentclass[a4paper,10pt]{article} \usepackage{tikz} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt}% \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=$] % \begin{document} \begin{tikzpicture} \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); } \end{tikzpicture} \end{document}
Click to download: labeled-chain.tex • labeled-chain.pdf
Open in Overleaf: labeled-chain.tex