1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows,positioning,shapes,arrows,decorations.markings,arrows.meta}

\tikzset{
      box/.style={draw,fill=white,rectangle,minimum size=2.5cm,align=center},
      diatostealth/.style={draw,{Diamond}-{Stealth}}
}

\begin{document}
\begin{tikzpicture}

\node[box](a){a}; 
\node[box, below left=1.5cm of a](b){b}; 
\node[box, below right=1.5cm of a](c){c}; 


% the arrows
\path[diatostealth] (a.south) -- (b.north){};
\path[diatostealth] (a.south) -- (c.north){};

\end{tikzpicture}
\end{document}

What I have This is what I have currently.

What I want This is what I am trying to achieve.

  • 2
    While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Dec 4 '14 at 22:08
2

You can use intermediate coordinates. So the line on the left can be achieved by:

\path[diatostealth, thick] 
    (a.south) 
    -- ++(0,-0.5cm)
    -| (b.north)
    ;

means:

  • start at (a.south).
  • the ++ means the coordinate which is -0.5cm below the last point,
  • the -| means to draw a horizontal and then ventical line to the point (b.north).

enter image description here

Code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows,positioning,shapes,arrows,decorations.markings,arrows.meta}

\tikzset{
      box/.style={draw,fill=white,rectangle,minimum size=2.5cm,align=center},
      diatostealth/.style={draw,{Diamond}-{Stealth}}
}

\begin{document}
\begin{tikzpicture}

\node[box](a){a}; 
\node[box, below left=1.5cm of a](b){b}; 
\node[box, below right=1.5cm of a](c){c}; 


% the arrows
\path[diatostealth, thick] 
    (a.south) 
    -- ++(0,-0.5cm)
    -| (b.north)
    ;
\path[diatostealth, thick] 
    (a.south) 
    -- ++(0,-0.5cm)
    -| (c.north){};

\end{tikzpicture}
\end{document}
2

If it looks like a tree, it should be a forest...

\documentclass[tikz,border=12pt,mult,varwidth]{standalone}
\usepackage{forest,amssymb}
\usetikzlibrary{shadows,arrows.meta}

\begin{document}

\tikzset{
  my shadow/.style={drop shadow={shadow xshift=.25ex, shadow yshift=-.25ex}}
}

\begin{forest}
  for tree={
    draw,
    parent anchor=south,
    child anchor=north,
    fill=white,
    my shadow,
    minimum width=20pt,
    text height=7.5pt,
    font=\sffamily,
    edge path={
      \noexpand\path [-{Stealth[]}, \forestoption{edge}] (!u.parent anchor) node [inner sep=0pt, anchor=north, outer sep=0pt, scale=.5] {$\blacklozenge$} -- +(0,-5pt) -| (.child anchor)\forestoption{edge label};
    },
  }
  [a
    [b]
    [c]
  ]
\end{forest}

abc forest

  • 1
    If it looks like a tree, it should be in a forest! – user11232 Dec 5 '14 at 10:10
  • @HarishKumar Yes... ;) But ironically, it is exceedingly difficult to include two or more trees in a forest of this kind :(. – cfr Dec 5 '14 at 15:53

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.