# Linguistics: What are the best packages to use create bracketed structures with movement lines?

I've been working with gb4e to manage numbered examples for a long time, but I was wondering it was possible to incorporate movement lines, or if I should use some other package. More concretely, I would like to generate something like the below:

I don't know about the best way to create the bracketed structures, but here I show how to insert the so-called movement lines: \connect[direction]{left-end}{mid-text}{right-end}. Here is the MWE.

\documentclass{article}
\usepackage{stackengine,amssymb}
\def\stacktype{L}
\newsavebox\tmpbox
\def\rlht{3ex}    \def\rlwd{.8pt} \def\rloffset{3pt}
\newcommand\vstrut[1][x]{%
\def\stacktype{S}%
\if x#1%
\smash{\makebox[0pt]{\rule{\rlwd}{\rlht}}}%
\else%
\smash{\makebox[0pt]{\stackon[-5pt]{\rule{\rlwd}{\rlht}}%
{\hspace{.5\dimexpr\rlwd\relax}$\blacktriangle$}}}%
\fi%
}
\newcommand\conR[2][x]{%
\savebox\tmpbox{#2}%
\stackunder[\dimexpr\rlht-\rlwd\relax+\rloffset]{\usebox{\tmpbox}}{%
\rule{.5\wd\tmpbox}{0pt}\vstrut[#1]\rule{.5\wd\tmpbox}{\rlwd}}%
}
\newcommand\conL[2][x]{%
\savebox\tmpbox{#2}%
\stackunder[\dimexpr\rlht-\rlwd\relax+\rloffset]{\usebox{\tmpbox}}{%
\rule{.5\wd\tmpbox}{\rlwd}\vstrut[#1]\rule{.5\wd\tmpbox}{0pt}}%
}
\newcommand\conM[1]{%
\savebox\tmpbox{#1}%
\stackunder[\dimexpr\rlht-\rlwd\relax+\rloffset]{\usebox{\tmpbox}}{%
\rule{\wd\tmpbox}{\rlwd}}%
}
\newcommand\connect[4][x]{%
\if l#1\conR[a]{#2}\else\conR{#2}\fi%
\conM{#3}%
\if r#1\conL[a]{#4}\else\conL{#4}\fi\ignorespaces%
}
\newcommand\lb[1]{[$_\mathrm{\scriptscriptstyle#1}\,$}

\begin{document}
\lb{TP}\itshape Seve%
\connect[l]{r}{al riots\upshape\lb{T}are]\lb{VP}\lb{V}believed]\lb{TP}%
\lb{T}to]\lb{AUXP}\lb{AUX}have]\lb{VP}\lb{V}occurred]\lb{QP}}{t}%
\upshape]]]]]]
\end{document}


Personally, I once used linguex in conjunction with pst-jtree. That gives you all the power you need. Please excuse that I shortened the example somewhat. The \jtree command has to be called once in the document before the example for some reason. Also note that the document has to be compiled as .ps first.

\documentclass[12pt]{article}
\usepackage{linguex}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{pst-xkey}
\usepackage{epsfig}
\usepackage{pst-jtree}

\begin{document}

\jtree
\endjtree
\exi. \rnode{a1}{X} [CP $\ldots$ [TP $\ldots$ \rnode{a2}{t} $\ldots$]]

\ncbar[angleA=270, angleB=270, linestyle=dashed]{<-}{a1}{a2}

\end{document}


You know, actually there is an example of such a thing in the end of the gb4e documentation.

\documentclass{article}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex\atcenter{\arrowalign{
\lb{TP} & \emph{Seveal riots} & \lb{T}are]\lb{VP}\lb{V}believed]\lb{TP}\lb{T}to]\lb{AUXP}\lb{AUX}have]\lb{VP}\lb{V}occurred]\lb{QP}&\emph{t}&]]]]]] \cr

But there is a problem with an alignment: number is between an arrow and an example… There is no such a problem with Steven B. Segletes’s solution. First I've tried to do it with tikz-dependency, but there is the same alignment problem.