1

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?

Torbjørn T.
  • 206,688

1 Answers1

2

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:

enter image description here