\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\begin{document}
\tikzstyle{minsizebox} = [rectangle, draw, fill=blue!10!green!20, minimum width=3.5cm, minimum height=1cm, inner sep=0.5em, text centered, rounded corners=4, align=center]
\tikzstyle{purpleminbox} = [rectangle, draw, fill=blue!15, inner sep=0.5em, text centered, minimum width=3.5cm,minimum height=1cm,anchor=center, drop shadow, align=center]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{figure}
\centering
\begin{tikzpicture}[node distance=2cm]
\node[minsizebox] (tl) {Top Left};
\node[minsizebox, right of=tl, xshift=2cm] (tr) {Top Right};
\node[purpleminbox, below of=tl] (ml) {Middle left};
\node[purpleminbox, below of=tr] (mr) {Middle Right};
\node[minsizebox, below of=ml] (bl) {Bottom Left};
\node[minsizebox, below of=mr] (br) {Bottom Right};
\draw[arrow] (tl) -- (ml);
\draw[arrow] (tr) -- (mr);
\draw[arrow] (ml) -- (bl);
\draw[arrow] (mr) -- (br);
\end{tikzpicture}
\end{figure}
\end{document}
现在:
期望:
基本上,我希望中间节点占据两个节点的空间。箭头仍应指向它们之前的位置,即各个节点的“北”和“南”位置。
答案1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur,positioning}
\begin{document}
\tikzstyle{minsizebox} = [rectangle, draw, fill=blue!10!green!20, minimum width=3.5cm, minimum height=1cm, inner sep=0.5em, text centered, rounded corners=4, align=center]
\tikzstyle{purpleminbox} = [rectangle, draw, fill=blue!15, inner sep=0.5em, text centered, minimum width=7.5cm,minimum height=1cm,anchor=center, drop shadow, align=center]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{figure}
\centering
\begin{tikzpicture}[node distance=2cm]
\node[minsizebox] (tl) {Top Left};
\node[minsizebox, right of=tl, xshift=2cm] (tr) {Top Right};
\path (tl) -- (tr) node[midway](t){};
\node[purpleminbox, below of=t] (m) {Middle};
\node[minsizebox, below = 3cm of tl] (bl) {Bottom Left};
\node[minsizebox, below = 3cm of tr] (br) {Bottom Right};
\draw[arrow] (tl) -- (tl|-m.north);
\draw[arrow] (tr) -- (tr|-m.north);
\draw[arrow] (bl|-m.south) -- (bl);
\draw[arrow] (br|-m.south) -- (br);
\end{tikzpicture}
\end{figure}
\end{document}
答案2
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows.blur,fit}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[%
minsizebox/.style={rectangle, draw, fill=blue!10!green!20, minimum width=3.5cm, minimum height=1cm, inner sep=0.5em, text centered, rounded corners=4, align=center},
purpleminbox/.style={rectangle, draw, fill=blue!15, inner sep=0.5em, text centered, minimum width=3.5cm,minimum height=1cm, anchor=center, align=center},
arrow/.style={thick,->,>=stealth},
node distance=2cm]
\node[minsizebox] (tl) {Top Left};
\node[minsizebox, right of=tl, xshift=2cm] (tr) {Top Right};
\node[purpleminbox, below of=tl] (ml) {Middle left};
\node[purpleminbox, below of=tr] (mr) {Middle Right};
\node[minsizebox, below of=ml] (bl) {Bottom Left};
\node[minsizebox, below of=mr] (br) {Bottom Right};
\node[fit=(ml) (mr), purpleminbox, drop shadow, inner sep=0pt, label=center:Middle] (m) {};
\draw[arrow] (tl) -- (ml);
\draw[arrow] (tr) -- (mr);
\draw[arrow] (ml) -- (bl);
\draw[arrow] (mr) -- (br);
\end{tikzpicture}
\end{figure}
\end{document}