TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 12 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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