diff options
author | Karl Berry <karl@freefriends.org> | 2019-07-11 21:04:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-07-11 21:04:12 +0000 |
commit | 7559eb16050dce8cef70650604224db997445886 (patch) | |
tree | fef9221758a3d08bb43edaf54e3841fd08d5de2f /Master/texmf-dist | |
parent | 7db6071b1ded2ed4dd2c31a1a67a43e6eaba756b (diff) |
adtrees (11jul19)
git-svn-id: svn://tug.org/texlive/trunk@51618 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/adtrees/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/adtrees/adtreesdoc.pdf | bin | 306406 -> 343779 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/adtrees/adtreesdoc.tex | 628 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/adtrees/adtrees.sty | 657 |
4 files changed, 999 insertions, 292 deletions
diff --git a/Master/texmf-dist/doc/latex/adtrees/README b/Master/texmf-dist/doc/latex/adtrees/README index ed7b75851e1..27948ed5fe9 100644 --- a/Master/texmf-dist/doc/latex/adtrees/README +++ b/Master/texmf-dist/doc/latex/adtrees/README @@ -2,8 +2,8 @@ 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 -- adtree.sty: containing the LaTeX engine to adpositional trees; -- adtreedoc.pdf: the human readable documentation for the package; -- adtreedoc.tex: the source code for the documentation. +- 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/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.pdf b/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.pdf Binary files differindex ee1d7c58a54..833e48f5d55 100644 --- a/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.pdf +++ b/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.pdf diff --git a/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.tex b/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.tex index d835371065e..e2ddf915868 100644 --- a/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.tex +++ b/Master/texmf-dist/doc/latex/adtrees/adtreesdoc.tex @@ -4,6 +4,7 @@ \usepackage{graphics} \usepackage{adtrees} \usepackage{url} +\usepackage{microtype} \begin{document} \title{Adpositional Trees in \LaTeX} @@ -17,7 +18,7 @@ \author[Federico Gobbo]{Federico Gobbo} \address[Federico Gobbo]{Faculty of Humanities\\ University of Amsterdam\\ - Spuistraat 210,NL-1012VT Amsterdam, The Netherlands} + Spuistraat 134,NL-1012VT Amsterdam, The Netherlands} \email{F.Gobbo@uva.nl} \urladdr{http://federicogobbo.name} \maketitle @@ -31,16 +32,9 @@ discussed in F.~Gobbo and M.~Benini, \textit{Constructive Adpositional 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. This -package is an improvement over the original one used to typeset all -the examples in the previously cited book. The present package -maintains the same graphical presentation with a number of -improvements, and an incompatible syntax. Also, the original package, -although never distributed, is no longer maintained. - -This document describes all the features of the package. It is written -so that a user may start typesetting adtrees as soon as possible: all -the fundamental commands and macros are presented in +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. @@ -56,20 +50,28 @@ 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 +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. Using the package in a -document requires it to be invoked with -\verb|\usepackage{adtrees}|.\vspace{1.5ex} +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*} @@ -112,7 +114,7 @@ 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:24): +Benini (2011): \begin{equation*} \ATr{to}{I_2^2} {\ATm{Kim}{O_2}} @@ -222,7 +224,7 @@ 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:29): +the one in Figure~2.16 (Gobbo and Benini 2011): \begin{equation*} \unitlength.23ex \ATl{with}{I^3_3}[phrase] @@ -264,7 +266,7 @@ also avoided in complex adtrees using advanced commands. See Section Sometimes, for the sake of clarity, morphological relations should be stated explicitly. For example, the following adtree: \begin{equation*} - \unitlength.2ex +% \unitlength.3ex \ATr{-ly}{E>I^3_2} {\ATm{quick-}{A}} {\ATre{I^3_2} @@ -307,9 +309,11 @@ The package provides the commands \verb|\ATlmu|, \verb|\ATrmu|, and 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} @@ -319,6 +323,7 @@ Drawing an adtree in a display is the simplest and most common way: 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} @@ -334,13 +339,13 @@ 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 AMS-\TeX\/, are another good and reliable option to -place adtrees in a page.\vspace{1.5ex} +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.3ex + \unitlength.18ex \fbox{\ATl{with}{I^3_3} {\ATs{the key}{O_3}} {\ATre{I^3_2} @@ -352,11 +357,11 @@ 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 -\ATm{Gargoyle}{O}, produces a box whose baseline is exactly the +\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 \ATre{I_2^2} {\ATm{the box}{O_2}} -{\ATbe{I_1^2}{\ATm{Kim}{O_1}}{\ATs{owns}{I^2}}}, behaves similarly, +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. @@ -401,6 +406,7 @@ 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, @@ -411,61 +417,63 @@ 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. +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.3ex + {\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 by +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}}} } + {\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} -adopting the strategy to affect all the branches in the adtree. Notice -how the outermost braces limit the scope of the change to the value of -\verb|\unitlength|. On the contrary, -\begin{equation*} - \ATl{with}{I^3_3} - {\unitlength.12ex\ATxl{\ATbe{O_3} - {\ATm{the}{A}} - {\ATm{key}{O}}}} - {\unitlength.33ex\ATre{I^3_2} - {\ATs{the door}{O_2}} - {\ATs{will be opened}{I^3}}} -\end{equation*} -modifies the length of all the branches in the left subtree to -\verb|3ex| (since $3 = 25 \cdot 0.12$), and to \verb|8.25ex| in the -right subtree \begin{verbatim} + \unitlength.31ex \ATl{with}{I^3_3} {\unitlength.12ex\ATxl{\ATbe{O_3} {\ATm{the}{A}} {\ATm{key}{O}}}} - {\unitlength.33ex\ATre{I^3_2} + {\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 @@ -486,9 +494,9 @@ 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: +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 @@ -517,6 +525,9 @@ variants is: \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|. @@ -539,7 +550,7 @@ 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. +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 @@ -609,7 +620,7 @@ $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) affect the node locally, as in the length +the combined variant) affects the node locally, as in the length variants' case. For example @@ -663,6 +674,7 @@ 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 @@ -729,9 +741,9 @@ has been obtained by the code {\ATs{The box belongs}{I^2_1}}} \end{verbatim} -The \verb|L| hidden feature of the package, already introduces, allows -to redefine these commands within the scope of a single node, as in -the root of +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}} @@ -944,6 +956,7 @@ 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 @@ -963,12 +976,11 @@ trick to equalise the position of adposition blocks. For example, \begin{equation*} - \unitlength.2ex + \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}} + {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}}} } @@ -1095,9 +1107,420 @@ modifying the (internal) command \verb|\@ATsmall|: \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. +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} @@ -1105,11 +1528,11 @@ 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{equation*} +\begin{center} \ATlinearise{\ATlcL{.3ex}{I_2^2}[phrase] {\ATm{\cancel{something}}{O}[object][fruit]} {\ATs{Kim eats}{I_1^2}}} -\end{equation*} +\end{center} is the same as \begin{equation*} \ATlcL{.3ex}{I_2^2}[phrase] @@ -1135,13 +1558,14 @@ of graphical adtrees, one issues the command Linear adtrees are composed using the following commands \begin{verbatim} - \def\ATlinearadpositionblock#1#2#3{% - {#2}${}^{\hbox{#1}}_{\hbox{#3}}$} - \def\ATlinearfirstattribute#1#2{{#1}:{#2}} - \def\ATlinearnextattribute#1#2{{#1};{#2}} - \def\ATlinearsubtrees#1#2{(#1,\linebreak[0] #2)} - \def\ATlinearmorphemeblock#1#2{{#1}${}_{\hbox{#2}}$} - \def\ATlinearsummaryblock#1#2{({#1})${}_{\hbox{#2}}$} + \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}. @@ -1170,35 +1594,41 @@ For example, to list all the morpheme attributes occurring inside \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] + { \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{equation*} - {\def\ATlinearadpositionblock#1#2#3{\relax} +\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{equation*} -It is needless to say that such computations require a real \TeX\/ -magician, who is able to understand (and, hopefully, improve) 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}
\ No newline at end of file + \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: diff --git a/Master/texmf-dist/tex/latex/adtrees/adtrees.sty b/Master/texmf-dist/tex/latex/adtrees/adtrees.sty index 5d94825f81a..7cf97e3b0d2 100644 --- a/Master/texmf-dist/tex/latex/adtrees/adtrees.sty +++ b/Master/texmf-dist/tex/latex/adtrees/adtrees.sty @@ -1,14 +1,15 @@ -%%------------------------------------------------------- +%------------------------------------------------------- %% 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.0 - 2016/01/20 +%% Version 1.1 - 2019/07/11 %%------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{adtrees}[2016/01/20 v1.0 Adtrees package] +\ProvidesPackage{adtrees}[2019/07/11 v1.1 Adtrees package] \RequirePackage{cancel} +\RequirePackage{epic} %%------------------------------------------------------- %% We assume that \smaller is a command that reduces the @@ -18,8 +19,8 @@ %% the right size when dealing with \normalsize trees. %%------------------------------------------------------- \@ifundefined{smaller}% -{\gdef\@ATsmall{\small}}% -{\gdef\@ATsmall{\smaller}} + {\gdef\@ATsmall{\small}}% + {\gdef\@ATsmall{\smaller}} %%------------------------------------------------------- %% Usually, the angle in adtrees is 60 degrees @@ -36,7 +37,7 @@ \ATnormalangle %%------------------------------------------------------- -%% Firstly, we declare the internal variables +%% First, we declare the internal variables %%------------------------------------------------------- \newskip\@ATlen % a temporay length \newskip\@ATbp % the base point of a block @@ -63,6 +64,8 @@ \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 @@ -73,17 +76,20 @@ %% 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{% -\def\@ATcons{\noexpand\@ATcons}% -\expandafter\edef\expandafter\@ATstack\expandafter{% -\@ATcons{#1}\@ATstack}} + \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{% -\def\@ATcons{\noexpand\@ATcons}% -\expandafter\edef\expandafter\@ATstack\expandafter{#3\@ATeos}} + \global\advance\@ATstackheight-1% + \def\@ATcons{\noexpand\@ATcons}% + \expandafter\edef\expandafter\@ATstack\expandafter{#3\@ATeos}} \def\@ATpop{\expandafter\@AT@pop\@ATstack} %%------------------------------------------------------- @@ -98,7 +104,9 @@ %%------------------------------------------------------- \def\@ATadposition#1#2#3{% \if@ATlinear% - \ATlinearadpositionblock{#1}{#2}{#3}\else%% + \@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}% @@ -112,7 +120,7 @@ \hbox to\@ATlen{\hfil\box\@ATsc\hfil}\nointerlineskip% \ATpostadpositionskip}% \@ATwt\dp\@ATu% - \hbox{\raise\@ATwt\hbox{\box\@ATu}}\fi} + \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}}} @@ -120,29 +128,33 @@ \@ATtreeparsed{#1}{#2}{#3}{#4}{\hbox{#5}}} \def\@ATadposb#1#2#3#4#5[#6]{% \@ATadposc{#1}{#2}{#3}{#4}{% - \@ATadposd{#5}{\@ATsmall\ATAttributeBox{#6}}}} + \@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% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi} \def\@ATadpose#1#2{\if@ATlinear% - \ATlinearnextattribute{#1}{#2}\else% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}% \def\@ATadposf#1#2#3#4#5[#6]{% \@ATadposc{#1}{#2}{#3}{#4}{% - \@ATadpose{#5}{\@ATsmall\ATAttributeBox{#6}}}} + \@ATadpose{#5}{\ATAttributeBox{#6}}}} %%------------------------------------------------------- %% The internal drawing procedure for binary adtrees. @@ -184,62 +196,66 @@ %% and to limit register/memory usage. %%------------------------------------------------------- \def\@ATtreeparsed#1#2#3#4#5#6#7{% -\if@ATlinear% -\@ATadposition{#3}{#4}{#5}\ATlinearsubtrees{#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} + \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 @@ -248,32 +264,34 @@ %% been truncated. %%------------------------------------------------------- \def\@ATright#1#2#3{% -\if@ATlinear% -#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} + \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 @@ -282,31 +300,33 @@ %% has been truncated. %%------------------------------------------------------- \def\@ATleft#1#2#3{% -\if@ATlinear% -#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}% + \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. @@ -320,7 +340,10 @@ {\@ATadlb{#1}{#2}}% {\@ATadla{#1}{#2}}} \def\@ATadla#1#2{% - \if@ATlinear\ATlinearmorphemeblock{#1}{#2}\else% + \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{% @@ -334,28 +357,32 @@ \@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} + \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% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}% \def\@ATadle#1#2{\if@ATlinear% - \ATlinearnextattribute{#1}{#2}\else% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}% \def\@ATadlf#1#2[#3]{% \@ATadlc{#1}{\@ATadle{#2}{\ATAttributeBox{#3}}}} @@ -371,7 +398,10 @@ {\@ATadsb{#1}{#2}}% {\@ATadsa{#1}{#2}}} \def\@ATadsa#1#2{% - \if@ATlinear\ATlinearsummaryblock{#1}{#2}\else% + \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}% @@ -390,28 +420,32 @@ \@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} + \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% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}% \def\@ATadse#1#2{\if@ATlinear% - \ATlinearnextattribute{#1}{#2}\else% + \@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}% + \hbox to\@ATlen{\hfil\box\@ATsb\hfil}}\fi\fi}% \def\@ATadsf#1#2[#3]{% \@ATadsc{#1}{\@ATadse{#2}{\ATAttributeBox{#3}}}} @@ -455,9 +489,9 @@ %% %% \ATSummarySymbol defines the symbol used for the summary %%------------------------------------------------------- -\def\ATMorphemeBox#1{#1\strut} -\def\ATGrammarCharacterBox#1{$\mathrm{#1}$} -\def\ATAttributeBox#1{\textsf{[#1]}} +\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} @@ -546,36 +580,24 @@ \def\@ATmu{\mu} \def\@AT@shorttree#1#2#3#4#5{% \@ATtree{#1}{#2}{\hbox{$#3$}}% - {\@ATsmall\ATMorphemeBox{#4}}% - {\@ATsmall\ATGrammarCharacterBox{#5}}} -\def\ATl{\@AT@shorttree{\unitlength}{\@ATangle}% - {\scriptstyle\leftarrow}} -\def\ATlL#1{\@AT@shorttree{#1}{\@ATangle}% - {\scriptstyle\leftarrow}} -\def\ATlA#1{\@AT@shorttree{\unitlength}{#1}% - {\scriptstyle\leftarrow}} -\def\ATlLA#1#2{\@AT@shorttree{#1}{#2}% - {\scriptstyle\leftarrow}} -\def\ATr{\@AT@shorttree{\unitlength}{\@ATangle}% - {\scriptstyle\rightarrow}} -\def\ATrL#1{\@AT@shorttree{#1}{\@ATangle}% - {\scriptstyle\rightarrow}} -\def\ATrA#1{\@AT@shorttree{\unitlength}{#1}% - {\scriptstyle\rightarrow}} -\def\ATrLA#1#2{\@AT@shorttree{#1}{#2}% - {\scriptstyle\rightarrow}} -\def\ATb{\@AT@shorttree{\unitlength}{\@ATangle}% - {\scriptstyle\leftrightarrow}} -\def\ATbL#1{\@AT@shorttree{#1}{\@ATangle}% - {\scriptstyle\leftrightarrow}} -\def\ATbA#1{\@AT@shorttree{\unitlength}{#1}% - {\scriptstyle\leftrightarrow}} -\def\ATbLA#1#2{\@AT@shorttree{#1}{#2}% - {\scriptstyle\leftrightarrow}} + {\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\ATleLA#1#2{\ATlLA{#1}{#2}{$\@ATeps$}} \def\ATlc{\ATl{$\@ATepsc$}} \def\ATlcL#1{\ATlL{#1}{$\@ATepsc$}} \def\ATlcA#1{\ATlA{#1}{$\@ATepsc$}} @@ -608,18 +630,16 @@ \def\ATbmuL#1{\ATbL{#1}{$\@ATmu$}} \def\ATbmuA#1{\ATbA{#1}{$\@ATmu$}} \def\ATbmuLA#1#2{\ATbLA{#1}{#2}{$\@ATmu$}} -\def\ATxl{\@ATleft{\unitlength}{\@ATangle}} -\def\ATxlL#1{\@ATleft{#1}{\@ATangle}} -\def\ATxlA#1{\@ATleft{\unitlength}{#1}} \def\ATxlLA#1#2{\@ATleft{#1}{#2}} -\def\ATxr{\@ATright{\unitlength}{\@ATangle}} -\def\ATxrL#1{\@ATright{#1}{\@ATangle}} -\def\ATxrA#1{\@ATright{\unitlength}{#1}} +\def\ATxl{\ATxlLA{\unitlength}{\@ATangle}} +\def\ATxlL#1{\ATxlLA{#1}{\@ATangle}} +\def\ATxlA{\ATxlLA{\unitlength}} \def\ATxrLA#1#2{\@ATright{#1}{#2}} -\def\ATs#1#2{\@ATads{\ATMorphemeBox{#1}}% - {\ATGrammarCharacterBox{#2}}} -\def\ATm#1#2{\@ATadl{\ATMorphemeBox{#1}}% - {\ATGrammarCharacterBox{#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. @@ -632,17 +652,95 @@ %% where t is the text. All these renderings are coded via %% suitable blocks %%------------------------------------------------------- -\def\ATlinearise#1{\@ATlineartrue\hbox{#1}\@ATlinearfalse} -\def\ATLinear{\@ATlineartrue} -\def\ATNormal{\@ATlinearfalse} +\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}${}^{\hbox{#1}}_{\hbox{#3}}$} -\def\ATlinearfirstattribute#1#2{{#1}:{#2}} -\def\ATlinearnextattribute#1#2{{#1};{#2}} +\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}${}_{\hbox{#2}}$} -\def\ATlinearsummaryblock#1#2{({#1})${}_{\hbox{#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. @@ -659,12 +757,191 @@ %%------------------------------------------------------- \def\ATvcentre#1{% \setbox\@ATsc\hbox{#1}% - \@ATlen\dp\@ATsc\setbox\@ATsc\hbox{\raise\@ATlen\box\@ATsc} + \@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}} + \@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[#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}} |