forest
allows you to draw trees using a slightly more intuitive syntax, I think:
no need to leave spaces before the closing bracket, although it isn't a problem if you do so, either;
no need to preface a new sub-tree with a dot - just use brackets with nesting to represent the tree structure;
no need to explicitly make things TikZ nodes in order to name them - all nodes are TikZ nodes and can be given a name using name=
and, if necessary, extra names using alias=
.
In the following code, I've also used a phantom
node in order to move the bottom left node outwards, so that the connection between abelian groups
and class 5
is displayed more naturally.
\documentclass[tikz, border=5pt, varwidth, multi]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
parent anchor=south,
child anchor=north,
}
[Boolean Groups
[Abelian Groups, name=abelian groups
[Groups]
[, phantom]
]
[Class 3
[Class 5, name=class 5]
[Class 1]
[Class 2]
[Class 4]
]
]
\draw (abelian groups.south) -- (class 5);
\end{forest}
\end{document}
