1

So I am making a tree for my thesis with the following code. I could not find a lot of answers on find how to link a child ("niveaus") to two parents ("soft skills" and "hard skills"), so I solved it this way (see code). My problem is that the node "niveaus" has to be on the same height as the nodes "profiel" en "competenties". How should I do that?

P.S. I know my code is horrible, but I am quite new to LaTeX and I have never used Tikz before.

enter image description here

\begin{tikzpicture}[
    sibling distance=8em,level distance=10em, every node/.style={shape=rectangle,draw,align=center,rounded corners,}, ->, grow=right, edge from parent/.style={draw,-latex}
]
  
  \node{profiel}
    child {node {competenties}
        child{node(sk){soft skills}
            child{node[above right](n){niveaus}}
        }
        child{node(hs){hard skills}
            child[missing] {
             node(n) {niveaus}
            }
        }
    };
\draw (hs) [-latex]-- (n);
\end{tikzpicture}
1
  • Hi and welcome. Please, give a fully compilable code.
    – AndréC
    Jun 28, 2020 at 19:59

2 Answers 2

0

Using the forestpackage:

\documentclass[border=3mm]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta}

\begin{document}
    \begin{forest}
for tree = {
% nodes
    draw,
    rounded corners, 
    text depth=0.25ex,
% tree
    grow=0,
    anchor=east,
    s sep=11mm,
% edges
    edge={-Stealth},
            }
[profiel
    [competenties
        [soft skills, name=sf]
        [,coordinate,no edge [niveaus, name=n,no edge]]
        [hard skills, name=hs]
    ]
]
\draw[-Stealth] (sf) edge (n)
                (hs) edge (n);
\end{forest}
\end{document}

enter image description here

1
  • This one worked perfectly, thanks so much! Only one question: how can I make the arrow from the node "profiel" to the node "competenties" a bit longer?
    – user216556
    Jun 29, 2020 at 8:16
0

enter image description here

\begin{tikzpicture}[
sibling distance=8em,
level distance=10em, 
every node/.style={
                    shape=rectangle,
                    draw,
                    align=center,
                    rounded corners,
                    }, 
grow=right, 
edge from parent/.style={
                        draw,
                        -latex
                        }
]

\node{profiel}child {node {competenties}
                child{node(sk){soft skills}
                    }child{node[xshift =3cm](n) {niveaus}edge from parent[draw=none]}
                child{node(hs){hard skills}
                        }   
    };
\draw (hs) [-latex]-- (n);
\draw (sk) [-latex]-- (n);
\end{tikzpicture}
3
  • 1
    Why you provide only code fragment and not an MWE?
    – Zarko
    Jun 29, 2020 at 3:32
  • same language that the OP understands is better
    – js bibra
    Jun 29, 2020 at 3:36
  • 1
    well, your answer is not only for OP, but should help to all others with similar problem. BTW, MWE provide (far) more information as a code fragment, which can gives different result at different documentclass and preamble. well, it is up tp you haw you convinced what is better for OP.
    – Zarko
    Jun 29, 2020 at 3:49

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.