Tikz 图表乱了,如何修复?

Tikz 图表乱了,如何修复?

我想用 tikzcd 绘制下图

在此处输入图片描述

我尝试使用以下代码

\begin{tikzcd}
 X_{i}[1]\arrow[rd]& & X_{i + 1}[1]\arrow[rd]& &X_{i+2}[1]\arrow[rd] & &\cdots & & X_{i+j-2}[1]\arrow[rd]& &X_{i+j-1}[1] \\
& X_{i}[2]\arrow[rd] \arrow[ru]& & X_{i+1}[2]\arrow[ru]\arrow[rd]& &\ddots & &X_{i+j-3}[2]\arrow[rd]\arrow[ru] & & X_{i+j-2}[2]\arrow[ru]& \\
& & X_{i}[3]\arrow[rd]\arrow[ru]& & \ddots\arrow[rd] & & \iddots\arrow[ru]& & \iddots\arrow[ru]& & \\
& & & \ddots\arrow[rd]& &X_{i+1}[j-2]\arrow[rd]\arrow[ru] & &\iddots \arrow[ru]& & & \\
& & & &X_{i}[j-1]\arrow[rd]\arrow[ru] & &X_{i+1}[j-1]\arrow[ru] & & & & \\
& & & & &M \simeq X_{i}[j]\arrow[ru] & & & & & \\
\end{tikzcd}

我得到了类似

在此处输入图片描述

一切都乱了,箭头都歪了。我该如何修复?谢谢。

注意:您必须添加包 mathdots 才能使 \iddots 正常工作。

答案1

这就是我所做的,我没能完美地对齐斜点,因此我建议另一种选择:

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{mathdots}
\usepackage{tikz-cd}
\usepackage{graphics}
\newcommand{\dotl}{\rotatebox{346}{$\ddots$}}
\newcommand{\dotr}{\rotatebox{11}{$\iddots$}}
\begin{document}
\centering
\begin{tikzcd}[text width=5em,  text height=3ex, text centered, column sep={2.7em,between origins}]
%first line
    X_{i}[1]\arrow[rd]& & X_{i + 1}[1]\arrow[rd]& &X_{i+2}[1]\arrow[rd] & &\cdots & & X_{i+j-2}[1]\arrow[rd]& &X_{i+j-1}[1] \\
    %second line
    & X_{i}[2]\arrow[rd] \arrow[ru]& & X_{i+1}[2]\arrow[ru]\arrow[rd]& &\dotl & &X_{i+j-3}[2]\arrow[rd]\arrow[ru] & & X_{i+j-2}[2]\arrow[ru]& \\
    %third line
    & & X_{i}[3]\arrow[rd]\arrow[ru]& & \dotl\arrow[rd] & & \dotr\arrow[ru]& & \dotr\arrow[ru]& & \\
    %fourth line
    & & & \dotl\arrow[rd]& &X_{i+1}[j-2]\arrow[rd]\arrow[ru] & &\dotr \arrow[ru]& & & \\
    & & & &X_{i}[j-1]\arrow[rd]\arrow[ru] & &X_{i+1}[j-1]\arrow[ru] & & & & \\
    & & & & &M \simeq X_{i}[j]\arrow[ru] & & & & & \\
\end{tikzcd}
Other alternative:
\centering
\begin{tikzcd}[text width=5em,  text height=3ex, text centered, column sep={2.7em,between origins}]
%first line
    X_{i}[1]\arrow[rd]& & X_{i + 1}[1]\arrow[rd]& &X_{i+2}[1]\arrow[rd] & &\cdots & & X_{i+j-2}[1]\arrow[rd]& &X_{i+j-1}[1] \\
    %second line
    & X_{i}[2]\arrow[rd] \arrow[ru]& & X_{i+1}[2]\arrow[ru]\arrow[rd]& &\cdots & &X_{i+j-3}[2]\arrow[rd]\arrow[ru] & & X_{i+j-2}[2]\arrow[ru]& \\
    %third line
    & & X_{i}[3]\arrow[rd]\arrow[ru]& & \cdots\arrow[rd] & & \cdots\arrow[ru]& & \cdots\arrow[ru]& & \\
    %fourth line
    & & & \cdots\arrow[rd]& &X_{i+1}[j-2]\arrow[rd]\arrow[ru] & &\cdots \arrow[ru]& & & \\
    & & & &X_{i}[j-1]\arrow[rd]\arrow[ru] & &X_{i+1}[j-1]\arrow[ru] & & & & \\
    & & & & &M \simeq X_{i}[j]\arrow[ru] & & & & & \\
\end{tikzcd}
\end{document}

在此处输入图片描述

相关内容