2

It is basically the same question as Forest: Create phantom node which takes up no space? but the solution offered there does not work with forest 2.1.5. I want the phantom S not to take space. I tried setting the baseline to the phantom node, but this did not have any effect.

\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}
  • I'm not sure what the output should look like, but load forest with [linguistics] as a package option rather than \useforestibrary. Does that solve the problem? – Alan Munn Aug 12 at 15:49
  • Right now the figure takes the same space as if the \phantom{s} would be visible. Loading the package with an option produces different output. Surprising! But the problem does not disappear. – Stefan Müller Aug 12 at 16:04
2

The solution is to use the phantom key of forest rather than the \phantom macro, which just makes the S invisible.

\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}

output of code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.