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 am trying to figure out how I can draw a tree in a graph's node with tikz. Meaning, the node is not supposed to have a value or name but a tree inside of the circle around it.

I tried the following with no success:

  • Insertion of qtree with \Tree [.Root[.Node Leaf] ].Root
  • Insertion of a new picture in this node
share|improve this question

2 Answers 2

up vote 2 down vote accepted

I've no problem with tikz-qtree inside a tikzpicture inside a \node

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}
\node[circle,draw]{\begin{tikzpicture} 
\Tree  [.S  [.NP  [.Det  the  ]  [.N  cat  ]  ]
[.VP  [.V  sat  ]
[.PP  [.P  on  ]
[.NP  [.Det  the  ]  [.N  mat  ]  ]  ]  ]  ]\end{tikzpicture}};
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer

You can add another tikzpicure in your tikzpicture and draw a tree inside of it. Below is a simple example:

\documentclass{article}
\usepackage{tikz}

\begin{document}

%start first picture
\begin{tikzpicture}
%draw a node
 \node[circle,draw] {
%add a tikzpicture in the node
\begin{tikzpicture}
\node {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}
};
\end{tikzpicture}

\end{document}

enter image description here

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.