직사각형 그룹의 수평 분리를 설정하는 방법

직사각형 그룹의 수평 분리를 설정하는 방법

다음 다이어그램에서:

\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}

여기에 이미지 설명을 입력하세요

리더와 태그의 직사각형 그룹 사이에 있는 수평 화살표의 텍스트는 상자 컨테이너와 겹칩니다.

두 그룹(리더와 태그)을 분리하여 두 그룹 사이의 빈 공간에 화살표의 텍스트를 맞추고 싶습니다.

문안 인사

답변1

node distance노드 내부에서 사용되지 않는 것에 대한 @marmot의 유용한 의견을 편집하십시오 ( 실제로 사용되는 것을 right=<Some Length> of <Poin>허용하지 않기 때문입니다).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}

@marmot가 요청한 변경 사항을 제외하고(향후 사용자가 이 답변을 찾고 이러한 명령이 이전 버전에서 제공된 대로 결합되어 적용될 수 있다고 가정할 경우) 방금 추가했습니다.

1) a shift={(<Some Length For X>,<Some Length For Y>)}초기 질문에 필요한 교대

node2) 주석에서 요청한 대로 "제목 상자"에 대한 새로운 명령

여기에 이미지 설명을 입력하세요

관련 정보