绘制失相精确序列图

绘制失相精确序列图

我想知道是否有一种简单的方法来绘制下面的图表,问题是我不知道如何绘制三个稍微失相的图表,下面的元素不是颜色。我所能做的就是

\begin{tikzcd}
            &                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &  
\end{tikzcd}

在此处输入图片描述

任何帮助或参考都将不胜感激。

答案1

好吧,我的代码并不漂亮,但我认为它完成了工作。我更喜欢使用纯 tikz 来调整所有位置(我认为这是易读性的关键),所以我更喜欢这种方法而不是 tikz-cd 或 tikz 矩阵库。

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[line join=round, line cap=round, y={(0,-1)}, every node/.style={minimum size=1.1cm},->]
% Distances
\def\sepx{2.6} 
\def\sepy{2.6}
\def\lx  {0.7}
\def\ly  {0.7}
\foreach\x in {1,...,5} \foreach\y in {1,...,4}
{%
  \coordinate (M-\x-\y) at (\x*\sepx,\y*\sepy);
}
% Black nodes
\node (N-3-1) at (M-3-1) {$B_{n+1}$};
\node (N-4-1) at (M-4-1) {$C_{n+1}$};
\node (N-1-2) at (M-1-2) {$0$};
\node (N-2-2) at (M-2-2) {$A_n$};
\node (N-3-2) at (M-3-2) {$B_n$};
\node (N-4-2) at (M-4-2) {$C_n$};
\node (N-5-2) at (M-5-2) {$0$};
\node (N-1-3) at (M-1-3) {$0$};
\node (N-2-3) at (M-2-3) {$A_{n-1}$};
\node (N-3-3) at (M-3-3) {$B_{n-1}$};
\node (N-4-3) at (M-4-3) {$C_{n-1}$};
\node (N-5-3) at (M-5-3) {$0$};
\node (N-1-4) at (M-1-4) {$0$};
\node (N-2-4) at (M-2-4) {$A_{n-2}$};
\node (N-3-4) at (M-3-4) {$B_{n-2}$};
\node (N-4-4) at (M-4-4) {$C_{n-2}$};
% Black arrows
\foreach\x in {1,...,4} \foreach\y in{2,3}
{%
  \pgfmathtruncatemacro\z{\x+1}
  \draw (N-\x-\y) -- (N-\z-\y);
}
\foreach\x in {1,2,3}
{%
  \pgfmathtruncatemacro\z{\x+1}
  \draw (N-\x-4) -- (N-\z-4);
}
\foreach\y in{2,3}
{%
  \pgfmathtruncatemacro\z{\y+1}
  \draw (N-2-\y) -- (N-2-\z);
}
\foreach\x in {3,4} \foreach\y in{1,2,3}
{%
  \pgfmathtruncatemacro\z{\y+1}
  \draw (N-\x-\y) -- (N-\x-\z);
}
% Red and blue nodes
\node[red]  (R-3-1) at ($(M-3-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-3-1) at ($(M-3-1)+(\lx,\ly)$)         {$b$};
\node[red]  (R-4-1) at ($(M-4-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-4-1) at ($(M-4-1)+(\lx,\ly)$)         {$c$};
\node[red]  (R-2-2) at ($(M-2-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-2-2) at ($(M-2-2)+(\lx,\ly)$)         {$a$};
\node[red]  (R-3-1) at ($(M-3-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-3-1) at ($(M-3-1)+(\lx,\ly)$)         {$b$};
\node[red]  (R-4-1) at ($(M-4-1)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-4-1) at ($(M-4-1)+(\lx,\ly)$)         {$c$};
\node[red]  (R-2-2) at ($(M-2-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[red]  (R-2-2) at ($(M-2-2)+(\lx,\ly)$)         {$a$};
\node[blue] (R-3-2) at ($(M-3-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-3-2) at ($(M-3-2)+(\lx,\ly)$)         {$\phantom{--}\beta\color{red}\begin{array}{l}+\partial b\\+\Delta b\end{array}$};
\node[blue] (R-4-2) at ($(M-4-2)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-4-2) at ($(M-4-2)+(\lx,\ly)$)         {$\phantom{+\Delta\gamma}\gamma\color{red}+\Delta\gamma$};
\node[blue] (R-2-3) at ($(M-2-3)+(0.5*\lx,0.5*\ly)$) {\rotatebox{135}{$\in$}};
\node[blue] (R-2-3) at ($(M-2-3)+(\lx,\ly)$)         {$\phantom{+\partial a}\alpha\color{red}+\partial a$};
\node[blue] (R-3-3) at ($(M-3-3)+(\lx,\ly)$)         {$\partial\beta$};
\node[blue] (R-4-3) at ($(M-4-3)+(\lx,\ly)$)         {$0$};
\node[blue] (R-2-4) at ($(M-2-4)+(\lx,\ly)$)         {$\partial\alpha$};
\node[blue] (R-3-4) at ($(M-3-4)+(\lx,\ly)$)         {$\partial^2\beta=0$};
% Red and blue arrows
\draw[red]  (R-3-1) -- (R-4-1);
\draw[red]  (R-3-1) -- (R-3-2);
\draw[red]  (R-4-1) -- (R-4-2);
\draw[red]  (R-2-2) -- (R-3-2);
\draw[red]  (R-2-2) -- (R-2-3);
\draw[blue] (R-3-2) -- (R-3-3);
\draw[blue] (R-3-2) -- (R-4-2);
\draw[blue] (R-4-2) -- (R-4-3);
\draw[blue] (R-2-3) -- (R-3-3);
\draw[blue] (R-3-3) -- (R-4-3);
\draw[blue] (R-2-3) -- (R-2-4);
\draw[blue] (R-3-3) -- (R-3-4);
\draw[blue] (R-2-4) -- (R-3-4);
\draw[red]  ($(R-3-2.north east)!0.3!(R-3-2.south east)$) -- ($(R-4-2.north west)!0.3!(R-4-2.south west)$);
% Arrow labels
\node       at ($(M-3-2)!0.5!(M-4-2)$) [above=-2mm] {$\psi$};
\node[blue] at ($(R-2-3)!0.5!(R-3-3)$) [below=-2mm] {$\psi$};
\node[blue] at ($(R-3-3)!0.5!(R-4-3)$) [below=-2mm] {$\psi$};
\node[blue] at ($(R-2-4)!0.5!(R-3-4)$) [below=-2mm] {$\varphi$};
\node[blue] at ($(R-3-2)!0.5!(R-3-3)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-4-2)!0.5!(R-4-3)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-2-3)!0.5!(R-2-4)$) [right=-2mm] {$\partial$};
\node[blue] at ($(R-3-3)!0.5!(R-3-4)$) [right=-2mm] {$\partial$};
% Dots ...
\node at ($(M-2-1)!0.5!(M-3-1)$) {$\cdots$};
\node at ($(M-4-1)!0.5!(M-5-1)$) {$\cdots$};
\end{tikzpicture} 
\end{document}

这是我得到的: 在此处输入图片描述

答案2

这不是答案,而是对 OP 评论问题的扩展回复。我建议为每种颜色创建一个图层,并用 (x,y) 偏移覆盖它们。至于如何做到这一点,我当然tikz有自己的保留和覆盖图层的方法,但在这里我使用\stackinset覆盖三个(在本例中是相同的)图层。

\documentclass{article}
\usepackage{tikz-cd,stackengine}
\begin{document}\scriptsize
\setbox0=\hbox{\begin{tikzcd}
            &                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &  
\end{tikzcd}}
\setbox2=\hbox{\color{red}\begin{tikzcd}
            &                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &  
\end{tikzcd}}
\setbox4=\hbox{\color{blue}\begin{tikzcd}
            &                             & B_{n+1} \arrow[d] \arrow[r] & C_{n+1}                     &   \\
0 \arrow[r] & A_n \arrow[r] \arrow[d]     & B_n \arrow[r] \arrow[d]     & C_n \arrow[r] \arrow[d]     & 0 \\
0 \arrow[r] & A_{n-1} \arrow[d] \arrow[r] & B_{n-1} \arrow[r] \arrow[d] & C_{n-1} \arrow[r] \arrow[d] & 0 \\
0 \arrow[r] & A_{n-2} \arrow[r]           & B_{n-2}                     & C_{n-2}                     &  
\end{tikzcd}}
\stackinset{c}{10pt}{c}{-35pt}{\copy4}{%
\stackinset{c}{16pt}{c}{-5pt}{\copy2}{%
\copy0}}  
\end{document}

在此处输入图片描述

相关内容