用forest 2.1.5建立一個不佔用空間的幻影節點

用forest 2.1.5建立一個不佔用空間的幻影節點

這基本上是同一個問題Forest:建立不佔用空間的虛擬節點?但那裡提供的解決方案不適用於森林 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

解決方案是使用phantomforest而不是\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}

程式碼的輸出

相關內容