![将空节点示例转换为森林 2.0](https://linux22.com/image/348359/%E5%B0%86%E7%A9%BA%E8%8A%82%E7%82%B9%E7%A4%BA%E4%BE%8B%E8%BD%AC%E6%8D%A2%E4%B8%BA%E6%A3%AE%E6%9E%97%202.0%20.png)
我使用下面的代码来生成该图形:
\documentclass{article}
\usepackage{forest}
\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,base=top},
where n children=0{tier=word}{}
}}
% auxiliary nodes without node label
\forestset{
empty nodes/.style={
delay={where content={}{shape=coordinate,for parent={for children={anchor=north}}}{}}}
}
\begin{document}
\begin{forest}
sn edges, empty nodes
[{}
[{} [{} [Mummy]]
[{} [must]]
[{} [leave]]]
[{} [now]]]
\end{forest}
\end{document}
这对于 1.0(例如 texlive 2013)运行良好,forest
但我无法让它在 2.0 上运行forest
。
这是我尝试过的:
\documentclass{article}
\usepackage{forest}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,base=top},
where n children=0{tier=word}{}
}}
\begin{document}
\begin{forest}
sn edges
[{}, nice empty nodes
[{} [{} [Mummy]]
[{} [must]]
[{} [leave]]]
[{} [now]]]
\end{forest}
\end{document}
答案1
定义empty nodes
为
\forestset{
empty nodes/.style={
for tree={calign=fixed edge angles},
delay={where content={}{shape=coordinate,for siblings={anchor=north}}{}}
}
}
看这个答案了解详情。