# How to draw hierarchical boxes with vertical lines of sight? [duplicate]

Possible Duplicate:
Creating a node fitting the horizontal width of two other nodes

I would like to draw a hierarchy of boxes where the borders of the boxes are vertically in the same line of sight. To give an example: (Unfortunately, new members are not allowed to post images ...)

*----------------------------------*
|              Level 1             |
*----------------------------------*
*--------------*    *--------------*
|    Level 2   |    |    Level 2   |
*--------------*    *--------------*


My problem is that, using nodes and drawing rectangles, I can't figure out how to adjust the size of the level 1 box such that the right and left border are in the same line of sight as the boxes of level 2. Is it maybe the wrong approach? Thanks in advance!

Cheers, Sema

-

## marked as duplicate by Tom Bombadil, Marco Daniel, Gonzalo Medina, lockstep, KurtOct 12 '12 at 22:26

Welcome to TeX.sx! Can you provide a minimal working example (MWE) so that we can see what you accomplished so far? As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. –  Qrrbrbirlbel Oct 12 '12 at 21:42

A simple method when all widths are known.

The TikZ library positioning is used here. Now you can reference the outer points of a shape in below=of.

## Code

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\draw [help lines] (-3,-2) grid (3,1);
\node[
minimum width=6cm,
draw
] (l1) {Level 1};
\node[
below=of l1.west,
anchor=west,
minimum width=2.5cm,
draw
] {Level 2a};
\node[
below=of l1.east,
anchor=east,
minimum width=2.5cm,
draw
] {Level 2b};
\end{tikzpicture}
\end{document}


## Output

-
Nearly the same code that I had prepared, so I prefer to don't post a nearly identical answer and vote for yours instead! ;-) –  Benedikt Bauer Oct 12 '12 at 22:10