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.

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

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

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 2 down vote accepted

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.


    \draw [help lines] (-3,-2) grid (3,1);
        minimum width=6cm,
        ] (l1) {Level 1};
        below=of l1.west,
        minimum width=2.5cm,
        ] {Level 2a};
        below=of l1.east,
        minimum width=2.5cm,
        ] {Level 2b};


enter image description here

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.