如何用 LaTex ? TikZ/PGF 绘制此图?

如何用 LaTex ? TikZ/PGF 绘制此图?

我希望画出这样的图:

在此处输入图片描述

我觉得很难,因为

  • 每个矩形大小相似,内部包含多行文本;
  • 有些矩形的右上角有一些数字;
  • 我无法处理从矩形IV发射的四支箭;
  • 不知道如何定位矩形X;
  • 我从来没有画过这种类型的图表,没有策略。

也许我的问题违反了论坛的规范,但是我没有其他办法。

答案1

请注意(几乎)所有问题都应包含一个与您要做的事情至少有一定关系的最小示例;)。例如,包含您正在处理的文本内容和基本文档框架。


以下是一种方法:

\documentclass[tikz,multi,border=10pt]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{forest}
  forked edges,
  /tikz/>/.tip={Stealth[]},
  my label/.style={%
    tikz+={\node [font=\scriptsize, anchor=south east] at (.north east) {#1};}
  },
  for tree={%
    draw,
    align=center,
    minimum height=20mm,
    minimum width=30mm,
    anchor=center,
    font=\scshape,
    l sep'=10mm,
    edge={->},
    s sep'=10mm,
  }
  [Introduction\\Sets, my label=1
    [I\\Groups, l sep'=20mm, my label={2,3}
      [II\\Structure\\of Groups, edge path'={(!u.west) |- (.child anchor)}, before computing xy={l'=20mm}]
      [III\\Rings, my label={2,3}
        [IV\\Modules, edge+={densely dashed}, my label={2,3,4}
          [V\\Galois\\Theory, my label={2,5}
            [VI\\Structure\\of Fields, my label=6]
          ]
          [VII\\Linear\\Algebra]
          [VIII\\Commutative\\Rings \&\\Modules, tikz+={\draw [->, densely dashed] (.east) -- (!n.west);}, my label=?]
          [IX\\Structure\\of Rings, my label={8,9,10}]
        ]
      ]
      [X\\Categories, no edge, before computing xy={l'=20mm}, my label=11]
    ]
  ]
\end{forest}
\end{document}

森林解决方案

答案2

我是提问者。有一个答案正在等待编辑,在很大程度上模仿了关联。之前答案有缺陷,之后@cfr热心指导,终于完成。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,fit,calc,positioning,arrows}
\begin{document}

\begin{tikzpicture}
\newlength{\hrrth}\setlength{\hrrth}{10mm}
\newlength{\wrrth}\setlength{\wrrth}{30mm}
\tikzset{box/.style={draw, rectangle, thick, text centered, minimum width=\wrrth, minimum height=20mm, align=center}}
\tikzset{line/.style={draw, thick, -latex' }}

\node [box] (O) {Introduction\\ Sets};
\node [box, below=\hrrth of O](I){I\\ Groups};
\node [below=\hrrth of I](Ia){};
\node [box, left=\wrrth of Ia](II){II\\ Structure\\ of Groups};
\node [box, below=\hrrth of I](III){III\\ Rings};
\node [box, below=\hrrth of III](IV){IV\\ Modules};
\coordinate[below=0.5\hrrth of IV](lline){};
\node [box, below=\hrrth of lline, xshift=-1.8\wrrth](V){V\\ Galoi Theory};
\node [box, below=\hrrth of V](VI){VI\\ Structure\\ of Fields};
\node [box, below=\hrrth of lline, xshift=-0.6\wrrth](VII){VII\\ Linear\\ Algebra};
\node [box, below=\hrrth of lline, xshift=0.6\wrrth](VIII){VIII\\ Commutative\\ Rings\\ \& Modules};
\node [box, below=\hrrth of lline, xshift=1.8\wrrth](IX){IX\\ Structure\\ of Rings};
\node [box, right=\wrrth of Ia](X){X\\ Categories};

\path [line] (O) -- (I);
\path [line] (I) -| (II);
\path [line] (I) -- (III);
\path [line,dashed] (III) -- (IV);
\draw [thick] (IV) -- (lline);
\path [line] (lline) -| (V);
\path [line] (lline) -| (VII);
\path [line] (lline) -| (VIII);
\path [line] (lline) -| (IX);
\path [line,dashed] (VIII) -- (IX);
\path [line] (V) -- (VI);


\node [above=0pt of O.north east, anchor=south east, font=\small] {1};
\node [above=0pt of I.north east, anchor=south east, font=\small] {2,3};
\node [above=0pt of III.north east, anchor=south east, font=\small] {2,3};
\node [above=0pt of IV.north east, anchor=south east, font=\small] {2,3,4};
\node [above=0pt of V.north east, anchor=south east, font=\small] {2,5};
\node [above=0pt of VI.north east, anchor=south east, font=\small] {6};
\node [above=0pt of VII.north east, anchor=south east, font=\small] {2,3};
\node [above=0pt of VIII.north east, anchor=south east, font=\small] {7};
\node [above=0pt of IX.north east, anchor=south east, font=\small] {8,9,10};
\node [above=0pt of X.north east, anchor=south east, font=\small] {11};

\end{tikzpicture}
\end{document} 

在此处输入图片描述

相关内容