由于实际文本有相当多的条目,我想减少不同条目之间的垂直空间。
如何将“家庭”放在页面中间,并水平均匀分布“父母”。
任何能使其看起来更令人愉悦的想法都将不胜感激:-)
如果有人知道使用 Tikz 生成类似布局的简单方法,我会很乐意使用它。
谢谢 - Peter(请原谅我未能将最小工作示例放入代码格式)
\documentclass[12pt
,a4paper
,bibliography=totocnumbered
,parskip=half]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows.meta}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
for tree={
%draw=black,
%rounded corners,
%minimum width=3cm,
%minimum height=4ex,
%edge={-Latex},
},
where={level()<=0}{%
anchor=west,%parent anchor=children,
}{%
folder,
grow'=east,
align=left,
}
[Family
[Parent A
[Child A
[Grandchild A1]
[Grandchild A2
[GrandgrandChild]
]
[Grandchild A3]
]
]
[Parent B
[Child 2
[Grandchild 2a]
[Grandchild 2b]
]
]
[Parent C
[Child 3
[Grandchild 3]
]
]
]
\end{forest}
\end{document}
答案1
您可以设置l=
和s sep=
选项,并手动将家庭节点移至中心。这是一个相对紧凑的形式:
\documentclass[12pt
,a4paper
,bibliography=totocnumbered
,parskip=half]{scrartcl}
\usepackage{showframe}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows.meta}
\usepackage[edges]{forest}
\begin{document}
{\centering
\begin{forest}
forked edges,
for tree={
%draw=black,
%rounded corners,
%minimum width=3cm,
%minimum height=4ex,
%edge={-Latex},
},
where={level()<1}{%
xshift=35.8pt,
s sep=-5pt,
}{%
folder,
grow'=east,
align=left,
l=20pt,
s sep=-5pt
}
[Family
[Parent A
[Child A
[Grandchild A1]
[Grandchild A2
[GrandgrandChild]
]
[Grandchild A3]
]
]
[Parent B
[Child 2
[Grandchild 2a]
[Grandchild 2b]
]
]
[Parent C
[Child 3
[Grandchild 3]
]
]
]
\end{forest}\par}
\end{document}