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 want to be able to draw something like nested triangles that are arranged in a tree-like fashion. Or explicitly, a node of a tree is represented as an isosceles triangle pointed upward. Each subtree should be drawn as a subtriangle.

Here is an image

enter image description here

Are there any nice packages for doing things like this? Or should I use a geometry drawing package.

share|improve this question
    
The tikz package is what I would recommend. –  Peter Grill Apr 16 '12 at 20:52
    
Thank you, I added an image. I was discussing Tikz with a few people this morning, and I had gotten the impression that is not user friendly. Would you suggest that in fact, Tikz is easy to use? –  Jonathan Gallagher Apr 16 '12 at 21:16
    
Tikz will have hiccups in the beginning. But you know it will be a starting trouble which goes off slowly. If you are after drawing software you can look at inkscape (inkscape.org) of geogebra (geogebra.org/cms). –  Harish Kumar Apr 16 '12 at 23:23
add comment

1 Answer 1

up vote 6 down vote accepted

As others have commented, PGF/TikZ can be an option. In the following example I used the isosceles triangle shape from the shapes library and defined the \MyTr command with three mandatory arguments (name, minimum height, and position of the triangle). Of course, this is just to show one possibility, but you can change and adapt the code depending on your specific needs:

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

\definecolor{tblue}{RGB}{207,232,229}

\newcommand\MyTr[3]{%
  \node[isosceles triangle, isosceles triangle apex angle=70,
    draw, inner sep=0pt,anchor=lower side,rotate=90,draw=black,
    fill=tblue, minimum height=#2 cm] (#1) at #3 {};
  \fill (#1.apex) -- (#1.20) -- (#1.340) -- cycle;}

\begin{document}

\begin{tikzpicture}
\MyTr{a}{8}{(0,0)}
\MyTr{b}{2.5}{(-2.5,0)}
\MyTr{c}{2.5}{(2.5,0)}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thank you! It looks like Tikz is certainly a reasonable solution. I will look into it. –  Jonathan Gallagher Apr 18 '12 at 0:32
    
@JonathanGallagher: you're welcome! If my response answers your question, please consider marking it as "Accepted" by clicking the tickmark below its vote count. –  Gonzalo Medina Apr 18 '12 at 1:28
    
Do you know of documentation for tikz where things like apex are defined. I did not see it in the manual by Tantau for example. –  Jonathan Gallagher Apr 18 '12 at 17:44
    
@JonathanGallagher: the anchors for the isosceles triangle shape appear in a diagram in page 429 of the current CTAN version of the pgfmanual. –  Gonzalo Medina Apr 18 '12 at 17:47
    
Thank you for the help! –  Jonathan Gallagher Apr 18 '12 at 18:11
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.