我一直想用填充点来给一些节点上色。但我被卡住了,按照森林包指南,我只能填充第一行和两行。
我正在尝试做的事情:
我只能做第一个和第二个。这是我的最小代码:
\documentclass[border=3mm]{standalone}
\usepackage[linguistics,edges]{forest}
\forestset{
ned/.style={%
for tree={calign=fixed edge angles},
delay={%
where content={}{%
shape=coordinate,
for nodewalk={%
Nodewalk={%
on invalid=fake,
}{%
parent,
}{%
for children={anchor=north},
}
}{},
}{},
},
},
}
\begin{document}
\begin{forest}
ned
[DP
[
[
[pro]
[
[VP
[NP\\ t\textsubscript{1}]
[V\\Tuttukları]
]
[T]
]
]
[C]
]
[
[NP\\aşçı]
[D]
]
]
\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=red] (!1.child anchor) circle[radius=2pt];
\end{forest}
\end{document}
答案1
为了更容易理解,我每个节点选择了一种颜色(您可以根据需要将它们更改为红色)。
从上到下:
\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=black] (!1.child anchor) circle[radius=2pt];
\path[fill=green] (!11.child anchor) circle[radius=2pt];
\path[fill=blue] (!112.child anchor) circle[radius=2pt];
\path[fill=yellow] (!1121.south) circle[radius=2pt];
\path[fill=orange] (!11212.child anchor) circle[radius=2pt];
梅威瑟:
\documentclass[border=3mm]{standalone}
\usepackage[linguistics,edges]{forest}
\forestset{
ned/.style={%
for tree={calign=fixed edge angles},
delay={%
where content={}{%
shape=coordinate,
for nodewalk={%
Nodewalk={%
on invalid=fake,
}{%
parent,
}{%
for children={anchor=north},
}
}{},
}{},
},
},
}
\begin{document}
\begin{forest}
ned
[DP
[
[
[pro]
[
[VP
[NP\\ t\textsubscript{1}]
[V\\Tuttukları]
]
[T]
]
]
[C]
]
[
[NP\\aşçı]
[D]
]
]
\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=black] (!1.child anchor) circle[radius=2pt];
\path[fill=green] (!11.child anchor) circle[radius=2pt];
\path[fill=blue] (!112.child anchor) circle[radius=2pt];
\path[fill=yellow] (!1121.south) circle[radius=2pt];
\path[fill=orange] (!11212.child anchor) circle[radius=2pt];
\end{forest}
\end{document}
我认为它是不言自明的,否则请告诉我。