3

The following code

\documentclass{article}

\usepackage{tikz-cd}

\begin{document} \begin{tikzcd}[column sep = tiny] {...} & {-2} & {-1} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & {...} \ {} &&&&&&& {} \ {} &&&&&&& {} \ {...} & {-2} & {-1} & 0 & 1 & 2 & 3 & 4 & 5 & 6 & {...} \ \arrow[from=1-4, to=4-8] \arrow[from=1-6, to=4-6] \arrow[from=1-8, to=4-4] \arrow[from=1-2, to=4-10] \arrow[from=1-10, to=4-2] \end{tikzcd} \end{document}

yields the following figure :

enter image description here

For obvious aesthetic reasons, I would like the figure the arrows to cross in one central point. How can I achieve this with tikz-cd ?

141592653
  • 133

1 Answers1

6

The issue is that the cells that contain a - sign are wider than the cells that don't. Since the arrows are drawn to the centers of the cells, they are slightly off center with respect to the rest of the diagram. One solution is to set minimum width for every cell. (If you wish you can also reduce column sep to 0.)

Also, you only need two rows if you set row sep, and the last row should not have \\ at the end (to have proper vertical spacing after the diagram). Lastly, use \cdots instead of {...}.

enter image description here

\documentclass{article}

\usepackage{tikz-cd}

\begin{document} \begin{tikzcd}[column sep=0pt, minimum width=8mm, row sep=2cm] \cdots & -2 & -1 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & \cdots \ \cdots & -2 & -1 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & \cdots \arrow[from=1-4, to=2-8] \arrow[from=1-6, to=2-6] \arrow[from=1-8, to=2-4] \arrow[from=1-2, to=2-10] \arrow[from=1-10, to=2-2] \end{tikzcd} \end{document}

Sandy G
  • 42,558