![将多个节点置于另一个节点下方的中心,用多个箭头连接](https://linux22.com/image/400731/%E5%B0%86%E5%A4%9A%E4%B8%AA%E8%8A%82%E7%82%B9%E7%BD%AE%E4%BA%8E%E5%8F%A6%E4%B8%80%E4%B8%AA%E8%8A%82%E7%82%B9%E4%B8%8B%E6%96%B9%E7%9A%84%E4%B8%AD%E5%BF%83%EF%BC%8C%E7%94%A8%E5%A4%9A%E4%B8%AA%E7%AE%AD%E5%A4%B4%E8%BF%9E%E6%8E%A5.png)
我正在学习使用 tikz 创建图表,并希望重新创建以下内容(但文本已B*
旋转):
到目前为止我有以下内容:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains}
\tikzset{
big/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=10em,
minimum height=3em,
text centered,
on chain,
join
},
small/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=4em,
minimum height=2em,
text centered,
on chain,
rotate=-90,
join
},
line/.style={draw, thick, <-},
every join/.style={->, thick, shorten >=1pt},
}
\begin{document}
\begin{tikzpicture}[node distance=1.8cm, start chain=going below]
\node[big] (A) {A};
\node[small] (B1) {B1};
\node[small, on chain=going right] (B2) {B2};
\end{tikzpicture}
\end{document}
但正如所见,我被困在了B
s 上。我认为链条被重定向到了正确的位置,但我不知道如何将它们置于中心位置,A
同时用独特的箭头将它们连接起来。
我该如何继续?
答案1
像这样吗?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{chains,calc,shapes.geometric}
\tikzset{
big/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=10em,
minimum height=3em,
text centered,
%on chain,
%join
},
small/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=2em,
minimum height=4em,
text centered,
on chain,
anchor=center
},
line/.style={draw, thick, <-},
every join/.style={->, thick, shorten >=1pt},
}
\begin{document}
\begin{tikzpicture}[node distance=1.8cm,>=stealth]
\begin{scope}[start chain=going right,local bounding box=B]
\foreach \X in {1,...,4} {\node[small] (B\X) {B\X};}
\end{scope}
\path let \p1=($(B.east)-(B.west)$) in
node[big,above=of B,minimum width=\x1](A) {A};
\begin{scope}[start chain=going below,nodes={on chain,big,join}]
\node[below=of B,ellipse,minimum height=5em] (C){C};
\node (D){D};
\end{scope}
\foreach \X in {1,...,4} {
\draw[line] (B\X.north) -- (B\X.north|-A.south);
\draw[line] (C.200-44*\X) -- (B\X.south);}
\end{tikzpicture}
\end{document}