# How to make a commutative diagram with 16 rectangles and to take not more than half a page?

Here is the code I am using:

\documentclass{article}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usepackage{mathtools, amssymb}
\usepackage{pst-node, auto-pst-pdf}

$\begin{tikzcd}[sep=large] M \rar \dar["\mathrm{Pinch}" ' ] \arrow[dr, dashed, "\beta_1 + \beta_2 + \beta_3 = 0", sloped] & * \rar \dar & \Sigma M \dar \rar & \Sigma M \dar \\% M \vee M \vee M \rar[swap, "{(\beta_1 , \beta_2 , \beta_3)}" ] & N \rar & N' \rar & \Sigma M \vee \Sigma M \vee \Sigma M \rar[swap, "{(\beta_1 , \beta_2 , \beta_3)}" ] & N \rar & N' \rar & \Sigma M \vee \Sigma M \vee \Sigma M \end{tikzcd}$


But this code gives the figure below:

So, I want to know how to make this commutative diagram have 16 rectangles and to take not more than half a page?

Also I want to color every third down arrow with green

Any help will with this will be greatly appreciated!

• Unless you quite drastically decrease the margin size and/or use a landscape oriented page, I'm pretty surre 16 rectangle sina single line won't fit, even if you use a quite small font size. Jun 5, 2021 at 14:55
• Even if each rectangle is less than 2cm wide, sixteen of them will take 32cm. How to fit an elephant in a suitcase? Jun 5, 2021 at 15:07
• you need to rethink design of your diagram. Do you realy need all nodes? One possible solution is to split it into two (or three) parts. Jun 5, 2021 at 15:10
• Simply replace "article" with "standalone". You might need to load the standalone package. Jun 5, 2021 at 16:17
• @Happy Just try John's recommendation - that's quicker than asking :) Jun 6, 2021 at 1:41

With tikz-cd, only first few nodes (since contents of others is unknown):

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

\begin{document}
$\begin{tikzcd}[sep=large] M \rar \dar["\mathrm{Pinch}" ' ] \drar[dashed, "\beta_1 + \beta_2 + \beta_3 = 0", sloped] & * \rar \dar \arrow[dd, phantom, ""{coordinate, name=U}] & \Sigma M \rar \dar & \Sigma M \dar \arrow[ddlll, dashed, to path={ -- ([xshift=5em]\tikztostart.east) |- ([yshift=-3em]U) [near end]\tikztonodes -| ([xshift=-2em]\tikztotarget.west) -- (\tikztotarget)}] \\ M \vee M \vee M \rar[swap, "{(\beta_1,\beta_2,\beta_3)}" ] \arrow[d, phantom, ""{coordinate, name=V}] & N \rar & N' \rar & \Sigma M\vee \Sigma M\vee \Sigma M \arrow[ddlll, "{(\beta_1,\beta_2,\beta_3)}" ', to path={ -- ([xshift=1em]\tikztostart.east) |- (V) [near end]\tikztonodes -| ([xshift=-3em]\tikztotarget.west) -- (\tikztotarget)}] \\ * \rar \dar & * \rar \dar & * \rar[dashed] \dar & ~ \\ N \rar & N' \rar & \Sigma M\vee \Sigma M\vee \Sigma M \rar[dashed] & ~ \end{tikzcd}$
\end{document}


Not an answer, just too long for a comment. This shows how to use standalone class with pdflatex.

\documentclass{standalone}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{tikz-cd}
\usepackage{mathtools, amssymb}
% \usepackage{pst-node, auto-pst-pdf}% ???

\begin{document}

\begin{tikzcd}[sep=large]
M \rar \dar["\mathrm{Pinch}" ' ]  \arrow[dr, dashed, "\beta_1 + \beta_2 + \beta_3 = 0", sloped] & * \rar \dar & \Sigma M \dar \rar & \Sigma M \dar \\%
M \vee M \vee M \rar[swap, "{(\beta_1 , \beta_2 , \beta_3)}" ] & N \rar & N' \rar & \Sigma M \vee \Sigma M \vee \Sigma M \rar[swap, "{(\beta_1 , \beta_2 , \beta_3)}" ] & N \rar & N' \rar & \Sigma M \vee \Sigma M \vee \Sigma M
\end{tikzcd}

\end{document}


This is how to produce the same diagram (more of less) using a plain tikzpicture.

\documentclass{standalone}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools, amssymb}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows.meta,calc}

\begin{document}

\begin{tikzpicture}
\matrix (A) [matrix of math nodes, row sep=2cm, column sep={3cm,between origins}]{
M & * & \Sigma M & \Sigma M \\
M \vee M \vee M & N & N' & \Sigma M \vee \Sigma M \vee \Sigma M \\
N & N' & \Sigma M \vee \Sigma M \vee \Sigma M \\
};
\draw[->] (A-1-1) -- (A-1-2);
\draw[->] (A-1-2) -- (A-1-3);
\draw[->] (A-1-3) -- (A-1-4);

\draw[->] (A-1-1) -- (A-2-1) node[midway,left] {Pinch};
\draw[->] (A-1-2) -- (A-2-2);
\draw[->] (A-1-3) -- (A-2-3);
\draw[->] (A-1-4) -- (A-2-4);

\draw[dashed,->] (A-1-1) -- (A-2-2) node[midway,above,sloped] {$\beta_1 + \beta_2 + \beta_3 = 0$};

\draw[->] (A-2-1) -- (A-2-2) node[midway,below] {$(\beta_1 , \beta_2 , \beta_3)$};
\draw[->] (A-2-2) -- (A-2-3);
\draw[->] (A-2-3) -- (A-2-4);

\draw[thick,green,->] (A-2-4) |- ($(A-2-4)!0.5!(A-3-1)$)% midway
node[below, black]{$(\beta_1 , \beta_2 , \beta_3)$}
-| (A-3-1);

\draw[->] (A-3-1) -- (A-3-2);
\draw[->] (A-3-2) -- (A-3-3);
\end{tikzpicture}

\end{document}


• So where is the 16 rectangles? Jun 7, 2021 at 1:14
• I should warn you that I know nothing about tikzcd protocol. I could do the whole thing using tikz, however. Jun 7, 2021 at 13:21
• Ok. I will try the code and let you know if I have further questions. Jun 7, 2021 at 15:51
• your second code did not work with me, I am still having my problem. Jun 12, 2021 at 11:02
• Also, your first code did not work with me, I am still having my problem. Jun 12, 2021 at 11:05