11

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:

\global\long\def\constituent#1#2{\left[_{\mbox{#2}}\mbox{\,}\mbox{#1}\right]}

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.

13

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.)

gb4e

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

\documentclass{article}
\usepackage{gb4e}
\primebars
\begin{document}
\begin{exe}
\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} ]]]]}
\end{exe}
\end{document}

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.)

linguex

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

\documentclass{article}
\usepackage{linguex}
\begin{document}
\exi. [CP [DP who ] [C$'$ did [TP [DP you ] [T$'$ t [VP see t ]]]]]

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