
решение1
Вы можете использовать мощныйforest
пакет; вы даже можете доверить пакету расчеты содержимого:
Код:
\documentclass[border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
parent anchor=south,
s sep=2pt
},
delay={for descendants={
if n=1
{draw,content/.wrap 2 pgfmath args=
{$c\binom{n}{#2}^{2}$}{content}{int(2^level)}}
{if n'=1{draw,content/.wrap 2 pgfmath args=
{$c\binom{n}{#2}^{2}$}{content}{int(2^level)}}{}
},
where n children={0}{draw,content=c}{}
}
}
[$cn^{2}$,draw
[
[
[
[]
[]
[]
]
[
[,phantom]
]
[
[,phantom]
]
[
[]
[]
[]
]
]
[
[,phantom]
]
[
[,phantom]
]
[
[
[]
[]
[]
]
[
[,phantom]
]
[
[,phantom]
]
[
[]
[]
[]
]
]
]
[
[,phantom [,phantom]]
]
[
[,phantom [,phantom]]
]
[
[
[
[]
[]
[]
]
[
[,phantom]
]
[
[,phantom]
]
[
[]
[]
[]
]
]
[
[,phantom]
]
[
[,phantom]
]
[
[
[]
[]
[]
]
[
[,phantom]
]
[
[,phantom]
]
[
[]
[]
[]
]
]
]
]
\end{forest}
\end{document}
решение2
forest
позволяет вам указать дерево, используя стандартную скобочную нотацию. Смотритемой ответ на предыдущий вопросдля объяснения того, как превратить дерево в спецификацию с помощью скобочной нотации. Другие ответы там охватывают другие пакеты, подходящие для рисования простых деревьев (как указано в вопросе). Так что если вам не нравится forest
, возможно, подойдет что-то другое.
Для forest
начала вот прототип:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
draw,
align=center
}
[root
[child
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
[grandchild, calign with current]
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
]
[child
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
[grandchild, calign with current]
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
]
[child
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
[grandchild, calign with current]
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
]
[child
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
[grandchild, calign with current]
[grandchild
[great\\-grandchild]
[great\\-grandchild]
[great\\-grandchild]
]
]
]
\end{forest}
\end{document}