<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%&amp;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.]{
  &amp; &amp; &amp; S &amp; &amp; &amp; \\
  &amp; NP &amp; &amp; &amp; &amp; VP &amp; \\
  Det &amp; &amp; N &amp; &amp; V &amp; NP &amp; PP
}
\drop\frm{-}
\endxy
\endgroup
\noindent
The vertical dotted lines between two adjacent cells in the above
diagram can be replaced by \verb+&amp;+'s and the rightmost lines can be
replaced by \verb+\\+.  The \verb+&amp;+'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{
  &amp; &amp; &amp; \xynode[-2,2]{S} \\
  &amp; \xynode[-1,1]{NP} &amp; &amp; &amp; &amp; \xynode[-1,0,1]{VP} \\
  \xynode{Det} &amp; &amp; \xynode{N} &amp; &amp; \xynode{V} &amp; \xynode{NP} &amp; \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} &amp; \xynode{B} \\
  \xynode{C} &amp; \xynode{D}
}
\end{verbatim}
\endgroup

\hfil\xy
\xytree{
  \xynode{A} &amp; \xynode{B} \\
  \xynode{C} &amp; \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} &amp; \xynode{B} \\
  \xynode{C} &amp; \xynode{D}
}
\end{verbatim}
\bgroup\rowheight=0.5pc
\hfil\xy
\xytree{
  \xynode{A} &amp; \xynode{B} \\
  \xynode{C} &amp; \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{
  &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \xynode{VP}
}
\end{verbatim}
\hfil\xy
\xytree{
  &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \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{
  &amp; \xynode[-1,1]{S} \\
  \xynode[0]{NP} &amp; &amp; \xytrinode{VP} \\
  \xyterminal{It} &amp; &amp;
  \xyterminal{is raining}
}
\end{verbatim}
\hfil\xy
\xytree{
  &amp; \xynode[-1,1]{S} \\
  \xynode[0]{NP} &amp; &amp; \xytrinode{VP} \\
  \xyterminal{It} &amp; &amp;
  \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{
  &amp; \xynode[-1,1]{S} \\
  \xynode[0]{NP} &amp;
  &amp; \xytrinode[-5]{VP}\\
  \xynode{It} &amp; &amp; \xynode{is raining}
}
\end{verbatim}
\hfil\xy
\xytree{
  &amp; \xynode[-1,1]{S} \\
  \xynode[0]{NP} &amp; &amp; \xytrinode[-5]{VP} \\
  \xyterminal{It} &amp; &amp; \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|&lt;|, \verb|&gt;|, \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 &amp;
  \xytree{
    \xynode{}
    \xyconnect[#2](R,L){0,1}
    &amp;
    \xynode{}
  }}
\begin{center}\tabcolsep3pt
  \begin{tabular}{|ll|ll|ll|}\hline
    \myarrow{-} &amp;
    \myarrow{--} &amp;
    \myarrow{.} \\
    \myarrow{:} &amp;
    \myarrow[\~{}]{~} &amp;
    \myarrow[\~{}\~{}]{~~} \\
    \myarrow{=} &amp;
    \myarrow{==} &amp; &amp;
    \\\hline
    \myarrow{|-&gt;} &amp;
    \myarrow{&lt;-&gt;} &amp;
    \myarrow{(-+} \\
    \myarrow{(.)} &amp;
    \myarrow{&gt;.&lt;} &amp;
    \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[-&gt;][#1](R,L){0,1} &amp; \xynode{X$'$}}}
\begin{center}
\begin{tabular}{|ll|}\hline
  \verb|[^]| &amp; \infl{^} \\
  \verb|[_]| &amp; \infl{_} \\
  \verb|[_1pc]| &amp; \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 **@{-} ?&gt;*@{&gt;} +/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[-&gt;][^](#1){0,1} &amp; \xynode{X$'$}}}
\begin{tabular}{|ll|}\hline
  default &amp; \bend{D,U} \\
  \verb|(UL,DR)| &amp; \bend{UL,DR} \\
  \verb|(DR,UL)| &amp; \bend{DR,UL} \\
  \verb|(U,D)| &amp; \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{ &amp; \xynode[-1,1]{XP} \\
  \xynode{...} &amp; &amp; \xynode[-1,1]{X$'$} \\
  &amp; \xynode{X} &amp; &amp; \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 &amp; abs. pos &amp; directionality \\\hline
  ... &amp; \verb|"2,1"| &amp; \verb|{1,-1}| \\
  X$'$ &amp; \verb|"2,3"| &amp; \verb|{1,1}| \\
  X &amp; \verb|"3,2"| &amp; \verb|{2,0}| \\
  Y &amp; \verb|"3,4"| &amp; \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]{ &amp; \xynode{XP}
  \xyconnect[.&gt;]{1,-1}"_{\{$1,-1$\}}"
  \xyconnect[.&gt;]{2,0}"|{\{$2,0$\}}"
  \xyconnect[.&gt;]{1,1}"^{\{$1,1$\}}"
  \xyconnect[.&gt;][_1pc]{2,2}"_{\{$2,2$\}}"
  \\
  \xynode{...} &amp; &amp; \xynode{X$'$}
  \\
  &amp; \xynode{X} &amp; &amp; \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}"| &amp;
    \xytree[4]{\xynode{}\xyconnect[-&gt;](R,L){0,1}"^{label}" &amp;} \\
    \verb+"|{label}"+ &amp;
    \xytree[4]{\xynode{}\xyconnect[-&gt;](R,L){0,1}"|{label}" &amp;} \\
    \verb|"_{label}"| &amp;
    \xytree[4]{\xynode{}\xyconnect[-&gt;](R,L){0,1}"_{label}" &amp;} \\\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|^&lt;{x}| &amp; \unskip
    \xytree[2]{\xyconnect[-&gt;](R,L){0,1}"^&lt;{x}" &amp;} &amp;
    start pos of the line \\
    \verb|^&lt;&lt;{x}| &amp;
    \xytree[2]{\xyconnect[-&gt;](R,L){0,1}"^&lt;&lt;{x}" &amp;} &amp;
    more \verb|&lt;|  \\
    \verb|^&gt;{x}| &amp;
    \xytree[2]{\xyconnect[-&gt;](R,L){0,1}"^&gt;{x}" &amp;} &amp;
    end of line \\
    \verb|^&gt;&gt;{x}| &amp;
    \xytree[2]{\xyconnect[-&gt;](R,L){0,1}"^&gt;&gt;{x}" &amp;} &amp;
    more \verb|&gt;| \\
    \verb|^(.3){x}| &amp;
    \xytree[2]{\xyconnect[-&gt;](R,L){0,1}"^(.3){x}" &amp;} &amp;
    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|+| &amp; increase label size \\
    \verb|+&lt;dimen&gt;| &amp; increase \verb|&lt;dimen&gt;| \\
    \verb|+=| &amp; increase to frame size \\
    \verb|-| &amp; decrease label size \\
    \verb|-&lt;Å©±â&gt;| &amp; decrease \verb|&lt;Å©±â&gt;| \\
    \verb|-=| &amp; decrease to frame size \\\hline
    \verb|!| &amp; don't center \\\hline
    \verb|[o]| &amp; oval \\\hline
    \verb|[l] [r] [u] [d]| &amp; align left, right, up, down \\\hline
    \verb|[F] [F=]| &amp; single/double line frame \\
    \verb|[F.] [F--]| &amp; dotted/dashed line frame \\
    \verb|[F-,] [F-:&lt;3pt&gt;]| &amp; shaded/rounded frame \\
    &amp; (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}        ^*+&lt;5pt&gt;[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{ &amp; \xynode{XP}
  \xyconnect{1,-1}"_*[o][F.]{x}"
  \xyconnect{1,1}"^*+&lt;5pt&gt;[o][F.]{x}"
  \\
  \xynode{X$'$} &amp; &amp; \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} &amp; \xybarnode{head-noun} &amp;
    \xybarnode{verb} &amp; \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+&amp;+.

Above example \ex{-1} was typeset as follows.
\begin{verbatim}
Morpho-syntactic agreement (AGR) can
be represented as \xytext{
  \xybarnode{Det}\xybarconnect{1} &amp;
  \xybarnode{head-noun} &amp;
  \xybarnode{verb} &amp; \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 &amp; agreement &amp;
      (AGR)}\hspace{-2pt}}
\item \xytext{\xybarnode{head-noun} &amp; \xybarnode{agreement} &amp;
    \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]| &amp; \rule{0pt}{20pt}
  \xytext{\xybarnode{agreement}\xybarconnect[2]{1} &amp; \xybarnode{problem}} \\
  \verb|[3]|(default) &amp;
  \xytext{\xybarnode{agreement}\xybarconnect{1} &amp; \xybarnode{problem}} \\
  \verb|[4]| &amp;
  \xytext{\xybarnode{agreement}\xybarconnect[4]{1} &amp; \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+[-&gt;]+).

\hfil
\xytext{\xybarnode{agreement}
  \xybarconnect(UL,UL){2}
  \xybarconnect[4][--]{2}
  \xybarconnect[5][.](UR,UR){2}
  &amp;
  \xybarnode{phenomena}
  \xybarconnect[3][=](D,D){1}
  &amp;
  \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) &amp; \rule{0pt}{25pt}
  \xytext{\xybarnode{agreement}\xybarconnect(U,U){1} &amp;
    \xybarnode{problem}} \\
  \verb|(UR,UL)| &amp; \rule{0pt}{0pt}
  \xytext{\xybarnode{agreement}\xybarconnect(UR,UL){1} &amp;
    \xybarnode{problem}} \\
  \verb|(DL,DR)| &amp; \raisebox{-20pt}{\rule{0pt}{0pt}}
  \xytext{\xybarnode{agreement}\xybarconnect(DL,DR){1} &amp;
    \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}| &amp; \rule{0pt}{25pt}
  \xytext{\xybarnode{agr}\drop\frm{.}
    \xybarconnect{1}
    &amp; \xybarnode{phenomena}\drop\frm{-} &amp;
    \xybarnode{problem} &amp; \xybarnode{solving}}\\[5pt]
  \verb|{2}| &amp;
  \xytext{\xybarnode{agr}\drop\frm{.}
    \xybarconnect{2}
    &amp; \xybarnode{phenomena} &amp;
    \xybarnode{problem}\drop\frm{-} &amp; \xybarnode{solving}}\\[5pt]
  \verb|{3}| &amp;
  \xytext{\xybarnode{agr}\drop\frm{.}
    \xybarconnect{3}
    &amp; \xybarnode{phenomena} &amp;
    \xybarnode{problem} &amp; \xybarnode{solving}\drop\frm{-}}\\[5pt]
  \verb|{-1}| &amp;
  \xytext{\xybarnode{agr} &amp; \xybarnode{phenomena} &amp;
    \xybarnode{problem}\drop\frm{-} &amp; \xybarnode{solving}\drop\frm{.}
    \xybarconnect{-1}}\\[5pt]
  \verb|{-2}| &amp;
  \xytext{\xybarnode{agr} &amp; \xybarnode{phenomena}\drop\frm{-} &amp;
    \xybarnode{problem} &amp; \xybarnode{solving}\drop\frm{.}
    \xybarconnect{-2}}\\[5pt]
  \verb|{-3}| &amp; \raisebox{-10pt}{}
  \xytext{\xybarnode{agr}\drop\frm{-} &amp; \xybarnode{phenomena} &amp;
    \xybarnode{problem} &amp; \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} \\
  &amp; \yynode[1,2]{parent} \\
  &amp; &amp; \yynode{me} \\
  &amp; &amp; \yynode{sister} \\
  &amp; \yynode[1]{uncle \&amp; aunt} \\
  &amp; &amp; \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} \\
  &amp; \yynode[1,2]{parent} \\
  &amp; &amp; \yynode{me} \\
  &amp; &amp; \yynode{sister} \\
  &amp; \yynode[1]{uncle \&amp; aunt} \\
  &amp; &amp; \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 \&amp; 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]{
  &amp; &amp; \xynode[-1,1]{grandparent} \\
  &amp; \xynode[-1,1]{parent} &amp; &amp; \xynode[0]{uncle \&amp; aunt} \\
  \xynode{me} &amp; &amp; \xynode{sister} &amp; \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&lt;diameter&gt;{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&lt;thickness&gt;{,}
\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&lt;diameter&gt;{shape}
\end{verbatim}
\end{example}
In case of circled frame, \verb+&lt;diameter&gt;+ sets the diameter of the
circle.  In case of oval frame, \verb+&lt;diameter&gt;+ 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{}
  &amp; \xynode{\texttt{\{.\}}}
  \drop\frm{.}
  &amp; \xynode{\texttt{$&lt;$44pt$&gt;$\{.\}}}
  \drop\frm&lt;44pt&gt;{.}
  \\
  \xynode{\texttt{\{-\}}}
  \drop\frm{-}
  &amp; \xynode{\texttt{$&lt;$8pt$&gt;$\{-\}}}
  \drop\frm&lt;8pt&gt;{-}
  &amp; \xynode{\texttt{$&lt;$44pt$&gt;$\{-\}}}
  \drop\frm&lt;44pt&gt;{-}
  \\
  \xynode{\texttt{\{=\}}}
  \drop\frm{=}
  &amp; \xynode{\texttt{$&lt;$8pt$&gt;$\{=\}}}
  \drop\frm&lt;8pt&gt;{=}
  &amp; \xynode{\texttt{$&lt;$44pt$&gt;$\{=\}}}
  \drop\frm&lt;44pt&gt;{=}
  \\
  \xynode{\texttt{\{--\}}}
  \drop\frm{--}
  &amp; \xynode{\texttt{\{o-\}}}
  \drop\frm{o-}
  &amp; \xynode{\texttt{$&lt;$44pt$&gt;$\{--\}}}
  \drop\frm&lt;44pt&gt;{--}
  \\
  \xynode{\texttt{\{,\}}}
  \drop\frm{,}
  &amp; \xynode{\texttt{$&lt;$5pt$&gt;$\{,\}}}
  \drop\frm&lt;5pt&gt;{,}
  &amp; \xynode{\texttt{\{-,\}}}
  \drop\frm{-,}
  \\
  \xynode{\texttt{\{o\}}}
  \drop\frm{o}
  &amp; \xynode{\texttt{$&lt;$8pt$&gt;$\{o\}}}
  \drop\frm&lt;8pt&gt;{o}
  &amp; \xynode{\texttt{\{.o\}}}
  \drop\frm{.o}
  \\
  \xynode{\texttt{\{oo\}}}
  \drop\frm{oo}
  &amp; \xynode{\texttt{$&lt;$8pt$&gt;$\{oo\}}}
  \drop\frm&lt;8pt&gt;{oo}
  &amp; \xynode{\texttt{\{-o\}}}
  \drop\frm{-o}
  \\
  \xynode{\texttt{\{e\}}}
  \drop\frm{e}
  &amp; \xynode{\texttt{$&lt;$20pt,8pt$&gt;$\{e\}}}
  \drop\frm&lt;20pt,8pt&gt;{e}
  &amp; \xynode{\texttt{\{.e\}}}
  \drop\frm{.e}
  \\
  \xynode{\texttt{\{ee\}}}
  \drop\frm{ee}
  &amp; \xynode{\texttt{$&lt;$20pt,8pt$&gt;$\{ee\}}}
  \drop\frm&lt;20pt,8pt&gt;{ee}
  &amp; \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&lt;3pt&gt;{,}+

\hfil\xy
\xytree{
  &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \xynode{VP}
}
\drop\frm{--}
\drop\frm&lt;3pt&gt;{,}
\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{_\}}
  &amp;
  \xynode{\begin{avm}\avml\texttt{\char123\^{}\ttbs\char125\char125}\\upper\avmr\end{avm}}
  \drop\frm{^\}}
  &amp;
  \xynode{\begin{avm}\avml\texttt{\char123\ttbs\char123\char125}\\left\avmr\end{avm}}
  \drop\frm{\{}
  &amp;
  \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{_)}
  &amp;
  \xynode{\begin{avm}\avml\texttt{\char123\^{})\char125}\\upper\avmr\end{avm}}
  \drop\frm{^)}
  &amp;
  \xynode{\begin{avm}\avml\texttt{\char123(\char125}\\left\avmr\end{avm}}
  \drop\frm{(}
  &amp;
  \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{
  &amp; &amp; &amp; \xynode{S} \\
  &amp; \xynode{NP} &amp; &amp; &amp; &amp; \xynode{VP} \\
  \xynode{Det}
  &amp; &amp; \xynode{N} &amp; &amp; \xynode{V} &amp; &amp; \xynode{PP}
  \ar @{-&gt;} '[-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
&lt;0pt,0pt&gt;*\asrnode{k}="k",
&lt;1em,0pt&gt;*\asrnode{a}="a",
&lt;2em,0pt&gt;*\asrnode{t}="t",
&lt;0pt,1cm&gt;*\asrnode{$\times$}="x1",
&lt;1em,1cm&gt;*\asrnode{$\times$}="x2",
&lt;2em,1cm&gt;*\asrnode{$\times$}="x3",
&lt;.5em,2cm&gt;*\asrnode{$\mu$}="m1",
&lt;2em,2cm&gt;*\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
&lt;0pt,0pt&gt;*\asrnode{k}="k",
&lt;1em,0pt&gt;*\asrnode{a}="a",
&lt;2em,0pt&gt;*\asrnode{t}="t",
&lt;0pt,1cm&gt;*\asrnode{$\times$}="x1",
&lt;1em,1cm&gt;*\asrnode{$\times$}="x2",
&lt;2em,1cm&gt;*\asrnode{$\times$}="x3",
&lt;.5em,2cm&gt;*\asrnode{$\mu$}="m1",
&lt;2em,2cm&gt;*\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.]{
  &amp; (1,2) &amp; &amp; \\
  (2,1) &amp; &amp; (2,3) &amp; \\
  &amp; (3,2) &amp; &amp; (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{
  &amp; \xynode[2]{(1,2)} \\
  \xynode{(2,1)} &amp; &amp; \xynode{(2,3)} \\
  &amp; \xynode{(3,2)} &amp; &amp; \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{
  &amp; \xynode[2]{(1,2)} \\
  \xynode{(2,1)} &amp; &amp; \xynode{(2,3)} &amp; \\
  &amp; \xynode{(3,2)} &amp; &amp; \xynode{(3,4)}
}
\end{verbatim}
\hfil\xy\rowheight1.5pc
\xytree{
  &amp; \xynode[2]{(1,2)} \\
  \xynode{(2,1)} &amp; &amp; \xynode{(2,3)} &amp; \\
  &amp; \xynode{(3,2)} &amp; &amp; \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{ &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \xynode{VP}}
    \drop\frm{.}
  \endxy
\end{raggedleft}
\end{verbatim}
%
\begin{raggedleft}
  \xy
    \xytree{ &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \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{ &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \xynode{VP}}
\drop\frm{.}
\endxy
\end{verbatim}
\hfil
\xy
\xytree{ &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \xynode{VP}}
\drop\frm{.}
\endxy

A right-justified example using \verb+\hfill+ follows.

\begin{verbatim}
\hfill
\xy
\xytree{ &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \xynode{VP}}
\drop\frm{.}
\endxy
\end{verbatim}
\hfill
\xy
\xytree{ &amp; \xynode[-1,1]{S} \\
  \xynode{NP} &amp; &amp; \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{ &amp; \xynode[-1,1]{S} \\
    \xynode{NP} &amp; &amp; \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{
      &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \xynode{VP}}
    \drop\frm{.}
    \endxy
  }}
\end{verbatim}
\enumsentence[(\ref{misalign}$'$)]{\evnup{%
    \xy
    \xytree{
      &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \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{
    &amp; \xynode[-1,1]{S} \\
    \xynode{NP} &amp; &amp; \xynode{VP}}
  \drop\frm{.}
  \endxy
}
\end{verbatim}
%
\enumsentence[(\ref{misalign}$''$)]{\leavevmode
  \xy
  \xytree{
    &amp; \xynode[-1,1]{S} \\
    \xynode{NP} &amp; &amp; \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{
      &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \xynode{VP}}
    \drop\frm{.}
    \endxy
  }
\item \leavevmode
  \xy
  \xytree{
    &amp; \xynode[-1,1]{NP} \\
    \xynode{Det} &amp; &amp; \xynode{N}}
  \drop\frm{.}
  \endxy
}
\end{verbatim}
%
\eenumsentence{
\item \evnup{%
    \xy
    \xytree{
      &amp; \xynode[-1,1]{S} \\
      \xynode{NP} &amp; &amp; \xynode{VP}}
    \drop\frm{.}
    \endxy
  }
\item \leavevmode
  \xy
  \xytree{
    &amp; \xynode[-1,1]{NP} \\
    \xynode{Det} &amp; &amp; \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]{
  &amp; \xynode[-1,1]{\begin{avm}\[head &amp; \@3 \\ subcat &amp; \q&lt;
      \q&gt;\]\end{avm}} \\
  \xynode{\begin{avm}
      \[
      \@2head &amp; \@1\\
      marking &amp; \@4 \\
      subcat &amp; \q&lt; \q&gt;
      \]
    \end{avm}} &amp; &amp; \xynode{\begin{avm}
      \[
      head\@3 &amp; \[
                pos &amp; V[-A] \\
                vform &amp; da
                \] \\
      subcat &amp; \q&lt; \@2 \q&gt;
      \]
    \end{avm}}
}
\drop\frm{.}
\endxy

\begin{verbatim}
\xytree[2.2]{
  &amp; \xynode[-1,1]{\begin{avm}
      \[
      head &amp; \@3 \\
      subcat &amp; \q&lt; \q&gt;
      \]
    \end{avm}} \\
  \xynode{\begin{avm}
      \[
      \@2head &amp; \@1\\
      marking &amp; \@4 \\
      subcat &amp; \q&lt; \q&gt;
      \]
    \end{avm}} &amp; &amp; \xynode{\begin{avm}
      \[
      head\@3 &amp; \[
                pos &amp; V[-A] \\
                vform &amp; da
                \] \\
      subcat &amp; \q&lt; \@2 \q&gt;
      \]
    \end{avm}}
}
\end{verbatim}
\noindent
The overall structuring of the tree can be simplified as follows.
\begin{verbatim}
\xytree[2.2]{ &amp; \xynode[-1,1]{AVM} \\
  \xynode{AVM} &amp; &amp; \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{
  &amp; &amp; &amp; &amp; \xynode[-2,2]{pernum} \\
  &amp; &amp; \xynode[-2,-1,0,1,2]{non3sg} &amp; &amp; &amp; &amp; \xynode{3sg} \\
  \xynode{1sg} &amp; \xynode{1pl} &amp; \xynode{2sg} &amp; \xynode{2pl} &amp; \xynode{3pl}
}
\drop\frm{.}
\endxy

\bigskip
\begin{verbatim}
\xytree{
  &amp; &amp; &amp; &amp; \xynode[-2,2]{pernum} \\
  &amp; &amp; \xynode[-2,-1,0,1,2]{non3sg} &amp; &amp; &amp;
  &amp; \xynode{3sg} \\
  \xynode{1sg} &amp; \xynode{1pl}
  &amp; \xynode{2sg} &amp; \xynode{2pl}
  &amp; \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{
  &amp; \xynode[-1,1]{Agr$_s$P} \\
  \xynode{NP}
  \xyconnect[--][_.7pc](D,L){1,1}
  &amp; &amp; \xynode[-1,1]{Agr$_{s}^{'}$} \\
  &amp; \xynode{Agr$_s$}
  \xyconnect[--][_2pc](D,L){2,2}
  &amp; &amp; \xynode[-1,1]{...} \\
  &amp; &amp; \xynode{..} &amp; &amp; \xynode[-1,1]{VP} \\
  &amp; &amp; &amp; \xynode{V} &amp; &amp; \xynode{...}
}
\drop\frm{.}
\endxy

\begin{verbatim}
\xytree{
  &amp; \xynode[-1,1]{Agr$_s$P} \\
  \xynode{NP}
  \xyconnect[--][_.7pc](D,L){1,1}
  &amp; &amp; \xynode[-1,1]{Agr$_{s}^{'}$} \\
  &amp; \xynode{Agr$_s$}
  \xyconnect[--][_2pc](D,L){2,2}
  &amp; &amp; \xynode[-1,1]{...} \\
  &amp; &amp; \xynode{..} &amp; &amp; \xynode[-1,1]{VP} \\
  &amp; &amp; &amp; \xynode{V} &amp; &amp; \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}"
  &amp; \xybarnode{\qquad}
  &amp; \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}"
  &amp; \xybarnode{\qquad}
  &amp; \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
</pre></body></html>