2

I want to be able to typeset syntactic trees in a way that will achieve the following:

  • straight spine when there is no label on the nonterminal node
  • obtuse angle at each (binary) branch (so the tree is not too tall)

I'm having trouble making forest or (tikz-)qtree to achieve this easily. Surely there is someone with a solution to this problem out there.

Basically I want to achieve this:

what I want

but what I get with tikz-qtree is

qtree

which I got using the following code:

\usepackage{tikz,tikz-qtree-compat}
    \tikzset{baseline=0pt,level distance=20pt,sibling distance=0pt}
\begin{document}
    \Tree [.CP [.who ] [ [.$\lambda_1$ ]
        [.IP [.$t_1$ ] [.registered ] ] ] ] 
\end{document}

or, with forest:

forest

using the following code:

\usepackage[linguistics]{forest}
\newcommand{\tree}[1]{
    \begin{forest}
        for tree={
        inner sep=0pt,
        % where n children=0{font=\itshape}{},
     %    calign=fixed edge angles,
        parent anchor=south,
      },
      before typesetting nodes={% page 52: example (81)
        where content={}{% shape=coordinate gives an error if used here but this is *almost* right - it just leaves a little, tiny gap
          text width=.001pt,
          inner sep=0pt,
          before drawing tree={% here we make sure that the tiny gap disappears so only the size is not quite dimensionless
            shape=coordinate,
            typeset node,
          },
          for parent={
            for children={
              anchor=north,
            }
          }
        }{}
      }
      #1
    \end{forest}
}

\begin{document}
    \tree{
        [CP [who] [ [$\lambda_1$] 
        [IP [$t_1$] [registered]]]]
    }
\end{document}

Does anyone have an easy way of getting nice trees like in the first image (where not all nonterminals have labels, but some do, and the spine is nice and straight, but the trees are not too tall? I'd be happy to learn there's an easy way of doing this... thanks!

2

I can't answer your question, but as someone who worked for several years on code to format tree diagrams, I can maybe give some perspective. I found that the biggest problem, which I did not solve, was how to keep trees from getting too wide (not too tall). The method that worked well for simple trees did not extend well to complicated trees, because the complicated ones tended to overlap the left and right page boundaries (or screen boundaries).

I found that I could fit fairly large trees on a page by hand coding an individual tree by trial and error, making some descending branches longer so that leaves to the left and right did not run into one another, but getting the program code to do this automatically was a problem that I didn't manage to solve.

| improve this answer | |
  • Yes, that's true... width is another problem with large trees. But, right now I'm just trying to find a way to get forest's small trees to be smaller vertically, or qtree's trees to be straight-spined, in either case without making the angles too acute. The way these packages deal with larger trees is subject to a different list of desired behaviors, ha! – postylem Jan 17 '19 at 18:19
  • 1
    I don't understand why you want trees to be straight-spined. Seems odd. – Greg Lee Jan 17 '19 at 20:41
  • 1
    I suppose it's just an arbitrary convention, but it seems that is the way many syntacticians and semanticists like to draw their trees, especially for English, where it's pretty much all right-branching. Perhaps it comes from handwriting them, where you'd just draw a line for the spine and then as many shorter lines off of that line as you sketch in the projections. All I know is I see it often and I want to be able to replicate it. – postylem Jan 18 '19 at 5:13
1

This answer from TeX stackexchange has a working example that does what I was looking for: https://tex.stackexchange.com/a/471489/19048

| improve this answer | |

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.