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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I type set this example, I get

I, love, my , country

as four different nodes.

I know I am not able to get a syntax for enclosing MULTIPLE words together for tikz-qtree. I tried to look into various examples in manual, but manual has used single words only to exemplify.

\begin{tikzpicture}
    \tikzset{edge from parent/.style=
    {draw,
    edge from parent path={(\tikzparentnode.south)
    -- +(0,-8pt)
    -| (\tikzchildnode)}}}
    \Tree [.S [.I love my country [.Det the ] [.N cat ] ]
    [.VP [.V sat ]
    [.PP [.P on ]
    [.NP [.Det the ] [.N mat ] ] ] ] ]
    \end{tikzpicture}
share|improve this question

Here is the answer. Just enclose in{}. Sorry for the inconvenience.

\begin{tikzpicture}
    \tikzset{edge from parent/.style=
    {draw,
    edge from parent path={(\tikzparentnode.south)
    -- +(0,-8pt)
    -| (\tikzchildnode)}}}
    \Tree [.S [.{I love my country}  [.Det the ] [.N cat ] ]
    [.VP [.V sat ]
    [.PP [.P on ]
    [.NP [.Det the ] [.N mat ] ] ] ] ]
    \end{tikzpicture}

Just to high light the change-

\documentclass{article}
\usepackage{tikz, tikz-qtree}
\begin{document}

\begin{tikzpicture}
    \tikzset{edge from parent/.style=
    {draw,
    edge from parent path={(\tikzparentnode.south)
    -- +(0,-8pt)
    -| (\tikzchildnode)}}}
    \Tree [.S [.{\colorbox{red}{I love my country}}  [.Det the ] [.N cat ] ]
    [.VP [.V sat ]
    [.PP [.P on ]
    [.NP [.Det the ] [.N mat ] ] ] ] ]
    \end{tikzpicture}

\end{document}
share|improve this answer

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.