topnush
I am trying to draw the following simple tree.
```
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
level 1/.style={sibling distance=2cm},
level 2/.style={sibling distance=1.5cm}
every node/.style={circle, draw, minimum size=1cm} % Adjust the size as needed
]
\node[circle, draw] {5}
child {
node[circle, draw] {2}
child {
node[circle, draw] {1}
}
child {
node[circle, draw] {3, 4}
}
}
child {
node[circle, draw] {8, 10}
child {
node[circle, draw] {6, 7}
}
child {
node[circle, draw] {9}
}
child {
node[circle, draw] {11,12}
}
};
\end{tikzpicture}
\end{document}
```
This gives me:
![tree.png](/image?hash=9479c7752020354a7fa360961335a0800657c4be4a2094746b75a8ac4cb892b6)
My preferred solution would be reduce the space in the nodes with two numbers and increase the size of the nodes with one number to match.
Top Answer
samcarter
You could use the `forest` package. This will automatically avoid overlapping:
```
\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={circle,draw,minimum width=3em}
[5
[2
[1]
[{3,4}]
]
[{8,10}
[{6,7}]
[9]
[{11,12}]
]
]
\end{forest}
\end{document}
```
![document-1.png](/image?hash=ee5481636d7da420ccee8f607b94695f003948362fb0e033adfb670f9ac9da16)