章节阅读顺序图

章节阅读顺序图

我需要为一本书创建一个图表,指示阅读章节的顺序。例如:

在此处输入图片描述

(取自http://www.proba.jussieu.fr/pageperso/giacomin/pub/RPM/Site/Contents_files/dep.jpg- 不是我的。)

此外(由于出版商的要求),它需要在 TeX 中完成,而不是作为图表导入。(我想 TikZ 可能工作得很好,但手动定位所有节点会很麻烦。)制作有吸引力的图表的最佳方法是什么?

答案1

以下是一些可以让你入门的东西tikz

截屏

它与您的图片并不完全相同,但我必须为您留下一些工作:)我已经使用该positioning库来根据彼此的相对位置指定每个节点。

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

\begin{document}

\begin{tikzpicture}[>=stealth,every node/.style={shape=rectangle,draw,rounded corners},]
    % create the nodes
    \node (c1) {Chapter 1};
    \node (c4) [below right=of c1]{Chapter 4};
    \node (c5) [below left=of c4]{Chapter 5};
    \node (c6) [right =of c5]{Chapter 6};
    \node (c7) [right =of c6]{Chapter 7};
    \node (c8) [right =of c7]{Chapter 8};
    \node (c9) [right =of c8]{Chapter 9};
    \node (c2) [below =of c5]{Chapter 2};
    \node (c3) [below right =of c2]{Chapter 3};
    % connect the nodes
    \draw[->] (c1) to[out=0,in=135] (c4);
    \draw[->] (c1.west) to[out=180,in=180] (c2.west);
    \draw[->] (c4) to[out=180,in=75] (c5);
    \draw[->] (c4) -- (c6);
    \draw[->] (c4.south east) -- (c7);
    \draw[->] (c4.east) to[out=0,in=110] (c8);
    \draw[->] (c4.east) to[out=0,in=110] (c9);
    \draw[->,dashed] (c2) -- (c5);
    \draw[->,dashed] (c2) -- (c6);
    \draw[->,dashed] (c2) -- (c7.south);
    \draw[->,dashed] (c2) -- (c8.south);
    \draw[->] (c2) -- (c3);
\end{tikzpicture}

\end{document}

这是更好的东西

在此处输入图片描述

正如 Caramdir 的回答中所述向标准 TikZ 节点添加更多锚点标准nodes有锚点node.〈angle〉,位于(= )和angle之间,我使用如下0east360

\draw[->] (c1) to[out=0,in=135] (c4);
\draw[->] (c1.west) to[out=180,in=180] (c2.west);
\draw[->] (c4) to[out=180,in=75] (c5);
\draw[->] (c4) -- (c6);
\draw[->] (c4.south east) -- (c7);
\draw[->] (c4.-5) to[out=0,in=110] (c8);
\draw[->] (c4.5) to[out=0,in=110] (c9);
\draw[->,dashed] (c2) -- (c5);
\draw[->,dashed] (c2) -- (c6);
\draw[->,dashed] (c2.5) to[out=0,in=225] (c7.south);
\draw[->,dashed] (c2.east) to[out=0,in=225] (c8.south);
\draw[->] (c2.-5) to[out=0,in=135] (c3.west);

当然,所有这些都可以整理成一个\foreach循环,但我发现没有循环的话代码会更容易阅读。

相关内容