5

I've got

\Tree [.CP [.TP [.NP [.D the ] [.N woman ] [.CP [.TP [.NP [.N who
] ] [.VP [.V stole ] [.NP [.D my ] [.N necklace ] ] ] ] ] ] [.VP
[.V entered ] ] ] ]

which gives me a nice tree, but the last leaf nodes (e.g. from N to woman) have a line connecting. Can I remove that one?

1
  • Please always post code that begins with \documentclass{...} and ends with \end{document}, a so-called minimal working example (MWE). Once you've got this, it's easy to add a picture of the output to the question as well, which makes it more accessible for potential answerers.
    – doncherry
    Oct 3, 2012 at 21:07

1 Answer 1

5

Yes, you can remove this by doing the following:

Add the line

    \tikzset{every tree node/.style={align=center, anchor=north}}

This allows node labels to have line breaks in them.

Then make all your terminal nodes be part of the node label itself:

\documentclass{article}
\usepackage{tikz-qtree}
\tikzset{every tree node/.style={align=center, anchor=north}}
\begin{document}
\Tree [.CP [.TP [.NP [.D\\the ] [.N\\woman ] [.CP [.NP [.N\\who
] ] [.TP [.NP\\t ]  [.VP [.V\\stole ] [.NP [.D\\my ] [.N\\necklace ] ] ] ] ] ] [.VP
[.V\\entered ] ] ] ]
\end{document}

output of code

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.