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 would like to show such a structure in my LaTeX document. How can this be done?

enter image description here

share|improve this question
    
Have a look to Work breakdown structures: it's a good starting point. –  Claudio Fiandrino Feb 23 '13 at 13:19
add comment

1 Answer

up vote 6 down vote accepted

The dirtree package is built for producing diagrams like this. Below I give its default style and then show how to adjust the parameters to get something closer to your hand drawing.

Sample output

\documentclass{article}

\usepackage{dirtree}

\begin{document}

\dirtree{%
.1 HTML.
.2 Head.
.3 Title.
.3 Meta.
.2 Body.
.3 SVG.
.4 Image.
}

\renewcommand{\DTstyle}{\textrm\expandafter\raisebox{-0.7ex}}
\DTsetlength{1em}{1em}{0.2em}{0.4pt}{0.4pt}
\setlength{\DTbaselineskip}{2\baselineskip}

\dirtree{%
.1 HTML.
.2 Head.
.3 Title.
.3 Meta.
.2 Body.
.3 SVG.
.4 Image.
}

\end{document}

The parameter changes that are made in the second example are as follows:

  1. The style of the nodes is changed so that (a) we use a standard text font and (b) the node is shifted down relative to the horizontal lines

  2. The standard lengths of dirtree are adjusted, so that (a) the dots at the cross are the same wdith 0.4pt as the lines, this is the last two parameters and (b) the vertical lines are moved further under the nodes, the first parameter 1em. The second and third parameters have their standard value

  3. The internal baseline skip of dirtree is made larger, moving the lines apart and moving the tops of the vertial lines down, so they don't cover the shifted text.

share|improve this answer
    
AWESOME! The code looks very nice and clean. Thank you very much. Is there the possibility of displaying three trees in a row next to each other? –  Benny Neugebauer Feb 23 '13 at 18:23
1  
No problem, just put each \dirtree in a minipage of width say 0.3\linewdith and collect them together in a center environment. –  Andrew Swann Feb 23 '13 at 20:12
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.