# Aligning trees built with tikzpicture

I want to align some trees I am creating. I want the root node of all the trees to be on the same line. Currently for each tree I create, the root node of each subsequent tree is on a line after the bottom of the previous tree. How can I do this?

-

In a very simple manner, you can specify the position of the root in the picture. Look at this MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}

\begin{tikzpicture}[edge from parent fork down,
every node/.style={fill=red!30,rounded corners},
edge from parent/.style={red,thick,draw}]
\node at (0,0) {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};

\node at (4,0) {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};

\node at (8,0) {root}
child {node {left}}
child {node {right}
child {node {child}}
child {node {child}}
};
\end{tikzpicture}

\end{document}


This will be graphically:

-
that's exactly what I want to do. –  Harold Rosenberger Apr 7 '12 at 14:02
[edge from parent fork down,every node/.style=fill=red!30,rounded corners}, edge from parent/.style={red,thick,draw}] –  Harold Rosenberger Apr 7 '12 at 14:04
Now, I do now have nice straight lines as shown. ALso, how can I get it to look more like a typical binary tree? Also, the top two level of my trees, the nodes are black. –  Harold Rosenberger Apr 7 '12 at 14:16
Happy that it works also to you. To have the picture more similar to a binary tree you just need to remove the general options in [ ] after the opening of the tikzpicture. You can also refer to the pgfmanual page 114 (version October 25, 2010). –  Claudio Fiandrino Apr 7 '12 at 14:22