3

I have four nodes, one parent and three children. I am trying to link with these specific arrow paths:

path lines I want

I have only just started working with the tikz package and my code so far looks like:

\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc}

\begin{document}

\begin{tikzpicture}[
,node distance =5mm
,>=latex'
,block/.style ={
    ,draw
    ,minimum height = 10mm
    ,minimum width =28mm
    ,align=center
    }
,every path/.style={->} %sets arrow style
]
\node [block]   (main) {Main};
\node [block, below=of main] (second)   {Second};  
\node [block, left=of second] (first)   {First};
\node [block, right=of second] (third)  {Third};

\draw (main) to (first);
\draw (main) to (second);
\draw (main) to (third);
\end{tikzpicture}

\end{document}

Which gives me:

enter image description here

I tried using -| but that only produced one corner in the path, not the two I need. Any help is appreciated.

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Tiuri Jan 9 at 10:50
4

like this:

enter image description here

\begin{tikzpicture}[
,node distance =5mm
,>=latex'
,block/.style ={
    ,draw
    ,minimum height = 10mm
    ,minimum width =28mm
    ,align=center
    }
,every path/.style={->} %sets arrow style
]
\node [block]   (main) {Main};
\node [block, below=of main] (second)   {Second};
\node [block, left=of second] (first)   {First};
\node [block, right=of second] (third)  {Third};

\draw ([xshift=-3mm] main.south) -- + (0,-2mm) -| (first);
\draw (main) to (second);
\draw ([xshift= 3mm] main.south) -- + (0,-2mm) -| (third);
\end{tikzpicture}
  • Ah great! Thankyou @Zarko - can I also ask what is the role of the "-- + (0,-2mm)" operation? – Davin Jan 9 at 11:04
  • in used case: "draw from given coordinate 2mm down". it is relative coordinate. see 13.4 Relative and Incremental Coordinates, tikz and pgf manual, page 143. – Zarko Jan 9 at 13:48

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.