
答え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}