# Simple trees for mathematics

I have to draw many simple trees similar to the ones depicted for instance at page 128 or 133 of this beautiful book by Cheng and Lauda. I used to have some knowledge of the package forest, but unfortunately I now realise that I have forgotten most of it (although I guess I should play with the circle or encircle option, somehow).

The best would be a simple macro using forest or qtree allowing to draw these upward growing, unlabelled trees.

You could start here:

\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={%
label/.option=content,
grow=north,
content=,
circle,
fill,
minimum size=3pt,
inner sep=0pt,
}
[
[ [][] ]
[ [][][][] ]
]
\end{forest}
\end{document}


• Wonderful, many thanks! Quick remark for anybody interested in the same question: with the option grow=north the tree is drawn from right to left; in case you prefer the left to right version, then right option is grow'=north. – Andrea Gagna Feb 16 at 16:58

I've no experience with forest (DG's answer seems a good place to start) but have recreated one of the figures in the book using the tikz trees library (only), in case you decided that the forest package wasn't necessary and/or were already familiar with drawing in tikz.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{tikzpicture}[
level 1/.style={grow via three points={one child at (0,1) and two children at (-.5,1) and (.5,1)}},
level 2/.style={grow via three points={one child at (0,1) and two children at (-.25,1) and (.25,1)}},
level 3/.style={grow via three points={one child at (0,1) and two children at (-.125,1) and (.125,1)}},
every node/.style={circle, fill=black, inner sep = .25ex, minimum size=.25ex}]
\node {}
child{
node {}
child{
node {}
child{node {}}
child[very thick]{node {}}
child{node {}}
}
child{
node {}
}
}
child{
node {}
child{
node {}
child foreach \x in {1,2,3} {node {}}
}
child{
node {}
}
}
child{
node {}
child{
node {}
child[red]{node {}}
child[missing]
}
child{
node {}
}
}
child{
node {}
child{
node {}
}
child{
node {}
child{node {}}
child[missing]
child{node {}}
}
child{
node {}
}
};
\end{tikzpicture}


The drawing trees with tikz is explained in section 21 Making Trees Grow of the tikz manual. Noteworthy in this example:

• The coordinates in each style at the start of the picture determine the placement of children at the level indicated
• Individual children (edges) and nodes (vertices) can have their own styling (for example, very thick)
• The missing key is useful to create a child that 'takes up space' but is not visible (such as that adjacent to the edge highlighted in red above)
• If all children are going to be the same, you can use a foreach construct