矢印を動かす

矢印を動かす

非常にシンプルな 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}

ここに画像の説明を入力してください

関連情報