I am trying to create a LCM tree diagram which looks something like this:

Also what is the code to draw circles around numbers?
I am trying to create a LCM tree diagram which looks something like this:

Also what is the code to draw circles around numbers?
With my tikz-based package forest, this can be achieved in a very concise way:

\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest} mark/.style={circle,draw=red}
[8[2,mark][4[2,mark][2,mark]]]
\end{forest}
\end{document}
forest is indeed a very nice package. I'm wondering why you decided not to use the qtree .label syntax for node labels. I've got lots of legacy trees, so that switching to forest would take some effort. Would it be possible to support both styles?
– Alan Munn
Jan 28 '13 at 00:41
synttree's syntax to qtrees. Legacy trees ... "native" support will surely not be possible, because forest (like synttree) requires every node, including leaves, to be bracketed. It might be possible, however, to create a style which would use forest's dynamic tree mechanism to cover the rudimentary qtree syntax. I'll think about it...
– Sašo Živanović
Jan 28 '13 at 01:02
Tikz can do nice trees:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[thick]
\node {8}
child { node[circle,draw=red] {2} }
child { node {4}
child { node[circle,draw=red] {2} }
child { node[circle,draw=red] {2} }
};
\end{tikzpicture}
\end{center}
\end{document}
Just to add the obligatory tikz-qtree solution:
\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[Red/.style={circle,draw=red}]
\Tree [.8 [.\node[Red] (A){2}; ]
[.4
[.\node [Red] (B) {2}; ]
[.\node [Red] (C) {2};]]]
\end{tikzpicture}
\end{document}
