# Draw dephased exact sequence diagram

I was wondering whether there was a simple way to draw the following diagram, the problem is that I don't know how to draw three diagram dephased of a little bit with the elements under, not the colors. All I can do is

\begin{tikzcd}
&                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &
\end{tikzcd}


Any help or reference would appreciated.

Well, my code isn't pretty but I think it gets the job done. I feel more comfortable with plain tikz for tweaking all the positions (the key for legibility, I think), so I prefer this method to tikz-cd or tikz matrix library.

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[line join=round, line cap=round, y={(0,-1)}, every node/.style={minimum size=1.1cm},->]
% Distances
\def\sepx{2.6}
\def\sepy{2.6}
\def\lx  {0.7}
\def\ly  {0.7}
\foreach\x in {1,...,5} \foreach\y in {1,...,4}
{%
\coordinate (M-\x-\y) at (\x*\sepx,\y*\sepy);
}
% Black nodes
\node (N-3-1) at (M-3-1) {$B_{n+1}$};
\node (N-4-1) at (M-4-1) {$C_{n+1}$};
\node (N-1-2) at (M-1-2) {$0$};
\node (N-2-2) at (M-2-2) {$A_n$};
\node (N-3-2) at (M-3-2) {$B_n$};
\node (N-4-2) at (M-4-2) {$C_n$};
\node (N-5-2) at (M-5-2) {$0$};
\node (N-1-3) at (M-1-3) {$0$};
\node (N-2-3) at (M-2-3) {$A_{n-1}$};
\node (N-3-3) at (M-3-3) {$B_{n-1}$};
\node (N-4-3) at (M-4-3) {$C_{n-1}$};
\node (N-5-3) at (M-5-3) {$0$};
\node (N-1-4) at (M-1-4) {$0$};
\node (N-2-4) at (M-2-4) {$A_{n-2}$};
\node (N-3-4) at (M-3-4) {$B_{n-2}$};
\node (N-4-4) at (M-4-4) {$C_{n-2}$};
% Black arrows
\foreach\x in {1,...,4} \foreach\y in{2,3}
{%
\pgfmathtruncatemacro\z{\x+1}
\draw (N-\x-\y) -- (N-\z-\y);
}
\foreach\x in {1,2,3}
{%
\pgfmathtruncatemacro\z{\x+1}
\draw (N-\x-4) -- (N-\z-4);
}
\foreach\y in{2,3}
{%
\pgfmathtruncatemacro\z{\y+1}
\draw (N-2-\y) -- (N-2-\z);
}
\foreach\x in {3,4} \foreach\y in{1,2,3}
{%
\pgfmathtruncatemacro\z{\y+1}
\draw (N-\x-\y) -- (N-\x-\z);
}
% Red and blue nodes
\node[red]  (R-3-1) at ($(M-3-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-3-1) at ($(M-3-1)+(\lx,\ly)$)         {$b$};
\node[red]  (R-4-1) at ($(M-4-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-4-1) at ($(M-4-1)+(\lx,\ly)$)         {$c$};
\node[red]  (R-2-2) at ($(M-2-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-2-2) at ($(M-2-2)+(\lx,\ly)$)         {$a$};
\node[red]  (R-3-1) at ($(M-3-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-3-1) at ($(M-3-1)+(\lx,\ly)$)         {$b$};
\node[red]  (R-4-1) at ($(M-4-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-4-1) at ($(M-4-1)+(\lx,\ly)$)         {$c$};
\node[red]  (R-2-2) at ($(M-2-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-2-2) at ($(M-2-2)+(\lx,\ly)$)         {$a$};
\node[blue] (R-3-2) at ($(M-3-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-3-2) at ($(M-3-2)+(\lx,\ly)$)         {$\phantom{--}\beta\color{red}\begin{array}{l}+\partial b\\+\Delta b\end{array}$};
\node[blue] (R-4-2) at ($(M-4-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-4-2) at ($(M-4-2)+(\lx,\ly)$)         {$\phantom{+\Delta\gamma}\gamma\color{red}+\Delta\gamma$};
\node[blue] (R-2-3) at ($(M-2-3)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-2-3) at ($(M-2-3)+(\lx,\ly)$)         {$\phantom{+\partial a}\alpha\color{red}+\partial a$};
\node[blue] (R-3-3) at ($(M-3-3)+(\lx,\ly)$)         {$\partial\beta$};
\node[blue] (R-4-3) at ($(M-4-3)+(\lx,\ly)$)         {$0$};
\node[blue] (R-2-4) at ($(M-2-4)+(\lx,\ly)$)         {$\partial\alpha$};
\node[blue] (R-3-4) at ($(M-3-4)+(\lx,\ly)$)         {$\partial^2\beta=0$};
% Red and blue arrows
\draw[red]  (R-3-1) -- (R-4-1);
\draw[red]  (R-3-1) -- (R-3-2);
\draw[red]  (R-4-1) -- (R-4-2);
\draw[red]  (R-2-2) -- (R-3-2);
\draw[red]  (R-2-2) -- (R-2-3);
\draw[blue] (R-3-2) -- (R-3-3);
\draw[blue] (R-3-2) -- (R-4-2);
\draw[blue] (R-4-2) -- (R-4-3);
\draw[blue] (R-2-3) -- (R-3-3);
\draw[blue] (R-3-3) -- (R-4-3);
\draw[blue] (R-2-3) -- (R-2-4);
\draw[blue] (R-3-3) -- (R-3-4);
\draw[blue] (R-2-4) -- (R-3-4);
\draw[red]  ($(R-3-2.north east)!0.3!(R-3-2.south east)$) -- ($(R-4-2.north west)!0.3!(R-4-2.south west)$);
% Arrow labels
\node       at ($(M-3-2)!0.5!(M-4-2)$) [above=-2mm] {$\psi$};
\node[blue] at ($(R-2-3)!0.5!(R-3-3)$) [below=-2mm] {$\psi$};
\node[blue] at ($(R-3-3)!0.5!(R-4-3)$) [below=-2mm] {$\psi$};
\node[blue] at ($(R-2-4)!0.5!(R-3-4)$) [below=-2mm] {$\varphi$};
\node[blue] at ($(R-3-2)!0.5!(R-3-3)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-4-2)!0.5!(R-4-3)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-2-3)!0.5!(R-2-4)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-3-3)!0.5!(R-3-4)$) [right=-2mm] {$\partial$};
% Dots ...
\node at ($(M-2-1)!0.5!(M-3-1)$) {$\cdots$};
\node at ($(M-4-1)!0.5!(M-5-1)$) {$\cdots$};
\end{tikzpicture}
\end{document}


This is what I get:

This is not an answer, but an extended reply to a comment question from the OP. I suggested creating one layer in each color and overlaying them with an (x,y) shift. As to how that might be done, I sure tikz has its own ways of retaining and overlaying layers, but here I use \stackinset to overlay three (in this case identical) layers.

\documentclass{article}
\usepackage{tikz-cd,stackengine}
\begin{document}\scriptsize
\setbox0=\hbox{\begin{tikzcd}
&                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &
\end{tikzcd}}
\setbox2=\hbox{\color{red}\begin{tikzcd}
&                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &
\end{tikzcd}}
\setbox4=\hbox{\color{blue}\begin{tikzcd}
&                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &
\end{tikzcd}}
\stackinset{c}{10pt}{c}{-35pt}{\copy4}{%
\stackinset{c}{16pt}{c}{-5pt}{\copy2}{%
\copy0}}
\end{document}