I want to list the number of subsets of the set {1, 2, 3, 4, 5}. I tried with forest
package.
\documentclass[border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={edge={->}}
[\{1;\,2;\,3;\,4;\,5\}[1[2[3[4[5]][5]][4[5]][5]][3[4[5]][5]][4[5]][5]][2[3[4[5]][5]][4[5]][5]][3[4[5]][5]][4[5]][5]]
\end{forest}
\end{document}
In this diagram, have not the empty set. What is the better way to list?
Best Answer
Here's another method, which I eventually figured out. Instead of using pure TikZ, it combines Forest with expl3 functions to construct the contents of all nodes bar the root.
subsets
initiates the style.n elements=<integer>
should be used to specify the number of elements in the root subset. The style will then construct the root subset, add the descendants and populate them appropriately. That is,will produce the tree for the root set containing 3 elements
and
that for the set containing 5.
Complete code: