这基本上是同一个问题森林:创建不占用空间的幻影节点?但那里提供的解决方案不适用于森林 2.1.5。我希望幻影 S 不占用空间。我尝试将基线设置为幻影节点,但这没有任何效果。
\documentclass{article}
\usepackage{forest}
\useforestlibrary{linguistics}
\begin{document}
\noindent
This is some very informative text, that is very informative.\\
\begin{forest}
[\phantom{S}
[S, no edge, baseline
[NP,name=np11
[he]]
[VP, name=vp1
[V,name=v1 [knows]]]]
[S, no edge, name=s2
[V, name=vcoord, no edge [and, name=and, no edge]]
[VP
[V,name=v2 [loves]]
[NP, name=np22 [this record, roof]]]]]
\draw (s2.south)--(np11.north)
(vp1.south)--(np22.north);
\draw[thick] (vcoord.south)--(v1.north)
(vcoord.south)--(v2.north)
(vcoord.south)--(and.north);
\end{forest}
\end{document}
答案1
解决方案是使用phantom
键forest
而不是\phantom
宏,这只会使 S 不可见。
\documentclass{article}
\usepackage[linguistics]{forest}
\begin{document}
\noindent
This is some very informative text, that is very informative.\\
\begin{forest}
[S, phantom
[S, no edge, baseline
[NP,name=np11
[he]]
[VP, name=vp1
[V,name=v1 [knows]]]]
[S, no edge, name=s2
[V, name=vcoord, no edge [and, name=and, no edge]]
[VP
[V,name=v2 [loves]]
[NP, name=np22 [this record, roof]]]]]
\draw (s2.south)--(np11.north)
(vp1.south)--(np22.north);
\draw[thick] (vcoord.south)--(v1.north)
(vcoord.south)--(v2.north)
(vcoord.south)--(and.north);
\end{forest}
\end{document}