# Drawing a dashed line in illustration of the snake lemma

How can I draw the dashed line crossing from the right-above to the left-below?

• Welcome to TeX.SX! If it's just the dashed line across the diagonal you have trouble with, it would be helpful if you could post your code for the rest so it's easier to work on adjusting a ready-made example. Commented Nov 5, 2016 at 14:56
• I'm sure we've had exactly this question before.... snake diagram or something similar? Commented Nov 5, 2016 at 15:08
• If this is via xy it is a bit hard, but not impossible. If this is via tikz-cd it is almost trivial. But in any case, please provide some code. (my guess is xy given the arrow heads) Commented Nov 5, 2016 at 15:16
• See if tex.stackexchange.com/questions/3892 is useful. (@cmhughes) Commented Nov 5, 2016 at 15:20
• tex.stackexchange.com/questions/31687/… Commented Nov 5, 2016 at 15:29

\documentclass[ tikz,
border=5mm]{standalone}
% partly based on Loop Space answer on question
% \url{http://tex.stackexchange.com/questions/31687/bending-snakes-with-xy-pic}
\usepackage{amsmath}
\usetikzlibrary{arrows.meta, calc, matrix, quotes}

\DeclareMathOperator{\im}{im}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,
nodes in empty cells,
nodes={minimum height=4ex,text depth=0.5ex},
column sep={2.5cm,between origins},
row sep={2cm,between origins}]
{
&   0           &   0           &   0           &       \\
%2
0   &   \ker\alpha  &   \ker\beta   &   \ker\gamma  &       \\
%3
0   &   \vert M     &   N           &   P           &   0   \\
%4
0   &   M'          &   N'          &   P'          &   0   \\
%5
& M'/\im\alpha  & N'/\im\beta   & P'/\im\gamma  &   0   \\
%6
&   0           &   0           &   0           &       \\
};
%%%% Horizontal arrows,
%   2nd row
\draw[dotted,->]    (m-2-1) -- (m-2-2);
\draw[dashed,->]    (m-2-2) -- (m-2-3);
\draw[dashed,->]    (m-2-3) -- (m-2-4);

\draw[dashed, ->] (m-2-4) to[out=0,in=180] (m-5-2);
%   3th row
\draw[dotted,->]    (m-3-1) -- (m-3-2);
\draw[->]           (m-3-2) -- (m-3-3);
\draw[->]           (m-3-3) -- (m-3-4);
\draw[->]           (m-3-4) -- (m-3-5);
%   4th row
\draw[->]           (m-4-1) -- (m-4-2);
\draw[->]           (m-4-2) -- (m-4-3);
\draw[->]           (m-4-3) -- (m-4-4);
\draw[dotted,->]    (m-4-4) -- (m-4-5);
%   5th row
\draw[dashed,->]    (m-5-2) -- (m-5-3);
\draw[dashed,->]    (m-5-3) -- (m-5-4);
\draw[dotted,->]    (m-5-4) -- (m-5-5);
%%%% Vertical arrows
%   2nd column
\foreach \i in {2,3,4}
\foreach \j [count=\jx from 1] in {2,...,6}
{
\draw[->] (m-\jx-\i) -- (m-\j-\i);
}
%   nodes on arrows in 3th row
\path   (m-3-2) to["$\alpha$"] (m-4-2)
(m-3-3) to["$\beta$" ] (m-4-3)
(m-3-4) to["$\gamma$"] (m-4-4);
\end{tikzpicture}
\end{document}