TIKZ. 화살표를 이동

TIKZ. 화살표를 이동

나는 매우 간단한 tikzpicture 테이블 구성표를 가지고 있으며 화살표를 오른쪽으로 이동해야 합니다. 이제 다음과 같습니다. 여기에 이미지 설명을 입력하세요

하지만 나는 다음과 같이 만들고 싶습니다.여기에 이미지 설명을 입력하세요

내 코드:

    ... \\ 
        \\
        &
        \node [block_center] (des1) {X[0] OP Y[0]}; 
        &
        \node [block_center] (des2) {X[1] OP Y[1]}; 
        &
        \node [block_center] (des3) {X[2] OP Y[2]}; 
        &
        \node [block_center] (des4) {X[3] OP Y[3]}; 
        \\
    };
    \begin{scope}[every path/.style=line]
        
        \path (x1) -- (op1);
        \path (x2) -- (op2);
        \path (x3) -- (op3);
        \path (x4) -- (op4);
        
        \path (y1) -- (op1);
        \path (y2) -- (op2);
        \path (y3) -- (op3);
        \path (y4) -- (op4); ...
        

답변1

좋아, 당신은 여기에 처음 왔으니 ...

운동과 재미를 위해:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                chains,
                positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 5mm and 3mm,
  start chain = going right,
   box/.style = {draw, thick, 
                 text width=8em, minimum height=3ex, align=#1},
 box/.default = center
                        ]
\foreach \i in {0,1,...,3}
{
    \node  (n1\i)  [box, on chain] {X[\i]};
    \node  (n2\i)  [box=right, below=of n1\i] {Y[\i]};
    \node  (n3\i)  [box, below=of n2\i] {OPERATION};
    \draw[-Stealth] (n1\i) -- (n3\i);
    \draw[-Stealth] ([xshift=2em] n2\i.south) coordinate (aux) 
                                              -- (aux |- n3\i.north);
    \node  (n4\i)  [box, below=of n3\i] {X[\i] OP Y[\i]};
    \draw[-Stealth] (n3\i) -- (n4\i);
}
    \end{tikzpicture}        
\end{document}

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

부록: 여기서 연습은 원래 답변의 작은 변형이므로 결과는 약간 더 화려합니다 ...

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                chains,
                positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 5mm and 3mm,
  start chain = going right,
   box/.style = {draw, thick, outer sep=0pt,
                 text width=6em, minimum height=3ex, align=#1},
 box/.default = center
                        ]
\foreach \i in {0,1,...,3}
{
    \node  (n1\i)  [box, on chain] {X[\i]};
    \node  (n2\i)  [box=right, below=of n1\i] {Y[\i]};
    \node  (n3\i)  [box, below=of n2\i] {OPERATION};
    \draw[-Stealth] (n1\i) -- (n3\i);
    \draw[white, thick, densely dashed] (n2\i.north) -- (n2\i.south);
    \draw[-Stealth, 
          transform canvas={xshift=2em}] (n2\i) -- (n3\i);
    \node  (n4\i)  [box, below=of n3\i] {X[\i] OP Y[\i]};
    \draw[-Stealth] (n3\i) -- (n4\i);
}
    \end{tikzpicture}        
\end{document}

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

관련 정보