没研究过tikz-qtree
这个包,只测试了下原生的写法。或许有更好的实践。晚点再测试下。
\documentclass[tikz,border=2pt]{standalone}
% \usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[grow=right,
growth parent anchor=east,
every node/.style={draw,
inner sep=0pt,
outer sep=0pt},
level 1/.style={anchor=west,
level distance=2cm,
sibling distance=2cm},
level 2/.style={anchor=west,
level distance=2cm,
sibling distance=1cm},
edge from parent path={(\tikzparentnode.east) |-
(\tikzchildnode.west)}
]
\node [anchor=east] {Root}
child {node {A}
child {node {a1}}
child {node {a2}}}
child {node {BBBB}
child {node {b1}}
child {node {b2}}};
\draw [step=1cm,help lines] (0,-2) grid (6,2);
\end{tikzpicture}
\end{document}
问 更改 tikz-qtrees 中 level distance 的计算方式