2

I have never used tikz before, but it seems like the package to use if I want to create the following diagram:

enter image description here

I am wondering if any experienced tikz users could point me in the right direction, such as what functions to use, as I attempt to write the code.

EDIT: Code based on Gonzalo's solution:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[
  math mode=false,
  arrows={-latex},
  row sep=0pt,
  column sep=1.5cm,
  arrow/.style={>=latex}
]
\textbf{Vanity} & \textbf{Wisdom} & \textbf{God} \\
1:1--11\ar[dr] & & \\
& 1:12--18\ar[dl] & \\
2:1--11\ar[dr] & & \\
& 2:12--19\ar[dl] & \\
2:20--23\ar[drr] & & \\
& & 2:24--26\ar[dl] \\
& 3:1--8\ar[dl] & \\
3:9\ar[drr] & & \\
& & 3:10--17\ar[dl] \\
& 3:18--22\ar[dl] & \\
4:1--16\ar[drr] & & \\
& & 5:1--7\ar[dl] \\
& 5:8--17\ar[dr] & \\
& & 5:18---6:2\ar[dll] \\
6:3--12\ar[dr] & & \\
& 7:1--12\ar[dr] & \\
& & 7:13--18\ar[dl] \\
& 7:19--25\ar[dr] & \\
& & 7:26-20\ar[dl]\\
& 8:1-9\ar[dl] & \\
8:10\ar[drr] & & \\
& & 8:11--13\ar[dll] \\
8:14--18\ar[drr] & & \\
& & 9:1\ar[dl] \\
& 9:2--6\ar[dr] \\
& & 9:7--10\ar[dl] \\
& 9:11--18\ar[dl] \\
10:1--20\ar[drr] & & \\
& & 11:1---12:7\ar[dll] \\
12:8\ar[dr] & & \\
& 12:9\ar[dr] & \\
& & 12:10--13 \\

\end{tikzcd}

\end{document}
1
  • 1
    \matrix. Or specify coordinates by integers and then adjust xcale/yscale.
    – Symbol 1
    Aug 13, 2015 at 2:11

3 Answers 3

8

Here I propose another simpler option using tikz-cd; the code is much shorter now:

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[
  math mode=false,
  arrows={-latex},
  row sep=0pt,
  column sep=1.5cm,
]
\textbf{Vanity} & \textbf{Wisdom} & \textbf{God} \\
1:1--11\ar[dr] & & \\
& 1:12--18\ar[dl] & \\
2:1--11\ar[dr] & & \\
& 2:12--19\ar[dl] & \\
2:20--23\ar[drr] & & \\
& & 2:24--26\ar[dl] \\
& 3:1--8\ar[dl] & \\
3:9 & & \\
\end{tikzcd}

\end{document}

The result:

enter image description here

2
  • Could you, please, explain the arrows={-latex}, arrow/.style={>=latex} options?I suppose that >=latex is for the tips.
    – Sigur
    Aug 14, 2015 at 5:52
  • 1
    @Sigur arrows={-latex} sets the arrow to have tips at the end and the tips to be of "latex" kind. arrow/.style={>=latex} was a leftover that I've now removed from the answer. Aug 14, 2015 at 13:48
2

Here is another solution using explicit positions (via the TikZ library positioning). To add a new node in the chain, just add text/col (where col is V, W or G) in the foreach (don't forget the % just after the last item).

enter image description here

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[node distance=1*\baselineskip and 1cm]
  \node[font=\bfseries](V){Vanity};
  \node[font=\bfseries,right=of V](W){Wisdom};
  \node[font=\bfseries,right=of W](G){God};
  \coordinate [below=of V.center] (n);
  \node (n-0) at (n -| V) {1:1--11};
  \foreach \text/\col[count=\c,evaluate=\c as \p using int(\c-1)] in {
    1:12--18/W,
    2:1--11/V,
    2:12--19/W,
    2:20--23/V,
    2:24--26/G,
    3:1--8/W,
    3:9/V,
    3:10--17/G,
    3:18--22/W,
    4:1--16/V,
    5:1--7/G%
  }{
    \coordinate[below=of n] (n);
    \node (n-\c) at (n -| \col) {\text};
    \draw[-latex] (n-\p) -- (n-\c);
  }
\end{tikzpicture}
\end{document}
1

One option, that Symbol mentioned in a comment, is to use a TikZ \matrix. Here's a little example illustrating this approach; two commands are used to simplift drawing arrows:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\newcommand\DArrow[4]{
  \draw[arr] ([yshift=-2pt]mat-#1-#2.east) -- ([yshift=2pt]mat-#3-#4.west);
}
\newcommand\RArrow[4]{
  \draw[arr] ([yshift=-2pt]mat-#1-#2.west) -- ([yshift=2pt]mat-#3-#4.east);
}

\begin{document}

\begin{tikzpicture}[
  arr/.style={
    ->,
    >=latex,
    shorten >= 5pt,
    shorten <= 5pt
  },
]
\matrix[
  matrix of nodes,
  column sep=2cm,
  row sep=-\pgflinewidth,
  nodes={
    minimum width=1.4cm,
    minimum height=10pt,
    align=center,
    anchor=north east
  },
  nodes in empty cells,
] (mat)
{
\textbf{Vanity} & \textbf{Wisdom} & \textbf{God} \\
1:1--11& & \\
&1:12--18& \\
2:1--11&& \\
& 2:12--19 & \\
2:20--23 & & \\
& & 2:24--26 \\
& 3:1--8 & \\
3:9 & & \\
};
\DArrow{2}{1}{3}{2}
\RArrow{3}{2}{4}{1}
\DArrow{4}{1}{5}{2}
\RArrow{5}{2}{6}{1}
\DArrow{6}{1}{7}{3}
\RArrow{7}{3}{8}{2}
\RArrow{8}{2}{9}{1}
\end{tikzpicture}

\end{document}

The result:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .