Possible Duplicate:
Creating a node fitting the horizontal width of two other nodes
I want to draw a rectangle node whose width is determined by the extent of two other nodes. I know there is minimum width, but I find the extraction of x coordinates rather difficult. Is there an easy way to achieve the desired result?
\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[rectangle,draw] (a) {a};
\node[rectangle,draw,right=0.2cm of a] (b) {b};
\node[rectangle,draw,below=0.2cm of a.south west,anchor=north west] (ab) {ab};
\end{tikzpicture}
\end{document}

How do I control the width of the "ab" node so that it is right-aligned with "b"?
(And, by the way, how do I control the height of the "a" node so that it matches the height of the "b" node? My workaround consists of using a \phantom{b} in such cases -- rather hackish...)
\phantom{b}you should use\vphantom{b}as that won't effect horizontal spacing. Alternatively you could use a\strut. – Peter Grill Jul 18 '12 at 04:43minimum widthto that value. – Jake Jul 18 '12 at 04:47\strut? – krlmlr Jul 18 '12 at 13:27\fbox{a\strut}\fbox{b\strut} \fbox{a\vphantom{b}}\fbox{b}There is also a\mathstrutfor use in math mode. – Peter Grill Jul 18 '12 at 21:24