1

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}
1

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}

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.