summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xytree
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/xytree
Initial commit
Diffstat (limited to 'macros/latex/contrib/xytree')
-rw-r--r--macros/latex/contrib/xytree/README25
-rw-r--r--macros/latex/contrib/xytree/xytree-doc-en.pdfbin0 -> 268279 bytes
-rw-r--r--macros/latex/contrib/xytree/xytree-doc-en.tex1714
-rw-r--r--macros/latex/contrib/xytree/xytree.sty367
4 files changed, 2106 insertions, 0 deletions
diff --git a/macros/latex/contrib/xytree/README b/macros/latex/contrib/xytree/README
new file mode 100644
index 0000000000..77433119d9
--- /dev/null
+++ b/macros/latex/contrib/xytree/README
@@ -0,0 +1,25 @@
+This is the file README for xytree.sty. For full documentation, read
+xytree-doc-en.pdf.
+
+xytree.sty utilizes the Xy-pic package to draw syntactic trees. There
+are currently some similar LaTeX packages for this purpose, but they
+have strength and weakness, so one allows to draw only binary trees
+and the other permits to draw only limited sorts of lines. Some
+packages provide quasi perfect solution in this area, but have the
+dependency on the other graphic language, which dvi driver can not
+directly process.
+
+The aim of xytree.sty is to draw linguistic syntactic trees with ease
+and to support hopefully sufficient functionality, that the linguist
+may need.
+
+xytree.sty also provides macros for drawing other kinds of trees and
+linguistic diagrams.
+
+Licensing of this package is covered by LPPL.
+
+For whatever reason, you can contact me via e-mail:
+
+ koaunghi@kornet.net
+
+Koaunghi Un.
diff --git a/macros/latex/contrib/xytree/xytree-doc-en.pdf b/macros/latex/contrib/xytree/xytree-doc-en.pdf
new file mode 100644
index 0000000000..59c3ce5f41
--- /dev/null
+++ b/macros/latex/contrib/xytree/xytree-doc-en.pdf
Binary files differ
diff --git a/macros/latex/contrib/xytree/xytree-doc-en.tex b/macros/latex/contrib/xytree/xytree-doc-en.tex
new file mode 100644
index 0000000000..24aa6d9005
--- /dev/null
+++ b/macros/latex/contrib/xytree/xytree-doc-en.tex
@@ -0,0 +1,1714 @@
+%&pdflatex
+\documentclass[a4paper]{article}
+
+\usepackage{xytree}
+\usepackage{a4wide}
+\usepackage{multicol}
+\usepackage{avm,cm-lingmacros}
+
+\usepackage{fullname}
+
+\newcommand{\ttbs}{\char92}
+\ifx\pdftexversion\undefined
+\usepackage[dvips,colorlinks=false]{hyperref}
+\else
+\usepackage[pdftex,colorlinks=false]{hyperref}
+\fi
+
+\parskip\bigskipamount
+
+\begin{document}
+
+\title{\textsf{xytree.sty} --- A \LaTeX{} package for drawing
+ syntactic trees (version 1.5)}
+
+\author{Koaunghi Un}
+
+\date{2006/8/15}
+
+\maketitle
+
+\begin{quotation}
+ \begin{center}
+ \bfseries \large Abstract
+ \end{center}
+
+ \textsf{xytree.sty} utilizes the \Xy-pic package to draw syntactic
+ trees. There are currently some similar \LaTeX{} packages for this
+ purpose, but they have strength and weakness, so one allows to draw
+ only binary trees and the other permits to draw only limited sorts
+ of lines. Some packages provide quasi perfect solution in this
+ area, but have the dependency on the other graphic language, which
+ \texttt{dvi} driver can not directly process.
+
+ The aim of \textsf{xytree.sty} is to draw linguistic syntactic trees
+ with ease and to support hopefully sufficient functionality, that
+ the linguist may need.
+
+ In the version of 1.5, a functionality is added for semanticists to
+ draw DRS (Discourse Representation Structure).
+\end{quotation}
+
+%\tableofcontents
+
+\bigskip
+
+\begin{multicols}{2}
+
+\section{Introduction}
+\label{sec:intro}
+
+\textsf{xytree.sty} is based on the powerful vector drawing package,
+\Xy-pic. Although \namecite{vogel00} takes the same approach, it's
+functionality is somehow limited to fulfill linguists' needs.
+
+With \textsf{parsetree.sty} linguists can draw syntactic trees
+relatively easily, though without curved lines and arrows. Moreover a
+node can have only three or less daughter. See
+\namecite{arnold97:_packag_drawin_trees_latex}.
+
+\textsf{tree-dvips.sty} by Emma Pease would be the best in this
+contest. Indeed it provides all the functionality, which
+\textsf{xytree.sty} does. The main strength and weakness in the same
+time in this package is the use of \verb+\special+ command. The
+PostScript language inside this command draws the lines to construct
+the desired tree. But, the \verb+\special+ command in the \verb+dvi+
+file can only be processed by \verb+dvi+ drivers, which understand
+PostScript language. Consequently, the output of
+\textsf{tree-dvips.sty} requires an unpleasant handling. That is,
+some previewers like \verb+xdvi+ can not show the lines drawn by
+\textsf{tree-dvips.sty}. Secondly, PDF file cannot be produced by
+\verb+pdflatex+, because the PostScript prologue of
+\textsf{tree-dvips.sty} isn't compatible with PDF specification. In
+order to make a PDF file, an intermediate PS file between \verb+dvi+
+and PDF is indispensable.
+
+Such a cold comfort was due to the weakness of \LaTeX{} in the field
+of graphics, which can now be supplemented by \Xy-pic{} package. See
+\namecite{rose99:_xy_guide,rose99:_xy_refer_manual}.
+
+\section{Loading xytree.sty}
+\label{sec:basics}
+
+In order to use \textsf{xytree.sty}, put the following line between
+\verb|\documentclass| and \verb|\begin{document}| as shown in \ex{1}.
+%
+\begin{example}\label{usepackage}
+\begin{verbatim}
+\usepackage{xytree}
+\end{verbatim}
+\end{example}
+
+
+\section{Usage}
+\label{sec:usage}
+
+As an experience, it would be advisable to analyze trees as lattice
+structure before doing the actual task.
+
+\begingroup
+\xy
+\def\objectstyle{\hbox}
+\xymatrix @W=1.7pc @H=1pc @R=0pc @C=0pc @*[F.]{
+ & & & S & & & \\
+ & NP & & & & VP & \\
+ Det & & N & & V & NP & PP
+}
+\drop\frm{-}
+\endxy
+\endgroup
+\noindent
+The vertical dotted lines between two adjacent cells in the above
+diagram can be replaced by \verb+&+'s and the rightmost lines can be
+replaced by \verb+\\+. The \verb+&+'s delimiting empty cells on the
+right side of a line are optional and the last \verb+\\+ can be also
+omitted.
+
+The next step is to specify nonempty cells as node. The tree can be
+finished up by drawing lines, which connect nodes as shown
+below.\footnote{The outer dotted line denotes the range of drawn
+ trees.}
+
+\xy
+\def\objectstyle{\hbox}
+\xytree{
+ & & & \xynode[-2,2]{S} \\
+ & \xynode[-1,1]{NP} & & & & \xynode[-1,0,1]{VP} \\
+ \xynode{Det} & & \xynode{N} & & \xynode{V} & \xynode{NP} & \xynode{PP} \\
+}
+\drop\frm{.}
+\endxy
+
+In the following, macros for node declaration, node connection, etc.
+will be explained.
+
+
+\subsection{\textbackslash xytree}
+
+A tree is drawn with a \verb+\xytree+ macro and it's general syntax looks
+like \ex{1}.
+\begin{example}\label{xytree}
+ \begin{verbatim}
+ \xytree[col spacing]{matrix}
+ \end{verbatim}
+\end{example}
+%
+\verb|\xytree| takes an optional and a mandatory argument. The
+optional argument \texttt{[col spacing]} controls the horizontal
+distances between two adjacent nodes. The value should be positive
+decimal numeral in unit of \textsf{pc} (1\textsf{pc}=12\textsf{pt}).
+The default is \textsf{0.5}. The mandatory argument \verb+matrix+ is
+the actual content of a tree, consisting of nodes and delimiters.
+
+Below, an output of \verb+\xytree+ with its source code is shown.
+
+\begingroup
+\renewcommand{\baselinestretch}{1.0}\normalsize
+\begin{verbatim}
+\xytree{
+ \xynode{A} & \xynode{B} \\
+ \xynode{C} & \xynode{D}
+}
+\end{verbatim}
+\endgroup
+
+\hfil\xy
+\xytree{
+ \xynode{A} & \xynode{B} \\
+ \xynode{C} & \xynode{D}
+}
+\drop\frm{.}
+\endxy
+
+The row spacing can be given with \verb+\rowheight+ before
+\verb+\xytree+ begins. The default is \textsf{2pc}. An example with
+smaller \verb+\rowheight+ is shown below.
+\begin{verbatim}
+\rowheight=0.5pc
+\xytree{
+ \xynode{A} & \xynode{B} \\
+ \xynode{C} & \xynode{D}
+}
+\end{verbatim}
+\bgroup\rowheight=0.5pc
+\hfil\xy
+\xytree{
+ \xynode{A} & \xynode{B} \\
+ \xynode{C} & \xynode{D}
+}
+\drop\frm{.}
+\endxy
+\egroup
+
+In case of wider entry in nodes like AVM, \texttt{[col spacing]} tends
+to grow. If a tree should have some labels on the connecting lines
+between nodes, \verb+\rowheight+ will be useful. For AVM, confer
+\namecite{pease00:_linguis_macros} or \namecite{manning93}.
+
+
+\subsection{\textbackslash xynode}
+\label{subsection:xynode}
+
+A tree reaches completion, when all nodes are specified and necessary
+lines are drawn to connect nodes. \verb+\xynode+ declares and
+connects nodes inside one macro. A simple tree can be completed only
+with \verb+\xynode+ command. This command has the form like \ex{1}.
+%
+\begin{example}\label{xynode}
+\begin{verbatim}
+\xynode[lower nodes]{entry}
+\end{verbatim}
+\end{example}
+%
+\texttt{[lower nodes]} is integer numbers delimited by comma. Each
+number denotes the relative positions of target nodes to be connected
+from the current node with straight line. The position is counted
+relatively, e.g. \verb+0+ is the node directly under the current
+node, \verb+1+ is the first node rightwards under the current node.
+Likewise, \verb+-2+ is the second node leftwards under the current
+node.
+
+In the following tree, the node with starting line is \textsf{S}.
+\verb+-1+ connects to the node \textsf{NP} and \verb+1+ connects to
+the node \textsf{VP}.
+
+\begin{verbatim}
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}
+}
+\end{verbatim}
+\hfil\xy
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}
+}
+\drop\frm{.}
+\endxy
+
+\noindent
+\verb|{entry}| is the content of the current node and in many cases it
+is the phrasal sign of the syntactic structure.
+
+
+\subsection{\textbackslash xytrinode}
+
+A triangle instead of a line is used if the daughter node is not a
+sort of \textsf{word}. In order to draw a triangle, use
+\verb+\xytrinode+ like \ex{1}.
+\begin{example}\label{xytreenode}
+\begin{verbatim}
+\xytrinode[width]{entry}
+\end{verbatim}
+\end{example}
+
+An example follows:
+\begin{verbatim}
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode[0]{NP} & & \xytrinode{VP} \\
+ \xyterminal{It} & &
+ \xyterminal{is raining}
+}
+\end{verbatim}
+\hfil\xy
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode[0]{NP} & & \xytrinode{VP} \\
+ \xyterminal{It} & &
+ \xyterminal{is raining}
+}
+\drop\frm{.}
+\endxy
+
+As a default the base of the triangle is as wide as the width of the
+entry. Though, a different value can be specified with
+\texttt{[width]}. If it is a positive real number the triangle will
+have longer base, and if it is a negative real number the width will
+be shorter. The unit of \texttt{[width]} is \textsf{mm}.
+
+The following example shows an output of a tree with shorter base
+length using \texttt{[5]}.
+
+\begin{verbatim}
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode[0]{NP} &
+ & \xytrinode[-5]{VP}\\
+ \xynode{It} & & \xynode{is raining}
+}
+\end{verbatim}
+\hfil\xy
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode[0]{NP} & & \xytrinode[-5]{VP} \\
+ \xyterminal{It} & & \xyterminal{is raining}
+}
+\drop\frm{.}
+\endxy
+
+The mandatory argument \verb+{entry}+ is the content of the tree node
+as explained in the \verb+\xynode+.
+
+
+\subsection{\textbackslash xyterminal}
+
+As shown in the above examples, the leaf nodes as phonological
+representation of the phrasal signs are written in italic shape. The
+command \verb+\xyterminal+ is intended to be used for such leaf nodes.
+This command replaces \verb+\xynode+ command and it has no optional
+argument for the connecting lines with the daughters.
+
+The general syntax is as \ex{1}.
+\begin{example}\label{xyterminal}
+\begin{verbatim}
+\xyterminal{entry}
+\end{verbatim}
+\end{example}
+
+
+\subsection{\textbackslash xyconnect}
+\label{subsection:xyconnect}
+
+For simple syntactic trees, I think, no more commands need to be
+added. For complicated syntactic trees, though, this line connecting
+macro is useful. It's general syntax is as \ex{1}.\footnote{Because
+ of limited paper width a long line is broken into several ones.}
+%
+\begin{example}\label{xyconnect}
+\begin{verbatim}
+\xyconnect
+ [arrow form]
+ [bending of line]
+ (start pos, end pos)
+ {target node number}
+ "label of line"
+\end{verbatim}
+\end{example}
+%
+The fourth argument is mandatory, and all the others are optional. In
+other word, given the pair of \texttt{\{target node number\}}, a line is
+drawn with default values.
+
+\texttt{[arrow form]} is the optional argument for specifying the form of
+arrow. The default value is \verb+-+, straight line. An arrow
+consists of tail, shaft, and nib. The nib and tail can be chosen with
+\verb|<|, \verb|>|, \verb|(|, \verb|)|, \verb+|+, \verb|+|, \verb|/|
+and the shaft with \verb|-|, \verb|--|, \verb|.|, \verb|~|, \verb|~~|,
+\verb|=|, \verb|:|.
+
+Without nib and tail, it is a line. But without shaft, no arrow is
+formed.
+
+Examples forming the arrows with proper combination of tail, shaft,
+and nib are shown below. The order of the combination is
+\texttt{[tail~shaft nib]}, and \texttt{tail} and \texttt{nib} can be
+omitted.
+%
+\newcommand{\myarrow}[2][\empty]{
+ \ifx\empty#1\relax\texttt{#2}\else
+ \texttt{#1}\fi &
+ \xytree{
+ \xynode{}
+ \xyconnect[#2](R,L){0,1}
+ &
+ \xynode{}
+ }}
+\begin{center}\tabcolsep3pt
+ \begin{tabular}{|ll|ll|ll|}\hline
+ \myarrow{-} &
+ \myarrow{--} &
+ \myarrow{.} \\
+ \myarrow{:} &
+ \myarrow[\~{}]{~} &
+ \myarrow[\~{}\~{}]{~~} \\
+ \myarrow{=} &
+ \myarrow{==} & &
+ \\\hline
+ \myarrow{|->} &
+ \myarrow{<->} &
+ \myarrow{(-+} \\
+ \myarrow{(.)} &
+ \myarrow{>.<} &
+ \myarrow{/.+}
+ \\\hline
+ \end{tabular}
+\end{center}
+
+The second optional argument \texttt{[bending of line]} is used to
+draw curved lines.
+
+\newcommand{\infl}[1]{%
+ \xytree[1]{\xynode{X}\xyconnect[->][#1](R,L){0,1} & \xynode{X$'$}}}
+\begin{center}
+\begin{tabular}{|ll|}\hline
+ \verb|[^]| & \infl{^} \\
+ \verb|[_]| & \infl{_} \\
+ \verb|[_1pc]| & \infl{_1pc}\\\hline
+\end{tabular}
+\end{center}
+As can be noted from the above example, \verb+^+ bends lines to upward
+direction and \verb+_+ to downward direction. This directionality is
+determined by stretching a line from left to right. If the direction
+of a line is from right to left, the bending direction reverses.
+Given by some value of dimension after the direction sign, the amount
+of the inflection is specified by that value. \verb+1pc+ in the above
+example (the last one) bends the line downwards by 1\textsf{pc}.
+
+The third optional argument \texttt{(start pos, end pos)} consists of
+a comma-separated pair of position markers. The first marker is for
+the start position of the line and the second for the end position.
+The markers are denoted by one or two uppercase letters as shown
+below.
+
+\medskip
+\def\corner#1{\POS"box"+0;"box"+#1 **@{-} ?>*@{>} +/1pc/ *\hbox{\tt#1}}
+%
+\hfil\xy 0.(-11,-6).(11,6)!C="box"*\frm{.},"box";
+ "box"+L**@{.}, "box"+R**@{.}, "box"+D**@{.}, "box"+U**@{.}
+%
+ \corner{L} \corner{R} \corner{D} \corner{U}
+ \corner{DL}\corner{DR}\corner{UL}\corner{UR}
+\endxy
+
+And some examples follow.
+\begin{center}
+\newcommand{\bend}[1]{%
+ \xytree[1]{\xynode{X}\xyconnect[->][^](#1){0,1} & \xynode{X$'$}}}
+\begin{tabular}{|ll|}\hline
+ default & \bend{D,U} \\
+ \verb|(UL,DR)| & \bend{UL,DR} \\
+ \verb|(DR,UL)| & \bend{DR,UL} \\
+ \verb|(U,D)| & \bend{U,D} \\\hline
+\end{tabular}\\
+\end{center}
+The default is \textsf{(D,U)}.
+
+\verb|{target node number}| is the only mandatory argument in this
+command. It is a pair of integers delimited by a comma. The first
+integer number is responsible for the relative row number of the target
+node against the current node, and the second for the relative column
+number. If the target node is placed above the current node, the
+relative row number must be negative, and vice versa. Likewise, if
+the target node is in the left side of the current node, the column
+number must be negative, and vice versa. This is the same
+directionality as of \verb+\xynode+ command. In case of
+\verb+\xynode+, the relative row number of the target node is always
+\verb+1+, so only the relative column number(s) of the target node
+is(are) to be specified as optional argument.
+
+The matrix size of the tree below is $4\times 3$, which means 4
+columns and 3 rows.
+
+\hfil\xy
+\xytree{ & \xynode[-1,1]{XP} \\
+ \xynode{...} & & \xynode[-1,1]{X$'$} \\
+ & \xynode{X} & & \xynode{Y}}
+\drop\frm{.}
+\endxy
+
+The absolute position of the node \textsf{XP} is represented as \verb+"1,2"+.
+From this node as current node, all the directionality of
+\verb+\xyconnect+ can be summarized as follows.
+\begin{center}
+\begin{tabular}{|lll|}\hline
+ node & abs. pos & directionality \\\hline
+ ... & \verb|"2,1"| & \verb|{1,-1}| \\
+ X$'$ & \verb|"2,3"| & \verb|{1,1}| \\
+ X & \verb|"3,2"| & \verb|{2,0}| \\
+ Y & \verb|"3,4"| & \verb|{2,2}| \\\hline
+\end{tabular}
+\end{center}
+To be clearer, the diagram below will show the relative positions as
+labels on the connecting lines.
+
+\hfil\xy
+\xytree[2]{ & \xynode{XP}
+ \xyconnect[.>]{1,-1}"_{\{$1,-1$\}}"
+ \xyconnect[.>]{2,0}"|{\{$2,0$\}}"
+ \xyconnect[.>]{1,1}"^{\{$1,1$\}}"
+ \xyconnect[.>][_1pc]{2,2}"_{\{$2,2$\}}"
+ \\
+ \xynode{...} & & \xynode{X$'$}
+ \\
+ & \xynode{X} & & \xynode{Y}}
+\drop\frm{.}
+\endxy
+
+The last argument of \verb+\xyconnect+, \texttt{"label of line"} is
+optional, which puts labels on the connecting line. Labels will be by
+default centered on the line. Basically, there are three kinds of
+label formats. As can be noticed in the above diagram, the label on
+the line between \textsf{XP} and \textsf{X$'$} is typeset as \verb+"^{1,1}"+,
+the label on the line between \textsf{XP} and \textsf{Y} as \verb+"_{2,2}"+, and
+the label on the line between \textsf{XP} and \textsf{X} as \verb+"|{2,0}"+.
+The directionality of the label position is the same as the one of the
+line bending, e.g. if a line starts from left to right, \verb+_+ puts
+labels below the line, \verb+^+ above the line. Because \verb+|+
+breaks the line, the directionality means nothing.
+\begin{center}
+ \begin{tabular}{|ll|}\hline
+ \verb|"^{label}"| &
+ \xytree[4]{\xynode{}\xyconnect[->](R,L){0,1}"^{label}" &} \\
+ \verb+"|{label}"+ &
+ \xytree[4]{\xynode{}\xyconnect[->](R,L){0,1}"|{label}" &} \\
+ \verb|"_{label}"| &
+ \xytree[4]{\xynode{}\xyconnect[->](R,L){0,1}"_{label}" &} \\\hline
+ \end{tabular}
+\end{center}
+
+To put labels in the different position on the line than in the
+middle, type the displacement character directly after the
+directionality character as follows.
+\begin{center}\tabcolsep3pt
+ \begin{tabular}{|lll|}\hline
+ \verb|^<{x}| & \unskip
+ \xytree[2]{\xyconnect[->](R,L){0,1}"^<{x}" &} &
+ start pos of the line \\
+ \verb|^<<{x}| &
+ \xytree[2]{\xyconnect[->](R,L){0,1}"^<<{x}" &} &
+ more \verb|<| \\
+ \verb|^>{x}| &
+ \xytree[2]{\xyconnect[->](R,L){0,1}"^>{x}" &} &
+ end of line \\
+ \verb|^>>{x}| &
+ \xytree[2]{\xyconnect[->](R,L){0,1}"^>>{x}" &} &
+ more \verb|>| \\
+ \verb|^(.3){x}| &
+ \xytree[2]{\xyconnect[->](R,L){0,1}"^(.3){x}" &} &
+ 30\% pos
+ \\\hline
+ \end{tabular}
+\end{center}
+
+Label itself is given in the curly brace (\verb+{}+). Modification of
+the label happens if the following modifier is used before
+\verb+{label}+ and after modifier mark \verb+*+ is specified.
+\begin{center}
+ \tabcolsep3pt
+ \begin{tabular}{|ll|}\hline
+ \verb|+| & increase label size \\
+ \verb|+<dimen>| & increase \verb|<dimen>| \\
+ \verb|+=| & increase to frame size \\
+ \verb|-| & decrease label size \\
+ \verb|-<Å©±â>| & decrease \verb|<Å©±â>| \\
+ \verb|-=| & decrease to frame size \\\hline
+ \verb|!| & don't center \\\hline
+ \verb|[o]| & oval \\\hline
+ \verb|[l] [r] [u] [d]| & align left, right, up, down \\\hline
+ \verb|[F] [F=]| & single/double line frame \\
+ \verb|[F.] [F--]| & dotted/dashed line frame \\
+ \verb|[F-,] [F-:<3pt>]| & shaded/rounded frame \\
+ & (diameter=3pt) straight line \\\hline
+ \end{tabular}
+\end{center}
+For example, to put rounded (\verb+[o]+) and dotted frame
+(\verb+[F.]+) around the label, specify the label as follows.
+\begin{verbatim}
+_*[o][F.]{x} ^*+<5pt>[o][F.]{x}
+\end{verbatim}
+The result is shown below. The label with size increment is on the
+left line and the one with 5pt increment on the right.
+
+\xy
+\xytree{ & \xynode{XP}
+ \xyconnect{1,-1}"_*[o][F.]{x}"
+ \xyconnect{1,1}"^*+<5pt>[o][F.]{x}"
+ \\
+ \xynode{X$'$} & & \xynode{Y}
+}
+\drop\frm{.}
+\endxy
+
+
+\subsection{\textbackslash xytext}
+
+For agreement representation, a diagram like \ex{1} is used.
+\enumsentence{%
+ Morpho-syntactic agreement (AGR) can be represented as \xytext{
+ \xybarnode{Det}\xybarconnect{1} & \xybarnode{head-noun} &
+ \xybarnode{verb} & \xybarnode{...}}}
+%
+To retain the baseline and spacing on the both side of the text in
+such a diagram, \verb+\xytext+ can be used instead of \verb+\xytree+.
+\verb+\xytext+ requires one mandatory argument as in \ex{1}.
+%
+\begin{example}\label{xytext}
+\begin{verbatim}
+\xytext{row}
+\end{verbatim}
+\end{example}
+The argument \verb+{row}+ is a row of content delimited by \verb+&+.
+
+Above example \ex{-1} was typeset as follows.
+\begin{verbatim}
+Morpho-syntactic agreement (AGR) can
+be represented as \xytext{
+ \xybarnode{Det}\xybarconnect{1} &
+ \xybarnode{head-noun} &
+ \xybarnode{verb} & \xybarnode{...}}
+\end{verbatim}
+The entry in a node should be specified with \verb+\xybarnode+ command
+and the arrows with \verb+\xybarconnect+.
+
+
+\subsection{\textbackslash xybarnode}
+
+As said in the previous subsection, \verb+\xybarnode+ is used for
+nodes in \verb+\xytext+. The major function of this command is to
+retain the baseline of texts.
+
+Comparing \ex{1}[a] and \ex{1}[b] makes it clearer.
+%
+\eenumsentence{
+\item \evnup{\def\objectstyle{\hbox}%
+ \xymatrix @C=0pt @M=0pt {head-noun & agreement &
+ (AGR)}\hspace{-2pt}}
+\item \xytext{\xybarnode{head-noun} & \xybarnode{agreement} &
+ \xybarnode{(AGR)}}}
+%
+For the word ``agreement'' in \ex{0}[a] \verb+\xybarnode+ is not used,
+but in \ex{0}[b] it is used. In \ex{0}[a] all node are aligned with
+all character on it's baseline. In \ex{0}[b] the character \textsf{g}
+in the word \textsf{agreement} displaced the whole word upwards.
+\verb+\xybarnode+ command is necessary to get rid of such unwanted
+displacement.
+
+
+\subsection{\textbackslash xybarconnect}
+
+Inside \verb+\xytext+ the arrow showing agreement structure is drawn
+with \verb+\xybarconnect+ macro, which have the following general
+syntax as in \ex{1}.
+%
+\begin{example}\label{xybarconnect}
+\begin{verbatim}
+\xybarconnect
+ [spacing]
+ [line art]
+ (start pos, end pos)
+ {target node}
+ "line label"
+\end{verbatim}
+\end{example}
+%
+\verb+[spacing]+ is the first optional argument. It is used to set
+spacing between text and horizontal line. A real number specifies the
+spacing in unit of \textsf{pt}. The default is \textsf{3}.
+\begin{center}
+\begin{tabular}{|ll|}\hline
+ \verb|[2]| & \rule{0pt}{20pt}
+ \xytext{\xybarnode{agreement}\xybarconnect[2]{1} & \xybarnode{problem}} \\
+ \verb|[3]|(default) &
+ \xytext{\xybarnode{agreement}\xybarconnect{1} & \xybarnode{problem}} \\
+ \verb|[4]| &
+ \xytext{\xybarnode{agreement}\xybarconnect[4]{1} & \xybarnode{problem}} \\\hline
+\end{tabular}
+\end{center}
+The shape of the line can be specified with the second optional
+argument \texttt{[line art]}. All the line shapes explained in the
+subsection \ref{subsection:xyconnect} can be used here too. The
+default one is a straight line with arrow head (\verb+[->]+).
+
+\hfil
+\xytext{\xybarnode{agreement}
+ \xybarconnect(UL,UL){2}
+ \xybarconnect[4][--]{2}
+ \xybarconnect[5][.](UR,UR){2}
+ &
+ \xybarnode{phenomena}
+ \xybarconnect[3][=](D,D){1}
+ &
+ \xybarnode{problem}
+\POS "1,1"+UL+(-3,8);\POS "1,3"+UR+(3,8) **\dir{.}
+\POS "1,1"+UL+(-3,8);\POS "1,1"+DL+(-3,-6) **\dir{.}
+\POS "1,3"+UR+(3,8);\POS "1,3"+DR+(3,-6) **\dir{.}
+\POS "1,1"+DL+(-3,-6);\POS "1,3"+DR+(3,-6) **\dir{.}
+}
+
+\noindent
+As explained in subsection \ref{subsection:xyconnect}, the corner
+position of the source and target node can be specified with the
+optional argument \texttt{(start pos, end pos)}.
+
+\begin{center}
+\begin{tabular}{|ll|}\hline
+ \verb|(U,U)|(default) & \rule{0pt}{25pt}
+ \xytext{\xybarnode{agreement}\xybarconnect(U,U){1} &
+ \xybarnode{problem}} \\
+ \verb|(UR,UL)| & \rule{0pt}{0pt}
+ \xytext{\xybarnode{agreement}\xybarconnect(UR,UL){1} &
+ \xybarnode{problem}} \\
+ \verb|(DL,DR)| & \raisebox{-20pt}{\rule{0pt}{0pt}}
+ \xytext{\xybarnode{agreement}\xybarconnect(DL,DR){1} &
+ \xybarnode{problem}} \\\hline
+\end{tabular}
+\end{center}
+
+\noindent
+The only mandatory argument \verb|{target node}| in this command is
+used to specify the relative position number of target node from the
+current node.
+\begin{center}
+\begin{tabular}{|ll|}\hline
+ \verb|{1}| & \rule{0pt}{25pt}
+ \xytext{\xybarnode{agr}\drop\frm{.}
+ \xybarconnect{1}
+ & \xybarnode{phenomena}\drop\frm{-} &
+ \xybarnode{problem} & \xybarnode{solving}}\\[5pt]
+ \verb|{2}| &
+ \xytext{\xybarnode{agr}\drop\frm{.}
+ \xybarconnect{2}
+ & \xybarnode{phenomena} &
+ \xybarnode{problem}\drop\frm{-} & \xybarnode{solving}}\\[5pt]
+ \verb|{3}| &
+ \xytext{\xybarnode{agr}\drop\frm{.}
+ \xybarconnect{3}
+ & \xybarnode{phenomena} &
+ \xybarnode{problem} & \xybarnode{solving}\drop\frm{-}}\\[5pt]
+ \verb|{-1}| &
+ \xytext{\xybarnode{agr} & \xybarnode{phenomena} &
+ \xybarnode{problem}\drop\frm{-} & \xybarnode{solving}\drop\frm{.}
+ \xybarconnect{-1}}\\[5pt]
+ \verb|{-2}| &
+ \xytext{\xybarnode{agr} & \xybarnode{phenomena}\drop\frm{-} &
+ \xybarnode{problem} & \xybarnode{solving}\drop\frm{.}
+ \xybarconnect{-2}}\\[5pt]
+ \verb|{-3}| & \raisebox{-10pt}{}
+ \xytext{\xybarnode{agr}\drop\frm{-} & \xybarnode{phenomena} &
+ \xybarnode{problem} & \xybarnode{solving}\drop\frm{.}
+ \xybarconnect{-3}}\\\hline
+\end{tabular}
+\end{center}
+
+\noindent
+\texttt{"line label"}, if given, is placed in the middle of connection
+line. \texttt{line label} should be typeset with leading \verb|_| or
+\verb|^| and in curly brace. The directionality is the same as
+explained in subsection \ref{subsection:xyconnect}.
+
+
+\subsection{\textbackslash yytree}
+\label{subsection:yytree}
+
+Although not requested by linguists, there is an another tree drawing
+macro defined in this package. \verb|\yytree| uses indentation and
+connection lines to draw a hierarchical tree in horizontal direction.
+
+The general syntax is as \ex{1}.
+%
+\begin{example}\label{yytree}
+\begin{verbatim}
+\yytree[indentation]{matrix}
+\end{verbatim}
+\end{example}
+%
+The optional argument \verb|[indentation]| is the amount of
+indentation for each depth of the hierarchy. The default is \textsf{2}
+in unit of \textsf{pc}. The mandatory argument \verb|{matrix}| is the
+content of horizontal hierarchical tree. Unlikely \verb|\xytree| only
+one node per a row should be defined in \verb|\yytree|.
+
+\xy
+\yytree{
+ \yynode[1,4]{grandparent} \\
+ & \yynode[1,2]{parent} \\
+ & & \yynode{me} \\
+ & & \yynode{sister} \\
+ & \yynode[1]{uncle \& aunt} \\
+ & & \yynode{cousin}}
+\drop\frm{.}
+\endxy
+
+
+\subsection{\textbackslash yynode}
+\label{subsection:yynode}
+
+\verb|\yynode| specifies a node in \verb|\yytree| command. The general
+syntax is as \ex{1}.
+%
+\begin{example}\label{yynode}
+\begin{verbatim}
+\yynode[target node #]{node}
+\end{verbatim}
+\end{example}
+%
+The optional argument \texttt{[target node \#]} is comma-separated row
+numbers, to which a connection line is drawn. As usual, the number is
+counted relatively to the current node. E.g. \texttt{1} denotes the
+row below current node and \texttt{2} the second row below current
+node.
+
+The tree in subsection \ref{subsection:yytree} is typeset as follows.
+\begin{verbatim}
+\yytree{
+ \yynode[1,4]{grandparent} \\
+ & \yynode[1,2]{parent} \\
+ & & \yynode{me} \\
+ & & \yynode{sister} \\
+ & \yynode[1]{uncle \& aunt} \\
+ & & \yynode{cousin}}
+\end{verbatim}
+The \verb|[1,4]| of the node \textsf{grandparent} for example connects
+to the row \textsf{parent} directly under the current node and to the
+fifth row \textsf{uncle \& aunt} (fourth row from the current node)
+with a line.
+
+
+\subsection{\textbackslash xynodefont}
+\label{subsection:xynodefont}
+
+This command sets the global font used in the nodes of \verb|\xytree|
+and \verb|\yytree|.
+%
+\begin{example}\label{xynodefont}
+\begin{verbatim}
+\xynodefont{font spec}
+\end{verbatim}
+\end{example}
+%
+For \texttt{font spec}, font changing commands are used. For example,
+the following command typesets all nodes with italic and bold face
+font as shown in the diagram below.
+\begin{verbatim}
+\xynodefont{\itshape\bfseries}
+\end{verbatim}
+
+\begingroup
+\xy
+\xynodefont{\itshape\bfseries}
+\xytree[1]{
+ & & \xynode[-1,1]{grandparent} \\
+ & \xynode[-1,1]{parent} & & \xynode[0]{uncle \& aunt} \\
+ \xynode{me} & & \xynode{sister} & \xynode{cousin}}
+\drop\frm{.}
+\endxy
+\endgroup
+
+This command affects all the node that appear after this declaration,
+except the node, which are set with the command \verb|\xyterminal|.
+
+
+\section{Useful macros from \texorpdfstring{\Xy-pic}{Xy-pic}}
+
+The commands from \Xy-pic package can be directly used with
+\textsf{xytree.sty} to draw complicated trees. In this section, some
+useful commands from \namecite{rose99:_xy_guide} are illustrated.
+
+
+\subsection{Frame around node}
+
+To enclose a node or tree in a frame, \verb|\drop| \verb|\frm| after
+the \verb|\xynode| as shown in \ex{1}.
+\begin{example}\label{dropframe}
+\begin{verbatim}
+ \drop\frm{line art}
+\end{verbatim}
+\end{example}
+\verb|{.}|, \verb|{-}|, \verb|{=}|, \verb|{--}|,
+\verb|{==}|, \verb|{o-}| can be used for \verb|{line art}|.
+\verb|{o-}| drops rounded frame, whereas others do not. Though, by
+specifying diameter for the corners as in \ex{1}, the others can have
+also rounded corners.
+\begin{example}
+\begin{verbatim}
+ \drop\frm<diameter>{line art}
+\end{verbatim}
+\end{example}
+
+If \verb+,+ follows \texttt{line art}, a shadow effect happens. For
+example, \verb+{,}+ draws a shadowed frame without surrounding line
+and \verb+{-,}+ shadowed frame with straight line. The thickness of
+the shadow can be set as in \ex{1}.
+\begin{example}
+\begin{verbatim}
+\drop\frm<thickness>{,}
+\end{verbatim}
+\end{example}
+
+For a circled or oval frame, set \verb+{line art}+ as \verb+{o}+
+or \verb+{e}+ respectively. \verb+{oo}+ or \verb+{ee}+ doubles the
+frame line. The general syntax is shown in \ex{1}.
+\begin{example}
+\begin{verbatim}
+\drop\frm<diameter>{shape}
+\end{verbatim}
+\end{example}
+In case of circled frame, \verb+<diameter>+ sets the diameter of the
+circle. In case of oval frame, \verb+<diameter>+ sets two
+comma-separated diameters of the major and minor axis (in the order of
+$x$ and $y$ axis).
+
+The examples for frame commands follow.
+
+\hfil\xy\rowheight1.5pc
+\xytree[3]{
+ \xynode{\texttt{\{\}}}
+ \drop\frm{}
+ & \xynode{\texttt{\{.\}}}
+ \drop\frm{.}
+ & \xynode{\texttt{$<$44pt$>$\{.\}}}
+ \drop\frm<44pt>{.}
+ \\
+ \xynode{\texttt{\{-\}}}
+ \drop\frm{-}
+ & \xynode{\texttt{$<$8pt$>$\{-\}}}
+ \drop\frm<8pt>{-}
+ & \xynode{\texttt{$<$44pt$>$\{-\}}}
+ \drop\frm<44pt>{-}
+ \\
+ \xynode{\texttt{\{=\}}}
+ \drop\frm{=}
+ & \xynode{\texttt{$<$8pt$>$\{=\}}}
+ \drop\frm<8pt>{=}
+ & \xynode{\texttt{$<$44pt$>$\{=\}}}
+ \drop\frm<44pt>{=}
+ \\
+ \xynode{\texttt{\{--\}}}
+ \drop\frm{--}
+ & \xynode{\texttt{\{o-\}}}
+ \drop\frm{o-}
+ & \xynode{\texttt{$<$44pt$>$\{--\}}}
+ \drop\frm<44pt>{--}
+ \\
+ \xynode{\texttt{\{,\}}}
+ \drop\frm{,}
+ & \xynode{\texttt{$<$5pt$>$\{,\}}}
+ \drop\frm<5pt>{,}
+ & \xynode{\texttt{\{-,\}}}
+ \drop\frm{-,}
+ \\
+ \xynode{\texttt{\{o\}}}
+ \drop\frm{o}
+ & \xynode{\texttt{$<$8pt$>$\{o\}}}
+ \drop\frm<8pt>{o}
+ & \xynode{\texttt{\{.o\}}}
+ \drop\frm{.o}
+ \\
+ \xynode{\texttt{\{oo\}}}
+ \drop\frm{oo}
+ & \xynode{\texttt{$<$8pt$>$\{oo\}}}
+ \drop\frm<8pt>{oo}
+ & \xynode{\texttt{\{-o\}}}
+ \drop\frm{-o}
+ \\
+ \xynode{\texttt{\{e\}}}
+ \drop\frm{e}
+ & \xynode{\texttt{$<$20pt,8pt$>$\{e\}}}
+ \drop\frm<20pt,8pt>{e}
+ & \xynode{\texttt{\{.e\}}}
+ \drop\frm{.e}
+ \\
+ \xynode{\texttt{\{ee\}}}
+ \drop\frm{ee}
+ & \xynode{\texttt{$<$20pt,8pt$>$\{ee\}}}
+ \drop\frm<20pt,8pt>{ee}
+ & \xynode{\texttt{\{-e\}}}
+ \drop\frm{-e}
+ \\
+}
+\drop\frm{--}
+\endxy
+
+If the framing of node applies to the tree as a whole, enclose the
+whole tree in between \verb+\xy+ and \verb+\endxy+.
+\begin{example}
+\begin{verbatim}
+\xy
+ \xytree{node matrix}
+ \drop\frm{shape}
+\endxy
+\end{verbatim}
+\end{example}
+The following example shows the effect of dashed frame
+(\verb+\drop\frm{--}+) with shadow (\verb+\drop\frm<3pt>{,}+
+
+\hfil\xy
+\xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}
+}
+\drop\frm{--}
+\drop\frm<3pt>{,}
+\endxy
+
+
+\subsection{Extensible braces for nodes}
+
+The usual extensible braces in \LaTeX{} are more optimized in
+\Xy-pic. The general syntax is as \ex{1}.
+\begin{example}
+\begin{verbatim}
+\drop\frm{brace}
+\end{verbatim}
+\end{example}
+The following \verb+{brace}+ can be used.
+
+\medskip
+\xy
+\xytree[2]{
+ \xynode{\begin{avm}\avml\texttt{\char123\_\ttbs\char125\char125}\\lower\avmr\end{avm}}
+ \drop\frm{_\}}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123\^{}\ttbs\char125\char125}\\upper\avmr\end{avm}}
+ \drop\frm{^\}}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123\ttbs\char123\char125}\\left\avmr\end{avm}}
+ \drop\frm{\{}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123\ttbs\char125\char125}\\right\avmr\end{avm}}
+ \drop\frm{\}}
+ \\
+ \xynode{\begin{avm}\avml\texttt{\char123\_)\char125}\\lower\avmr\end{avm}}
+ \drop\frm{_)}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123\^{})\char125}\\upper\avmr\end{avm}}
+ \drop\frm{^)}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123(\char125}\\left\avmr\end{avm}}
+ \drop\frm{(}
+ &
+ \xynode{\begin{avm}\avml\texttt{\char123)\char125}\\right\avmr\end{avm}}
+ \drop\frm{)}
+}
+\drop\frm{--}
+\endxy
+
+
+\subsection{Lines passing through nodes}
+
+After the nodes in a tree are defined, it is possible to draw a line,
+which passes through the nodes. The line breaks at the node positions
+automatically.
+
+\xy
+\xytree{
+ & & & \xynode{S} \\
+ & \xynode{NP} & & & & \xynode{VP} \\
+ \xynode{Det}
+ & & \xynode{N} & & \xynode{V} & & \xynode{PP}
+ \ar @{->} '[-1,-1]_1 '[-2,-3]_2 '[-1,-5]|3 '[0,-6]_4 '[0,-4]_5
+ '[0,-2]_6 [-1,-5]_7
+}
+\drop\frm{.}
+\endxy
+
+The general syntax for such construction is shown in \ex{1}.
+\begin{example}
+\begin{verbatim}
+\ar @{line art} '[mid nodes]{label}
+ ... [end node]
+\end{verbatim}
+\end{example}
+\verb+{line art}+, \verb+{label}+, and \texttt{[mid}/\texttt{end
+ node(s)]} are the same as shown in the command
+\verb+\xynodeconnect+. Note that \verb+'+ precedes the first mid
+node. All node positions are relative to the current node. In the
+above diagram the line, for example, starts from the lower-right node
+\textsf{PP}. The \textsf{NP} node, which is a mid node and end node, is typeset
+as \verb+'[-1,-5]+ for the mid node, whereas as \verb+[-1,-5]+ for the
+end node.
+
+
+\subsection{Discourse Representation Structure}
+\label{sec:drs}
+
+The semanticists need to draw Discourse Representation Structures (DRS)
+as illustrated below \cite{kamp_reyle93}:
+
+\drsrectbox{
+\drsbox{x y}{farmer(x)\\donkey(y)\\x owns y}
+\drsdiabox{every\\x}
+\drsbox{u}{u = y\\x beats u}
+}
+
+The difficulty resides in drawing diamond-shaped box, which is solved
+with \Xy-pic module in this package.
+
+The above diagram is coded as follows:
+\begin{verbatim}
+\drsrectbox{
+ \drsbox{x y}{farmer(x)\\donkey(y)\\
+ x owns y}
+ \drsdiabox{every\\x}
+ \drsbox{u}{u = y\\x beats u}
+}
+\end{verbatim}
+For DRS, following three macros are provided.
+
+\subsubsection{\textbackslash drsbox}
+\label{sec:drsbox}
+
+This macro draws a standard rectangular DRS box. The syntax follows:
+\begin{example}
+\begin{verbatim}
+\drsbox[line art]
+ {referent}
+ {proposition}
+\end{verbatim}
+\end{example}
+The sort of lines can be given by the first optional argument
+\texttt{[line art]} (cf.\ subsection \ref{subsection:xyconnect}). The
+referents used in the propositions will be placed in the separated
+boxes as shown bellow:
+\begin{example}
+ \evnup{\drsbox{referents}{proposition 1\\proposition
+ 2\\...\\proposition n}}
+\begin{verbatim}
+\drsbox{referents}
+ {proposition 1\\
+ proposition 2\\
+ ...\\
+ proposition n}
+\end{verbatim}
+\end{example}
+Each proposition is separated by \verb|\\|.
+
+\subsubsection{\textbackslash drsrectbox}
+\label{sec:drsrectbox}
+
+This macro draws a simple rectangular box consisting of only
+propositions without referents.
+\begin{example}
+\begin{verbatim}
+\drsrectbox[line art]{proposition}
+\end{verbatim}
+\end{example}
+The following illustrates the usage:
+\begin{example}
+ \evnup{\drsrectbox{proposition 1\\proposition
+ 2\\...\\proposition n}}
+\begin{verbatim}
+\drsrectbox{proposition 1\\
+ proposition 2\\
+ ...\\
+ proposition n}
+\end{verbatim}
+\end{example}
+
+\subsubsection{\textbackslash drsdiabox}
+\label{sec:drsdiabox}
+
+This macro draws a diamond-shaped box used for representing conditions
+in DRS. The syntax is shown below:
+\begin{example}
+\begin{verbatim}
+\drsdiabox[line art]{condition}
+\end{verbatim}
+\end{example}
+An example follows:
+\begin{example}
+ \evnup{\drsdiabox{condition}}
+\begin{verbatim}
+\drsdiabox{condition}
+\end{verbatim}
+\end{example}
+
+\subsubsection{Nesting DRS boxes}
+\label{sec:nestingDRS}
+
+The boxes made by above DRS macros can be nested in each other as
+shown in the following example:
+\begin{example}
+ \evnup{\drsbox{x}{predro(x)\\
+ \drsbox{y}{donkey(y)\\own(x,y)}
+ $\Rightarrow$
+ \drsbox{z w}{beat(z,w)\\z=x\\w=y}}
+ }
+\begin{verbatim}
+\drsbox{x}{predro(x)\\
+ \drsbox{y}{donkey(y)\\own(x,y)}
+ $\Rightarrow$
+ \drsbox{z w}{beat(z,w)\\z=x\\w=y}
+\end{verbatim}
+\end{example}
+
+\subsection{Autosegmental Representation}
+\label{sec:asr}
+
+Autosegmental Representation (ASR) can be drawn directly with \Xy-pic
+macros with ease\footnote{Some skills in using \Xy-pic module directly
+ are required to draw ASR diagrams though.}. In principle, no
+further macros need to be provided to draw ASR diagrams, but only for
+convenience, a macros to align the segmental nodes horizontally is
+defined in \textsf{xytree.sty}.
+\begin{example}
+\begin{verbatim}
+\asrnode{node}
+\end{verbatim}
+\end{example}
+This macros is identical with \texttt{\textbackslash
+ txt\{\textbackslash strut \}} in \Xy-pic module.
+
+Here is an example using this macro in drawing an ASR diagram with
+\Xy-pic macros:
+\begin{example}
+ \evnup{\xy
+<0pt,0pt>*\asrnode{k}="k",
+<1em,0pt>*\asrnode{a}="a",
+<2em,0pt>*\asrnode{t}="t",
+<0pt,1cm>*\asrnode{$\times$}="x1",
+<1em,1cm>*\asrnode{$\times$}="x2",
+<2em,1cm>*\asrnode{$\times$}="x3",
+<.5em,2cm>*\asrnode{$\mu$}="m1",
+<2em,2cm>*\asrnode{$\mu$}="m2",
+"k"+U;"x1"+D**\dir{-};
+"a"+U;"x2"+D**\dir{-};
+"t"+U;"x3"+D**\dir{-};
+"x1"+U;"m1"+D**\dir{-};
+"x2"+U;"m1"+D**\dir{-};
+"x3"+U;"m2"+D**\dir{-};
+\endxy}
+\begin{verbatim}
+\xy
+<0pt,0pt>*\asrnode{k}="k",
+<1em,0pt>*\asrnode{a}="a",
+<2em,0pt>*\asrnode{t}="t",
+<0pt,1cm>*\asrnode{$\times$}="x1",
+<1em,1cm>*\asrnode{$\times$}="x2",
+<2em,1cm>*\asrnode{$\times$}="x3",
+<.5em,2cm>*\asrnode{$\mu$}="m1",
+<2em,2cm>*\asrnode{$\mu$}="m2",
+"k"+U;"x1"+D**\dir{-};
+"a"+U;"x2"+D**\dir{-};
+"t"+U;"x3"+D**\dir{-};
+"x1"+U;"m1"+D**\dir{-};
+"x2"+U;"m1"+D**\dir{-};
+"x3"+U;"m2"+D**\dir{-};
+\endxy
+\end{verbatim}
+\end{example}
+
+
+\section{Notes}
+\label{sec:note}
+
+\subsection{Error message}
+
+If a line tries to connect to an undefined node, an error occurs. For
+example, the matrix below has the size of $3\times4$.
+
+\begingroup
+\hfil\xy
+\def\objectstyle{\hbox}
+\xymatrix @W=2pc @H=1pc @R=0pc @C=0pc @*[F.]{
+ & (1,2) & & \\
+ (2,1) & & (2,3) & \\
+ & (3,2) & & (3,4)
+}
+\drop\frm{-}
+\endxy
+\endgroup
+
+\noindent
+If a line tries to connect from node ``(1,2)'' to the node ``(2,4)''
+with following codes
+\begin{verbatim}
+\xytree{
+ & \xynode[2]{(1,2)} \\
+ \xynode{(2,1)} & & \xynode{(2,3)} \\
+ & \xynode{(3,2)} & & \xynode{(3,4)}
+}
+\end{verbatim}
+an error occurs as follows because of the undefined node right after
+the node ``(2,3)'' (the trailing empty nodes need not necessarily
+defined).
+
+\noindent
+\texttt{! Xy-pic error: in entry "1,2":\\ No [1,2] (is "2,4") from
+ here.}
+
+This message says that an error occurred at the entry in the absolute
+position \verb+"1,2"+ and pointing to an entry at the relative position
+\verb+[1,2]+ caused an undefined entry with an absolute position
+\verb+"2,4"+.
+
+Such an error can be avoided by defining an empty entry at the
+absolute position \verb+"2,4"+ if the line should be appear. Remember
+that all empty nodes at the right-side of a non-empty nodes can be
+omitted. Though, if a node somewhere in the \Xy-pic matrix point to
+such an empty node, it must not be omitted.
+
+In many cases, analyzing the error messages is helpful to find out
+which of undefined target node is unintentionally accessed by a
+connection line. An example is shown below, where the error is solved
+by defining an empty node.
+
+\begin{verbatim}
+\xytree{
+ & \xynode[2]{(1,2)} \\
+ \xynode{(2,1)} & & \xynode{(2,3)} & \\
+ & \xynode{(3,2)} & & \xynode{(3,4)}
+}
+\end{verbatim}
+\hfil\xy\rowheight1.5pc
+\xytree{
+ & \xynode[2]{(1,2)} \\
+ \xynode{(2,1)} & & \xynode{(2,3)} & \\
+ & \xynode{(3,2)} & & \xynode{(3,4)}
+}
+\drop\frm{.}
+\endxy
+
+
+\subsection{Problem in left/right alignment}
+\label{subsection:alignment}
+
+If used barely (without \verb+\xy+ and \verb+\endxy+), \verb+\xytree+
+and \verb+\yytree+ don't show inconsistency in alignment with the
+text, but if used inside \verb+\xy+ and \verb+\endxy+ or
+\verb+\begin{xy}+ and \verb+\end{xy}+ in order to use such command as
+\verb+\drop\frm+, the tree is aligned to the left side of the text as
+shown below (\textsf{raggedleft} environment doesn't work).
+
+\begin{verbatim}
+\begin{raggedleft}
+ \xy
+ \xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+\end{raggedleft}
+\end{verbatim}
+%
+\begin{raggedleft}
+ \xy
+ \xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+\end{raggedleft}
+\noindent
+This kind of error seems to happen by an internal mechanism of \Xy-pic
+macros, and can be avoid by setting \verb+\hfil+ or \verb+\hfill+ in
+front of \verb+\xy+ instead of using \texttt{center} or
+\texttt{raggedleft} environment.
+
+An example of using \verb+\hfil+ to align tree to the center of text
+line is shown below.
+\begin{verbatim}
+\hfil
+\xy
+\xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+\drop\frm{.}
+\endxy
+\end{verbatim}
+\hfil
+\xy
+\xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+\drop\frm{.}
+\endxy
+
+A right-justified example using \verb+\hfill+ follows.
+
+\begin{verbatim}
+\hfill
+\xy
+\xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+\drop\frm{.}
+\endxy
+\end{verbatim}
+\hfill
+\xy
+\xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+\drop\frm{.}
+\endxy
+
+
+\subsection{Problem in alignment within \textbackslash
+ enumsentence}
+
+This kind of bottom-aligning problem happens, when a tall object is
+put inside of \verb+\enumsentence+ macro. The \verb+\enumsentence+ or
+\verb+\eenumsentence+ macro is provided by \textsf{lingmacros.sty} to
+make enumerated linguistic examples. The erroneous output looks like
+as follows. The example numbering is placed under the tree.
+\begin{example}\label{misalign}
+ \xy
+ \xytree{ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+\end{example}
+%
+Because this kind of error occurs so often with
+\textsf{lingmacros.sty}, it provides an extra macro \verb+\evnup+.
+See \namecite{pease00:_linguis_macros}. An example of \verb|\evnup|
+below aligns the tree correctly with the example number.
+
+\begin{verbatim}
+\enumsentence{\evnup{%
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+ }}
+\end{verbatim}
+\enumsentence[(\ref{misalign}$'$)]{\evnup{%
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+ }}%
+Another solution would be using \verb+\leavevmode+ in front of
+\verb+\xy+ to escape from vertical mode of \TeX. An example using
+this method follows.
+
+\begin{verbatim}
+\enumsentence{\leavevmode
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+}
+\end{verbatim}
+%
+\enumsentence[(\ref{misalign}$''$)]{\leavevmode
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+}
+If an example has several sub-examples, \verb+\eenumsentence+ macro is
+used. The sub-examples are introduced by \verb+\item+ command. In
+this case, all sub-examples should be individually handled with
+\verb+\evnup+ or \verb+leavevmode+ command for proper alignment. See
+the following example.
+
+\begin{verbatim}
+\eenumsentence{
+\item \evnup{%
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+ }
+\item \leavevmode
+ \xy
+ \xytree{
+ & \xynode[-1,1]{NP} \\
+ \xynode{Det} & & \xynode{N}}
+ \drop\frm{.}
+ \endxy
+}
+\end{verbatim}
+%
+\eenumsentence{
+\item \evnup{%
+ \xy
+ \xytree{
+ & \xynode[-1,1]{S} \\
+ \xynode{NP} & & \xynode{VP}}
+ \drop\frm{.}
+ \endxy
+ }
+\item \leavevmode
+ \xy
+ \xytree{
+ & \xynode[-1,1]{NP} \\
+ \xynode{Det} & & \xynode{N}}
+ \drop\frm{.}
+ \endxy
+}
+
+
+\section{Some examples}
+
+\avmhskip{3pt}
+\avmfont{\scshape}
+\avmvalfont{\itshape}
+
+
+\subsection{Tree with AVM}
+
+% example 1
+\noindent
+\xy
+\xytree[2.2]{
+ & \xynode[-1,1]{\begin{avm}\[head & \@3 \\ subcat & \q<
+ \q>\]\end{avm}} \\
+ \xynode{\begin{avm}
+ \[
+ \@2head & \@1\\
+ marking & \@4 \\
+ subcat & \q< \q>
+ \]
+ \end{avm}} & & \xynode{\begin{avm}
+ \[
+ head\@3 & \[
+ pos & V[-A] \\
+ vform & da
+ \] \\
+ subcat & \q< \@2 \q>
+ \]
+ \end{avm}}
+}
+\drop\frm{.}
+\endxy
+
+\begin{verbatim}
+\xytree[2.2]{
+ & \xynode[-1,1]{\begin{avm}
+ \[
+ head & \@3 \\
+ subcat & \q< \q>
+ \]
+ \end{avm}} \\
+ \xynode{\begin{avm}
+ \[
+ \@2head & \@1\\
+ marking & \@4 \\
+ subcat & \q< \q>
+ \]
+ \end{avm}} & & \xynode{\begin{avm}
+ \[
+ head\@3 & \[
+ pos & V[-A] \\
+ vform & da
+ \] \\
+ subcat & \q< \@2 \q>
+ \]
+ \end{avm}}
+}
+\end{verbatim}
+\noindent
+The overall structuring of the tree can be simplified as follows.
+\begin{verbatim}
+\xytree[2.2]{ & \xynode[-1,1]{AVM} \\
+ \xynode{AVM} & & \xynode{AVM}
+}
+\end{verbatim}
+\noindent
+The connection lines of nodes start from the node in the first row
+(\verb+[-1,1]+), \verb+-1+ connects to the first node in the second
+row, and \verb+1+ connects to the second node in the second row. Each
+node is typeset using \texttt{avm} environment provided by
+\textsf{avm.sty}.
+
+
+\subsection{Multiple daughter node}
+
+% example 2
+\xy
+\xytree{
+ & & & & \xynode[-2,2]{pernum} \\
+ & & \xynode[-2,-1,0,1,2]{non3sg} & & & & \xynode{3sg} \\
+ \xynode{1sg} & \xynode{1pl} & \xynode{2sg} & \xynode{2pl} & \xynode{3pl}
+}
+\drop\frm{.}
+\endxy
+
+\bigskip
+\begin{verbatim}
+\xytree{
+ & & & & \xynode[-2,2]{pernum} \\
+ & & \xynode[-2,-1,0,1,2]{non3sg} & & &
+ & \xynode{3sg} \\
+ \xynode{1sg} & \xynode{1pl}
+ & \xynode{2sg} & \xynode{2pl}
+ & \xynode{3pl}
+}
+\end{verbatim}
+\noindent
+% explanation
+At first, all node positions are fixed. \textsf{pernum} is placed at
+the fifth cell of the first row, \textsf{nonsg} third cell of the
+second row, \textsf{3sg} seventh cell of the second row, and so on.
+The line from the node \textsf{pernum} connects to the second node
+leftwards and second node rightwards in the row below, all relatively
+(\verb+[-2,2]+). The five daughter nodes of \textsf{non3sg} is placed
+from the first cell in the third row. The connection lines are coded
+as \verb+[-2,-1,0,1,2]+.
+
+
+\subsection{Special connection line}
+
+% example 3
+\xy
+\xytree{
+ & \xynode[-1,1]{Agr$_s$P} \\
+ \xynode{NP}
+ \xyconnect[--][_.7pc](D,L){1,1}
+ & & \xynode[-1,1]{Agr$_{s}^{'}$} \\
+ & \xynode{Agr$_s$}
+ \xyconnect[--][_2pc](D,L){2,2}
+ & & \xynode[-1,1]{...} \\
+ & & \xynode{..} & & \xynode[-1,1]{VP} \\
+ & & & \xynode{V} & & \xynode{...}
+}
+\drop\frm{.}
+\endxy
+
+\begin{verbatim}
+\xytree{
+ & \xynode[-1,1]{Agr$_s$P} \\
+ \xynode{NP}
+ \xyconnect[--][_.7pc](D,L){1,1}
+ & & \xynode[-1,1]{Agr$_{s}^{'}$} \\
+ & \xynode{Agr$_s$}
+ \xyconnect[--][_2pc](D,L){2,2}
+ & & \xynode[-1,1]{...} \\
+ & & \xynode{..} & & \xynode[-1,1]{VP} \\
+ & & & \xynode{V} & & \xynode{...}
+}
+\end{verbatim}
+\noindent
+Specifying and connecting nodes with lines are the basic task in
+drawing trees. In order to draw dash lines, \verb+\xycoonect+ macro
+is used.\\
+\verb|\xyconnect[--][_.7pc](D,L){2,2}|\\
+This is the dash line connecting node \textsf{NP} and
+\textsf{Agr$_s$}. The second optional argument is given as
+\verb+[_.7pc]+, which specifies the amount of inflection of the dash
+line. The direction of the dash line is from left to right, so the
+dash line inflects downwards (\verb+_+). Because node
+\textsf{Agr$_s$} and \textsf{V} are placed more far away than node
+\textsf{NP} and \textsf{Agr$_s$}, the amount of inflection of the dash
+line is given by more larger value of \verb+[_2pc]+.
+
+
+\subsection{Dependency diagram}
+
+% example 4
+\xytext{
+ \xybarnode{V}
+ \xybarconnect[3][-](D,DL){2}"|{R}"
+ \xybarconnect[6][-](D,D){2}"|{R}"
+ & \xybarnode{\qquad}
+ & \xybarnode{(DP$_1-\alpha$ DP$_2-\alpha$)}
+\POS "1,1"+UL;\POS "1,3"+UR **\dir{.}
+\POS "1,1"+UL;\POS "1,1"+DL+(0,-8) **\dir{.}
+\POS "1,3"+UR;\POS "1,3"+DR+(0,-8) **\dir{.}
+\POS "1,1"+DL+(0,-8);\POS "1,3"+DR+(0,-8) **\dir{.}
+}
+
+\noindent
+% code:
+\begin{verbatim}
+\xytext{
+ \xybarnode{V}
+ \xybarconnect[3][-](D,DL){2}"|{R}"
+ \xybarconnect[6][-](D,D){2}"|{R}"
+ & \xybarnode{\qquad}
+ & \xybarnode{(DP$_1-\alpha$ %
+ DP$_2-\alpha$)
+}
+\end{verbatim}
+
+\noindent
+Three nodes are specified. Second and third node are connected with
+line from the first node. Breaking the connection line, the labels
+are placed in the middle.
+
+
+\section{Summary}
+
+In this manual, many macros for drawing syntactic trees for
+linguistics are explained. A tree is constructed with a
+\verb+\xytree+ command. It is advisable to analyze the tree structure
+in a lattice structure. A simple tree could be completed using only
+\verb+\xynode+ commands by connecting nodes with it's optional
+argument. If a tree has more or less complicated lines,
+\verb+\xyconnect+ command can be used.
+
+For agreement structure, \verb+\xytext+ is used. In this case
+\verb+\xybarnode+ is used to specify nodes and \verb+\xybarconnect+ is
+used for the connection lines.
+
+The commands provided by \Xy-pic package can also be used to draw very
+complicated trees. Some frequently encountered errors and a possible
+solutions are also treated in this manual.
+
+As an extension for semanticists, \verb+\drsbox+, \verb+\drsrectbox+,
+\verb+\drsdiabox+ are added to \textsf{xytree.sty} for drawing DRS
+diagrams. One could also use \Xy-pic macros directly to draw ASR
+diagrams. In this case, \verb+\asrnode+ could be used efficiently.
+
+With \textsf{xytree.sty}, it is relatively easy to draw linguistic
+syntactic trees. For more question concerning this package, please
+mail me (\url{mailto:koaunghi@kornet.net}).
+
+\bibliographystyle{fullname}
+\bibliography{xytree}
+
+\end{multicols}
+
+\end{document}
+
+% LocalWords: xytree pic parsetree dvips Pease PostScript xdvi PDF pdflatex xy
+% LocalWords: dvi pc Det AVM pease xynode xytrinode xyterminal xyconnect pos
+% LocalWords: DL Koaunghi Un XP AGR agr
diff --git a/macros/latex/contrib/xytree/xytree.sty b/macros/latex/contrib/xytree/xytree.sty
new file mode 100644
index 0000000000..29adb6e030
--- /dev/null
+++ b/macros/latex/contrib/xytree/xytree.sty
@@ -0,0 +1,367 @@
+\NeedsTeXFormat{LaTeX2e}
+%%%
+%%% xytree.sty
+%%%
+%%% Ver 1.0 xytree.sty written by Koaunghi Un <2004/08/10>
+%%% Ver 1.1 modified by Koaunghi Un <2004/11/05>
+%%% \barnodeconnect with label
+%%% Ver 1.2 added two new macros by Koaunghi Un <2004/12/20>
+%%% \yytree: a new tree macro
+%%% \xynodefont: font changing macro for all nodes in \xytree
+%%% and \yytree.
+%%% Ver 1.3 added three new macros by Koaunghi Un <2006/02/27>
+%%% for drawing diagrams for Discourse Representation Structure
+%%% \drsbox: with referent and predicate
+%%% \drsrectbox: only for predicate
+%%% \drsdiabox: diamond-shaped box for DRS conditions.
+%%% Ver 1.4 Bug fixed by Koaunghi Un <2006/03/07>
+%%% \drop'ing a frame after \xytrinode shifted the reference
+%%% point to the lower right corner of the triangle.
+%%% Ver 1.5 correct font change of \xyterminal by Koaunghi Un <2006/08/15>
+%%% italic font shape of \xyterminal after \\
+%%%
+
+\ProvidesPackage{xytree}[2006/8/15 Pacakge for drawing trees]
+\typeout{`xytree.sty' package v1.5 for drawing trees.}
+
+\RequirePackage[all]{xy}
+
+%%
+%% \xytree[column spacing in pc]{matrix}
+%% -------
+%% A tree is a simple macro of the form "\xytree{...}"
+%% It is an xymatrix, with "&" as column separator and "\\" as row
+%% separator:
+%%
+%% \rowheight: sets row spacing.
+%%
+
+\newdimen\rowheight\newdimen\XyColumnSpacing \rowheight2pc
+\makeatother
+\newcommand{\xytree}[2][0.5]{\XyColumnSpacing=#1pc\relax%
+ \ifdim\XyColumnSpacing>0pt\relax\else\XyColumnSpacing=0.01.pc\fi%
+ \rule{0pt}{0pt}%
+ \xymatrix @R=\rowheight @!C=\XyColumnSpacing @M=0pc {#2}}
+\makeatletter
+
+%%
+%% \xyconnect[line shape]
+%% [line bend]
+%% (source corner, target corner)
+%% {target row, target col}
+%% "label"
+%%
+
+\def\xyconnect{\@ifnextchar[{\n@deconnect}{\n@deconnect[-]}}%]
+\def\n@deconnect[#1]{\@ifnextchar[{\n@dec@nnect[#1]}%]
+ {\n@dec@nnect[#1][\empty]}}
+\def\n@dec@nnect[#1][#2]{\@ifnextchar({\n@d@c@nnect[#1][#2]}%)
+ {\n@d@c@nnect[#1][#2](D,U)}}
+\def\n@d@c@nnect[#1][#2](#3)#4{\@ifnextchar"{\connectwitharrow[#1][#2](#3)#4}%
+ {\connectwitharrow[#1][#2](#3)#4""}}
+\makeatother
+\def\connectwitharrow[#1][#2](#3,#4)#5"#6"{%
+ \ifx\empty#2\relax
+ \ar @{#1} []+#3;[#5]+#4 #6
+ \else
+ \ar @{#1} @/#2/ []+#3;[#5]+#4 #6
+ \fi}
+\makeatletter
+
+\def\labelstyle{\hbox}
+\def\ind#1{{\fboxsep1pt\fbox{\small#1}}}
+
+\def\@drawlines#1,#2\relax{%
+ \xyconnect{1,#1}%
+ \ifx#2\@empty\else\@drawlines#2\relax\fi%
+}
+
+%%
+%% Tree Node
+%%
+%% \xynode[connecting nodes delimited by ,]{entry}
+%% \xytrinode[+/-triangle width]{entry}
+%% \xyterminal{entry}
+%%
+%% Following code
+%% \xynode{ & xynode[-1,1]{S} \\
+%% \xynode[0]{NP} & & \xytrinode{VP} \\
+%% \xyterminal{I} & & \xyterminal{ate an apple}
+%% }
+%% will draw following tree diagram:
+%% S
+%% /\
+%% / \
+%% / \
+%% NP VP
+%% | /\
+%% | / \
+%% | ____
+%% I ate an apple
+%% with the terminal nodes written in italic shape.
+%% Lines are drawn with the macro \xyconnect defined above.
+%%
+
+\def\xynode{\@ifnextchar[{\xyn@de}{\xyn@de[]}}%]
+\def\xyn@de[#1]#2{{\txt{{\strut\xyn@def@nt #2}}}%
+ \ifx#1\@empty\else\expandafter\@drawlines#1,\relax\fi}
+\newcommand{\xytrinode}[2][0]{{\txt{{\strut#2}}}
+ \POS[]+D;\POS[d]+UL\POS-(#1,0)**\dir{-}%
+ \POS[]+D;\POS[d]+UR\POS+(#1,0)**\dir{-}%
+ \POS[]\POS[d]+UL\POS-(#1,0);\POS[]\POS[d]+UR\POS+(#1,0)**\dir{-};\POS[]}
+\newcommand{\xyterminal}[1]{\textit{\txt{\strut #1}}}
+
+%%
+%% \xytext
+%% -------
+%% For morph-syntactic agrement "\xytext{...}" is used in place of "\xytree"
+%% It is \xytree with one column:
+%%
+
+\makeatother
+\newcommand{\xytext}[1]{\raisebox{3pt}{\def\objectstyle{\hbox}%
+ \xymatrix @C=1ex @M=0pt {#1}}\hspace{-2pt}}
+\makeatletter
+
+%%
+%% \xybarconnect[line displacement]
+%% [line shape]
+%% (source corner, target corner)
+%% {target row, target col}
+%% "label"
+%%
+
+\def\xybarconnect{\@ifnextchar[%]
+ {\b@rconnect}{\b@rconnect[3]}}
+\def\b@rconnect[#1]{\@ifnextchar[%]
+ {\b@rc@nnect[#1]}{\b@rc@nnect[#1][->]}}
+\def\b@rc@nnect[#1][#2]{\@ifnextchar(%)
+ {\b@rc@nn@ct[#1][#2]}{\b@rc@nn@ct[#1][#2](U,U)}}
+\def\b@rc@nn@ct[#1][#2](#3,#4)#5{\@ifnextchar"%
+ {\b@rc@nn@ct@[#1][#2](#3,#4)#5}%
+ {\b@rc@nn@ct@[#1][#2](#3,#4)#5""}}
+\def\b@rc@nn@ct@[#1][#2](#3,#4)#5"#6"{%
+ \edef\reserved@a{%
+ \csname c@rner@#3\endcsname#1\relax/%
+ \csname c@rner@#4\endcsname#1\relax}%
+ \expandafter\DrawHorizontal\reserved@a/#1/#2/#3/#4/#5/#6\end\ignorespaces}
+\def\c@rner@U#1\relax{#1}
+\let\c@rner@UL\c@rner@U
+\let\c@rner@UR\c@rner@U
+\let\c@rner@R\c@rner@U
+\def\c@rner@D#1\relax{-#1}
+\let\c@rner@DR\c@rner@D
+\let\c@rner@DL\c@rner@D
+\let\c@rner@L\c@rner@D
+\makeatother
+\def\DrawHorizontal#1/#2/#3/#4/#5/#6/#7/#8\end{%
+ \ar @{#4} '[0,0]+#5 '[0,0]+#5+(0,#1) '[0,#7]+#6+(0,#2)#8 [0,#7]+#6
+}
+\makeatletter
+
+%%
+%% \xybarnode{entry}
+%%
+%% Following codes
+%% AGR \xytext{\xybarnode{Det}\xybarconnect{1} & \xybarnode{head-noun} & verb} ...
+%% will draw following diagram:
+%% ______
+%% | |
+%% | \/
+%% AGR Det head-noun verb ...
+%%
+
+\newcommand{\xybarnode}[1]{\strut#1\ignorespaces}
+
+%%
+%% \yytree[indentation in pc]{matrix}
+%% -------
+%%
+%% A \yytree is an another tree drawing macro of the form "\yytree{...}"
+%% It is an xymatrix, with "&" as column separator and "\\" as row
+%% separator:
+%%
+
+\makeatother
+\newcommand{\yytree}[2][2]{%
+ \rule{0pt}{0pt}%
+ \xymatrix @!0 @C=#1pc @R=1.5pc @W=0pc @*[r] {#2}
+}
+\makeatletter
+
+%%
+%% \yynode[daughter nodes delimited by ,]{entry}
+%% -------
+%%
+%% For example
+%% \yytree{ \yynode[1,4]{top} \\
+%% & \yyode[1,2]{A} \\
+%% & & \yynode{Aa} \\
+%% & & \yynode{Ab} \\
+%% & \yynode[1]{B} \\
+%% & & \yynode{Ba}
+%% }
+%% will produce the following tree:
+%% top
+%% |-- A
+%% | |-Aa
+%% | |-Ab
+%% |-- B
+%% |-Ba
+%% with proper bending line for the last daughter node.
+%%
+
+\def\yynode{\@ifnextchar[{\yyn@de}{\yyn@de[]}}%]
+\def\yyn@de[#1]#2{{\txt{{\xyn@def@nt #2}}}%
+ \@tempcnta=0
+ \ifx#1\@empty\else\expandafter\@yylines#1,\relax\fi%
+ \ifnum\@tempcnta>0
+ \edef\reserved@a{\noexpand\POS[]+D+(1,0);[\the\@tempcnta,0]+(1,0)**\noexpand\dir{-}}%
+ \reserved@a\fi
+}
+
+\def\@yylines#1,#2\relax{%
+ \POS[#1,0]+(1,0);[#1,1]+L **\dir{-}%
+ \@tempcnta=#1
+ \ifx#2\@empty\else\@yylines#2\relax\fi%
+}
+
+%%
+%% \xynodefont
+%% -----------
+%% Default font for node entries in \xytree and \yytree.
+%% This is initially set to be empty, which is the same as \rmfamily
+%% \xynodefont{\itshape} typeset all node entries in italic shape.
+%%
+
+\def\xynodefont#1{\def\xyn@def@nt{#1}}
+\xynodefont{}
+
+%%%
+%%% Discourse Representation Structure
+%%%
+%% This is not related with linguistic trees, but because no other
+%% packages provide a convenient way to draw DRS diagram without the
+%% help of pstricks, these three macros for drawing DRS diagram are
+%% added here. They use also Xy-pic feature to construct boxes.
+%%
+
+\newdimen\drs@wd\newdimen\drs@ht\newdimen\drsboxsep
+\drsboxsep6pt
+\newbox\drs@boxa\newbox\drs@boxb
+
+%%
+%% \drsbox[line art]{referent}{predicate}
+%% -------
+%% [line art] : optional. specifies the art of lines. All \dir
+%% directionals of Xy-pic kernel library can be used (not \dir2,
+%% \dir3, \dir_, \dir^ directionals)
+%% referent:
+%% predicate:
+%%
+
+%% ------------
+%% | x |
+%% ------------
+%% | |
+%% | donkey(x)|
+%% | green(x) |
+%% | |
+%% ------------
+
+\newcommand{\drsbox}[3][-]{%
+ \begin{tabular}{l}\tabcolsep0pt
+ \itshape
+ \setbox\drs@boxa\hbox{\begin{tabular}{l}#2\end{tabular}}%
+ \drs@wd=\wd\drs@boxa
+ \drs@ht=\ht\drs@boxa\advance\drs@ht by\dp\drs@boxa
+ \setbox\drs@boxb\hbox{\begin{tabular}{l}#3\end{tabular}}%
+ \ifdim\drs@wd<\wd\drs@boxb\drs@wd\wd\drs@boxb\fi
+ \advance\drs@ht by\ht\drs@boxb \advance\drs@ht by\dp\drs@boxb
+ \divide\drs@ht by2
+ \advance\drs@ht by1.5\drsboxsep
+ \wd\drs@boxa=\drs@wd\wd\drs@boxb=\drs@wd
+ \ifdim\ht\drs@boxa<\bigskipamount\ht\drs@boxa=\bigskipamount\fi
+ \xy
+ <0pt,0pt>*\hbox{\box\drs@boxb}="b";
+ <0pt,\drs@ht>*\hbox{\box\drs@boxa}="a";
+ "a"+LU+<-\drsboxsep,.5\drsboxsep>;
+ "a"+RU+<\drsboxsep,.5\drsboxsep>**\dir{#1};
+ "b"+RD+<\drsboxsep,-\drsboxsep>**\dir{#1};
+ "b"+LD+<-\drsboxsep,-\drsboxsep>**\dir{#1};
+ "a"+LU+<-\drsboxsep,.5\drsboxsep>**\dir{#1};
+ "b"+LU+<-\drsboxsep,\drsboxsep>;"b"+RU+<\drsboxsep,\drsboxsep>**\dir{#1};
+ \endxy
+ \end{tabular}}
+
+%%
+%% \drsrectbox[line art]{content}
+%% -----------
+%%
+
+%% -------------
+%% | |
+%% | man(u) |
+%% | unicorn(u)|
+%% | seeks(u,v)|
+%% | |
+%% -------------
+
+\newcommand{\drsrectbox}[2][-]{%
+ \begin{tabular}{l}\tabcolsep0pt
+ \itshape
+ \xy
+ *\hbox{\begin{tabular}{l}#2\end{tabular}}="a";
+ "a"+LD+<-\drsboxsep,-\drsboxsep>;
+ "a"+LU+<-\drsboxsep,\drsboxsep>**\dir{#1};
+ "a"+RU+<\drsboxsep,\drsboxsep>**\dir{#1};
+ "a"+RD+<\drsboxsep,-\drsboxsep>**\dir{#1};
+ "a"+LD+<-\drsboxsep,-\drsboxsep>**\dir{#1};
+ \endxy
+ \end{tabular}}
+
+%%
+%% \drsdiabox[line art]{conditions}
+%% ----------
+%%
+
+%% /\
+%% / \
+%% / \
+%% / \
+%% / \
+%% / every \
+%% \ x /
+%% \ /
+%% \ /
+%% \ /
+%% \ /
+%% \/
+
+\newcommand{\drsdiabox}[2][-]{%
+ \begin{tabular}{l}\tabcolsep0pt
+ \itshape
+ \setbox\drs@boxa\hbox{\begin{tabular}{c}#2\end{tabular}}%
+ \@tempdima=\wd\drs@boxa
+ \@tempdima=.5\wd\drs@boxa
+ \advance\@tempdima by.5\ht\drs@boxa
+ \advance\@tempdima by.5\drsboxsep
+ \xy
+ *\hbox{\box\drs@boxa}="a";
+ "a"+<-\@tempdima,0pt>;
+ "a"+<0pt,\@tempdima>**\dir{#1};
+ "a"+<\@tempdima,0pt>**\dir{#1};
+ "a"+<0pt,-\@tempdima>**\dir{#1};
+ "a"+<-\@tempdima,0pt>**\dir{#1};
+ \endxy
+ \end{tabular}}
+
+%%%
+%%% Autosegmental Representation
+%%% ----------------------------
+%%%
+
+
+\def\asrnode#1{\txt{\strut#1}}
+
+\endinput