# draw an ellipse into a Tree picture -tikz package

I have draw a tree using tikz package like this

\begin{tikzpicture}
\tikzstyle{level 1}=[sibling distance=40mm]
\tikzstyle{level 2}=[sibling distance=20mm]
\tikzstyle{level 3}=[sibling distance=10mm]
\node{S}
child{node{N} child{node{mary}} }
child{node{VP}
child{node{V} child{node{brought }}}
child{node{NP}   child{node{D} child{node{a}}} child{node{N} child{node{cat}}}  }
child{node{PP}  child{node{IN} child{node{to}}}     child{node{N}  child{node{school}}} }                          }
;
\end{tikzpicture}


the result of my picture it is like this

Now i want to draw an ellipse an some text in my picture to describe her like this

How i can do that , any answer will be appreciate

Name the nodes and use the fit library:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,shapes}

\begin{document}

\begin{tikzpicture}[every fit/.style={ellipse,draw,red,inner sep=-2pt},]
\tikzstyle{level 1}=[sibling distance=40mm]
\tikzstyle{level 2}=[sibling distance=20mm]
\tikzstyle{level 3}=[sibling distance=10mm]
\node (S) {S}
child{node (n) {N} child{node (mary) {mary}} }
child{node (VP) {VP}
child{node{V} child{node{brought }}}
child{node (np) {NP}   child{node{D} child{node (a) {a}}} child{node{N} child{node (cat) {cat}}}  }
child{node{PP}  child{node{IN} child{node{to}}}     child{node{N}  child{node{school}}} }                          }
;

\node[fit=(np) (a) (cat)] {};
\node[fit=(n) (mary)] {};
\node[right=1cm,red] at (S) {S $\rightarrow$ N VP};
\node[right=1cm,red] at (VP) {VP $\rightarrow$ V NP PP};

\end{tikzpicture}

\end{document}


• I did exactly the same, I took the liberty to edit your post to add the labels – Tom Bombadil Jun 10 '12 at 20:22
• @TomBombadil: thanks; I was just going to add the texts in red. – Gonzalo Medina Jun 10 '12 at 20:23