如何在 tikz 中将双圆放置在两个由标记箭头连接的水平矩形的中心下方以形成圆圈?

如何在 tikz 中将双圆放置在两个由标记箭头连接的水平矩形的中心下方以形成圆圈?

我已尝试过:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes, quotes, arrows.meta, arrows, calc, shadows, positioning}
\usetikzlibrary{patterns,shapes.geometric}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[
node distance = 10mm and -50mm,
circ/.style={draw, circle, ultra thick, double=pink!60, double distance = .5pt, text width=15mm, fill=white, draw=black, ultra thick, align=center},
rec/.style={draw, rectangle, fill=white, draw=black, ultra thick, minimum height = 1cm, minimum width=1cm, text width = 2cm, align=center},
every edge/.style = {draw, line width = 5mm, black, ultra thick, -Stealth},
]
\begin{scope}
\node (in)  [rec][left]{ABC};
\node (in0) [rec][left =of in]{DEF};                
\node (sa)  [circ] [below left=of in] {Generalized Ruleset};
\end{scope}
\draw[->] (in) edge (sa);
\draw[->] (in0) edge (sa);
\end{tikzpicture}
\end{figure}
\end{document}

我需要在箭头连接的两个水平矩形的中心下方放置两个水平矩形和一个圆圈。我知道这是可以做到的,但目前我无法做到。请帮忙。任何帮助我都会很感激。

答案1

有很多选择,这里有一个非常基本的选择:

\path (in) -- (in0) node[midway,below=3em,circ] (sa)  {Gen-\\ eralized Ruleset};

完整最小示例:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[
circ/.style={draw, circle, ultra thick, double=pink!60, double distance = .5pt, text width=15mm, fill=white, draw=black, ultra thick, align=center},
rec/.style={draw, rectangle, fill=white, draw=black, ultra thick, minimum height = 1cm, minimum width=1cm, text width = 2cm, align=center},
every edge/.style = {draw, line width = 5mm, black, ultra thick, -Stealth},
]
\begin{scope}
\node (in)  [rec][left]{ABC};
\node (in0) [rec][left =of in]{DEF};   
\path (in) -- (in0) node[midway,below=3em,circ] (sa)  {Gen-\\ eralized Ruleset};
\end{scope}
\draw[->] (in) edge (sa)  (in0) edge (sa);
\end{tikzpicture}
\end{figure}
\end{document}

在此处输入图片描述

您也可以将其画成一棵有森林的树。

\documentclass[11pt]{article}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\tikzset{circ/.style={draw, circle, ultra thick, double=pink!60, double distance = .5pt, text width=15mm, fill=white, draw=black, ultra thick, align=center},
rec/.style={draw, rectangle, fill=white, draw=black, ultra thick, minimum height = 1cm, minimum width=1cm, text width = 2cm, align=center},
my edge/.style = {draw, line width = 5mm, black, ultra thick, Stealth-},
}
\begin{document}
\begin{forest}
for tree={grow=north,edge=my edge,s sep+=2em,l sep+=2em}
[Gen-\\ eralized Ruleset,circ,
 [ABC,rec]
 [DEF,rec]
]
\end{forest}
\end{document}

在此处输入图片描述

相关内容