So legen Sie die horizontale Trennung einer Gruppe von Rechtecken fest

So legen Sie die horizontale Trennung einer Gruppe von Rechtecken fest

Im folgenden Diagramm:

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows.meta,calc,fit,backgrounds,shapes.multipart,positioning}
\tikzset{box/.style={draw, rectangle, rounded corners, thick, node 
distance=7em, 
text width=6em, text centered, minimum height=3.5em}}
%\tikzset{line/.style={draw, thick, -{Latex[length=2mm,width=1mm]}}}
\tikzset{every node/.style={font=\footnotesize}}

\PreviewEnvironment{tikzpicture}
%=======================================
% Adjust the boarder of the flowchart
%=======================================
\setlength\PreviewBorder{4pt}%

\begin{document}
%************************************************************
%************************************************************
%  Define block styles
%************************************************************
%************************************************************
\tikzset{
block/.style={rectangle split, draw, rectangle split parts=2,text width=14em, text centered, rounded corners, minimum height=4em},
grnblock/.style={rectangle, draw, fill=green!20, text width=10em, text centered, rounded corners, minimum height=4em}, 
whtblock/.style={rectangle, draw, fill=white!20, text width=14em, text centered, minimum height=4em},    
line/.style={draw, {latex[length=3mm,width=2.25mm]}-{latex[length=3mm,width=2.25mm]}},
cloud/.style={draw, ellipse,fill=white!20, node distance=3cm,    minimum height=4em},  
% container/.style={draw, rectangle,dashed,inner sep=0.28cm, rounded corners,fill=yellow!20,minimum height=4cm}}
container1/.style={draw, rectangle,inner sep=0.48cm,fill=blue!10,minimum height=4cm},
container2/.style={draw, rectangle,inner sep=0.28cm,fill=green!10,minimum height=4em}}
%************************************************************
%************************************************************ 
\begin{tikzpicture}[node distance = 1.25cm, auto,every text node part/.style={align=center}]
%
%===============================================    
%  Reader
%===============================================  
  \node [whtblock,font=\fontsize{12}{0}\selectfont] (LBT) {LBT \\[0.5em]Reader Anti-Collision Protocol};   
  \node [whtblock, below=of LBT, node distance=2.5cm,font=\fontsize{12}{0}\selectfont] (FSA) {FSA \\[0.5em]Anti-Collision Protocol};
  \node [whtblock, below=of FSA, node distance=2.5cm,font=\fontsize{12}{0}\selectfont] (PHY) {PHY Layer};
%*****************
% TAG
%***************
  \node [whtblock, right=of PHY, node distance=13cm,font=\fontsize{12}{0}\selectfont] (PHYtag) {PHY Layer\\[0.5em](Energy Harvester)};
  \node [whtblock, above=of PHYtag, node distance=13cm,font=\fontsize{12}{0}\selectfont] (FSAtag) {FSA \\[0.5em]Anti-Collision Protocol};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   CONTAINERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{scope}[on background layer]
  \coordinate (aux1) at ([yshift=3mm]LBT.north);
  \node [container1,fit=(aux1) (FSA)(PHY)] (Reader) {};
  \node at (Reader.north) [fill=white,draw,font=\fontsize{12}{0}\selectfont] {\textbf{Reader}};
%-----------------------------------------------------------
  \coordinate (aux2) at ([yshift=3mm]FSAtag.north);
  \node [container1,fit=(aux2) (PHYtag)(FSAtag)] (TAG) {};
  \node at (TAG.north) [fill=white,draw,font=\fontsize{12}{0}\selectfont] {\textbf{Tag}};
\end{scope}
%************************************************************
%************************************************************
%  Draw edges
%************************************************************
%************************************************************
\draw [line,darkgray,very thick] (LBT.south) -- (FSA.north);
\draw [line,darkgray,very thick] (FSA.south) -- (PHY.north);
\draw [line,darkgray,very thick] (FSAtag.south) -- (PHYtag.north);

\draw [-latex,darkgray,ultra thick] ([yshift=6pt]PHY.east) -- node [above] {Power-Up \\[0.5em] Link} ([yshift=6pt]PHYtag.west);
\draw [-latex,darkgray,ultra thick] ([yshift=-6pt]PHYtag.west) -- node [below] {Backscattered \\[0.5em] Link} ([yshift=-6pt]PHY.east);
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Der Text der horizontalen Pfeile zwischen den Rechteckgruppen des Readers und des Tags überlappt sich mit den Box-Containern.

Ich möchte die beiden Gruppen (Reader und Tag) trennen, damit der Text der Pfeile in den leeren Bereich zwischen den beiden Gruppen passt.

Grüße

Antwort1

