\documentclass[border=10pt]{standalone}
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
every node/.style = {shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20}]]
\node {A}
child { node {A1} }
child { node {A2}
child { node {B1}
child { node {B2} }
child { node {C1} } }
child { node {C2} } };
\end{tikzpicture}
\end{document}
有什么提示吗?
答案1
这里有一个解决方案forest
,它基本上就是为做这种事情而设计的。
\documentclass{article}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={draw, rounded corners=5mm, font=\sffamily,
minimum width=2cm, minimum height=1cm,
forked edge, edge={blue,-latex},
s sep=2cm, l sep=1cm, fork sep=5mm}
[A[A1][A2[B1[C1][C2]][B2]]]
\end{forest}
\end{document}