# Tikz diagram is messed up, how to fix?

I'd like to draw the following diagram with tikzcd

I tried with the following code

\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}

and I get something like

it is all messed up, the arrows are crooked. How can I fix it? Thanks.

Obs. You have to add the package mathdots for \iddots to work.

• Why tell us what we have to add? Add everything into your example so that we can compile it as-is. That way, nobody has to guess which packages you are using or which class. We don't want everything, of course. Just the stuff needed to compile the problem. – cfr Feb 13 '17 at 2:24
• Presumably, you need to make the empty nodes the same size as the non-empty ones. All nodes the same size, in fact. And to rotate the image to make it fit the paper, presumably. – cfr Feb 13 '17 at 2:26
• If you don't know how to create a minimal working example (MWE), see this link: meta.tex.stackexchange.com/q/228. – CarLaTeX Feb 13 '17 at 9:01
• Ok, I'll fix the question as soon as possible. Thanks anyway. – Dion Feb 13 '17 at 10:10
• The mathtools package includes \mathclap to hide the width of your nodes. – John Kormylo Feb 13 '17 at 17:45

## 1 Answer

This is what I've done, I didn't manage to perfectly align the oblique points, hence I suggest also another alternative:

\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}

• Thanks by the effort, it seems nice to me. I took another approach, later on I'll share it. – Dion Feb 14 '17 at 18:13