4

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
4

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

| improve this answer | |
2

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

| improve this answer | |

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.