我需要用 tikZ 构建一个像这里这样的图表https://en.wikipedia.org/wiki/Homotopy_category_of_chain_complexes。我尝试了很多次,但是没有效果。
答案1
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[row sep=1.5cm,column sep=1.5cm]
\cdots \arrow[r,"d_A^{n-2}"] & A^{n-1}\arrow[dl,"h^{n-1}" description]
\arrow[r,"d_A^{n-1}"] \arrow[d,"~f^{n-1}",xshift=-1mm] \arrow[d,swap,"g^{n-1}~",xshift=1mm]
& A^{n} \arrow[dl,"h^{n}" description,swap]
\arrow[r,"d_A^{n}"] \arrow[d,"~f^{n}",xshift=-1mm] \arrow[d,swap,"g^{n}~",xshift=1mm]
& A^{n+1} \arrow[dl,"h^{n+1}" description,swap]
\arrow[r,"d_A^{n+1}"] \arrow[d,"~f^{n+1}",xshift=-1mm] \arrow[d,swap,"g^{n-1}~",xshift=1mm]
& \arrow[dl,"h^{n+2}" description,swap]\cdots\\
\cdots \arrow[r,"d_A^{n-2}"] & B^{n-1}\arrow[r,"d_B^{n-1}"] & B^{n}
\arrow[r,"d_B^{n}"] & B^{n+1}
\arrow[r,"d_B^{n+1}"] & \cdots
\\
\end{tikzcd}\]
\end{document}
答案2
为了锻炼(我还在学习tikz-cd
)和娱乐:
- 基于土拨鼠用(非常)小的变化来回答
DAS
为较短的代码定义了对角箭头的样式( )- 用于
'
交换功能:例如\arrow[d,"g^{n-1}" ',
代替\arrow[d,"g^{n-1}",swap,
- 向下箭头的位移与土拨鼠回答
- 尝试在编辑器中美化代码
\documentclass[12pt,margin=3mm]{standalone}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}[
row sep = 1.5cm,
column sep = 1.5cm,
DAS/.style = {% Diagonal Arrow with Sloped labels
dl, swap, sloped, pos=0.3}
]
\cdots \arrow[r,"d_A^{n-2}"]
& A^{n-1}\arrow["h^{n-1}",DAS]
\arrow[r,"d_A^{n-1}"]
\arrow[d,"g^{n-1}" ',xshift=-1mm]
\arrow[d,"f^{n-1}",xshift=1mm]
& A^{n} \arrow["h^{n}",DAS]
\arrow[r,"d_A^{n}"]
\arrow[d,"g^{n}" ',xshift=-1mm]
\arrow[d,"f^{n}",xshift=1mm]
& A^{n+1} \arrow[dl,"h^{n+1}",DAS]
\arrow[r,"d_A^{n+1}"]
\arrow[d,"g^{n-1}" ',xshift=-1mm]
\arrow[d,"f^{n+1}",xshift=1mm]
& \arrow["h^{n+2}",DAS]\cdots \\
\cdots \arrow[r,"d_A^{n-2}"]
& B^{n-1} \arrow[r,"d_B^{n-1}"]
& B^{n} \arrow[r,"d_B^{n}"]
& B^{n+1} \arrow[r,"d_B^{n+1}"]
& \cdots
\end{tikzcd}
\]
\end{document}