summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/adtrees
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/adtrees
Initial commit
Diffstat (limited to 'macros/latex/contrib/adtrees')
-rw-r--r--macros/latex/contrib/adtrees/README9
-rw-r--r--macros/latex/contrib/adtrees/adtrees.sty947
-rw-r--r--macros/latex/contrib/adtrees/adtreesdoc.pdfbin0 -> 343779 bytes
-rw-r--r--macros/latex/contrib/adtrees/adtreesdoc.tex1634
4 files changed, 2590 insertions, 0 deletions
diff --git a/macros/latex/contrib/adtrees/README b/macros/latex/contrib/adtrees/README
new file mode 100644
index 0000000000..27948ed5fe
--- /dev/null
+++ b/macros/latex/contrib/adtrees/README
@@ -0,0 +1,9 @@
+The adtrees package provides a package to write adpositional trees, a
+formalism devoted to represent natural language expressions.
+
+The package is composed by the filed
+- adtrees.sty: containing the LaTeX engine to adpositional trees;
+- adtreesdoc.pdf: the human readable documentation for the package;
+- adtreesdoc.tex: the source code for the documentation.
+
+The package is distributed under the GNU General Public License.
diff --git a/macros/latex/contrib/adtrees/adtrees.sty b/macros/latex/contrib/adtrees/adtrees.sty
new file mode 100644
index 0000000000..7cf97e3b0d
--- /dev/null
+++ b/macros/latex/contrib/adtrees/adtrees.sty
@@ -0,0 +1,947 @@
+%-------------------------------------------------------
+%% This package is deputed to draw AdTrees as defined by
+%% F. Gobbo and M. Benini in "Constructive Adpositional
+%% Grammars: Foundations of Constructive Linguistics",
+%% Cambrdige Scholar Publishing
+%%
+%% Version 1.1 - 2019/07/11
+%%-------------------------------------------------------
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{adtrees}[2019/07/11 v1.1 Adtrees package]
+\RequirePackage{cancel}
+\RequirePackage{epic}
+
+%%-------------------------------------------------------
+%% We assume that \smaller is a command that reduces the
+%% current font size, e.g., from \Large to \large. If it
+%% is defined, then we use it.
+%% Otherwise we stick on a safe choice: \small, which is
+%% the right size when dealing with \normalsize trees.
+%%-------------------------------------------------------
+\@ifundefined{smaller}%
+ {\gdef\@ATsmall{\small}}%
+ {\gdef\@ATsmall{\smaller}}
+
+%%-------------------------------------------------------
+%% Usually, the angle in adtrees is 60 degrees
+%% To set it to 90 degrees, issue the command
+%% \ATwideangle
+%% To set it to 120 degrees, issue the command
+%% \ATextrawideangle
+%% To revert to the standard 60 degrees,
+%% \ATnormalangle
+%%-------------------------------------------------------
+\def\ATnormalangle{\def\@ATangle{60}}
+\def\ATwideangle{\def\@ATangle{90}}
+\def\ATextrawideangle{\def\@ATangle{120}}
+\ATnormalangle
+
+%%-------------------------------------------------------
+%% First, we declare the internal variables
+%%-------------------------------------------------------
+\newskip\@ATlen % a temporay length
+\newskip\@ATbp % the base point of a block
+\newskip\@ATwt % the width of a block
+\newskip\@ATh % the height of a block
+\newskip\@ATbl % left base point
+\newskip\@ATrl % left rest (width minus base point)
+\newskip\@ATwl % left width
+\newskip\@ATbr % right base point
+\newskip\@ATrr % right rest
+\newskip\@ATwr % right width
+\newskip\@ATskip % skip before a block
+\newskip\@ATpiks % skip after a block
+\newskip\@ATunit % another temporary length
+\newbox\@ATu % temporary block
+\newbox\@ATsa % temporary save box
+\newbox\@ATsb % temporary save box
+\newbox\@ATsc % temporary save box
+\newbox\@ATta % left save box
+\newbox\@ATtb % right save box
+
+\def\@ATtok{\z@} % placeholder for the conversion
+ % number to dimension
+
+\newif\if@ATlinear % switch for linear vs tree format
+\@ATlinearfalse % (usually false)
+\newif\if@ATtabul % switch for linear vs tree format
+\@ATtabulfalse % (usually false)
+
+%%-------------------------------------------------------
+%% The variable stack implementation
+%% Since variables' scope is not limited to the enclosing
+%% group, but extends to subgroups, we need to memorise
+%% variables which may be overwritten during a recursive
+%% macro expansion. Hence, we save them in a stack.
+%% In this case, we know that the saved values are, in
+%% fact, dimensions. We store them as numbers.
+%%-------------------------------------------------------
+\newcount\@ATstackheight \@ATstackheight0
+\def\@ATeos{X}
+\edef\@ATstack{\@ATeos}
+\def\@ATpush#1{%
+ \global\advance\@ATstackheight1%
+ \def\@ATcons{\noexpand\@ATcons}%
+ \expandafter\edef\expandafter\@ATstack\expandafter{%
+ \@ATcons{#1}\@ATstack}}
+\def\@AT@top#1#2#3X{#2}
+\def\@ATtop{\expandafter\@AT@top\@ATstack}
+\def\@AT@pop#1#2#3X{%
+ \global\advance\@ATstackheight-1%
+ \def\@ATcons{\noexpand\@ATcons}%
+ \expandafter\edef\expandafter\@ATstack\expandafter{#3\@ATeos}}
+\def\@ATpop{\expandafter\@AT@pop\@ATstack}
+
+%%-------------------------------------------------------
+%% To typeset an adtree we start by typesetting the
+%% adposition box. So, we parse the attributes, if any,
+%% and we construct a suitable box containing the trajectory,
+%% followed by the adposition, and closed by the grammar
+%% character together with the attributes, if present.
+%% Suitable skips are put in between these pieces.
+%%
+%% Then, the drawing procedure gets invoked.
+%%-------------------------------------------------------
+\def\@ATadposition#1#2#3{%
+ \if@ATlinear%
+ \@ATlinearadpositionblock{#1}{#2}{#3}\else%
+ \if@ATtabul%
+ \@ATtabularadpositionblock{#1}{#2}{#3}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATsc\hbox{#3}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb\copy\@ATsc}%
+ \@ATlen\wd\@ATu%
+ \setbox\@ATu\vbox{%
+ \ATpreadpositionskip%
+ \hbox to\@ATlen{\hfil\copy\@ATsa\hfil}\nointerlineskip%
+ \ATfirstinteradpositionskip%
+ \hbox to\@ATlen{\hfil\copy\@ATsb\hfil}\nointerlineskip%
+ \ATsecondinteradpositionskip%
+ \hbox to\@ATlen{\hfil\box\@ATsc\hfil}\nointerlineskip%
+ \ATpostadpositionskip}%
+ \@ATwt\dp\@ATu%
+ \hbox{\raise\@ATwt\hbox{\box\@ATu}}\fi\fi}
+\def\@ATtree#1#2#3#4#5{%
+ \@ifnextchar[{\@ATadposb{#1}{#2}{#3}{#4}{#5}}%
+ {\@ATadposa{#1}{#2}{#3}{#4}{#5}}}
+\def\@ATadposa#1#2#3#4#5{%
+ \@ATtreeparsed{#1}{#2}{#3}{#4}{\hbox{#5}}}
+\def\@ATadposb#1#2#3#4#5[#6]{%
+ \@ATadposc{#1}{#2}{#3}{#4}{%
+ \@ATadposd{#5}{\ATAttributeBox{#6}}}}
+\def\@ATadposc#1#2#3#4#5{%
+ \@ifnextchar[{\@ATadposf{#1}{#2}{#3}{#4}{#5}}%
+ {\@ATadposa{#1}{#2}{#3}{#4}{#5}}}
+\def\@ATadposd#1#2{\if@ATlinear%
+ \@ATlinearfirstattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularfirstattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATfirstattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}
+\def\@ATadpose#1#2{\if@ATlinear%
+ \@ATlinearnextattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularnextattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATinterattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}%
+\def\@ATadposf#1#2#3#4#5[#6]{%
+ \@ATadposc{#1}{#2}{#3}{#4}{%
+ \@ATadpose{#5}{\ATAttributeBox{#6}}}}
+
+%%-------------------------------------------------------
+%% The internal drawing procedure for binary adtrees.
+%%
+%% A block is drawn from the extreme left to the extreme
+%% right. First, we draw the left subtree, eventually
+%% prepending a skip (when the right subtree extends
+%% beyond the left one); then, we draw the connecting
+%% branches, lifting them to the proper height; lastly,
+%% we draw the right subtree, eventually followed by a
+%% skip, when the left subtree extends beyond the right
+%% one.
+%%
+%% Our blocks are thought to as a TeX block, starting from
+%% the current position and ending at the right edge.
+%% This block carries the information, called 'base point',
+%% that identifies where it must be linked with an upper
+%% block, i.e., where is the current position of the
+%% upper block.
+%%
+%% Summarising, calculation are as follows:
+%% 1. when bl + rr + 50u > wr & bl + rr + 50u > wl
+%% skip = 0pt
+%% piks = 0pt
+%% bp = bl + 25u
+%% wt = bl + rr + 50u
+%% 2. when bl + rr + 50u < wl & wr < wl
+%% skip = 0pt
+%% piks = rl - rr - 50u
+%% bp = bl + 25u
+%% wt = wl
+%% 3. when bl + rr + 50u < wr & wl < wr
+%% skip = br - bl - 50u
+%% piks = 0pt
+%% bp = br - 50u
+%% wt = wr
+%%
+%% Some care has been taken to improve calculation time
+%% and to limit register/memory usage.
+%%-------------------------------------------------------
+\def\@ATtreeparsed#1#2#3#4#5#6#7{%
+ \if@ATlinear%
+ \@ATlinearadpositionblock{#3}{#4}{#5}%
+ \@ATlinearsubtrees{#6}{#7}\else%
+ \if@ATtabul%
+ \vbox{\@ATtabularadpositionblock{#3}{#4}{#5}%
+ \@ATtabularsubtrees{#6}{#7}}\else%
+ \sbox{\@ATta}{\ignorespaces#6\@killglue}%
+ \@ATpush{\the\@ATbp}\@ATpush{\the\@ATwt}%
+ \sbox{\@ATtb}{\ignorespaces#7\@killglue}%
+ \setbox\@ATu\hbox{\usebox{\@ATta}\usebox{\@ATtb}}\@ATh\ht\@ATu%
+ \setbox\@ATu\hbox{\usebox{\@ATta}}\@ATlen\ht\@ATu\advance\@ATlen -\@ATh%
+ \edef\@ATtok{\@ATtop}\@ATpop\@ATwl\@ATtok%
+ \edef\@ATtok{\@ATtop}\@ATpop\@ATbl\@ATtok%
+ \@ATrl\@ATwl\advance\@ATrl -\@ATbl%
+ \sbox{\@ATta}{\raisebox{-\@ATlen}{\usebox{\@ATta}}}%
+ \setbox\@ATu\hbox{\usebox{\@ATtb}}\@ATwr\@ATwt\@ATlen\ht\@ATu%
+ \advance\@ATlen -\@ATh\@ATbr\@ATbp\@ATrr\@ATwr\advance\@ATrr -\@ATbr%
+ \sbox{\@ATtb}{\raisebox{-\@ATlen}{\usebox{\@ATtb}}}%
+ \@ATskip\z@\@ATpiks\z@%
+ \@ATunit\unitlength%
+ \unitlength#1%
+ \@ATlen\@ATbl\advance\@ATlen\@ATrr\advance\@ATlen 50\unitlength\relax%
+ \ifdim\@ATlen<\@ATwl%
+ \ifdim\@ATwr<\@ATwl\@ATpiks\@ATrl\advance\@ATpiks -\@ATrr%
+ \advance\@ATpiks -50\unitlength\fi%
+ \@ATlen\@ATwl\fi\relax%
+ \ifdim\@ATlen<\@ATwr\@ATlen\@ATwr%
+ \@ATskip\@ATbr\advance\@ATskip -\@ATbl%
+ \advance\@ATskip -50\unitlength\fi\relax%
+ \global\@ATbp\@ATbl\global\advance\@ATbp 25\unitlength%
+ \global\advance\@ATbp \@ATskip\global\@ATwt\@ATlen%
+ \setbox\@ATu\box\voidb@x%
+ \unitlength\@ATunit%
+ \hbox{\hspace*{\@ATskip}\usebox{\@ATta}\hspace*{-\@ATrl}%
+ \@ATunit\unitlength%
+ \unitlength#1%
+ \edef\@AT@angle{#2}%
+ {\ifnum\@AT@angle=120%
+ \raisebox{\@ATh}{\begin{picture}(50,12.5)%
+ \thicklines\put(25,12.5){\ATleftbranch{-2}{-1}{25}}%
+ \put(25,12.5){\ATcircle{2}}%
+ \put(25,9.5){\makebox(0,0)[t]{\@ATadposition{#3}{#4}{#5}}}%
+ \thicklines\put(25,12.5){\ATrightbranch{2}{-1}{25}}%
+ \end{picture}}%
+ \else\ifnum\@AT@angle=90%
+ \raisebox{\@ATh}{\begin{picture}(50,25)%
+ \thicklines\put(25,25){\ATleftbranch{-1}{-1}{25}}%
+ \put(25,25){\ATcircle{2}}%
+ \put(25,19){\makebox(0,0)[t]{\@ATadposition{#3}{#4}{#5}}}%
+ \thicklines\put(25,25){\ATrightbranch{1}{-1}{25}}%
+ \end{picture}}%
+ \else%
+ \raisebox{\@ATh}{\begin{picture}(50,50)%
+ \thicklines\put(25,50){\ATleftbranch{-1}{-2}{25}}%
+ \put(25,50){\ATcircle{2}}%
+ \put(25,35){\makebox(0,0)[t]{\@ATadposition{#3}{#4}{#5}}}%
+ \thicklines\put(25,50){\ATrightbranch{1}{-2}{25}}%
+ \end{picture}}\fi\fi}%
+ \unitlength\@ATunit%
+ \hspace*{-\@ATbr}\usebox{\@ATtb}\hspace*{\@ATpiks}}\fi\fi}
+
+%%-------------------------------------------------------
+%% The internal drawing procedure for right extensions
+%% of an adtree.
+%% Essentially, this is an adtree where the left side has
+%% been truncated.
+%%-------------------------------------------------------
+\def\@ATright#1#2#3{%
+ \if@ATlinear%
+ #3\else%
+ \if@ATtabul%
+ #3\else%
+ \sbox{\@ATtb}{\ignorespaces#3\@killglue}%
+ \setbox\@ATu\hbox{\usebox{\@ATtb}}\@ATh\ht\@ATu\@ATwr\@ATwt%
+ \@ATbr\@ATbp\@ATrr\@ATwr\advance\@ATrr -\@ATbr%
+ \global\advance\@ATbp\ifdim\@ATbr<25pt -\@ATbp\else -25\unitlength\fi%
+ \@ATwt\@ATrr\advance\@ATwt 25\unitlength\global\advance\@ATwt\@ATbp%
+ \setbox\@ATu\box\voidb@x%
+ \hbox{\hspace*{\@ATbp}%
+ \@ATlen\unitlength%
+ \unitlength#1%
+ \edef\@AT@angle{#2}%
+ \ifnum\@AT@angle=120%
+ \raisebox{\@ATh}{\begin{picture}(25,12.5)%
+ \thicklines\put(0,12.5){\ATrightbranch{2}{-1}{25}}%
+ \end{picture}}%
+ \else\ifnum\@AT@angle=90%
+ \raisebox{\@ATh}{\begin{picture}(25,25)%
+ \thicklines\put(0,25){\ATrightbranch{1}{-1}{25}}%
+ \end{picture}}%
+ \else%
+ \raisebox{\@ATh}{\begin{picture}(25,50)%
+ \thicklines\put(0,50){\ATrightbranch{1}{-2}{25}}%
+ \end{picture}}\fi\fi%
+ \unitlength\@ATlen%
+ \hspace*{-\@ATbr}\usebox{\@ATtb}}\fi\fi}
+
+%%-------------------------------------------------------
+%% The internal drawing procedure for left extensions
+%% of an adtree.
+%% Essentially, this is an adtree where the right side
+%% has been truncated.
+%%-------------------------------------------------------
+\def\@ATleft#1#2#3{%
+ \if@ATlinear%
+ #3\else%
+ \if@ATtabul%
+ #3\else%
+ \sbox{\@ATta}{\ignorespaces#3\@killglue}%
+ \setbox\@ATu\hbox{\usebox{\@ATta}}\@ATh\ht\@ATu\@ATwl\@ATwt%
+ \@ATrl\@ATwl\advance\@ATrl -\@ATbp\global\advance\@ATbp 25\unitlength\relax%
+ \global\@ATwt\ifdim\@ATbp<\@ATwl\@ATwl\else\@ATbp\fi\relax%
+ \setbox\@ATu\box\voidb@x%
+ \hbox{\usebox{\@ATta}\hspace*{-\@ATrl}%
+ \@ATlen\unitlength%
+ \unitlength#1%
+ \edef\@AT@angle{#2}%
+ \ifnum\@AT@angle=120%
+ \raisebox{\@ATh}{\begin{picture}(25,12.5)%
+ \thicklines\put(25,12.5){\ATleftbranch{-2}{-1}{25}}%
+ \end{picture}}%
+ \else\ifnum\@AT@angle=90%
+ \raisebox{\@ATh}{\begin{picture}(25,25)%
+ \thicklines\put(25,25){\ATleftbranch{-1}{-1}{25}}%
+ \end{picture}}%
+ \else%
+ \raisebox{\@ATh}{\begin{picture}(25,50)%
+ \thicklines\put(25,50){\ATleftbranch{-1}{-2}{25}}%
+ \end{picture}}\fi\fi%
+ \unitlength\@ATlen%
+ \hspace*{-\@ATbp}\hspace*{\@ATwt}}\fi\fi}%
+
+%%-------------------------------------------------------
+%% The internal procedure to draw a leaf.
+%% Its base point is in the middle of the box.
+%%
+%% First we parse attributes, accumulating them together
+%% with the grammar character. Then, we assemble the
+%% morpheme with the computed box.
+%%-------------------------------------------------------
+\def\@ATadl#1#2{\@ifnextchar[%
+ {\@ATadlb{#1}{#2}}%
+ {\@ATadla{#1}{#2}}}
+\def\@ATadla#1#2{%
+ \if@ATlinear\relax%
+ \@ATlinearmorphemeblock{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularmorphemeblock{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \setbox\@ATu\vbox{%
+ \ATpremorphemeskip%
+ \hbox to\@ATlen{\hfil\copy\@ATsa\hfil}\nointerlineskip%
+ \ATintermorphemeskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}\nointerlineskip%
+ \ATpostmorphemeskip}%
+ \@ATwt\dp\@ATu\setbox\@ATu\hbox{\raise\@ATwt\hbox{\box\@ATu}}%
+ \setbox\@ATsa\vbox{\ATpremorphemeskip\hbox{\box\@ATsa}}%
+ \@ATwt\ht\@ATu\advance\@ATwt-\ht\@ATsa%
+ \setbox\@ATu\hbox{\lower\@ATwt\hbox{\box\@ATu}}%
+ \global\@ATwt\wd\@ATu\global\@ATbp .5\@ATwt%
+ \hbox{\box\@ATu}\fi\fi}
+\def\@ATadlb#1#2[#3]{%
+ \@ATadlc{#1}{\@ATadld{#2}{\ATAttributeBox{#3}}}}
+\def\@ATadlc#1#2{\@ifnextchar[%
+ {\@ATadlf{#1}{#2}}%
+ {\@ATadla{#1}{#2}}}
+\def\@ATadld#1#2{\if@ATlinear%
+ \@ATlinearfirstattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularfirstattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATfirstattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}%
+\def\@ATadle#1#2{\if@ATlinear%
+ \@ATlinearnextattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularnextattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATinterattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}%
+\def\@ATadlf#1#2[#3]{%
+ \@ATadlc{#1}{\@ATadle{#2}{\ATAttributeBox{#3}}}}
+
+%%-------------------------------------------------------
+%% The internal procedure to draw a summary.
+%% Its base point is in the middle of the box.
+%%
+%% First we parse attributes, accumulating them together
+%% with the grammar character. Then, we assemble the
+%% summary symbol with the morpheme and the computed box.
+%% -------------------------------------------------------
+\def\@ATads#1#2{\@ifnextchar[%
+ {\@ATadsb{#1}{#2}}%
+ {\@ATadsa{#1}{#2}}}
+\def\@ATadsa#1#2{%
+ \if@ATlinear\relax%
+ \@ATlinearsummaryblock{#1}{#2}\else%
+ \if@ATtabul\relax%
+ \@ATtabularsummaryblock{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATsc\hbox{\ATSummarySymbol}%
+ \setbox\@ATu\vbox{\copy\@ATsc\copy\@ATsa\copy\@ATsb}%
+ \@ATlen\wd\@ATu%
+ \setbox\@ATu\vbox{%
+ \hbox to\@ATlen{\hfil\copy\@ATsc\hfil}\nointerlineskip%
+ \ATpremorphemeskip%
+ \hbox to\@ATlen{\hfil\copy\@ATsa\hfil}\nointerlineskip%
+ \ATintermorphemeskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}\nointerlineskip%
+ \ATpostmorphemeskip}%
+ \@ATwt\dp\@ATu\setbox\@ATu\hbox{\raise\@ATwt\hbox{\box\@ATu}}%
+ \setbox\@ATsa\vbox{%
+ \hbox{\box\@ATsc}\nointerlineskip%
+ \ATpremorphemeskip\hbox{\box\@ATsa}}%
+ \@ATwt\ht\@ATu\advance\@ATwt-\ht\@ATsa%
+ \setbox\@ATu\hbox{\lower\@ATwt\hbox{\box\@ATu}}%
+ \global\@ATwt\wd\@ATu\global\@ATbp .5\@ATwt%
+ \hbox{\box\@ATu}\fi\fi}
+\def\@ATadsb#1#2[#3]{%
+ \@ATadsc{#1}{\@ATadsd{#2}{\ATAttributeBox{#3}}}}
+\def\@ATadsc#1#2{\@ifnextchar[%
+ {\@ATadsf{#1}{#2}}%
+ {\@ATadsa{#1}{#2}}}
+\def\@ATadsd#1#2{\if@ATlinear%
+ \@ATlinearfirstattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularfirstattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATfirstattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}%
+\def\@ATadse#1#2{\if@ATlinear%
+ \@ATlinearnextattribute{#1}{#2}\else%
+ \if@ATtabul%
+ \@ATtabularnextattribute{#1}{#2}\else%
+ \setbox\@ATsa\hbox{#1}\setbox\@ATsb\hbox{#2}%
+ \setbox\@ATu\vbox{\copy\@ATsa\copy\@ATsb}\@ATlen\wd\@ATu%
+ \vbox{%
+ \hbox to\@ATlen{\hfil\box\@ATsa\hfil}\nointerlineskip%
+ \ATinterattrskip%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}%
+\def\@ATadsf#1#2[#3]{%
+ \@ATadsc{#1}{\@ATadse{#2}{\ATAttributeBox{#3}}}}
+
+%%-------------------------------------------------------
+%% The commands to format adtrees in the standard way.
+%%
+%% \ATMorphemeBox{<morpheme>}
+%% generates a horizontal box containing the morpheme
+%%
+%% \ATGrammarCharacterBox{<grammar character>}
+%% generates a horizontal box containing the grammar character
+%%
+%% \ATAttributeBox{<attribute>}
+%% generates a horizontal box containing the attribute of a morpheme
+%%
+%% - \ATfirstattrskip generates the vertical material to be put before
+%% the first attribute in a morpheme or summary box
+%% - \ATinterattrskip generates the vertical material to be put
+%% between two attributes in a morpheme or summary box
+%%
+%% - \ATpremorphemeskip generates the vertical material to be put
+%% before the morpheme in a morpheme or summary box
+%% - \ATintermorphemeskip generates the vertical material to be but
+%% between the morpheme and the grammar character in a morpheme or
+%% summary box
+%% - \ATpostmorphemeskip generates the vertical material to be put
+%% after the grammar character or the last attribute in a morpheme
+%% or summary box
+%%
+%% - \ATpreadpositionskip generates the vertical material appearing
+%% before the trajectory in the root of a node
+%% - \ATfirstinteradpositionskip generates the vertical material to be
+%% put between the trajectory and the adposition in the root of a
+%% node
+%% - \ATsecondinteradpositionskip generates the vertical material to
+%% be put between the adposition and the grammar character in the
+%% root of a node
+%% - \ATpostadpositionskip generates the vertical material to be put
+%% after the grammar character or the last attribute in the root of
+%% a node
+%%
+%% \ATSummarySymbol defines the symbol used for the summary
+%%-------------------------------------------------------
+\def\ATMorphemeBox#1{\mbox{#1\strut}}
+\def\ATGrammarCharacterBox#1{\mbox{\@ATsmall$\mathrm{#1}$}}
+\def\ATAttributeBox#1{\mbox{\@ATsmall\textsf{[#1]}}}
+
+\def\ATfirstattrskip{\vskip.7ex}
+\def\ATinterattrskip{\vskip.5ex}
+
+\def\ATpremorphemeskip{\vskip.5ex}
+\def\ATintermorphemeskip{\vskip1ex}
+\def\ATpostmorphemeskip{\relax}
+
+\def\ATpreadpositionskip{\relax}
+\def\ATfirstinteradpositionskip{\vskip.3ex}
+\def\ATsecondinteradpositionskip{\vskip.3ex}
+\def\ATpostadpositionskip{\relax}
+
+\def\ATSummarySymbol{$\triangle$}
+
+\def\ATleftbranch#1#2{\line(#1,#2)}
+\def\ATrightbranch#1#2{\line(#1,#2)}
+\def\ATcircle{\circle*}
+
+%%-------------------------------------------------------
+%% The following commands draw an adtree specifying its adposition,
+%% the grammar character of the resulting expression, and the left and
+%% right subtrees. The l, r, and b variants differ in the trajectory,
+%% which is a left arrow, a right arrow, or a bidirectional arrow,
+%% respectively.
+%% \ATl{<adposition>}{<grammar character>}
+%% {<left subtree>}{<right subtree>}
+%% \ATr{<adposition>}{<grammar character>}
+%% {<left subtree>}{<right subtree>}
+%% \ATb{<adposition>}{<grammar character>}
+%% {<left subtree>}{<right subtree>}
+%%
+%% A single morpheme can be typeset by the following command
+%% \ATm{<morpheme>}{<grammar character>}{x1}...{xn}
+%% with x1,..,xn stacked as morpheme's attributes
+%%
+%% A summary has the same structure as a morpheme, but it is provided
+%% to give graphical evidence that the <text> can be further expanded
+%% as an adtree
+%% \ATs{<text>}{<grammar character>}{x1}...{xn}
+%% with x1,..,xn stacked as morpheme's attributes
+%%
+%% To write complex adtrees, we need to extend branches on the left
+%% and on the right:
+%% \ATxl{<adtree>}
+%% \ATxr{<adtree>}
+%%
+%% To avoid writing of epsilons, i.e., empty morphemes:
+%% \ATle{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATre{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATbe{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%%
+%% The epsilon transformations are very useful and common, so the
+%% following shortcuts allow to write them quickly.
+%% \ATlc{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATrc{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATbc{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%%
+%% The mu adpositions indicate morphological relations. The code
+%% to define them is similar to the one with the epsilons, but
+%% no transformations are involved. The related commands are
+%% \ATlmu{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATrmu{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%% \ATbmu{<grammar character>}
+%% {<left subtree>}{<rightsubtree>}
+%%
+%% All the above commands, except \ATs and \ATm, come in four
+%% variants:
+%% - the pure variants draws the adtree in the standard way
+%% - the L variants allow to specify the value for \unitlength to be
+%% used in the expansion of that particular node
+%% - the A variants allow to specify the value for the angle to be
+%% used in the expansion of that particular node
+%% - the LA variants allow to specify both values.
+%%-------------------------------------------------------
+\def\@ATeps{\epsilon}
+\def\@ATepsc{\cancel{\@ATeps}}
+\def\@ATmu{\mu}
+\def\@AT@shorttree#1#2#3#4#5{%
+ \@ATtree{#1}{#2}{\hbox{$#3$}}%
+ {\ATMorphemeBox{#4}}%
+ {\ATGrammarCharacterBox{#5}}}
+\def\ATlLA#1#2{\@AT@shorttree{#1}{#2}{\scriptstyle\leftarrow}}
+\def\ATl{\ATlLA{\unitlength}{\@ATangle}}
+\def\ATlL#1{\ATlLA{#1}{\@ATangle}}
+\def\ATlA{\ATlLA{\unitlength}}
+\def\ATrLA#1#2{\@AT@shorttree{#1}{#2}{\scriptstyle\rightarrow}}
+\def\ATr{\ATrLA{\unitlength}{\@ATangle}}
+\def\ATrL#1{\ATrLA{#1}{\@ATangle}}
+\def\ATrA{\ATrLA{\unitlength}}
+\def\ATbLA#1#2{\@AT@shorttree{#1}{#2}{\scriptstyle\leftrightarrow}}
+\def\ATb{\ATbLA{\unitlength}{\@ATangle}}
+\def\ATbL#1{\ATbLA{#1}{\@ATangle}}
+\def\ATbA{\ATbLA{\unitlength}}
+\def\ATleLA#1#2{\ATlLA{#1}{#2}{$\@ATeps$}}
+\def\ATle{\ATl{$\@ATeps$}}
+\def\ATleL#1{\ATlL{#1}{$\@ATeps$}}
+\def\ATleA#1{\ATlA{#1}{$\@ATeps$}}
+\def\ATlc{\ATl{$\@ATepsc$}}
+\def\ATlcL#1{\ATlL{#1}{$\@ATepsc$}}
+\def\ATlcA#1{\ATlA{#1}{$\@ATepsc$}}
+\def\ATlcLA#1#2{\ATlLA{#1}{#2}{$\@ATepsc$}}
+\def\ATlmu{\ATl{$\@ATmu$}}
+\def\ATlmuL#1{\ATlL{#1}{$\@ATmu$}}
+\def\ATlmuA#1{\ATlA{#1}{$\@ATmu$}}
+\def\ATlmuLA#1#2{\ATlLA{#1}{#2}{$\@ATmu$}}
+\def\ATre{\ATr{$\@ATeps$}}
+\def\ATreL#1{\ATrL{#1}{$\@ATeps$}}
+\def\ATreA#1{\ATrA{#1}{$\@ATeps$}}
+\def\ATreLA#1#2{\ATrLA{#1}{#2}{$\@ATeps$}}
+\def\ATrc{\ATr{$\@ATepsc$}}
+\def\ATrcL#1{\ATrL{#1}{$\@ATepsc$}}
+\def\ATrcA#1{\ATrA{#1}{$\@ATepsc$}}
+\def\ATrcLA#1#2{\ATrLA{#1}{#2}{$\@ATepsc$}}
+\def\ATrmu{\ATr{$\@ATmu$}}
+\def\ATrmuL#1{\ATrL{#1}{$\@ATmu$}}
+\def\ATrmuA#1{\ATrA{#1}{$\@ATmu$}}
+\def\ATrmuLA#1#2{\ATrLA{#1}{#2}{$\@ATmu$}}
+\def\ATbe{\ATb{$\@ATeps$}}
+\def\ATbeL#1{\ATbL{#1}{$\@ATeps$}}
+\def\ATbeA#1{\ATbA{#1}{$\@ATeps$}}
+\def\ATbeLA#1#2{\ATbLA{#1}{#2}{$\@ATeps$}}
+\def\ATbc{\ATb{$\@ATepsc$}}
+\def\ATbcL#1{\ATbL{#1}{$\@ATepsc$}}
+\def\ATbcA#1{\ATbA{#1}{$\@ATepsc$}}
+\def\ATbcLA#1#2{\ATbLA{#1}{#2}{$\@ATepsc$}}
+\def\ATbmu{\ATb{$\@ATmu$}}
+\def\ATbmuL#1{\ATbL{#1}{$\@ATmu$}}
+\def\ATbmuA#1{\ATbA{#1}{$\@ATmu$}}
+\def\ATbmuLA#1#2{\ATbLA{#1}{#2}{$\@ATmu$}}
+\def\ATxlLA#1#2{\@ATleft{#1}{#2}}
+\def\ATxl{\ATxlLA{\unitlength}{\@ATangle}}
+\def\ATxlL#1{\ATxlLA{#1}{\@ATangle}}
+\def\ATxlA{\ATxlLA{\unitlength}}
+\def\ATxrLA#1#2{\@ATright{#1}{#2}}
+\def\ATxr{\ATxrLA{\unitlength}{\@ATangle}}
+\def\ATxrL#1{\ATxrLA{#1}{\@ATangle}}
+\def\ATxrA{\ATxrLA{\unitlength}}
+\def\ATs#1#2{\@ATads{\ATMorphemeBox{#1}}{\ATGrammarCharacterBox{#2}}}
+\def\ATm#1#2{\@ATadl{\ATMorphemeBox{#1}}{\ATGrammarCharacterBox{#2}}}
+
+%%-------------------------------------------------------
+%% Public commands to write adtrees in linear format.
+%%
+%% Essentially, an adtree is written as Ad^dir_GC(L, R),
+%% where Ad is the adposition, dir is the direction, GC
+%% is the grammar character, and L and R are the left and
+%% right subtrees respectively. Leaves are written as
+%% m_GC, where m is the morpheme, and summaries as (t)_GC
+%% where t is the text. All these renderings are coded via
+%% suitable blocks
+%%-------------------------------------------------------
+\def\ATLinear{\global\@ATlineartrue\global\@ATtabulfalse%
+ \gdef\@ATlinearadpositionblock{\ATlinearadpositionblock}%
+ \gdef\@ATlinearfirstattribute{\ATlinearfirstattribute}%
+ \gdef\@ATlinearnextattribute{\ATlinearnextattribute}%
+ \gdef\@ATlinearsubtrees{\ATlinearsubtrees}%
+ \gdef\@ATlinearmorphemeblock{\ATlinearmorphemeblock}%
+ \gdef\@ATlinearsummaryblock{\ATlinearsummaryblock}}
+\def\ATNormal{\global\@ATlinearfalse\global\@ATtabulfalse}
+\def\ATlinearise#1{\ATLinear\ensuremath{#1}\ATNormal}
+
+\def\ATlinearadpositionblock#1#2#3%
+ {{#2}\textsuperscript{#1}\textsubscript{#3}}
+\def\ATlinearfirstattribute#1{{#1}:}
+\def\ATlinearnextattribute#1{{#1};}
+\def\ATlinearsubtrees#1#2{(#1,\linebreak[0] #2)}
+\def\ATlinearmorphemeblock#1#2{{#1}\textsubscript{#2}}
+\def\ATlinearsummaryblock#1#2{\mbox{$\triangle($}%
+ \mbox{#1}\mbox{$)$}\textsubscript{#2}}
+\def\@ATlinearadpositionblock{\ATlinearadpositionblock}%
+\def\@ATlinearfirstattribute{\ATlinearfirstattribute}%
+\def\@ATlinearnextattribute{\ATlinearnextattribute}%
+\def\@ATlinearsubtrees{\ATlinearsubtrees}%
+\def\@ATlinearmorphemeblock{\ATlinearmorphemeblock}%
+\def\@ATlinearsummaryblock{\ATlinearsummaryblock}
+
+%%-------------------------------------------------------
+%% Public commands to write adtrees in tabular format.
+%%
+%% Essentially, an adtree is written as
+%% Ad^dir_GC(
+%% L,
+%% R)
+%% where Ad is the adposition, dir is the direction, GC
+%% is the grammar character, and L and R are the left and
+%% right subtrees respectively. Leaves are written as
+%% m_GC, where m is the morpheme, and summaries as (t)_GC
+%% where t is the text. All these renderings are coded via
+%% suitable blocks
+%%-------------------------------------------------------
+\def\ATTabular{\global\@ATtabultrue\global\@ATlinearfalse%
+ \gdef\@ATtabularadpositionblock{\ATtabularadpositionblock}%
+ \gdef\@ATtabularfirstattribute{\ATtabularfirstattribute}%
+ \gdef\@ATtabularnextattribute{\ATtabularnextattribute}%
+ \gdef\@ATtabularsubtrees{\ATtabularsubtrees}%
+ \gdef\@ATtabularmorphemeblock{\ATtabularmorphemeblock}%
+ \gdef\@ATtabularsummaryblock{\ATtabularsummaryblock}%
+ \@AT@tabcountreset}
+
+\newenvironment{ATtabulardisplay}
+{\ATTabular\unskip\hfill\break}
+{\ATNormal}
+
+\newenvironment{ATtabular}
+{\hbox\bgroup\ATTabular}
+{\egroup\ATNormal}
+
+\def\ATtabskip{\hspace*{.7em}}
+\def\ATtabindent{\hspace*{1em}}
+
+\newcount\@AT@tabcount
+\newcount\@AT@@tabcount
+\def\@AT@tabcountreset{\global\@AT@tabcount0}
+\def\AT@loop@tab{\@AT@@tabcount\@AT@tabcount%
+ \ifnum\@AT@@tabcount>0%
+ \loop\ATtabskip\advance\@AT@@tabcount-1%
+ \ifnum\@AT@@tabcount>0\repeat\else\relax\fi}
+
+\def\ATtabularadpositionblock#1#2#3{%
+ \hbox{\ATtabindent\AT@loop@tab%
+ {#2}\textsuperscript{#1}\textsubscript{#3}}}
+\def\ATtabularmorphemeblock#1#2{
+ \hbox{\ATtabindent\AT@loop@tab%
+ {#1}\textsubscript{#2}}}
+\def\ATtabularsummaryblock#1#2{
+ \hbox{\ATtabindent\AT@loop@tab%
+ \mbox{$\triangle($}%
+ \mbox{#1}\mbox{$)$}\textsubscript{#2}}}
+\def\ATtabularfirstattribute{\ATlinearfirstattribute}
+\def\ATtabularnextattribute{\ATlinearnextattribute}
+\def\ATtabularsubtrees#1#2{%
+ \advance\@AT@tabcount1%
+ \vbox{#1\relax#2}%
+ \advance\@AT@tabcount-1}
+\def\@ATtabularadpositionblock{\ATtabularadpositionblock}%
+\def\@ATtabularfirstattribute{\ATtabularfirstattribute}%
+\def\@ATtabularnextattribute{\ATtabularnextattribute}%
+\def\@ATtabularsubtrees{\ATtabularsubtrees}%
+\def\@ATtabularmorphemeblock{\ATtabularmorphemeblock}%
+\def\@ATtabularsummaryblock{\ATtabularsummaryblock}%
+
+%%-------------------------------------------------------
+%% Centring adtrees.
+%%
+%% The command \ATvcentre{<adtree>} vertically centres its argument
+%% with respect to the current baseline
+%%
+%% The command \AThcentre{<adtree>} horizontally centres its argument
+%% around the current position in the baseline
+%%
+%% The command \ATcentre{<adtree>} centres its argument both
+%% horizontally and vertically around the current position in the
+%% baseline
+%%-------------------------------------------------------
+\def\ATvcentre#1{%
+ \setbox\@ATsc\hbox{#1}%
+ \@ATlen\dp\@ATsc\setbox\@ATsc\hbox{\raise\@ATlen\box\@ATsc}%
+ \@ATlen.5\ht\@ATsc\hbox{\lower\@ATlen\box\@ATsc}}%
+\def\AThcentre#1{%
+ \setbox\@ATsc\hbox{#1}%
+ \@ATlen-.5\wd\@ATsc\hbox{\kern\@ATlen\box\@ATsc}}
+\def\ATcentre#1{\AThcentre{\ATvcentre{#1}}}
+
+%%-------------------------------------------------------
+%% Pathlike adtrees.
+%%
+%% A pathlike adtree is rendered by enclosing it into the
+%% pathlikeadtree environment.
+%%-------------------------------------------------------
+
+% the pieces the user may use and change
+\newskip\ATpathinterskip \ATpathinterskip.5em
+\newskip\ATpathunitlength \ATpathunitlength4ex
+\newskip\ATpicskip \ATpicskip.2ex
+\newskip\ATpathlinethickness \ATpathlinethickness.1em
+\def\ATnGCBox#1{\@ATsmall$\mathrm{#1}$}
+\def\ATlGCBox#1{\@ATsmall$\mathrm{#1}$}
+\newskip\ATpathlabelhspace \ATpathlabelhspace.3em
+\newskip\ATpathlabelvspace \ATpathlabelvspace1ex
+\def\ATpathpichook{}
+
+%\newenvironment{pathlikeadtree}
+\def\pathlikeadtree{\@ATpathlistinit}
+\def\endpathlikeadtree{\@ATpathlistend}
+
+% some internal declarations
+\newif\if@ATpathfirstnode
+\newbox\@ATpathbox \newbox\@ATpathlinebox
+\newcount\@ATanchor \newcount\@ATcells \newcount\@ATadppars
+\newcount\@ATpa \newcount\@ATpb \newcount\@ATpc
+\newcount\@ATpd \newcount\@ATpe \newcount\@ATtmp
+\newcount\@ATtmpa \newcount\@AThmax
+
+% A pathlike adtree starts with parsing a node after cleaning up what
+% has to be done, and temporarily redefining &
+\def\@ATpathlistinit{%
+ \begingroup%
+ \linethickness{\ATpathlinethickness}%
+ \global\@ATpathfirstnodetrue\global\@ATanchor0\global\@ATcells0%
+ \global\@ATadppars0\global\@AThmax0\def\@ATpathdrawlines{\relax}%
+ \setbox\@ATpathbox\null\setbox\@ATpathlinebox\null\AT@n}
+
+% A pathlike adtree ends by drawing the two boxes which contain the
+% list of marked morphemes and the connecting lines, respectively
+\def\@ATpathlistend{%
+ \def\@ATca##1{\@ATpa ##1\relax}\def\@ATcb##1{\@ATpb ##1\relax}%
+ \def\@ATcc##1{\@ATpc ##1\relax}\def\@ATcd##1{\@ATpd ##1\relax}%
+ \def\@ATce##1{\@ATpe ##1\@ATto}\@ATpathdrawlines%
+ \global\setbox\@ATpathbox\hbox{%
+ \vbox{\box\@ATpathbox\nointerlineskip%
+ \vskip\ATpicskip\box\@ATpathlinebox}}%
+ \box\@ATpathbox\endgroup}
+
+% Parsing a node: it has the form
+% - morpheme[gc]
+% possibly followed by one or more arrow specs
+\def\AT@n#1[#2]{\@ifnextchar(%
+ {\@ATn{#1}{#2}\AT@to}
+ {\@ATn{#1}{#2}}}
+\def\AT@np{\@ifnextchar&{\@AT@n}{}}
+\def\@AT@n&#1[#2]{\AT@n#1[#2]}
+
+% when morpheme[gc] has been extracted, its cell is constructed as a
+% box and accumulated in the pathbox, correctly spaced
+% At the end, we pass on the next cell, if any
+\def\@ATn#1#2{%
+ \global\advance\@ATanchor1%
+ \setbox\@ATsa\hbox{\ignorespaces#1}\@ATlen\wd\@ATsa%
+ \setbox\@ATsb\hbox{\ATnGCBox{#2}}\@ATwt\wd\@ATsb\relax%
+ \ifdim\@ATlen<\@ATwt\relax\@ATlen\@ATwt\fi%
+ \setbox\@ATsa\vbox{\hbox to\@ATlen{\hfil\box\@ATsa\hfil}%
+ \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}%
+ \@ATwt\wd\@ATpathbox\advance\@ATwt.5\@ATlen%
+ \if@ATpathfirstnode\else\advance\@ATwt\ATpathinterskip\fi%
+ \expandafter\edef\csname @ATcell\the\@ATanchor\endcsname{\the\@ATwt}%
+ \setbox\@ATpathbox\hbox{\box\@ATpathbox%
+ \if@ATpathfirstnode\global\@ATpathfirstnodefalse\else%
+ \hskip\ATpathinterskip\fi\box\@ATsa}%
+ \@ifnextchar&{\AT@np}{}}
+
+% parsing an arrow spec: it has the form
+% (t,h)[gc]<a>
+% where the "a" part is optional
+% moreover, if "t" or "a" are specified by absolute positions, they
+% are preceded by "!".
+% parsing calculates the absolute values of the relative positions,
+% and send everything to \@ATtoa
+\def\AT@to(#1){\AT@@to#1)}
+\def\AT@@to{\@ifnextchar!{\AT@to@a}{\AT@tor(}}
+\def\AT@to@a!#1){\AT@toa(#1)}
+\def\AT@tor(#1,#2){%
+ \@ATtmp#1\advance\@ATtmp\@ATanchor\relax%
+ \AT@toa(\the\@ATtmp,#2)}
+\def\AT@toa(#1,#2)[#3]{\@ifnextchar<%
+ {\@AT@toa{#1}{#2}{\ATlGCBox{#3}}}%
+ {\@ATtoa{#1}{#2}{\ATlGCBox{#3}}{0}}}
+\def\@AT@toa#1#2#3<{\@ifnextchar!%
+ {\@AT@@toa{#1}{#2}{#3}}%
+ {\@ATtoar{#1}{#2}{#3}}}
+\def\@AT@@toa#1#2#3!#4>{\@ATtoa{#1}{#2}{#3}{#4}}
+\def\@ATtoar#1#2#3#4>{%
+ \@ATtmpa#4\relax\ifnum#4=\z@\relax\@ATtmpa\z@%
+ \else\advance\@ATtmpa\@ATanchor\fi%
+ \@ATtoa{#1}{#2}{#3}{\the\@ATtmpa}}
+
+% when an arrow has been parsed, we must accumulate it into the
+% command \@ATpathdrawlines which will construct the arrows at the
+% right moment, i.e., after the whole pathlike adtree has been
+% scanned. Notice how the command checks whether an arrow is followed
+% by another one, eventually restarting the parsing process for the
+% new arrow. If not, let's move to the next cell, if any
+\def\@ATtoa#1#2#3#4{%
+ \ifnum\@AThmax<#2\relax\@AThmax#2\fi%
+ \def\@ATca{\noexpand\@ATca}\def\@ATcb{\noexpand\@ATcb}%
+ \def\@ATcc{\noexpand\@ATcc}\def\@ATcd{\noexpand\@ATcd}%
+ \def\@ATce{\noexpand\@ATce}%
+ \expandafter\def\csname @ATadppar\the\@ATadppars\endcsname{#3}%
+ \expandafter\edef\expandafter\@ATpathdrawlines\expandafter{%
+ \@ATca{\the\@ATanchor}\@ATcb{#1}\@ATcc{#2}%
+ \@ATcd{\the\@ATadppars}\@ATce{#4}\@ATpathdrawlines}%
+ \global\advance\@ATadppars1\relax
+ \@ifnextchar({\AT@to}{\AT@np}}
+
+% at the end, an arrow is effectively drawn.
+\def\@ATto{%
+ \edef\@AText{\csname @ATcell\the\@ATpa\endcsname}\@ATbl\@AText%
+ \edef\@AText{\csname @ATcell\the\@ATpb\endcsname}\@ATbr\@AText%
+ \setbox\@ATsa\hbox{\csname @ATadppar\the\@ATpd\endcsname}%
+ \setbox\@ATsa\hbox{%
+ \hskip\ATpathlabelhspace\box\@ATsa\hskip\ATpathlabelhspace}%
+ \@ATbp\ht\@ATsa\advance\@ATbp\dp\@ATsa%
+ \advance\@ATbp\ATpathlabelvspace\relax%
+ \@ATskip\wd\@ATsa\relax\unitlength1pt\relax%
+ \@ATh\@ATpc\ATpathunitlength\relax%
+ \@ATunit\@AThmax\ATpathunitlength\relax%
+ \@ATlen\@ATbr\advance\@ATlen\@ATbl\relax%
+ \@ATwr\@ATbr\advance\@ATwr-\@ATbl\relax%
+ \@ATrr\@ATunit\advance\@ATrr-\@ATh\relax%
+ \ifnum\@ATpe=\z@\else%
+ \edef\@AText{\csname @ATcell\the\@ATpe\endcsname}\@ATrl\@AText\fi%
+ \ATpathpichook\relax%
+ \setbox\@ATu\hbox{%
+ \begin{picture}(\strip@pt\@ATlen,\strip@pt\@ATunit)
+ \put(\strip@pt\@ATbl,\strip@pt\@ATunit)%
+ {\line(0,-1){\strip@pt\@ATh}}%
+ \put(\strip@pt\@ATbr,\strip@pt\@ATunit)%
+ {\line(0,-1){\strip@pt\@ATh}}%
+ \ifdim\@ATwr<\z@\relax%
+ \put(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ {\vector(-1,0){-\strip@pt\@ATwr}}%
+ \put(\strip@pt\@ATbr,\strip@pt\@ATrr)%
+ {\makebox(0,\strip@pt\@ATbp)[l]{\box\@ATsa}}\else%
+ \put(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ {\vector(1,0){\strip@pt\@ATwr}}%
+ \put(\strip@pt\@ATbr,\strip@pt\@ATrr)%
+ {\makebox(0,\strip@pt\@ATbp)[r]{\box\@ATsa}}\fi%
+ \ifnum\@ATpe=\z@\else\ifdim\@ATrl<\@ATbl%
+ \@ATwt.5\ATpathunitlength%
+ \@ATwl\@ATbl\advance\@ATwl-\@ATwt%
+ \@ATwr\@ATrr\advance\@ATwr2\@ATwt%
+ \dottedline{3}(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ (\strip@pt\@ATwl,\strip@pt\@ATwr)%
+ \advance\@ATbl-\@ATwt\advance\@ATrr2\@ATwt%
+ \@ATlen\@ATbl\advance\@ATlen-\@ATrl%
+ \@ATwl\@ATbl\advance\@ATwl-\@ATlen%
+ \dottedline{3}(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ (\strip@pt\@ATwl,\strip@pt\@ATrr)%
+ \dottedline{3}(\strip@pt\@ATrl,\strip@pt\@ATunit)%
+ (\strip@pt\@ATrl,\strip@pt\@ATrr)\else%
+ \@ATwt.5\ATpathunitlength%
+ \@ATwl\@ATbl\advance\@ATwl\@ATwt%
+ \@ATwr\@ATrr\advance\@ATwr2\@ATwt%
+ \dottedline{3}(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ (\strip@pt\@ATwl,\strip@pt\@ATwr)%
+ \advance\@ATbl\@ATwt\advance\@ATrr2\@ATwt%
+ \@ATlen\@ATbl\advance\@ATlen-\@ATrl%
+ \@ATwl\@ATbl\advance\@ATwl-\@ATlen%
+ \dottedline{3}(\strip@pt\@ATbl,\strip@pt\@ATrr)%
+ (\strip@pt\@ATwl,\strip@pt\@ATrr)%
+ \dottedline{3}(\strip@pt\@ATrl,\strip@pt\@ATunit)%
+ (\strip@pt\@ATrl,\strip@pt\@ATrr)\fi\fi%
+ \end{picture}}%
+ \setbox\@ATpathlinebox\hbox{%
+ \box\@ATu\kern-\@ATlen\box\@ATpathlinebox}}
diff --git a/macros/latex/contrib/adtrees/adtreesdoc.pdf b/macros/latex/contrib/adtrees/adtreesdoc.pdf
new file mode 100644
index 0000000000..833e48f5d5
--- /dev/null
+++ b/macros/latex/contrib/adtrees/adtreesdoc.pdf
Binary files differ
diff --git a/macros/latex/contrib/adtrees/adtreesdoc.tex b/macros/latex/contrib/adtrees/adtreesdoc.tex
new file mode 100644
index 0000000000..e2ddf91586
--- /dev/null
+++ b/macros/latex/contrib/adtrees/adtreesdoc.tex
@@ -0,0 +1,1634 @@
+\documentclass{amsart}
+\usepackage{amssymb}
+\usepackage{color}
+\usepackage{graphics}
+\usepackage{adtrees}
+\usepackage{url}
+\usepackage{microtype}
+
+\begin{document}
+\title{Adpositional Trees in \LaTeX}
+\date{}
+\author[Marco Benini]{Marco Benini}
+\address[Marco Benini]{Dipartimento di Scienza e Alta Tecnologia\\
+ Universit\`a degli Studi dell'Insubria\\
+ via Valleggio 11, I-22100 Como, Italy}
+\email{marco.benini@uninsubria.it}
+\urladdr{http://marcobenini.wordpress.com}
+\author[Federico Gobbo]{Federico Gobbo}
+\address[Federico Gobbo]{Faculty of Humanities\\
+ University of Amsterdam\\
+ Spuistraat 134,NL-1012VT Amsterdam, The Netherlands}
+\email{F.Gobbo@uva.nl}
+\urladdr{http://federicogobbo.name}
+\maketitle
+
+% --------------------------
+\section{Introduction}\label{sec:introduction}
+Adpositional trees (adtrees, for short) are a formal way to represent
+expressions in natural language. They have been defined, used, and
+discussed in F.~Gobbo and M.~Benini, \textit{Constructive Adpositional
+ Grammars: Foundations of Constructive Linguistics}, Cambridge
+Scholar Press (2011). Since then, they have been used without
+theoretical modifications in a number of applications.
+
+This document describes the \LaTeX\/ package to draw adtrees. It is
+written so that a user may start typesetting adtrees as soon as
+possible: all the fundamental commands and macros are presented in
+Section~\ref{sec:simple}. At the first reading, the subsequent
+sections may be freely skipped.
+
+Section~\ref{sec:centring} describes the next obvious step: how to put
+an adtree inside your document, controlling the way to align it with
+other objects. Section~\ref{sec:complex} explains how to control the
+length of branches via the \verb|\unitlength| value. It also
+introduces the variants of the fundamental commands to modify the
+lengths of the branches in the adtree, the angle between them, or
+both, either globally, locally, or recursively.
+
+Section~\ref{sec:internal} describes the low-level definitions that
+affect the construction of the various pieces composing
+adtrees. Changing these definitions is intended for advanced users,
+who want to modify the standard appearance of
+adtrees. Section~\ref{sec:hints} concludes the description of the main
+graphical package, showing some special techniques to deal with
+adtrees, and a couple of very low-level primitives of the package.
+
+Sections~\ref{sec:pathlike} and~\ref{sec:tabular} describe two
+alternatives way to compose adtrees. the former shows a
+\emph{path-like} format which is useful when keeping the order of
+morphemes in the original sentence is important; the latter is a
+textual rendering of an adtree as a piece of indented text.
+
+The final Section~\ref{sec:linear} describes the way to render adtrees
+in a linear format. This is a minor feature which we discourage to
+use, except for very special purposes.
+
+% --------------------------
+\clearpage
+\section{Simple Adtrees}\label{sec:simple}
+The installation of the package is standard: see the documentation on
+your particular \TeX\/ system for the details. It reduces to put the
+\verb|.sty| file in a sensible place. Using the package in a document
+requires it to be invoked with
+\verb|\usepackage{adtrees}| in the preamble.\vspace{1.5ex}
+
+The simplest adtree is composed by a single morpheme:
+\begin{equation*}
+ \ATm{Liza}{O}
+\end{equation*}
+which has been typeset by the command
+\begin{verbatim}
+ \ATm{Liza}{O}
+\end{verbatim}
+
+Sometimes, a morpheme requires to specify attributes:
+\begin{equation*}
+ \ATm{Liza}{O}[proper noun][animated]
+\end{equation*}
+this behaviour is accomplished by the command
+\begin{verbatim}
+ \ATm{Liza}{O}[proper noun][animated]
+\end{verbatim}
+
+The general form of the \verb|\ATm| command is
+\begin{equation*}
+ \verb|\ATm{| m \verb|}{| g \verb|}[| a_1 \verb|]| \cdots \verb|[|
+ a_n \verb|]|
+\end{equation*}
+with $m$ the morpheme, $g$ its grammar character, and $a_1, \dots,
+a_n$ its attributes, if any. The attributes are optional, and there
+can be any number of them. Also, notice how all the commands in the
+package start with \verb|\AT|: the final \verb|m| stands for
+\emph{morpheme}. This is a general naming rule: all the fundamental
+command have the form \verb|\AT| followed by a single letter which
+reminds its function. Variants of the fundamental commands use a
+two-letter code, the first letter being the same as the fundamental
+command, and the second letter reminding the variant.
+
+% --------------------------
+\subsection{Complex Adtrees}\label{subsec:complex}
+A complex adtree is made by two adtrees, composed via an
+\emph{adposition}, which is described by a morpheme together with the
+grammar character of the resulting adtree, and the
+\emph{trajectory}. The trajectory is an arrow, and it can be
+$\leftarrow$, $\rightarrow$, or $\leftrightarrow$. The following three
+examples are very similar to the ones in Figure 2.11 of Gobbo and
+Benini (2011):
+\begin{equation*}
+ \ATr{to}{I_2^2}
+ {\ATm{Kim}{O_2}}
+ {\ATs{The box belongs}{I_1^2}}
+ \qquad
+ \ATl{$\epsilon$}{I_2^2}
+ {\ATs{the box}{O_2}}
+ {\ATs{Kim owns}{I_1^2}}
+ \qquad
+ \ATb{on}{E>I_1^1}
+ {\ATs{the box}{O}}
+ {\ATs{Kim jumps}{I_1^1}}
+\end{equation*}
+
+These adtrees are typeset, respectively, by the commands
+\begin{verbatim}
+ \ATr{to}{I_2^2}
+ {\ATm{Kim}{O_2}}
+ {\ATs{The box belongs}{I_1^2}}
+
+ \ATl{$\epsilon$}{I_2^2}
+ {\ATm{the box}{O_2}}
+ {\ATs{Kim owns}{I_1^2}}
+
+ \ATb{on}{E>I_1^1}
+ {\ATs{the box}{O_2}}
+ {\ATs{Kim jumps}{I_1^1}}
+\end{verbatim}\vspace{1.5ex}
+
+The general format of these commands is
+\begin{equation*}
+ c \verb|{| a \verb|}{| g \verb|}[| x_1 \verb|]| \dots \verb|[| x_n
+ \verb|]{| L \verb|}{| R \verb|}|
+\end{equation*}
+with $c$ among \verb|\ATl|, \verb|ATr|, \verb|\ATb|; $a$ the
+adposition: $g$ the grammar character of the whole construction; $x_1,
+\dots, x_n$ the optional attributes of the construction; $L$ the left
+adtree; and $R$ the right adtree. The adposition is typeset as normal
+text, the grammar character in math mode with the roman typeface, so
+that super- and sub-scripts can be freely used, and the trajectory is
+defined by the command: \verb|\ATl| for the \emph{left} arrow,
+\verb|\ATr| for the \emph{right} arrow, and \verb|\ATb| for the arrow
+in \emph{both} direction, following the general naming rule. The
+attributes are optional and they are typeset as in the morpheme
+construction.\vspace{1.5ex}
+
+Actually, the \verb|\ATm| command is used to typeset proper morphemes,
+while the \verb|\ATs| command is designed to typeset expressions which
+can be expanded into an adtree. In fact, the \verb|s| letter stands
+for \emph{summary}, following the general naming rule. The \verb|\ATs|
+command has the same syntax as the \verb|\ATm| command, and it differs
+just in the graphical appearance. So, it may take an arbitrary number
+of attributes, and whatever applies to \verb|\ATm| holds for
+\verb|\ATs|, too.
+
+% --------------------------
+\subsection{Epsilon Adpositions}\label{subsec:epsilon}
+Since writing adtrees with the empty adposition, represented by the
+$\epsilon$ symbol, is very common, the following commands are
+provided: \verb|\ATle|, \verb|\ATre|, and \verb|\ATbe|, with \verb|e|
+standing for \emph{empty} in the general naming convention. They
+behave as the command without the trailing \verb|e|, but the
+adposition is automatically typeset. Also, they share the same
+syntax. So, the previous example
+\begin{equation*}
+ \ATle{I_2^2}
+ {\ATs{the box}{O}}
+ {\ATs{Kim owns}{I_1^2}}
+\end{equation*}
+can be typeset in a simplified way as
+\begin{verbatim}
+ \ATle{I_2^2}
+ {\ATs{the box}{O}}
+ {\ATs{Kim owns}{I_1^2}}
+\end{verbatim}\vspace{1.5ex}
+
+Similarly, because the so-called epsilon-transformations are common,
+and they require to forget about adpositions and morphemes, which is
+graphically marked by cancelling them with a stroke, the package
+automatically includes the \verb|cancel| package by Donald Arseneau,
+(available in CTAN, at
+\url{http://mirror.ctan.org/macros/latex/contrib/cancel}). In
+addition, to simplify the cancellation of empty adpositions, the
+commands \verb|\ATrc| \verb|\ATlc| \verb|\ATbc| are provided, with
+\verb|c| standing for \emph{cancel ed}. They work as their
+counterparts with the trailing \verb|e|, sharing the same syntax. For
+example,
+\begin{equation*}
+ \ATlc{I_2^2}
+ {\ATs{\cancel{the apple}}{O}}
+ {\ATs{Kim eats}{I_1^2}}
+\end{equation*}
+has been typeset by
+\begin{verbatim}
+ \ATlc{I_2^2}
+ {\ATs{\cancel{the apple}}{O}}
+ {\ATs{Kim eats}{I_1^2}}
+\end{verbatim}
+
+% --------------------------
+\subsection{Overlapping subtrees}\label{subsec:overlapping}
+When one has to write complex adtrees, it is often the case that there
+are overlapping subtrees. To cope with these situations, the simplest
+way is to prolong the left or the right branch of a node. This
+behaviour can be accomplished with the \verb|\ATxl| and \verb|\ATxr|
+commands, where \verb|x| stands for \emph{extends} and \verb|l| and
+\verb|r| for \emph{left} and \emph{right}, respectively. They both
+take a single argument which is the adtree being appended at the end
+of the extended branch. For example, the following adtree, similar to
+the one in Figure~2.16 (Gobbo and Benini 2011):
+\begin{equation*}
+ \unitlength.23ex
+ \ATl{with}{I^3_3}[phrase]
+ {\ATs{the key}{O}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+has been typeset by the following \LaTeX\/ code
+\begin{verbatim}
+ \ATl{with}{I^3_3}[phrase]
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}
+
+The example also shows how to put an attribute in the top adposition.
+Normally, for reasons of space, adtrees use extensively summaries to
+put in evidence only the linguistic phenomenon needed in that
+moment. For example, the following adtree:
+\begin{equation*}
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATxr{\ATs{the door will be opened}{I^3_2}}}
+\end{equation*}
+has been typeset by the following \LaTeX\/ code
+\begin{verbatim}
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATxr{\ATs{the door will be opened}{I^3_2}}}
+\end{verbatim}
+The example also shows a right-branch extension. Overlapping can be
+also avoided in complex adtrees using advanced commands. See Section
+\ref{sec:complex} for details.
+
+% --------------------------
+\subsection{Morphological adpositions}\label{subsec:mu}
+Sometimes, for the sake of clarity, morphological relations should be
+stated explicitly. For example, the following adtree:
+\begin{equation*}
+% \unitlength.3ex
+ \ATr{-ly}{E>I^3_2}
+ {\ATm{quick-}{A}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+which has been typeset by the following \LaTeX\/ code
+\begin{verbatim}
+ \ATr{-ly}{E>I^3_2}
+ {\ATm{quick-}{A}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}
+could be made explicit, where the $\mu$ adposition indicates a
+morphological relation. For example, the following adtree is
+linguistically equivalent to the previous one:
+\begin{equation*}
+ \unitlength.2ex
+ \ATle{I^3_2}
+ {\ATxl{\ATxl{\ATrmu{E}
+ {\ATm{-ly}{E}}
+ {\ATm{quick-}{A}}}}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+and it has been typeset by the following \LaTeX\/ code
+\begin{verbatim}
+ \ATle{I^3_2}
+ {\ATxl{\ATxl{\ATrmu{E}
+ {\ATm{-ly}{E}}
+ {\ATm{quick-}{A}}}}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}
+The package provides the commands \verb|\ATlmu|, \verb|\ATrmu|, and
+\verb|\ATbmu|, analogous to the $\epsilon$ variants, to simplify the
+typesetting of adtrees using the $\mu$ adposition.
+
+% --------------------------
+\clearpage
+\section{Alignments and Centring}\label{sec:centring}
+Drawing an adtree in a display is the simplest and most common way:
+\begin{equation*}
+ \unitlength.18ex
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+is generated by the following code
+\begin{verbatim}
+ \begin{equation*}
+ \unitlength.18ex
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}}
+ {\ATs{will be opened}{I^3}}}
+ \end{equation*}
+\end{verbatim}\vspace{1.5ex}
+
+Putting an adtree in a figure environment reduces to write the
+corresponding \LaTeX\/ display inside the content of the \verb|figure|
+environment.
+
+In general, we strongly encourages the user to use a robust display
+environment, like \verb|equation*| or \verb|displaymath|, and to avoid
+the \verb|center| environment. Advanced displays to align mathematical
+material, as in the \AmS\ suite, are another good and reliable option
+to place adtrees in a page.\vspace{1.5ex}
+
+An adtree fits exactly its enclosing box, that is
+\begin{equation*}
+ \fboxsep0pt
+ \unitlength.18ex
+ \fbox{\ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATbe{O_2}{\ATm{the}{A}}{\ATm{door}{O}}}}
+ {\ATs{will be opened}{I^3}}}}
+\end{equation*}
+If one looks closely (and that is why the adtree is so big), there is
+half of the point in the root which lies outside the box. This is done
+on purpose, to make easier to collate together adtrees.\vspace{1.5ex}
+
+Writing a morpheme or a summary directly inside the text, like
+\fbox{\ATm{Gargoyle}{O}}, produces a box whose baseline is exactly the
+baseline of the morpheme. This makes the behaviour predictable, even
+if the graphical appearance is quite terrible (like in this
+paragraph). An adtree, like \fbox{\ATre{I_2^2} {\ATm{the box}{O_2}}
+ {\ATbe{I_1^2}{\ATm{Kim}{O_1}}{\ATs{owns}{I^2}}}}, behaves similarly,
+because the baseline of the box is the baseline of the lowest morpheme
+or summary in the whole tree, the one corresponding to the \emph{owns}
+morpheme in the example.
+
+So, at least in principle, since the user can rely on the size of the
+enclosing box, and on the position of the baseline, it is possible to
+align an adtree in whatever way one may desire. In our experience, the
+only really common way one requires to move adtrees in the surrounding
+text is to centre them: the package provides three commands to centre
+an adtree horizontally, vertically, or both. These are
+\verb|\ATvcentre|, \verb|\AThcentre|, and \verb|\ATcentre|,
+respectively. For example
+\begin{equation*}
+ \ATvcentre{\ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}}
+ \mathbin{\equiv}
+ \ATvcentre{\ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATxr{\ATs{will be opened}{I^3}}}}}
+\end{equation*}
+has been generated by
+\begin{verbatim}
+ \ATvcentre{\ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}}}
+ \mathbin{\equiv}
+ \ATvcentre{\ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATxr{\ATs{will be opened}{I^3}}}}}
+\end{verbatim}
+
+More sophisticated ways to place an adtree in the page are discussed
+in Section~\ref{sec:hints}.
+
+% --------------------------
+\clearpage
+\section{Dealing with Complex Adtrees}\label{sec:complex}
+Simple adtrees are easily typeset using the previously described
+commands. But, sooner or later, one has to typeset a complex adtree,
+which does not fit into the page, or whose branches overlap, no matter
+how we extend branches, or which looks awful because of a poor choice
+of dimensions. In all these cases, there are a number of strategies
+one may adopt.\vspace{1.5ex}
+
+The simplest and crudest one is to change the length of branches. In
+this respect, branches are drawn using the \LaTeX\/ \verb|picture|
+environment, so the length of each branch is $25\verb|\unitlength|$.
+
+The value of \verb|\unitlength| may be changed globally, affecting the
+way all subsequent adtrees in a document are typeset. Also, the value
+may be changed inside a surrounding group, which affects only the
+adtree to be typeset, but not the rest of the document.
+
+Finally, the value of \verb|\unitlength| can be changed within the
+adtree, to affect the point where the change appears and all the
+subtrees. Notice how there is no way to directly change the value of
+\verb|\unitlength| in a single node: we will return on this point
+later.
+
+For example,
+\begin{equation*}
+ {\unitlength.28ex
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}} }
+\end{equation*}
+has been typeset adopting the strategy to affect all the branches in
+the adtree:
+\begin{verbatim}
+ {\unitlength.3ex
+ \ATl{with}{I^3_3}{\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}} }
+\end{verbatim}
+
+On the contrary,
+\begin{verbatim}
+ \unitlength.31ex
+ \ATl{with}{I^3_3}
+ {\unitlength.12ex\ATxl{\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}}
+ {\unitlength.28ex\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}
+modifies the length of all the branches in the left subtree to
+\verb|3ex| (since $3 = 25 \cdot 0.12$), and to \verb|7ex| in the
+right subtree, while the outer branches have a length of
+\verb|7.75ex|, obtaining
+\begin{equation*}
+ \unitlength.31ex
+ \ATl{with}{I^3_3}
+ {\unitlength.12ex\ATxl{\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}}
+ {\unitlength.28ex\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+
+The adposition, and the related arrow and grammar character are moved
+accordingly, which is not pleasant in this example, although it is
+what one usually wants when changing the value of \verb|\unitlength|
+in the whole adtree.
+
+The right way to have the adposition always in the same place with
+respect to the branches in a node, is to fix a suitable
+\verb|\unitlength| for the whole adtree, and to extend locally, just
+in the single node, its value. The exact technique is a bit complex,
+and it will be explained by an example later. Usually, there is no
+need to cope with these minor details, except for maniacs or for high
+precision works.\vspace{1.5ex}
+
+The length of branches can be changed locally to a single node,
+without recursively affecting the subtrees, as it happens when we
+change the value of \verb|\unitlength| inside a node, like in the
+latest example. This can be achieved using the length variant of the
+adtree drawing commands. There are also an angle variant, and a
+variant affecting both the length and the angle.
+The complete list of complex adtree drawing commands, with all the
+variants is in Table~\ref{tab:1}
+\begin{table}
+\begin{center}
+ \begin{tabular}{cccc}\renewcommand{\arraystretch}{1.3}
+ \textbf{base command} & \textbf{length variant} & \textbf{angle
+ variant} & \textbf{combined variant}\\
+ \hline\hline
+ \multicolumn{4}{c}{{\huge\strut}\emph{plain adtrees}}\\
+ \verb|\ATl| & \verb|\ATlL| & \verb|\ATlA| & \verb|\ATlLA|\\
+ \verb|\ATr| & \verb|\ATrL| & \verb|\ATrA| & \verb|\ATrLA|\\
+ \verb|\ATb| & \verb|\ATbL| & \verb|\ATbA| & \verb|\ATbLA|\\
+ \hline
+ \multicolumn{4}{c}{{\huge\strut}\emph{extensions}}\\
+ \verb|\ATxl| & \verb|\ATxlL| & \verb|\ATxlA| & \verb|\ATxlLA|\\
+ \verb|\ATxr| & \verb|\ATxrL| & \verb|\ATxrA| & \verb|\ATxrLA|\\
+ \hline
+ \multicolumn{4}{c}{{\huge\strut}\emph{adtrees with special
+ adpositions}}\\
+ \verb|\ATle| & \verb|\ATleL| & \verb|\ATleA| & \verb|\ATleLA|\\
+ \verb|\ATlc| & \verb|\ATlcL| & \verb|\ATlcA| & \verb|\ATlcLA|\\
+ \verb|\ATlmu| & \verb|\ATlmuL| & \verb|\ATlmuA| & \verb|\ATlmuLA|\\
+ \verb|\ATre| & \verb|\ATreL| & \verb|\ATreA| & \verb|\ATreLA|\\
+ \verb|\ATrc| & \verb|\ATrcL| & \verb|\ATrcA| & \verb|\ATrcLA|\\
+ \verb|\ATrmu| & \verb|\ATrmuL| & \verb|\ATrmuA| & \verb|\ATrmuLA|\\
+ \verb|\ATbe| & \verb|\ATbeL| & \verb|\ATbeA| & \verb|\ATbeLA|\\
+ \verb|\ATbc| & \verb|\ATbcL| & \verb|\ATbcA| & \verb|\ATbcLA|\\
+ \verb|\ATbmu| & \verb|\ATbmuL| & \verb|\ATbmuA| & \verb|\ATbmuLA|\\
+ \hline
+ \end{tabular}
+\end{center}
+\caption{Complex adtrees drawing command.}\label{tab:1}
+\end{table}
+
+The names of these commands are easy to remember: the length variant
+has a trailing \verb|L|, the angle variant a trailing \verb|A|, and
+the combined variant a trailing \verb|LA|.
+
+The syntax of the length variant is the same as the base command
+except that there is an additional argument, the first one, which
+contains the value for the local \verb|\unitlength|. In fact, the
+length we specify has exactly the same effect of changing
+\verb|\unitlength| just before the command, but the change does not
+apply recursively.
+
+It is worth remarking that, e.g., \verb|\ATlL{\unitlength}| is
+equivalent to \verb|\ATl|, so to reduce the length of branches to
+$90\%$ of their current value, it suffices the write something like
+\verb|\ATrL{.9\unitlength}|.
+
+Similarly, the syntax of the angle variant requires an additional
+first argument which can be $60$, $90$, or $120$, representing the
+angle between the branches: the default is $60$ degrees. Specifying
+any other values resorts to the default.
+
+The combined variant requires two additional arguments, the length and
+the angle, in this order, before any other parameter.\vspace*{1.5ex}
+
+A hidden, very technical, feature of the package is that, whatever
+follows the length in the \verb|L| argument gets evaluated inside the
+group which generates the branches in the node. So, for those well
+inside \LaTeX\/ mysteries, this feature can be used to tweak the
+behaviour of the graphical engine.\vspace{1.5ex}
+
+For example,
+\begin{equation*}
+ \ATlL{.4ex}{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATreL{.25ex}{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+has been typeset by
+\begin{verbatim}
+ \ATlL{.4ex}{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATreL{.25ex}{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}\vspace{1.5ex}
+
+The \emph{trick} to have the adposition always in the same place we
+speak before, is now easy to write, although slightly
+cumbersome. Specifically, the trick is to choose a reasonable global
+value for \verb|\unitlength| which affects all the adtree, and then to
+locally extend the branches with the \verb|\ATxlL| and \verb|\ATxrL|
+commands whenever there is a need. The sensible choice for
+\verb|\unitlength| minimises the number of extensions, and nicely
+place the adpositions. For example
+\begin{verbatim}
+ {\unitlength.32ex
+ \ATl{with}{I^3_3}
+ {\ATxlL{.1ex}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}}
+ {\ATxrL{.2ex}
+ {\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}}}
+\end{verbatim}
+generates
+\begin{equation*}
+ {\unitlength.3ex
+ \ATl{with}{I^3_3}
+ {\ATxlL{.1ex}{\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}}
+ {\ATxrL{.2ex}{\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}}}
+\end{equation*}\vspace{1.5ex}
+
+Another possibility to change the geometry of adtrees is to modify the
+angle between the branches. The commands to change the angle in the
+whole document, or within any group, affecting just the content of the
+group, are \verb|\ATnormalangle|, which sets the angle to $60$
+degrees, the default, \verb|\ATwideangle|, which sets the angle to
+$90$ degrees, and \verb|\ATextrawideangle|, which sets the angle to
+$120$ degrees. These values are the only possible ones, also in the
+angle variant of the commands, as said before. Moreover, the value
+$60$, $90$, or $120$ passed to the angle variant of a command (or to
+the combined variant) affects the node locally, as in the length
+variants' case.
+
+For example
+\begin{equation*}
+ {\ATwideangle\unitlength.3ex
+ \ATl{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATxrL{.2ex}{\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}} }
+\end{equation*}
+has been typeset by
+\begin{verbatim}
+ {\ATwideangle\unitlength.3ex
+ \ATl{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATxrL{.2ex}{\ATre{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}} }
+\end{verbatim}
+
+However, the following adtree
+\begin{equation*}
+ \ATlLA{.5ex}{120}{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATreL{.25ex}{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{equation*}
+has been generated by
+\begin{verbatim}
+ \ATlLA{.5ex}{120}{with}{I^3_3}
+ {\ATbe{O_3}
+ {\ATm{the}{A}}
+ {\ATm{key}{O}}}
+ {\ATreL{.25ex}{I^3_2}
+ {\ATs{the door}{O_2}}
+ {\ATs{will be opened}{I^3}}}
+\end{verbatim}
+
+The placement of the adposition varies when the angle is changed: this
+has been done on purpose to cope with the reduction in height which is
+induced by a larger angle between the branches. Notice how the
+reduction in height may cause the adposition part of the adtree to
+fall beyond the base of the branches.
+
+% --------------------------
+\clearpage
+\section{Internal Constructions}\label{sec:internal}
+All the major parts of an adtree can be customised. This section
+describes a number of definitions which are used to control the
+spacing between the various parts of morpheme blocks, summaries, and
+adposition blocks. Also, the boxes which are deputed to provide a
+format to a single morpheme, a grammar character, or an attribute, are
+described.\vspace{1.5ex}
+
+The shape of the adposition block, which lies just below the root of a
+node in the adtree, is synthetically described as:
+\begin{equation*}
+ {\unitlength2ex
+ \begin{picture}(14,14)
+ \thinlines
+ \put( 0, 2){\line(1,0){14}}
+ \put( 0, 4){\line(1,0){14}}
+ \put( 0, 6){\line(1,0){14}}
+ \put( 0, 8){\line(1,0){14}}
+ \put( 0,10){\line(1,0){14}}
+ \put( 0,12){\line(1,0){14}}
+ \put( 7,13){\makebox(0,0){pre skip}}
+ \put( 7,11){\makebox(0,0){$t$}}
+ \put( 7, 9){\makebox(0,0){first intermediate skip}}
+ \put( 7, 7){\makebox(0,0){$a$}}
+ \put( 7, 5){\makebox(0,0){second intermediate skip}}
+ \put( 7, 3){\makebox(0,0){$g + x$}}
+ \put( 7, 1){\makebox(0,0){post skip}}
+ \thicklines
+ \put( 0, 0){\line(1,0){14}}
+ \put( 0,14){\line(1,0){14}}
+ \put( 0, 0){\line(0,1){14}}
+ \put(14, 0){\line(0,1){14}}
+ \end{picture}}
+ \qquad\qquad\qquad
+ \raisebox{6ex}{\ATb{$a$}{g}[x]{\ATm{}{}}{\ATm{}{}}}
+\end{equation*}
+Here, $t$ stands for the trajectory, one of $\leftarrow$,
+$\rightarrow$, or $\leftrightarrow$, as in the exemplifying adtree
+above; $a$ is the adposition; $g$ is the grammar character; $x$ is an
+attribute. The various skips are \LaTeX\/ commands deputed to add
+vertical space between the components.
+
+These commands, together with their definition, are:
+\begin{verbatim}
+ \def\ATpreadpositionskip{\relax}
+ \def\ATfirstinteradpositionskip{\vskip.3ex}
+ \def\ATsecondinteradpositionskip{\vskip.3ex}
+ \def\ATpostadpositionskip{\relax}
+\end{verbatim}
+They can be redefined globally, to affect all the adtrees following
+the redefinition, or locally, within a group which limits the
+scope. For example, the following adtree
+\begin{equation*}
+ {\def\ATpreadpositionskip{\vskip-2ex}
+ \ATrL{.3ex}{to}{I_2^2}
+ {\ATm{Kim}{O_2}}
+ {\ATs{The box belongs}{I^2_1}}}
+\end{equation*}
+has been obtained by the code
+\begin{verbatim}
+ {\def\ATpreadpositionskip{\vskip-2ex}
+ \ATrL{.3ex}{to}{I_2^2}
+ {\ATm{Kim}{O_2}}
+ {\ATs{The box belongs}{I^2_1}}}
+\end{verbatim}
+
+The \verb|L| hidden feature of the package, already introduced, which
+injects code into the macro expansion, allows to redefine these
+commands within the scope of a single node, as in the root of
+\begin{equation*}
+ \ATrL{\unitlength\def\ATpreadpositionskip{\vskip-2ex}}
+ {to}{I_2^2}{\ATm{Kim}{O}}
+ {\ATbe{I_1^2}{\ATs{The box}{O_1}}{\ATm{belongs}{I^2_1}}}
+\end{equation*}
+This effect is obtained by the following code
+\begin{verbatim}
+ \ATrL{\unitlength\def\ATpreadpositionskip{\vskip-2ex}}
+ {to}{I_2^2}
+ {\ATm{Kim}{O_2}}
+ {\ATbe{I_1^2}{\ATs{The box}{O_1}}{\ATm{belongs}{I^2}}}
+\end{verbatim}\vspace{1.5ex}
+
+Attributes are managed so to form a unique block together with the
+grammar character. This block is constructed by the \verb|\ATm| and
+\verb|\ATs| commands, and inside the previously described adposition
+block.
+
+It is important to remark that, although the size of text is normal in
+the case of the morpheme and summary blocks, and while it is small in
+the case of the adposition block, the values of skips are not affected
+by the size. Thus, we strongly suggest, if you want to change them, to
+express these values in the \verb|ex| unit, which is the right unit to
+measure vertical space in terms of the \emph{current} font size.
+
+The structure of the attribute block is
+\begin{equation*}
+ {\unitlength2ex
+ \begin{picture}(14,14)
+ \thinlines
+ \put( 0, 2){\line(1,0){14}}
+ \put( 0, 4){\line(1,0){14}}
+ \put( 0, 6){\line(1,0){14}}
+ \put( 0, 8){\line(1,0){14}}
+ \put( 0,10){\line(1,0){14}}
+ \put( 0,12){\line(1,0){14}}
+ \put( 7,13){\makebox(0,0){$g$}}
+ \put( 7,11){\makebox(0,0){first skip}}
+ \put( 7, 9){\makebox(0,0){$a_1$}}
+ \put( 7, 7){\makebox(0,0){intermediate skip}}
+ \put( 7, 5){\makebox(0,0){$\vdots$}}
+ \put( 7, 3){\makebox(0,0){intermediate skip}}
+ \put( 7, 1){\makebox(0,0){$a_n$}}
+ \thicklines
+ \put( 0, 0){\line(1,0){14}}
+ \put( 0,14){\line(1,0){14}}
+ \put( 0, 0){\line(0,1){14}}
+ \put(14, 0){\line(0,1){14}}
+ \end{picture}}
+ \qquad\qquad\qquad
+ {\def\ATAttributeBox#1{\strut\textsf{#1}}
+ \raisebox{20ex}{\ATm{}{g}[\lbrack$a_1$\rbrack]
+ [\vdots]
+ [\lbrack$a_n$\rbrack]} }
+\end{equation*}
+Here, $g$ is the grammar character, while $a_1, \dots, a_n$ are the
+various attributes. The commands defining the skips in this block are
+\begin{verbatim}
+ \def\ATfirstattrskip{\vskip.7ex}
+ \def\ATinterattrskip{\vskip.5ex}
+\end{verbatim}
+These definitions can be changed globally or locally, within the scope
+of a group. Also, in the case of attributes in the adposition block,
+they can be redefined within the single node, with the same technique
+as before.
+
+It is worth remarking that any kind of material can be generated by
+these commands, not only vertical space. For example
+\begin{equation*}
+ {\makeatletter
+ \def\ATfirstattrskip{\vskip.5ex
+ \hbox to\@ATlen{\hfil\tiny * * *\hfil}\nointerlineskip
+ \vskip.3ex}
+ \makeatother
+ \ATbe{O}[determ]
+ {\ATm{the}{A}}
+ {\ATm{box}{O}}}
+\end{equation*}
+has been generated by
+\begin{verbatim}
+ {\makeatletter
+ \def\ATfirstattrskip{\vskip.5ex
+ \hbox to\@ATlen{\hfil\tiny * * *\hfil}\nointerlineskip
+ \vskip.3ex}
+ \makeatother
+ \ATbe{O}[determ]
+ {\ATm{the}{A}}
+ {\ATm{box}{O}}}
+\end{verbatim}\vspace{1.5ex}
+
+Finally, morpheme and summary blocks are as follows:
+\begin{equation*}
+ {\unitlength2ex
+ \begin{picture}(14,12)
+ \thinlines
+ \put( 0, 2){\line(1,0){14}}
+ \put( 0, 4){\line(1,0){14}}
+ \put( 0, 6){\line(1,0){14}}
+ \put( 0, 8){\line(1,0){14}}
+ \put( 0,10){\line(1,0){14}}
+ \put( 7,11){\makebox(0,0){$\triangle$, if a summary}}
+ \put( 7, 9){\makebox(0,0){pre skip}}
+ \put( 7, 7){\makebox(0,0){$m$}}
+ \put( 7, 5){\makebox(0,0){intermediate skip}}
+ \put( 7, 3){\makebox(0,0){$g + x$}}
+ \put( 7, 1){\makebox(0,0){post skip}}
+ \thicklines
+ \put( 0, 0){\line(1,0){14}}
+ \put( 0,12){\line(1,0){14}}
+ \put( 0, 0){\line(0,1){12}}
+ \put(14, 0){\line(0,1){12}}
+ \end{picture}}
+ \qquad\qquad
+ \raisebox{15ex}{\ATm{m}{g}[x]}
+ \qquad
+ \raisebox{14ex}{\ATs{m}{g}[x]}
+\end{equation*}
+Here, $m$ is the morpheme or expression, and $g$ is the grammar
+character together with its attributes $x$. The commands defining the
+skips in this block are
+\begin{verbatim}
+ \def\ATpremorphemeskip{\vskip.5ex}
+ \def\ATintermorphemeskip{\vskip1ex}
+ \def\ATpostmorphemeskip{\relax}
+\end{verbatim}
+Again, these definitions can be modified globally, or locally, within
+a group that limits the scope of the change. It is worth remarking
+that nesting an \verb|\ATm| or \verb|\ATs| command inside a complex
+adtree provides a natural group. For example
+\begin{equation*}
+ \ATbe{O}
+ {\def\ATpremorphemeskip{\vskip0ex}
+ \def\ATintermorphemeskip{\vskip.2ex}
+ \ATm{the}{A}}
+ {\ATm{box}{O}}
+\end{equation*}
+has been typeset by
+\begin{verbatim}
+ \ATbe{O}
+ {\def\ATpremorphemeskip{\vskip0ex}
+ \def\ATintermorphemeskip{\vskip.2ex}
+ \ATm{the}{A}}
+ {\ATm{box}{O}}
+\end{verbatim}\vspace{1.5ex}
+
+Actually, the face of morphemes, adpositions, and expressions in
+summaries is controlled by the following command:
+\begin{verbatim}
+ \def\ATMorphemeBox#1{#1\strut}
+\end{verbatim}
+The \verb|\strut| forces all the instances to have the same minimal
+height and depth. So, to typeset all the morphemes and summaries in
+italic, as in
+\begin{equation*}
+ {\def\ATMorphemeBox#1{\textit{#1}\strut}
+ \ATb{in}{E>I_2^2}
+ {\ATs{the house}{O}}
+ {\ATs{Kim moves}{I^2_1}} }
+\end{equation*}
+the following code suffices
+\begin{verbatim}
+ {\def\ATMorphemeBox#1{\textit{#1}\strut}
+ \ATb{in}{E>I_2^2}
+ {\ATs{the house}{O}}
+ {\ATs{Kim moves}{I^2_1}} }
+\end{verbatim}\vspace{1.5ex}
+
+Similarly, the face of grammar characters, wherever they appear, is
+controlled by the command
+\begin{verbatim}
+ \def\ATGrammarCharacterBox#1{$\mathrm{#1}$}
+\end{verbatim}
+The same scoping rules apply as in the case of
+\verb|\ATMorphemeBox|. So, for example, we can make the grammar
+character of the left subtree to be \verb|\Huge|, as in
+\begin{equation*}
+ \ATb{in}{E>I_2^2}
+ {\def\ATGrammarCharacterBox#1{\Huge$\mathrm{#1}$}
+ \ATs{the house}{O}}
+ {\ATs{Kim move}{I_1^2}}
+\end{equation*}
+by typing the following code
+\begin{verbatim}
+ \ATb{in}{E>I_2^2}
+ {\def\ATGrammarCharacterBox#1{\Huge$\mathrm{#1}$}
+ \ATs{the house}{O}}
+ {\ATs{Kim moves}{I_1^2}}
+\end{verbatim}\vspace{1.5ex}
+
+Also attributes are typeset according to a command:
+\begin{verbatim}
+ \def\ATAttributeBox#1{\textsf{[#1]}}
+\end{verbatim}
+So, for example, the illustrating attribute block on the previous page
+has been generated by the following code
+\begin{verbatim}
+ {\def\ATAttributeBox#1{\strut\textsf{#1}}
+ \raisebox{20ex}{\ATm{}{g}[\lbrack$a_1$\rbrack]
+ [\vdots]
+ [\lbrack$a_n$\rbrack]} }
+\end{verbatim}\vspace{1.5ex}
+
+Finally, the symbol denoting a summary can be customised by changing
+\begin{verbatim}
+ \def\ATSummarySymbol{$\triangle$}
+\end{verbatim}
+It is important to remark that the top vertex of the triangle lies in
+the middle of the top of the $\triangle$ character, providing a
+natural point to join with the branches of adtrees. This fact should
+be taken in account when changing the definition.
+
+% --------------------------
+\clearpage
+\section{Hints and Tricks}\label{sec:hints}
+There are a few last features which can be exploited in the
+\verb|adtrees| package. These are the low-level commands to draw the
+branches:
+\begin{verbatim}
+ \def\ATleftbranch#1#2{\line(#1,#2)}
+ \def\ATrightbranch#1#2{\line(#1,#2)}
+ \def\ATcircle{\circle*}
+\end{verbatim}
+
+The \verb|\ATleftbranch| and \verb|\ATrightbranch| commands draw the
+left and the right branch of an adtree, respectively. Also, they draw
+the extensions, when present. They can be redefined globally, locally
+within the scope of a group, or locally within a node, using the
+implicit scope of the length variant, as previously described by the
+trick to equalise the position of adposition blocks.
+
+For example,
+\begin{equation*}
+ \unitlength.26ex
+ {\def\ATrightbranch#1#2{\color{red}\line(#1,#2)}
+ \ATlL{\unitlength
+ \def\ATleftbranch##1##2{\color{green}\line(##1,##2)}}
+ {with}{I^3_3}{\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{equation*}
+is obtained by making all the right branches red, and the topmost left
+branch green:
+\begin{verbatim}
+ {\def\ATrightbranch#1#2{\color{red}\line(#1,#2)}
+ \ATlL{\unitlength
+ \def\ATleftbranch##1##2{\color{green}\line(##1,##2)}}
+ {with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{verbatim}
+
+Also, the following definition
+\begin{verbatim}
+ {\def\ATcircle#1{\relax}
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{verbatim}
+suppresses the points in the whole adtree
+\begin{equation*}
+ \unitlength.2ex
+ {\def\ATcircle#1{\relax}
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{equation*}
+
+As a rather extreme and useless example, one can typeset the previous
+adtree without showing the branches and making the points really huge
+\begin{equation*}
+ {\def\ATcircle#1{\circle*{8}}
+ \def\ATleftbranch#1#2#3{\relax}
+ \def\ATrightbranch#1#2#3{\relax}
+ \unitlength.22ex
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{equation*}
+by the following code
+\begin{verbatim}
+ {\def\ATcircle#1{\circle*{8}}
+ \def\ATleftbranch#1#2#3{\relax}
+ \def\ATrightbranch#1#2#3{\relax}
+ \unitlength.22ex
+ \ATl{with}{I^3_3}
+ {\ATs{the key}{O_3}}
+ {\ATre{I^3_2}
+ {\ATxl{\ATs{the door}{O_2}}}
+ {\ATs{will be opened}{I^3}}} }
+\end{verbatim}\vspace{1.5ex}
+
+Another important aspect of the package is that every adtree lies in a
+\TeX\/ box. It means that all the standard commands to manipulate
+boxes are available.
+
+For example
+\begin{equation*}
+ \rotatebox{-30}
+ {\ATlcLA{.3ex}{90}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{equation*}
+has been generated by
+\begin{verbatim}
+ \rotatebox{-30}
+ {\ATlcLA{.3ex}{90}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{verbatim}
+
+Sometimes, scaling a box is required:
+\begin{equation*}
+ \scalebox{1.5}
+ {\ATlcLA{.3ex}{90}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{equation*}
+has been generated by
+\begin{verbatim}
+ \scalebox{1.5}
+ {\ATlcLA{.3ex}{90}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{verbatim}\vspace{1.5ex}
+
+A final point is that, when the \verb|\smaller| command is available,
+as in AMS-\TeX, changing the font size automatically makes the
+adposition blocks to be \verb|\smaller| than the size of the normal
+text, which is used to typeset the morpheme and summary blocks. For
+example,
+\begin{equation*}
+ \hbox{\huge
+ \ATlcLA{.3ex}{120}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{equation*}
+which has been generated by
+\begin{verbatim}
+ {\huge
+ \ATlcLA{.3ex}{120}{I_2^2}
+ {\ATs{\cancel{the apple}}{O_2}}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{verbatim}
+
+When the \verb|smaller| command is not available, the size of the
+adposition block is fixed to be \verb|\small|. This can be changed
+modifying the (internal) command \verb|\@ATsmall|:
+\begin{verbatim}
+ \makeatletter
+ \def\@ATsmall{\small}
+ \makeatother
+\end{verbatim}
+Changing \verb|\small| in the above code, modifies the size of the
+components of the adposition block. We suggest to avoid such a change,
+except in a local group which contains a complete adtree.\vfill
+
+% --------------------------
+\clearpage
+\section{Path-like Adtrees}\label{sec:pathlike}
+Adtrees are abstract representation of pieces of text. When the
+relation with an effective piece of text is relevant, a different
+representation is preferred: path-like adtrees. For example, the
+expression ``the girl for whom the man bought the book'' is rendered as
+\begin{displaymath}
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] ( 5,4)[\overleftarrow{I^4_3}] &
+ wh- [U] (-2,6)[\overleftarrow{O}] &
+ om [O_2] (-2,1)[\overleftarrow{O_2}] &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-4,5)[\overrightarrow{A}] &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{displaymath}
+from the code
+\begin{verbatim}
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] ( 5,4)[\overleftarrow{I^4_3}] &
+ wh- [U] (-2,6)[\overleftarrow{O}] &
+ om [O_2] (-2,1)[\overleftarrow{O_2}] &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-4,5)[\overrightarrow{A}] &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{verbatim}
+
+To write a path-like adtree one encloses it into a
+\verb!pathlikeadtree! environment. Then, each \emph{cell} is written.
+Cells are separated by \verb|&|. A cell is composed by a
+\emph{morpheme}, a \emph{grammar character}, and one or more
+\emph{arcs}. The morpheme $m$ comes first with his grammar character
+following in square brackets:
+\begin{verbatim}
+ \begin{pathlikeadtree}
+ morhpeme [G]
+ \end{pathlikeadtree}
+\end{verbatim}
+produces
+\begin{displaymath}
+ \begin{pathlikeadtree}
+ morhpeme [G]
+ \end{pathlikeadtree}
+\end{displaymath}
+
+An arc is specified as \verb|(|$t$\verb|,|$h$\verb|)[|$g$\verb|]|
+where $t$ is the \emph{target}, i.e., the node to which the arc is
+directed, $h$ is the \emph{height} of the arc, which \textbf{must} be
+a positive integer, and $g$ is the \emph{grammar character} of the
+composition of expressions which the arc intend to represent. It
+should be remarked that there \textbf{must} be no space between
+\verb|)| and \verb|[|. For example,
+\begin{displaymath}
+ \begin{pathlikeadtree}
+ the[A](1,1)[\overleftarrow{O}] &
+ girl[O]&for[U]&wh-[U]&om[O_2]&the[A]&man[O_1]&
+ bought[I^4_{\mathsf{dep}}]&the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{displaymath}
+has been typeset by
+\begin{verbatim}
+ \begin{pathlikeadtree}
+ the[A](1,1)[\overleftarrow{O}] &
+ girl[O]&for[U]&wh-[U]&om[O_2]&the[A]&man[O_1]&
+ bought[I^4_{\mathsf{dep}}]&the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{verbatim}
+
+The target uses a \emph{relative} specification: in the example, it is
+one step forward with respect to the node it has been written into. Of
+course, going backwards is possible, by using a negative value for the
+target:
+\begin{displaymath}
+ \begin{pathlikeadtree}
+ the[A]&girl[O]&for[U]&
+ wh-[U] (-2,2)[\overleftarrow{O}] &
+ om[O_2]&the[A]&man[O_1]&bought[I^4_{\mathsf{dep}}]&
+ the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{displaymath}
+\begin{verbatim}
+ \begin{pathlikeadtree}
+ the[A]&girl[O]&for[U]&
+ wh-[U] (-2,2)[\overleftarrow{O}] &
+ om[O_2]&the[A]&man[O_1]&bought[I^4_{\mathsf{dep}}]&
+ the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{verbatim}
+However, it is possible to specify an \emph{absolute} position
+prepending a \verb|!| to the target:
+\begin{verbatim}
+ \begin{pathlikeadtree}
+ the[A]&girl[O]&
+ for[U] (!8,1)[\overleftarrow{I^4_3}] &
+ wh-[U]&om[O_2]&the[A]&man[O_1]&
+ bought[I^4_{\mathsf{dep}}]&the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{verbatim}
+\begin{displaymath}
+ \begin{pathlikeadtree}
+ the[A]&girl[O]&
+ for[U] (!8,1)[\overleftarrow{I^4_3}] &
+ wh-[U]&om[O_2]&the[A]&man[O_1]&
+ bought[I^4_{\mathsf{dep}}]&the[A]&book[O_2]
+ \end{pathlikeadtree}
+\end{displaymath}
+
+The appearance of a path-like adtree is controlled by a number of
+parameters which the user may customise:
+\begin{itemize}
+\item \verb|\ATpathinterskip| (default: \verb|.5em|) is the distance
+ between two cells;
+\item \verb|\ATpathunitlength| (default: \verb|4ex|) corresponds to
+ the length of a line of height $1$;
+\item \verb|\ATpicskip| (default: \verb|.2ex|) is the distance between
+ the upper text and the arcs below;
+\item \verb|\ATpathlinethickness| (default: \verb|.1em|) specifies the
+ thickness of the arcs;
+\item \verb|\ATpathlabelhspace| (default: \verb|.3em|) defines the
+ horizontal space between the grammar character in an arc and the
+ vertical line of the arc to which it is closer;
+\item \verb|\ATpathlabelvspace| (default: \verb|1ex|) defines the
+ vertical space between the baseline of the grammar character in an
+ arc and the horizontal line of the arc.
+\end{itemize}
+Finally, the way in which the grammar characters are written is
+customisable by changing their default boxes. They are defined as
+\begin{verbatim}
+ \def\ATnGCBox#1{\@ATsmall$\mathrm{#1}$}
+ \def\ATlGCBox#1{\@ATsmall$\mathrm{#1}$}
+\end{verbatim}
+with \verb|\ATnGCBox| controlling the rendering of the part below each
+morpheme, and \verb|\ATlGCBox| controlling the labels of the arcs.
+
+As an example,
+\begin{displaymath}
+ \ATpathinterskip1.2em
+ \ATpathunitlength4.5ex
+ \ATpicskip1ex
+ \ATpathlinethickness.2pt
+ \ATpathlabelhspace1em
+ \ATpathlabelvspace2ex
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] ( 5,4)[\overleftarrow{I^4_3}] &
+ wh- [U] (-2,6)[\overleftarrow{O}] &
+ om [O_2] (-2,1)[\overleftarrow{O_2}] &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-4,5)[\overrightarrow{A}] &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{displaymath}
+has been typeset by
+\begin{verbatim}
+ \ATpathinterskip1.2em
+ \ATpathunitlength4.5ex
+ \ATpicskip1ex
+ \ATpathlinethickness.2pt
+ \ATpathlabelhspace1em
+ \ATpathlabelvspace2ex
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] ( 5,4)[\overleftarrow{I^4_3}] &
+ wh- [U] (-2,6)[\overleftarrow{O}] &
+ om [O_2] (-2,1)[\overleftarrow{O_2}] &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-4,5)[\overrightarrow{A}] &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{verbatim}
+
+Path-like adtrees as explained so far are useful to represent adtrees
+having $\epsilon$-only adpositions. Since every adtree, up to a
+syntactical transformation, can be represented in this way, although
+losing some pieces of structural content, path-like adtrees drawn
+using the previously explained features are completely general.
+
+However, there is less elegant way of writing general adtrees in the
+path-like form, in which adpositions are directly referred to in the
+arcs.
+
+In short, the arc syntax is generalised to
+\verb|(|$t$\verb|,|$h$\verb|)[|$g$\verb|]|\verb|<|$a$\verb|>| where
+the $a$ specifies the adposition, either using the relative or the
+absolute \verb|!| syntax. Of course, when there is no explicit
+adpostion to refer, i.e., the adposition is $\epsilon$, the previous
+syntax, without the parameter in angle brackets, is used.
+
+As an illustration,
+\begin{displaymath}
+ \ATpathinterskip1.2em
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] &
+ wh- [U] &
+ om [O_2] ( 3,4)[\overleftarrow{I^4_3}]<!3> &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-6,6)[\overrightarrow{A}]<-4> &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{displaymath}
+has been typeset by
+\begin{verbatim}
+\begin{displaymath}
+ \ATpathinterskip1.2em
+ \begin{pathlikeadtree}
+ the [A] ( 1,1)[\overleftarrow{O}] &
+ girl [O] &
+ for [U] &
+ wh- [U] &
+ om [O_2] ( 3,4)[\overleftarrow{I^4_3}]<!3> &
+ the [A] ( 1,1)[\overleftarrow{O_1}] &
+ man [O_1] ( 1,2)[\overleftarrow{I^4_1}] &
+ bought [I^4_{\mathsf{dep}}] (-6,6)[\overrightarrow{A}]<-4> &
+ the [A] ( 1,1)[\overleftarrow{O_2}] &
+ book [O_2] (-2,3)[\overleftarrow{I^4_2}]
+ \end{pathlikeadtree}
+\end{displaymath}
+\end{verbatim}\vspace{1.5ex}
+
+There are a few hints and tricks about path-like adtrees: first, as in
+the case of adtrees, the \verb|pathlikeadtree| environment produces a
+\TeX{} box, thus it can be manipulated by, e.g., rotating, scaling,
+etc.
+
+Second, while the syntax inside the \verb|pathlikeadtree| is quite
+rigid, it is possible to locally use commands by putting them in the
+morpheme of a cell. The effects of this commands influence the cell
+from the point they are issued, but also all the subsequent
+cells. Beware that using commands with side effects inside a
+\verb|pathlikeadtree| environment is an hack, which requires a deep
+understanding of how the code of the package operates.
+
+The third way to radically affect the appearance of a path-like adtree
+is to redefine \verb|\ATpathpichook|, which is \verb|\def|ined to be
+empty by default. This command is issued just before each arc is
+drawn. To code sophisticated manipulations of the drawing process
+requires to understand how the drawing engine works. However, for
+simple manipulations, it suffices to know that \verb|\@ATpa| contains
+the index of the source cell of an arc, \verb|\@ATpb| the index of the
+target cell, \verb|\@ATpc| the height, \verb|\@ATsa| is a box register
+containing the already formatted grammar character of an arc, and
+\verb|\@ATpe| is either $0$ or the index of the adposition cell.
+Needless to say, using this feature is for advanced users only.
+
+% --------------------------
+\clearpage
+\section{Tabular Adtrees}\label{sec:tabular}
+Sometimes it is useful to have a purely textual representation of an
+adtree, which is more compact and fits, e.g., in a double column
+format. For example
+\begin{equation*}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+\end{equation*}
+can be rendered as
+\begin{ATtabulardisplay}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+\end{ATtabulardisplay}
+
+Obtaining this effect is as simple as enclosing the adtree into a
+\verb!ATtabulardisplay! environment. The previous example has been
+typeset by
+\begin{verbatim}
+ \begin{ATtabulardisplay}
+ \ATrA{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}{\ATm{the}{A}}{\ATm{man}{O}}}
+ \end{ATtabulardisplay}
+\end{verbatim}
+
+The environment uses the \verb|\ATtabskip| command to declare the
+amount of space to use for indenting the sub-trees. The default is
+\verb|\def\ATtabskip{\hspace*{1em}}|. In addition, the whole
+environment is moved on the right by \verb|\ATtabindent|, with default
+value \verb|\def\ATtabindent{\hspace*{2em}}|.
+
+Alternatively, the environment \verb|ATtabular| allows to typeset the
+adtree in the same way but inside a box, which can then be manipulated
+as one pleases:
+\begin{displaymath}
+ \fbox{$\vcenter{\begin{ATtabular}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+ \end{ATtabular}}$} =
+ \fbox{$\vcenter{\begin{ATtabular}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+ \end{ATtabular}}$}
+\end{displaymath}
+\begin{verbatim}
+ \fbox{$\vcenter{
+ \begin{ATtabular}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+ \end{ATtabular}}$} =
+ \fbox{$\vcenter{
+ \begin{ATtabular}
+ \ATrLA{2\unitlength}{120}{wh-}{O}
+ {\ATr{for}{I}
+ {\ATs{the girl}{O}}
+ {\ATle{I^4_2}
+ {\ATs{the book}{Y}}
+ {\ATre{I^4_1}
+ {\ATm{-o}{X}}
+ {\ATs{bought}{I^4_{\mathrm{dep}}}}}}}
+ {\ATle{O}
+ {\ATm{the}{A}}
+ {\ATm{man}{O}}}
+ \end{ATtabular}}$}
+\end{verbatim}
+
+The various pieces of the adtree are rendered according to the
+following definitions, which could be modified on need, see also the
+next section, keeping in mind that they are not for the casual user.
+\begin{verbatim}
+ \def\ATtabularadpositionblock#1#2#3{%
+ \hbox{\ATtabindent\AT@loop@tab%
+ {#2}\textsuperscript{#1}\textsubscript{#3}}}
+ \def\ATtabularmorphemeblock#1#2{
+ \hbox{\ATtabindent\AT@loop@tab%
+ {#1}\textsubscript{#2}}}
+ \def\ATtabularsummaryblock#1#2{
+ \hbox{\ATtabindent\AT@loop@tab%
+ \mbox{$\triangle($}%
+ \mbox{#1}\mbox{$)$}\textsubscript{#2}}}
+ \def\ATtabularfirstattribute{\ATlinearfirstattribute}
+ \def\ATtabularnextattribute{\ATlinearnextattribute}
+ \def\ATtabularsubtrees#1#2{%
+ \advance\@AT@tabcount1%
+ \vbox{#1\relax#2}%
+ \advance\@AT@tabcount-1}
+\end{verbatim}
+
+Finally the \verb|\ATTabular| command can be used to switch from the
+normal graphical rendering of adtrees to the tabular one. This is a
+low-level command which has been left accessible to end-users willing
+to write their own environments when \verb|ATtabular| is not enough.
+
+% --------------------------
+\clearpage
+\section{Linear Adtrees}\label{sec:linear}
+Adtrees can be rendered in a linear format. This is not graphically
+pleasant, so we discourage users to adopt it.\vspace{1.5ex}
+
+Nevertheless, it may be useful to have a very compact representation
+of adtrees. This can be automatically obtained by prepending the
+\verb|\ATlinearise| command to an adtree. For example
+\begin{center}
+ \ATlinearise{\ATlcL{.3ex}{I_2^2}[phrase]
+ {\ATm{\cancel{something}}{O}[object][fruit]}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{center}
+is the same as
+\begin{equation*}
+ \ATlcL{.3ex}{I_2^2}[phrase]
+ {\ATm{\cancel{something}}{O}[object][fruit]}
+ {\ATs{Kim eats}{I_1^2}}
+\end{equation*}
+which shows how all the features of adtrees are rendered in the linear
+format.
+
+The linear presentation has been generated by
+\begin{verbatim}
+ \ATlinearise{\ATlcL{.3ex}{I_2^2}[phrase]
+ {\ATm{\cancel{something}}{O}[object][fruit]}
+ {\ATs{Kim eats}{I_1^2}}}
+\end{verbatim}
+which differs from the code to draw the graphics presentation just for
+\verb|\ATlinearise|.\vspace{1.5ex}
+
+Declaring \verb|\ATLinear| in some point of the text makes linear all
+the adtrees from that point on. To reestablish the standard behaviour
+of graphical adtrees, one issues the command
+\verb|\ATNormal|.\vspace{1.5ex}
+
+Linear adtrees are composed using the following commands
+\begin{verbatim}
+ \def\ATlinearadpositionblock#1#2#3%
+ {{#2}\textsuperscript{#1}\textsubscript{#3}}
+ \def\ATlinearfirstattribute#1{{#1}:}
+ \def\ATlinearnextattribute#1{{#1};}
+ \def\ATlinearsubtrees#1#2{(#1,\linebreak[0] #2)}
+ \def\ATlinearmorphemeblock#1#2{{#1}\textsubscript{#2}}
+ \def\ATlinearsummaryblock#1#2{\mbox{$\triangle($}%
+ \mbox{#1}\mbox{$)$}\textsubscript{#2}}
+\end{verbatim}
+Their meaning should be intuitive after the explanations in
+Section~\ref{sec:internal}.
+
+Also, it must be remarked that \verb|\ATMorphemeBox|,
+\verb|\ATGrammarCharacterBox|, and \verb|\ATAttributeBox| are still
+used to write the corresponding elements.\vspace{1.5ex}
+
+Linear adtrees are useful when it is required to perform some
+computation on an adtree inside \LaTeX, e.g., when trying to write a
+macro which manipulates an argument which is an adtree.
+
+The reason is double: first, the linear format require far less
+computation than the graphical rendering; and, second, the building
+macros receive inputs which have not been heavily preprocessed to
+prepare their graphical rendering, thus closer to what the user has
+written in the source code.
+
+For example, to list all the morpheme attributes occurring inside
+\begin{equation*}
+ \ATlL{.3ex}{with}{I^2_2}[phrase]
+ {\ATs{the key}{O}[third actant]}
+ {\ATre{I^2_1}
+ {\ATxl{\ATs{the door}{O}[second actant]}}
+ {\ATs{will be opened}{I^3}[governor]}}
+\end{equation*}
+we can execute
+\begin{verbatim}
+ { \def\ATlinearadpositionblock#1#2#3{\relax}
+ \def\ATlinearfirstattribute#1#2{#2}
+ \def\ATlinearnextattribute#1#2{[{#2}]}
+ \def\ATlinearsubtrees{\relax}
+ \def\ATlinearmorphemeblock#1{\relax}
+ \def\ATlinearsummaryblock#1{\relax}
+ \ATlinearise{
+ \ATl{with}{I^2_2}[phrase]
+ {\ATs{the key}{O}[third actant]}
+ {\ATre{I^2_1}
+ {\ATxl{\ATs{the door}{O}[second actant]}}
+ {\ATs{will be opened}{I^2}[governor]}}} }
+\end{verbatim}
+which produces
+\begin{center}
+ { \def\ATlinearadpositionblock#1#2#3{\relax}
+ \def\ATlinearfirstattribute#1#2{#2}
+ \def\ATlinearnextattribute#1#2{[{#2}]}
+ \def\ATlinearsubtrees{\relax}
+ \def\ATlinearmorphemeblock#1{\relax}
+ \def\ATlinearsummaryblock#1{\relax}
+ \ATlinearise{
+ \ATl{with}{I^2_2}[phrase]
+ {\ATs{the key}{O}[third actant]}
+ {\ATre{I^2_1}
+ {\ATxl{\ATs{the door}{O}[second actant]}}
+ {\ATs{will be opened}{I^2}[governor]}}} }
+\end{center}
+Needless to say, such computations require a real \TeX\/ magician, who
+is able to fully understand the code of the package! Nevertheless,
+this opens the door to \LaTeX\/ macros that operate on adtrees,
+treating them like data structures.\vfill
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End: