我用 Tikz 写了一棵树。代码如下
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\makeatletter
\date{}
\author{}
\makeatother
\begin{document}
\title{}
\maketitle
\begin{tikzpicture}
[
level 1/.style = { sibling distance = 8cm},
level 2/.style = { sibling distance = 6cm},
level 3/.style = { sibling distance = 4cm},
level 4/.style = { sibling distance = 2cm},
edge from parent fork down,
inner sep =0cm
]
\node {}
child {node {}
child {node{}
child {node {}
child {node {Lamproie}}}}}
child {node {}
child {node {}
child {node {}
child {node {Anguille}}}}
child {node {}
child {node{}
child {node {Dauphin}}
child {node {Gorille}}}
child {node {}
child {node {Crocodile}}
child {node {Aigle}}
}
}
}
;
\end{tikzpicture}
\end{document}
答案1
比较forest
简单。代码也更短更清晰:
\documentclass[margin=3mm]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
delay={where content={}{shape=coordinate}{}}, % insert coordinates in empty node
where n children=0{tier=word}{}, % align nodes at bottom of tree
for tree={
forked edge, % for forked edge
s sep = 2mm, % sibling distance
l sep = 6mm, % level distance
fork sep = 3mm, % distance from parent to branching point
}
[
[Lamproie]
[
[Anguille]
[
[
[Dauphin]
[Gorille]
]
[
[Crocodil]
[Aigle]
]
]
]
]
\end{forest}
\end{document}