Bearbeitung nach @marmots nützlichem Kommentar zur Nichtverwendung node distanceinnerhalb der Knoten (da die tatsächliche Verwendung right=<Some Length> of <Poin>nicht zulässig ist ):node distance

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows.meta,calc,fit,backgrounds,shapes.multipart,positioning}
\tikzset{box/.style={draw, rectangle, rounded corners, thick, node 
distance=7em, 
text width=6em, text centered, minimum height=3.5em}}
%\tikzset{line/.style={draw, thick, -{Latex[length=2mm,width=1mm]}}}
\tikzset{every node/.style={font=\footnotesize}}

\PreviewEnvironment{tikzpicture}
%=======================================
% Adjust the boarder of the flowchart
%=======================================
\setlength\PreviewBorder{4pt}%

\begin{document}
%************************************************************
%************************************************************
%  Define block styles
%************************************************************
%************************************************************
\tikzset{
block/.style={rectangle split, draw, rectangle split parts=2,text width=14em, text centered, rounded corners, minimum height=4em},
grnblock/.style={rectangle, draw, fill=green!20, text width=10em, text centered, rounded corners, minimum height=4em}, 
whtblock/.style={rectangle, draw, fill=white!20, text width=14em, text centered, minimum height=4em},    
line/.style={draw, {latex[length=3mm,width=2.25mm]}-{latex[length=3mm,width=2.25mm]}},
cloud/.style={draw, ellipse,fill=white!20, node distance=3cm,    minimum height=4em},  
% container/.style={draw, rectangle,dashed,inner sep=0.28cm, rounded corners,fill=yellow!20,minimum height=4cm}}
container1/.style={draw, rectangle,inner sep=0.48cm,fill=blue!10,minimum height=4cm},
container2/.style={draw, rectangle,inner sep=0.28cm,fill=green!10,minimum height=4em}}
%************************************************************
%************************************************************ 
\begin{tikzpicture}[node distance = 1.25cm, auto,every text node part/.style={align=center}]
%
%===============================================    
%  Reader
%===============================================  
  \node [whtblock,font=\fontsize{12}{0}\selectfont] (LBT) {LBT \\[0.5em]Reader Anti-Collision Protocol};   
  \node [whtblock, below=of LBT,font=\fontsize{12}{0}\selectfont] (FSA) {FSA \\[0.5em]Anti-Collision Protocol};
  \node [whtblock, below=of FSA,font=\fontsize{12}{0}\selectfont] (PHY) {PHY Layer};
%*****************
% TAG
%***************
  \node [whtblock, right=of PHY,font=\fontsize{12}{0}\selectfont,shift={(3cm,0)}] (PHYtag) {PHY Layer\\[0.5em](Energy Harvester)};
  \node [whtblock, above=of PHYtag,font=\fontsize{12}{0}\selectfont] (FSAtag) {FSA \\[0.5em]Anti-Collision Protocol};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   CONTAINERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{scope}[on background layer]
  \coordinate (aux1) at ([yshift=3mm]LBT.north);
  \node [container1,fit=(aux1) (FSA)(PHY)] (Reader) {};
  \node at (Reader.north) [fill=white,draw,font=\fontsize{12}{0}\selectfont] {\textbf{Reader}};
%-----------------------------------------------------------
  \coordinate (aux2) at ([yshift=3mm]FSAtag.north);
  \node [container1,fit=(aux2) (PHYtag)(FSAtag)] (TAG) {};
  \node at (TAG.north) [fill=white,draw,font=\fontsize{12}{0}\selectfont] {\textbf{Tag}};
\end{scope}
\node[whtblock,shift={(0,7.6cm)},minimum width=18cm,font=\fontsize{12}{0}\selectfont] at ($(Reader)!.5!(TAG)$) {\textbf{Scenario Setup}};
%************************************************************
%************************************************************
%  Draw edges
%************************************************************
%************************************************************
\draw [line,darkgray,very thick] (LBT.south) -- (FSA.north);
\draw [line,darkgray,very thick] (FSA.south) -- (PHY.north);
\draw [line,darkgray,very thick] (FSAtag.south) -- (PHYtag.north);

\draw [-latex,darkgray,ultra thick] ([yshift=6pt]PHY.east) -- node [above] {Power-Up \\[0.5em] Link} ([yshift=6pt]PHYtag.west);
\draw [-latex,darkgray,ultra thick] ([yshift=-6pt]PHYtag.west) -- node [below] {Backscattered \\[0.5em] Link} ([yshift=-6pt]PHY.east);
\end{tikzpicture}
\end{document}

Abgesehen von der Änderung, die @marmot gefordert hat (für den Fall, dass ein zukünftiger Benutzer diese Antwort findet und annimmt, dass diese Befehle wie in meiner vorherigen Version vorgesehen kombiniert werden könnten und wirksam würden), habe ich lediglich Folgendes hinzugefügt:

1) a shift={(<Some Length For X>,<Some Length For Y>)}für die in der Ausgangsfrage benötigte Verschiebung und

2) ein neuer nodeBefehl für das "Titelfeld", wie in den Kommentaren gefordert

Bildbeschreibung hier eingeben

verwandte Informationen