4
\documentclass{article}  
\usepackage{tikz}  
\usepackage{tikz-qtree}  
\usetikzlibrary{trees} % this is to allow the fork right path  
\pagecolor{olive!50!yellow!50!white}  
\begin{document}  

\begin{tikzpicture}[level distance=1.25in,sibling distance=.25in,scale=.75]
\tikzset{edge from parent/.style= 
            {thick, draw,
                edge from parent fork right},every tree node/.style={draw,minimum width=1in,text width=1in, align=center,fill=white},grow'=right}  
\Tree   
    [. parent   
        [.{nice child0}  
                [.{grandchild0-0 } ]  
            [.{grandchild0-1 } ]  
            [.{grandchild0-2 } ]  
            [.{grandchild0-3 with a really long name } ]  
        ]  
        [.child1  
                [.{grandchild1-0 } ]  
            [.{grandchild1-1 } ]  
            [.{grandchild1-2 } ]  
        ]   
        [.child2 ]  
        [.child3 ]  
    ]  
\begin{scope}  
\tikzset{edge from parent/.style= 
            {thick, draw,
                edge from parent fork left},every tree node/.style={draw,minimum width=1in,text width=1in, align=center,fill=white},grow'=left}  

\Tree   
    [.\node[draw=none]{};   
        [.{nice child0}  
                [.{grandchild0-0 } ]  
            [.{grandchild0-1 } ]  
            [.{grandchild0-2 } ]  
            [.{grandchild0-3 with a really long name } ]  
        ]  
        [.child1
                [.{grandchild1-0 } ]  
            [.{grandchild1-1 } ]  
            [.{grandchild1-2 } ]  
        ]   
        [.child2 ]  
        [.child3 ]  
    ]  

\end{scope}  
\end{tikzpicture}  
\end{document}
3

It has to do with how you overlay your tree nodes. Notice that TikZ draws the first nodes and sets the parent node and subsequently draws on top of that; hence, the way you had it, TikZ would fill draw and empty box on top of your label. Therefore, switching the order in which it is drawn solves the problem.

enter image description here

See the MWE:

\documentclass{article}  
\usepackage{tikz}  
\usepackage{tikz-qtree}  
\usetikzlibrary{trees} % this is to allow the fork right path  
\pagecolor{olive!50!yellow!50!white}  
\begin{document}  

\begin{tikzpicture}[level distance=1.25in,sibling distance=.25in,scale=.75]
\tikzset{edge from parent/.style= 
            {thick, draw,
                edge from parent fork right},every tree node/.style={draw,minimum width=1in,text width=1in, align=center,fill=white},grow'=right}  
\Tree   
    [.{}   
        [.{nice child0}  
                [.{grandchild0-0 } ]  
            [.{grandchild0-1 } ]  
            [.{grandchild0-2 } ]  
            [.{grandchild0-3 with a really long name } ]  
        ]  
        [.child1  
                [.{grandchild1-0 } ]  
            [.{grandchild1-1 } ]  
            [.{grandchild1-2 } ]  
        ]   
        [.child2 ]  
        [.child3 ]  
    ]  
\begin{scope}  
\tikzset{edge from parent/.style= 
            {thick, draw,
                edge from parent fork left},every tree node/.style={draw,minimum width=1in,text width=1in, align=center,fill=white},grow'=left}  

\Tree
    [.{parent}   
        [.{nice child0}  
            [.{grandchild0-0 } ]  
            [.{grandchild0-1 } ]  
            [.{grandchild0-2 } ]  
            [.{grandchild0-3 with a really long name } ]  
        ]  
        [.child1
                [.{grandchild1-0 } ]  
            [.{grandchild1-1 } ]  
            [.{grandchild1-2 } ]  
        ]   
        [.child2 ]  
        [.child3 ]  
    ]  

\end{scope}  
\end{tikzpicture}  
\end{document}

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.