
所以我有下面的 Tikzcd 圖,我試著將 Y 放置在三角形 W、(X x Y)、X 或三角形 W、(X x Y)、(X x Y) x Z 的中心
\begin{equation*}
\begin{tikzcd}[column sep=large, row sep=large]
X
&
& W
\ar[lldd, "(f'\times g')" description, dashed]
\ar[dd, "(f'\times g')\times g" description, dashed]
\ar[rdd, "g"]
\ar[ll, "f'"']
&
\\
&Y
&Y
&
\\
(X\times Y)
\ar[uu, "\pi_X"]
&
& (X\times Y)\times Z
\ar[ll, "p_{X\times Y}"]
\ar[r, "p_Z"']
& Z
\end{tikzcd}
\end{equation*}
我嘗試添加更多行和列。但 tikz-cd 似乎使得列間距不均勻,需要太多的行和列才實用。解決這個問題的最佳方法是什麼?
答案1
您可以記住節點並使用疊加層在三角形的重心處繪製所需的節點。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{equation*}
\begin{tikzcd}[column sep=large, row sep=large,remember picture]
|[alias=X]| X
&
& |[alias=W]| W
\ar[lldd, "(f'\times g')" description, dashed]
\ar[dd, "(f'\times g')\times g" description, dashed]
\ar[rdd, "g"]
\ar[ll, "f'"']
&
\\
&Y
&Y
&
\\
|[alias=XxY]| (X\times Y)
\ar[uu, "\pi_X"]
&
& |[alias=XxYxZ]| (X\times Y)\times Z
\ar[ll, "p_{X\times Y}"]
\ar[r, "p_Z"']
& Z
\end{tikzcd}
\tikz[overlay,remember picture]{%
\node (Y1) at (barycentric cs:X=1,W=1,XxY=1) {$Y$};
\draw[->] (Y1) -- (W);\draw[->] (Y1) -- (XxY);
\node (Y2) at (barycentric cs:XxYxZ=1,W=1,XxY=1) {$Y$};
\draw[->] (Y2) -- (W);\draw[->] (Y2) -- (XxY);
}
\end{equation*}
\end{document}
X
透過增加或的係數,XxYxZ
您可以將節點稍微移向矩形角。
更新:新增了連接箭頭,可能太多了,但要刪除哪些箭頭應該是顯而易見的。