0

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:

enter image description here

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!

Happy
  • 363
  • Please show a sketch of the expected output. How are these 16 rectangles supposed to be arranged. You also mention wanting the diagram to take up less than half a page. Does that refer to widthwise or lengthwise? – leandriis Jun 05 '21 at 14:44
  • For green colored downwars-pointing arrows, you can use \dar[green] instead of \dar. – leandriis Jun 05 '21 at 14:46
  • @leandriis just beside each other, like in the above given figure I have only 3 rectangles but I want to draw 16. Lenghtwise. – Happy Jun 05 '21 at 14:50
  • @leandriis thank you! – Happy Jun 05 '21 at 14:51
  • 3
    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. – leandriis Jun 05 '21 at 14:55
  • 3
    Even if each rectangle is less than 2cm wide, sixteen of them will take 32cm. How to fit an elephant in a suitcase? – egreg Jun 05 '21 at 15:07
  • 3
    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. – Zarko Jun 05 '21 at 15:10
  • @leandriis 16 rectangles not in a single line, in half a page. like for example 4 rectangles in the first line and so on until 4 rectangles in the fourth line. – Happy Jun 05 '21 at 15:14
  • Yeah I can split it into 3 or 4 parts, each part in a single line. @Zarko – Happy Jun 05 '21 at 15:15
  • @Happy: This misunderstanding is precisely why I asked for a sketch of the expected output. Your statement "just beside each other" made me (and apparently others, too) think you wanted to draw all 16 rectangles in a single row. – leandriis Jun 05 '21 at 15:23
  • I am so sorry for that. I do not mean that, next time I will sketch my figure with paint. The thing is that I usually sketch my figure with a pen and then take a photo and usually the photo has a very large size and can not be uploaded.@leandriis – Happy Jun 05 '21 at 15:26
  • You could use standalone class to show the complete diagram. – John Kormylo Jun 05 '21 at 15:57
  • @Happy: A photo of a hand-drawn sketch it perfectly fine. In order to upload it, you could crop it and/or decrease its resolution in order to get a smaller file size. – leandriis Jun 05 '21 at 16:02
  • @JohnKormylo how can I do this? – Happy Jun 05 '21 at 16:08
  • @leandriis ok, thank you! yeah I had to use another program to decrease its size. – Happy Jun 05 '21 at 16:09
  • 1
    Simply replace "article" with "standalone". You might need to load the standalone package. – John Kormylo Jun 05 '21 at 16:17
  • @JohnKormylo Just doing this? Nothing more? – Happy Jun 06 '21 at 00:40
  • 1
    @Happy Just try John's recommendation - that's quicker than asking :) – Dr. Manuel Kuehner Jun 06 '21 at 01:41
  • @JohnKormylo I did that but it did not compile and gave me an error – Happy Jun 06 '21 at 12:16
  • @Dr.ManuelKuehner I did that but it did not compile and gave me an error – Happy Jun 06 '21 at 12:16
  • @JohnKormylo can you please show me exactly the code? – Happy Jun 06 '21 at 12:18
  • See the second example in section 3.2 Tweaking to paths, page 12, TikZ-cd documentation (Version 1.0 May 4, 2021). it can be a way, how to solve your problem. – Zarko Jun 14 '21 at 05:55

2 Answers2

4

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}

demo


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}

demo2

John Kormylo
  • 79,712
  • 3
  • 50
  • 120
2

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}

enter image description here

Zarko
  • 296,517