%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Input file containing LaTeX macros to print labelled sentence
%  structures, typically for NL applications.
%
%  Added to MSc macros by Dave Moffat, who got them from Richard Barnett.
%  Many thanks to Richard, who also provided the following description
%  of what they do and how to use them :-
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% labelled sentence subparts (eg [ [the cat] [is [an example]]])
%                                 s np        vp  np
%
% \lablobrak{<word>}{<label>} opens a square bracket (labelled underneath
%                             with <label> and puts <word> to the right of
%                             the bracket
% \labrtrans{<word>}{<label>}{<trans>} as lablobrak but puts <trans>
%                                      underneath <label> and <word>,
%                                      left hand edges of <trans> and
%                                      <word> are aligned
% \trans{<word>}{<trans>} writes <word> with <trans> underneath, left hand
%                         edges aligned;  <trans> is at same vertical
%                         level as <trans> in \labrtrans
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%

\newlength{\tmplen}

\newcommand{\lablobrak}[2]
{
 \renewcommand{\arraystretch}{0.5}
 \begin{array}[t]{@{}l@{}}
 [{\rm #2} \\ {\scriptstyle #1}
 \end{array}
}

\newcommand{\labrtrans}[3]
{
 \settowidth{\tmplen}{[}
 \renewcommand{\arraystretch}{0.5}
 \begin{array}[t]{@{}l@{}}
 [{\rm #2} \\ {\scriptstyle #1} \\ \hspace*{\tmplen}{\rm #3}
 \end{array}
}

\newcommand{\trans}[2]
{
 \renewcommand{\arraystretch}{0.5}
 \begin{array}[t]{@{}l@{}}
 {\rm #1} \\ \hspace*{0em} \\ {\rm #2}
 \end{array}
}
