寻找此图表的 tikz 提示

寻找此图表的 tikz 提示

我以前从未使用过 tikz,但如果我想创建下图,它似乎是可以使用的包:

在此处输入图片描述

我想知道是否有任何有经验的 tikz 用户可以为我指明正确的方向,例如在我尝试编写代码时要使用哪些函数。

编辑:基于 Gonzalo 解决方案的代码:

\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

在这里我建议使用另一个更简单的选项tikz-cd;代码现在短多了:

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

结果:

在此处输入图片描述

答案2

这是使用显式位置的另一种解决方案(通过 TikZ 库positioning)。要在链中添加新节点,只需在(中添加text/col(其中colVWG即可foreach不要忘记%最后一项之后的)。

在此处输入图片描述

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

答案3

一个选择是象征评论中提到,使用 TikZ \matrix。这里有一个小例子来说明这种方法;两个命令用于简化绘制箭头:

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

结果:

在此处输入图片描述

相关内容