0

I want the arrow to be perpendicular between the node. How I can do this? Right now, it is slanted, between south.center to north.center of the nodes.

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shadows,petri,decorations.markings,shapes,calc}
\begin{document}
\tikzstyle{block} = [rectangle, fill=red!20,
text width=.23\textwidth, text centered, rounded corners, node distance=1cm]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[thick,scale=1, every node/.style={scale=0.9}]
    \node[block]at (0,0) (init) {Hello};
    \node[block, below of =init,xshift=1cm](init2) {Hello};
    \path[line](init)--(init2);
\end{tikzpicture}
\end{document}

enter image description here

NB: Please note, xshift of init2 is to show the situation. I have to adjust the path.

1
  • please have a look at the answer below if it meets the requirement -- (init.south|-init2.north) creates a temp node intersection lying directly below` init` node\
    – js bibra
    Dec 1 '20 at 15:25
2

enter image description here

\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shadows,petri,decorations.markings,shapes,calc}
\begin{document}
    \tikzstyle{block} = [rectangle, fill=red!20,
    text width=.23\textwidth, text centered, rounded corners, node distance=1cm]
    \tikzstyle{line} = [draw, -latex']
    \begin{tikzpicture}[thick,scale=1, every node/.style={scale=0.9}]
        \node[block]at (0,0) (init) {Hello};
        \node[block, below of =init,xshift=1cm](init2) {Hello};
        \path[line](init.south)--(init.south|-init2.north);
    \end{tikzpicture}
\end{document}
0

It is not clear, how your arrow should be:

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

\begin{document}
    \begin{tikzpicture}[
node distance = 8mm and 2mm,
  arr/.style = {semithick, -Straight Barb},
block/.style = {fill=red!20, rounded corners, 
                text width=.23\textwidth, align=center}
                        ]
\node (init1) [block]    {Hello};
\node (init2) [block, below=of init1, xshift=3em] {Hello};
%
\draw[arr] (init1) -- (init1 |- init2.north);    % this
\draw[arr, gray, very thick, semitransparent] (init1.south) -- ++ (0,-0.3) -| (init2); % or this?
    \end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.