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 create a LCM tree diagram which looks something like this:

http://static.prometheanplanet.com/images/resources/resource-thumbnails/thumb-nprealg-04-01-0002-diagram-thumb-lg-png.png

Also what is the code to draw circles around numbers?

share|improve this question
    
Welcome to TeX.sx! –  xfoo Jan 27 '13 at 18:09
    
Thank you all from the bottom of my heart! I know my students will appreciate these worksheets that you guys helped designed –  ElementarySchool Jan 30 '13 at 10:14
add comment

3 Answers 3

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}

output of code

share|improve this answer
add comment

With my tikz-based package forest, this can be achieved in a very concise way:

screenshot

\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}
share|improve this answer
2  
+1 This forest package looks like serious business!... –  Count Zero Jan 27 '13 at 21:06
    
@CountZero tnx! it did take a serious amount of time to write it ... :-) –  Sašo Živanović Jan 27 '13 at 21:35
1  
Congratulations and a big thank you for you contribution. Can you please add your details in here meta.tex.stackexchange.com/questions/1181/… ? You can use the proper icon for the dev-page. –  percusse Jan 27 '13 at 22:25
    
Thanks. Added --- great idea having such a page! I didn't use the icon since forest-styles is only a style repository. –  Sašo Živanović Jan 28 '13 at 0:27
    
@SašoŽivanović 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 0:41
show 2 more comments

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}
share|improve this answer
add comment

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.