Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm drawing a tree using the tikz-qtree package. There is a lot of text in the nodes. I'm finding it difficult to get the edges to meet the edge of the nodes. For some nodes with lots of text, the edge goes too far. Code is

\documentclass{minimal}
\usepackage{graphicx}
\usepackage{a4wide}

\usepackage{fullpage}
\usepackage{tikz}

\usetikzlibrary{shapes, positioning, shadows, trees}

\usepackage{tikz-dependency}
\usepackage{tikz-qtree}

\begin{document}
%===================================================

\centering
\begin{tikzpicture}

\tikzset{font=\small,
edge from parent fork down,
level distance=2.7cm,
every node/.style=
{top color=white,
bottom color=blue!10,
rectangle,rounded corners,
%minimum height=8mm,
draw=black,
thick,
align=center,
sibling distance = 4ex,   
%text depth = 0pt
},
edge from parent/.style=
{draw=black,
thick
}}

\Tree [.Morphemes [.Free-standing [.Open-class {cat, chase, dog} ] [.Closed-class {(1) Pronouns; she, him\\(2) Determiners; the, this\\(3) Prepositions; on, at\\(4) Auxilary verbs;\\ \textit{have} done, \textit{is} doing} ] ]
              [.Bound [.Open-class NONE ] [.Closed-class 
              [.Derivational {care-less\\un-wind} ] [.Inflectional {(1) Tense/Agreement marking on verbs;\\He go-es, They laugh-ed\\(2) Plural marking on nouns;\\dog-s, cat-s} ]                 
              ]]
]

\end{tikzpicture}



%====================================================

\end{document}

This is what the overlap looks likes (below). Any hints warmly welcomed.

overlap

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You need to characterize the path from the parent node to the child node. I take as reference the last example of page 4 in the documentation of tikz-qtree.

Code:

\documentclass{article}
\usepackage{tikz-qtree}
\usetikzlibrary{trees}

\begin{document}
%===================================================

\centering
\begin{tikzpicture}
\tikzset{font=\small,
edge from parent fork down,
level distance=2.7cm,
every node/.style=
{top color=white,
bottom color=blue!10,
rectangle,rounded corners,
%minimum height=8mm,
draw=black,
thick,
align=center,
sibling distance = 4ex,   
%text depth = 0pt
},
edge from parent/.style=
{draw=black,
thick,
% |-|-| here starts the new part
edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}
}}

\Tree [.Morphemes [.Free-standing [.Open-class {cat, chase, dog} ] [.Closed-class {(1) Pronouns; she, him\\(2) Determiners; the, this\\(3) Prepositions; on, at\\(4) Auxilary verbs;\\ \textit{have} done, \textit{is} doing} ] ]
              [.Bound [.Open-class NONE ] [.Closed-class 
              [.Derivational {care-less\\un-wind} ] [.Inflectional {(1) Tense/Agreement marking on verbs;\\He go-es, They laugh-ed\\(2) Plural marking on nouns;\\dog-s, cat-s} ]                 
              ]]
]

\end{tikzpicture}
%====================================================

\end{document}

Result:

enter image description here

share|improve this answer
    
Brilliant, thanks. That does the trick. –  Nick Riches Aug 2 '12 at 9:56
    
Glad of having helped you. If you are fully satisfied by the answer, please consider accepting it by clicking on the mark below the down arrow. :) –  Claudio Fiandrino Aug 2 '12 at 12:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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