# tikzcd align one diagram below another

I want to use tikzcd to draw a diagram with one above another, and with a big downarrow from up to down. So I need to put the following 3 parts vertically: And I want to get another similar one on its right, which I believe I can use \qquad. My code will be like this:

$$\begin{tikzcd}[column sep=3em] w \ar[rrd, bend left=16] \ar[rd, dotted, "\exists!"'] & & \\ & x \ar[r, "f"'] & y \end{tikzcd} \begin{tikzcd}[column sep=3em] {} \ar[Rightarrow, d, "p"]\\ {} \end{tikzcd} \begin{tikzcd}[column sep=3em] p(w) \ar[rrd, bend left=12] \ar[rd] & & \\ & p(x) \ar[r, "p(f)"'] & p(y) \end{tikzcd} \qquad \begin{tikzcd}[column sep=3em] w \ar[rrd, bend left=16] \ar[rd, dotted, "\exists!"'] & & \\ & x \ar[r, "f"'] & y \end{tikzcd} \begin{tikzcd}[column sep=3em] {} \ar[Rightarrow, d, "p"]\\ {} \end{tikzcd} \begin{tikzcd}[column sep=3em] p(w) \ar[rrd, bend left=12] \ar[rd] & & \\ & p(x) \ar[r, "p(f)"'] & p(y) \end{tikzcd}$$


The problem is, how to modify my code to get what I want? A way to make the big downarrow bigger would also be welcome. Thanks!

The easiest way to write both diagrams one above the other is probably to use a single tikzcd environment for the first diagram, the arrow and the second diagram.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
$$\begin{tikzcd}[column sep=3em] w \ar[rrd, bend left=16] \ar[rd, dotted, "\exists!"'] & & \\ & x \ar[r, "f"'] & y \\[-8mm] & {} \ar[Rightarrow, d, "p"]\\[5mm] & {} \\[-12mm] p(w) \ar[rrd, bend left=12] \ar[rd] & & \\ & p(x) \ar[r, "p(f)"'] & p(y) \end{tikzcd} \hspace*{11mm} \begin{tikzcd}[column sep=3em] w \ar[rrd, bend left=16] \ar[rd, dotted, "\exists!"'] & & \\ & x \ar[r, "f"'] & y \\[-8mm] & {} \ar[Rightarrow, d, "p"]\\[5mm] & {} \\[-12mm] p(w) \ar[rrd, bend left=12] \ar[rd] & & \\ & p(x) \ar[r, "p(f)"'] & p(y) \end{tikzcd}$$
\end{document}


Here, I used two environments for the two columns, as it makes the code easier to read. However, if the diagrams you wish to add on the right are different from those on the left, the columns might not be properly aligned. If that is the case, you could fix that by just putting everything in the same tikzcd environment.

• Thank you very much! Is it possible to separate the 2 diagrams/columns more, and make the big downarrows (with label "p") longer? And if possible, to make "p" closer to top and bottom (namely less space above its tail and below its head)...(so the overall effect will make it spreads longer horizontally) Commented Feb 19, 2023 at 20:25
• @Lao-tzu I edited my answer. To separate the two columns more, just increase the spacing between the tikzcd environments. I replaced \qquad with \hspace*{11mm}, and you can replace that length with whatever you prefer. To make the downarrows longer, you can increase the height of the corresponding rows by adding spacing with \\[...] at the end of the lines. Above, I used 5mm but of course you can change that. As for the last part of your comment, I'm sorry but I don't understand what you mean. Commented Feb 19, 2023 at 20:39
• Thank you very much, it's very helpful! The last part I meant to make "p" starts very near "$x$" and ends closer to the bent arrow. Commented Feb 19, 2023 at 20:43
• @Lao-tzu The label "p"? So you want the "p" next to the downarrow to be huge compared to the other labels? Or you want rather the downarrow to start closer to "x" and end closer to the bent arrow? Commented Feb 19, 2023 at 20:49
• Yes, I want the downarrow to start closer to "x" and end closer to the bent arrow (the label "p" still in the middle of the downarrow). Commented Feb 19, 2023 at 20:51