我正在嘗試繪製一個類似於以下的交換圖:
……除了我希望兩個箭頭$1 \times \tilde{I}$
和$\tilde{m}$
位於同一直線上,節點$\tilde{G} \times \tilde{G}$
位於中間位置。這是我的程式碼(儘管它可能沒有幫助):
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
& & & \tilde{G} \arrow{dd}{p}\\
& & \tilde{G} \times \tilde{G} \arrow{ru}{\tilde{m}} & \\
\tilde{G} \arrow{rru}{1 \times \tilde{I}} \arrow[swap]{r}{p} & G
\arrow[swap]{r}{1_{G}\times I} & G \times G \arrow[swap]{r}{m} & G
\end{tikzcd}
\end{document}
有什麼建議嗎?謝謝!
答案1
與 Zarko 的解決方案類似,但方法不同;主要技巧還是使用虛擬行。指定between origins
可確保類似網格的配置。
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep={6em,between origins},row sep={2.5em,between origins}]
& & & \tilde{G} \arrow[ddd,"p"] \\
& & \tilde{G} \times \tilde{G} \arrow[ru,"\tilde{m}"] & \\
\\
\tilde{G} \arrow[rruu,"1\times\tilde{I}"] \arrow[r,swap,"p"] & G
\arrow[r,swap,"1_{G}\times I"] & G \times G \arrow[r,swap,"m"] & G
\end{tikzcd}
\end{document}
另一個版本,中間的對角箭頭之間有入口。這裡的技巧是多使用一列,但在其兩側備份列寬度的一半。
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[column sep={6em,between origins},row sep={2.5em,between origins},nodes in empty cells]
& &[-3em] &[-3em] & \tilde{G} \arrow[dd,"p"] \\
& & \tilde{G} \times \tilde{G} \arrow[rru,"\tilde{m}"] \\
\tilde{G} \arrow[rru,"1\times\tilde{I}"] \arrow[r,swap,"p"] &
G \arrow[rr,swap,"1_{G}\times I"] & & G \times G \arrow[r,swap,"m"] & G
\end{tikzcd}
\end{document}
答案2
嘗試:
\documentclass[12pt]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[nodes in empty cells,
cells={nodes={minimum height=1.5em}}]
& & & \tilde{G} \arrow{ddd}{p}\\
& & \tilde{G} \times \tilde{G} \arrow{ru}{\tilde{m}} & \\%[5ex]
& & & \\
\tilde{G} \arrow{rruu}{1 \times \tilde{I}} \arrow[swap]{r}{p} & G
\arrow[swap]{r}{1_{G}\times I} & G \times G \arrow[swap]{r}{m} & G
\end{tikzcd}
\end{document}
附錄:row sep
透過減少節點的和 可以得到不太陡的坡度inner sep
:
\documentclass[12pt]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[nodes in empty cells,
row sep=-1ex,
cells={nodes={minimum height=1.5em, inner sep=2pt}}]
& & & \tilde{G} \arrow{ddd}{p}\\
& & \tilde{G} \times \tilde{G} \arrow{ru}{\tilde{m}} & \\%[5ex]
& & & \\
\tilde{G} \arrow{rruu}{1 \times \tilde{I}} \arrow[swap]{r}{p} & G
\arrow[swap]{r}{1_{G}\times I} & G \times G \arrow[swap]{r}{m} & G
\end{tikzcd}
\end{document}