I am trying to achieve an effect similar to this book in diagramming sentences.

Is there a package for achieving that? I can place all the brackets and subscripts manually, mixing math and text, but that quickly becomes ugly.

I also tried defining a macro:


and the something like

$\mbox{It is wrong\ensuremath{\constituent{\mbox{that 
\ensuremath{\constituent{\mbox{Bob insulted the president}}{IP}}}}{CP}}}$

gets rendered as

enter image description here

It's a workable solution, but sometimes I miss an mbox somewhere and get a compile error and it's a bit of a pain.


Both of the major linguistic example packages provide this functionality, although in different ways. I'm assuming you just want regular labelled bracketing as is normally done in articles in the literature (i.e., the brackets are all of a fixed size.)


The gb4e package provides an \lb command for a labelled bracket:

\ex{\lb{CP} \lb{DP} who_{i} ] \lb{C} did_{j} ] \lb{TP} \lb{DP} you ] \lb{\ibar{T}} t_{j} \lb{VP} see t_{i} ]]]]}

output of code

Note that this package also allows _ and ^ to be used outside of mathmode. (This can sometimes cause problems, but is very useful for linguistic work.)


The linguex package provides a special example environment that automatically subscripts labelled brackets:

\exi. [CP [DP who ] [C$'$ did [TP [DP you ] [T$'$ t [VP see t ]]]]]


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.