![如何使用 tikz 生成图表来展示大证明的组织(非终端节点是引理和其他辅助命题)](https://linux22.com/image/431537/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%20tikz%20%E7%94%9F%E6%88%90%E5%9B%BE%E8%A1%A8%E6%9D%A5%E5%B1%95%E7%A4%BA%E5%A4%A7%E8%AF%81%E6%98%8E%E7%9A%84%E7%BB%84%E7%BB%87%EF%BC%88%E9%9D%9E%E7%BB%88%E7%AB%AF%E8%8A%82%E7%82%B9%E6%98%AF%E5%BC%95%E7%90%86%E5%92%8C%E5%85%B6%E4%BB%96%E8%BE%85%E5%8A%A9%E5%91%BD%E9%A2%98%EF%BC%89.png)
如何生成以下图表(请参阅本文档第 4 页https://arxiv.org/pdf/2011.13661.pdf)。
请注意,红色文本实际上是可点击的链接。此外,理想情况下,我希望解决方案尽可能与位置无关(即,如果有的话,也不要太多硬编码坐标)。
答案1
作为起点:
\documentclass[margin=3.141592mm]{standalone}
\usepackage{newtxtext}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning}
\begin{document}
\begin{tikzpicture}[
node distance = 4mm and 8mm,
start chain = going below,
arr/.style = {{Straight Barb[scale=0.8]}-, rounded corners=1ex, semithick},
N/.style = {draw, rounded corners, thick, fill=#1,
text width=8em, align=center, inner ysep=2ex},
N/.default = white,
every edge/.style = {draw, arr}
]
\begin{scope}[nodes={on chain,join=by arr}]
\node[N=red!30] {Theorem 1}; % Theorem \ref{t:1}
\node[N=orange!30] {Lemma 1};
\node (n11) [N=orange!30] {Lemma 2};
\end{scope}
%
\node (n21) [N=blue!30, right=of n11] {Lemma 4};
\node (n22) [N=blue!30, above=of n21] {Lemma 3};
\node (n23) [N=blue!30, below=of n21] {Lemma 5};
%
\node (n31) [N, right=of n23] {Lemma 6};
\node (n32) [N, above=of n31] {Lemma 7};
\node (n33) [N, below=of n31] {Lemma 8};
%
\node (n41) [N, right=of n32] {Lemma 10};
\node (n42) [N, above=of n41] {Lemma 9};
\node (n43) [N, below=of n41] {Lemma 11};
% connections
\draw[arr] (n11)-- (n21);
\draw[arr] ([yshift=+1ex] n11.east) -- ++ (0.4,0) |- (n22);
\draw[arr] ([yshift=-1ex] n11.east) -- ++ (0.4,0) |- (n23);
%
\draw[arr] (n23)-- (n31);
\draw[arr] ([yshift=+1ex] n23.east) -- ++ (0.4,0) |- (n32.west);
\draw[arr] ([yshift=-1ex] n23.east) -- ++ (0.4,0) |- (n33.west);
%
\draw[arr] (n32)-- (n41);
\draw[arr] ([yshift=+1ex] n32.east) -- ++ (0.4,0) |- (n42.west);
\draw[arr] ([yshift=-1ex] n32.east) -- ++ (0.4,0) |- (n43.west);
;
\end{tikzpicture}
\end{document}