2

I am using the packages linguex, parsetree, and avm to make an example containing a table with two phrase structure trees. I'd like to have the table start on the same line as the example number. But when I begin the tabular environment without adding a line break, the trees aren't made.

Right line, trees don't work

Right line, trees don't work

Wrong line, trees work

Wrong line, trees work

What can I do to make the table start on the same line as the example?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[]{linguex}
\usepackage[]{parsetree}
\usepackage[]{avm}

\begin{document}

\ex.
\begin{tabular}[t]{cc}
\begin{parsetree}
    (
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    )
\end{parsetree}
&
\begin{parsetree}
    (
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    .\begin{avm}
        \[
        X \\
        Y
        \]
        \end{avm}.
    )
\end{parsetree}
\end{tabular}

\end{document}
  • Welcome! Where is parsetree.sty found? TeX Live doesn't seem to have it. And CTAN doesn't find parsetree either. – cfr Dec 19 '16 at 11:57
  • However, t will align the top of the tabular with the baseline, which probably isn't what you want. tex.stackexchange.com/q/332976 is possibly vaguely related, but concerns qtree rather than parsetree. Since I've no idea what parsetree does, I don't know if the question would be helpful or not. [Disclaimer: I wrote the answer there. I remembered answering something about AVM.] – cfr Dec 19 '16 at 11:59
  • I found parsetree.sty here. There is a little bit of documentation here, but the .sty file doesn't seem to be there anymore. – J. Bratt Dec 19 '16 at 14:36
4

This is not a direct answer to your question, but a recommendation, perhaps. It will probably benefit you to switch to a more modern tree-drawing package. Two popular TikZ-based packages are tikz-qtree and forest, but there are, for example, pstricks options, too. Of the TikZ-based options, Forest is the most powerful and flexible.

Here's a Forest-based solution which uses a modified version of the avm style defined in my earlier answer to qtree - reduce spacing between lines in multiline node label with avm and a variant avm only.

avm only is intended only for trees where every node is simply an avm environment.

avm is intended for trees where some nodes contain no avm environment or contain content before the avm environment. In this case, the avm environment should be prefixed by a :, with any prior content before the :.

\documentclass{article}
\usepackage[linguistics]{forest}
\usepackage{avm,array,linguex}
\forestset{%
  avm/.style={%
    TeX={\setlength\extrarowheight{-10pt}},
    before typesetting nodes={%
      for tree={%
        split option={content}{:}{content,make avm},
      },
    },
  },
  avm only/.style={%
    TeX={\setlength\extrarowheight{-10pt}},
    before typesetting nodes={%
      for tree={%
        make pure avm,
      },
    },
  },
  make avm/.style={%
    if content={}{
      content=#1,
      make pure avm,
    }{
      content+={%
        \\\begin{avm}#1\end{avm}
      },
    },
  },
  make pure avm/.style={%
    content/.wrap value={%
      \begin{avm}##1\end{avm}
    },
    plain content,
  },
}
\begin{document}
\ex.
\begin{forest}
  avm,
  [:\[X\\Y\]
    [:\[X\\Y\]
    ]
    [:\[X\\Y\]
    ]
  ]
\end{forest}
\begin{forest}
  avm only,
  [\[X\\Y\]
    [\[X\\Y\]
    ]
    [\[X\\Y\]
    ]
  ]
\end{forest}

\end{document}

Forest <code>avm</code> and <code>avm only</code>

0

I found that I was also able to get the right result by keeping parsetree and switching out linguex with gb4e.

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.