From 9c810d5d92f2e984c76f5bf46c95e94a0020cfcf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 14 Aug 2006 00:03:15 +0000 Subject: new latex package xyling (1aug06) git-svn-id: svn://tug.org/texlive/trunk@1949 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/xyling/README | 18 + Master/texmf-dist/doc/latex/xyling/xyli-doc.pdf | Bin 0 -> 156680 bytes Master/texmf-dist/doc/latex/xyling/xyli-doc.tex | 1221 +++++++++++++++++++++++ 3 files changed, 1239 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/xyling/README create mode 100644 Master/texmf-dist/doc/latex/xyling/xyli-doc.pdf create mode 100644 Master/texmf-dist/doc/latex/xyling/xyli-doc.tex (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/latex/xyling/README b/Master/texmf-dist/doc/latex/xyling/README new file mode 100644 index 00000000000..83b0133d49a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xyling/README @@ -0,0 +1,18 @@ +This is the file README for xyling.sty. For full documentation, read +xyli-doc.pdf. + +xyling.sty is a set of macros based on xypic.sty, considered to make +it easier to draw the kind of graphical objects that are frequently +used in linguistics, such as, first of all, phrase structure trees, +but also phonological structures. It is highly flexible and can easily +be extended to any kind of schematic object that combines text with +lines, boxes etc. + +Requirements: xypic + +Licensing of this package is covered by LPPL. + +Send your comments, suggestions, and bug reports to + rvogel@ling.uni-potsdam.de + +Ralf Vogel \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xyling/xyli-doc.pdf b/Master/texmf-dist/doc/latex/xyling/xyli-doc.pdf new file mode 100644 index 00000000000..af65abf1650 Binary files /dev/null and b/Master/texmf-dist/doc/latex/xyling/xyli-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/xyling/xyli-doc.tex b/Master/texmf-dist/doc/latex/xyling/xyli-doc.tex new file mode 100644 index 00000000000..4721c505ffe --- /dev/null +++ b/Master/texmf-dist/doc/latex/xyling/xyli-doc.tex @@ -0,0 +1,1221 @@ +\documentclass[12pt,a4paper]{article} +\usepackage{avm} +\usepackage{xyling} +\usepackage{textcomp} +\usepackage{mflogo} +\usepackage{wasysym} + + +\setlength{\parindent}{0pt} +\setlength{\parskip}{1.5ex} + +\title{\texttt{xyling} -- \LaTeX\ macros for linguistic graphics using the + \texttt{xypic} module\\ version 1.1, July 31, 2006} + +\author{Ralf Vogel\\Institut f\"ur Linguistik, Universit\"at Potsdam\\\tt + rvogel@ling.uni-potsdam.de\\\tt http://www.ling.uni-potsdam.de/\~{}rvogel/xyling +} \date{December 31, 2004} +\frenchspacing\raggedbottom + + +\begin{document}\maketitle + +This file explains the usage of the tree drawing macros in +\texttt{xyling.sty}. Please also inspect the style file which contains detailed +comments of the macros. These macros build on the \texttt{xypic} package by +Kristoffer H. Rose, version 3.7. + +\fbox{\parbox{.975\textwidth}{ \texttt{xypic} is loaded by \texttt{xyling.sty} + with the \texttt{dvips} option in order to be able to produce coloured + branches. This has a bad side effect: The use of the dvips option might + cause branches to disappear when you produce a pdf file with + \texttt{pdflatex}. Likewise, other packages that use postscript, like + \texttt{pstricks}, might have such side effects. If you experience this, + there are two ways of overcoming it: + +\begin{enumerate} +\item erase the dvips option in the \texttt{xypic} call in line 57 of + \texttt{xyling.sty}, i.e., use: \texttt{\textbackslash + RequirePackage[color,all]\{xy\}}. You will no longer be able to use + coloured branches now, however. Similarly, you might have to avoid using + other postscript packages, too. + \item create the pdf file via dvips and ps2pdf conversion. This is how this + documentation pdf file is created. +\end{enumerate} }} + +Load \texttt{xyling} with \verb|\usepackage{xyling}|. + +The macros in this package model the construction of syntactic tree structures +as a genuinely graphical problem: they contain three types of objects: + +\begin{itemize} +\item the \emph{grid} +\item the \emph{node labels} +\item the \emph{branches} +\end{itemize} + +The branches and nodes are positioned relative to the grid. It is +essential that each of these three elements is constructed independent of the +other two. They can be modified without unwanted side effects. This +is, to my mind, the most important difference to other tree drawing macro +packages, where, in particular, the label width often changes the angles of the +branches. + +A second major advantage to my mind lies in using the excellent \texttt{xypic} +package. \texttt{xypic} generates \MF\ code, so the drawing of trees is not +dependent on postscript specials, as, e.g., in Wolfgang Sternefeld's +\texttt{ps-trees}. Hence, no postprocessing is required. The trees generated by +postscript specials can neither be seen in a dvi previewer (at least not in my +current version of \texttt{xdvi} for linux), nor can they be taken over into a +pdf file by \texttt{pdflatex} (but it works in dvi to pdf conversion with +\texttt{dvipdf}, or ps to pdf conversion with \texttt{ps2pdf}). + + +\section{The Grid} +\label{sec:grid} + +A tree is a simple macro of the form \verb|\Tree{ ... }|. It is an \texttt{xymatrix}, with +\verb|&| as column separator and \verb|\\| as row separator. You should be +familiar with this structure from tabulars and similar structures. + +\verb|\Tree| has an optional argument that can be used for changing the space +between columns. The default is 0, wich does not actually mean 0 space, but +rather the default space. A negative value makes the tree smaller, a positive +value makes it wider: + +\begin{minipage}{.5\linewidth} + \begin{tabular}{l@{~~=~~}l} + \Tree{A & B} & \verb|\Tree{A & B}|\\ + \Tree[1]{A & B} & \verb|\Tree[1]{A & B}|\\ + \Tree[-1]{A & B} & \verb|\Tree[-1]{A & B}| + \end{tabular} +\end{minipage} + + +The distance between rows can also be controlled using the ``k''ontrolled version of +\verb|\Tree|, \verb|\Treek|, which has one more obligatory argument, the distance +between rows, which is defaulted to 2pc in \verb|\Tree|. Check the examples in table +\ref{tab:treek}. + + \begin{table}[htbp] + \begin{center} + \begin{tabular}{|l@{~~=~~}p{.5\linewidth}|}\hline + \Tree{ & VP \\ V && NP } & \verb|\Tree{ & VP \\ Vzero && NP }|\\\hline + \Treek{1}{ & VP \\ V && NP } & \verb|\Treek{1}{ & VP \\ V && NP }|\\\hline + \Treek{3}{ & VP \\ V && NP } & \verb|\Treek{3}{ & VP \\ V && NP }|\\\hline + \Treek{4}{ & VP \\ V && NP } & \verb|\Treek{4}{ & VP \\ V && NP }|\\\hline + \end{tabular}\\\medskip + \caption{Effects of the first argument of \textbackslash \texttt{Treek}} + \label{tab:treek} + \end{center} + \end{table} + \section{The Nodes} + \label{sec:nodes} + +A node is introduced with the command \verb|\K{...}|. Text is centered, both +horizontally and vertically! This means that text boxes might not be aligned on +the same baseline in \texttt{xypic}, using its standard command for text +insertion, \verb|\txt|. You can see this here: + +\underline{\Tree{\txt{muss~~} \txt{musg~~} \txt{must~~} \txt{Muss~~} \txt{Musg~~}}} + +The code:\\ +\verb|\Tree{\txt{muss~~}| \verb|\txt{musg~~}| \verb|\txt{must~~}| \newline +\verb|\txt{Muss~~}| \verb|\txt{Musg~~}}| + +The command \verb|\K| contains a strut of 18pt to prevent this. This is perfect +for up to 12pt fonts: + +\underline{\Tree{\K{muss~~} & \K{musg~~} & \K{must~~} &\K{Muss~~} & \K{Musg~~}}} + +The code:\\ \verb|\Tree{\K{muss~~}&| \verb|\K{musg~~}&| \verb|\K{must~~}&| + \verb|\K{Muss~~}&| \verb|\K{Musg~~}}| + +Node labels have the width 2pc, which is fine, because most node labels consist +of two upright letters, like NP, VP etc. Extremely wide labels do not affect the +matrix, because the node width is determined independently of the content of the +node -- by the value \verb|@W=2pc| in the definition of \verb|\Tree| and +\verb|\Treek|. + +\verb|\K| has an optional argument to move text freely horizontally -- measured +in pc. Positive values move the label to the right, negative values to the +left. 1pc is about 0.5 em in a 12pt font. Horizontal adjustments are necessary +for wide nodes: + +\Tree{ + & \K{VP} \B{dl}\B{dr} \\ + \K{\emph{very very very wide node}} & & \K{V$^0$} } + +The code:\vspace{-2ex} +\begin{verbatim} +\Tree{ & \K{VP} \B{dl}\B{dr} \\ + \K{\emph{very very very wide node}} & & \K{V$^0$} } +\end{verbatim} + +We have two solutions to this problem. The global one is widen the inter-column +space with the optional argument of \verb|\Tree|: + +\Tree[1]{ + & \K{VP} \B{dr}\B{dl} \\ +\K{\emph{very very very wide node}} & & \K{V$^0$} \\ +} + +The code:\vspace{-2ex} +\begin{verbatim} +\Tree[1]{ & \K{VP} \B{dr}\B{dl} \\ +\K{\emph{very very very wide node}} & & \K{V$^0$} } +\end{verbatim} + +The second solution is moving the wide node a bit to the left, using the +optional argument of \verb|\K|: + + \Tree{ + & \K{VP} \B{dl}\B{dr} \\ + \K[-5]{\emph{very very very wide node}} & & \K{V$^0$} } + +The code:\vspace{-2ex} +\begin{verbatim} + \Tree{ & \K{VP} \B{dr}\B{dl} \\ + \K[-5]{\emph{very very very wide node}} & & \K{V$^0$} } +\end{verbatim} + +\verb|\Kk| offers full control over the vertical and horizontal dimension. The +optional argument of \verb|\Kk| is the same as that of \verb|\K|, but there is +an additional obligatory argument denoting the vertical adjustment. So the +syntax is: \verb|\Kk[horizontal adjustment]{vertical adjustment}{node label}|. +The command \verb|\Kk[1]{1}{VP}| places the node VP 1pc right of and 1pc higher +than the standard position. This in fact allows you to put anything anywhere in +the tree. You can add comments to the side of the tree etc. + +Often, especially in the terminal nodes, you might need more than one line of +text. Use the command \verb|\Below| for putting text below text inserted by +\verb|\K|. Check the following example: + +\begin{minipage}[t]{2cm} + \Tree{\K{NP}\B{d} \\ \K{the}\Below{little}\Below{dog}} +\end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} +\Tree{\K{NP}\B{d} \\ +\K{the}\Below{little}\Below{dog}} \end{verbatim} +\end{minipage} + +\verb|\Below| has an optional argument for the vertical adjustment, negative +value lowers the text, positive value raises it. There also exists a kontrolled +version, \verb|Belowk|, which has the horizontal adjustment as its first +obligatory argument in addition. + + +\section{The Branches} +\label{sec:branches} + +Branch commands are inserted in the same field as their dominating node. The +simplest command is \verb|\B|. It has one obligatory argument, the description +of the target field. It is given in the steps it takes to reach it. For +instance, \verb|\B{dl}| draws a branch to the field one step down and one step +left from the current field. Use \texttt{u} and \texttt{r} for upwards and +rightwards steps. Upwards branches will strike through the label, however, so +this is not very useful. Branches should always go downwards. + +We are now ready to draw our first tree: + +\begin{center} \label{firsttree} + \Tree{ & \K{VP}\B{dl}\B{dr} \\ + \K{NP}\B{d} & & \K{V$'$}\B{dl}\B{dr} \\ + \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\ + & \K{\emph{loves}} & & \K{\emph{Mary}} } +\end{center} +This is the code: + +\begin{verbatim} +\Tree{ & \K{VP}\B{dl}\B{dr} \\ + \K{NP}\B{d} & & \K{V$'$}\B{dl}\B{dr} \\ + \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\ + & \K{\emph{loves}} & & \K{\emph{Mary}} }\end{verbatim} + +\verb|\B| has an optional argument, the vertical adjustment of the starting +position of the branch, negative value, e.g. \verb|\B[-1]{d}|, lowers the +starting position, positive value raises it. + +Some grammar formalisms, require labels on branches -- like HPSG, where head +and complement are explicitly denoted with the labels $H$ and $C$. This is +quite easy to integrate. The command \verb|\B| is based on the \texttt{xypic} +command \verb|\ar| which has the option of putting a label on a line. It uses +the syntax of subscripting and superscripting, i.e., \verb|^{}| and +\verb|_{}|. If you put these commands right behind a branch command, you will +get labels on the branch, \verb|_{}| puts it on the branches left side, and +\verb|^{}| on its right. The label is written in math mode, i.e., slanted, +unless you specify it to be in normal text font with, e.g. +\verb|\textnormal{}|. Here comes an example:\footnote{Thanks to Doug Arnold + for his suggestion to include this feature.} + +\begin{center} + \Tree{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\ + \K{NP}\B{d} & & \K{V$'$}\B{dl}_H\B{dr}^C \\ + \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\ + & \K{\emph{loves}} & & \K{\emph{Mary}} } + \end{center} +\begin{verbatim} +\Tree{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\ + \K{NP}\B{d} & & \K{V$'$}\B{dl}_H\B{dr}^C \\ + \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\ + & \K{\emph{loves}} & & \K{\emph{Mary}} } +\end{verbatim} + +There is no limitation on the number of branches either: + +\Tree{ & \K{S} \B{dl}\B{d}\B{dr}\B{drr} \\ +\K{NP}\B{d} & \K{V}\B{d} & \K{NP}\B{d} & \K{NP}\B{d} & \\ + \K{John} & \K{gave} & \K{Mary} & \K[2]{cookies} } +\begin{verbatim} +\Tree{ & \K{S} \B{dl}\B{d}\B{dr}\B{drr} \\ +\K{NP}\B{d} & \K{V}\B{d} & \K{NP}\B{d} & \K{NP}\B{d} \\ + \K{John} & \K{gave} & \K{Mary} & \K[2]{cookies} } +\end{verbatim} + +HPSG is also famous for crossing branches in cases where the linear order +and the hierarchical structure do not match. You can, of course, also let +branches cross. There are no system specific limits to what kinds of trees +you might want to draw. An admittedly ugly looking example is the +following German object initial sentence: + +\Tree[.5]{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\ +\K{Subject}\B{dddrr} && \K{V$'$}\B{dl}_{H}\B{dr}^{C} \\ +& \K{V$^{0}$}\B{dd} && \K{Object}\B{ddlll} \\ \\ +\K{B\"ucher}\Below{books} & \K{kaufte} \Below{bought} +& \K{Maria}\Below{Maria} +} +\begin{verbatim} +\Tree[.5]{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\ +\K{Subject}\B{dddrr} && \K{V$'$}\B{dl}_{H}\B{dr}^{C} \\ +& \K{V$^{0}$}\B{dd} && \K{Object}\B{ddlll} \\ \\ +\K{B\"ucher}\Below{books} & \K{kaufte} \Below{bought} +& \K{Maria}\Below{Maria} } +\end{verbatim} + + +We also have two kontrolled versions of the branching command, \verb|\Bkk| and +\verb|\Bk|. Both adjust the starting and target positions of branches. They have +three arguments, 1: adjustment of starting position, 2: adjustment of target +position, 3: destination. \verb|\Bk| only allows for vertical adjustments and +has numbers as its first two arguments. \verb|\Bkk| has comma-separated number +pairs as its first two arguments, for horizontal and vertical adjustment of +starting and target position. This gives you full control over the branches. +Some examples: + +\begin{minipage}[t]{3cm} + \fbox{\Treek{3} {\K{DP}\Below{[+definite]}\B[-5]{d}\\ + \K{\emph{the~bible}}}} + \end{minipage} + \begin{minipage}[t]{10cm} +\begin{verbatim} + \fbox{\Treek{3}{\K{DP}\Below{[+definite]} + \B[-5]{d}\\ \K{\emph{the~bible}} }} +\end{verbatim} + \end{minipage} + +\begin{minipage}[t]{3cm} + \Tree{ & \K{XP} \B{dl}\B{dr}\Bkk{2,0}{2,0}{dr} \\ + \K{YP} & & \K{ZP}} +\end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} +\Tree{ & \K{XP}\B{dl}\B{dr}\Bkk{2,0}{2,0}{dr} \\ +\K{YP}& & \K{ZP}}\end{verbatim} +\end{minipage} + + +\section{Abbreviations} +\label{sec:abbreviations} + +The usage of branching commands can be made much easier by the definition of +macros for most frequently used combinations. These are the ones defined in +\texttt{xyling.sty}. Define new ones if you need them and/or change those given +here: + +\begin{verbatim} +% \D goes to the position in the same column, one row below. +% The optional argument is the vertical adjustment of the +% starting position. + +\newcommand{\D}[1][0]{\B[#1]{d}} +\newcommand{\Dk}[2]{\Bk{#1}{#2}{d}} + +% \Dk is the \Bk version, i.e., it has two obligatory arguments +% defining the vertical adjustments of starting position and +% target position. + +\newcommand{\DL}[1][0]{\B[#1]{dl}} +\newcommand{\DLL}[1][0]{\B[#1]{dll}} +\newcommand{\DLLL}[1][0]{\B[#1]{dlll}} +\newcommand{\DR}[1][0]{\B[#1]{dr}} +\newcommand{\DRR}[1][0]{\B[#1]{drr}} +\newcommand{\DRRR}[1][0]{\B[#1]{drrr}} + +\newcommand{\DLk}[2][0]{\Bk{#1}{#2}{dl}} +\newcommand{\DLLk}[2][0]{\Bk{#1}{#2}{dll}} +\newcommand{\DLLLk}[2][0]{\Bk{#1}{#2}{dlll}} +\newcommand{\DRk}[2][0]{\Bk{#1}{#2}{dr}} +\newcommand{\DRRk}[2][0]{\Bk{#1}{#2}{drr}} +\newcommand{\DRRRk}[2][0]{\Bk{#1}{#2}{drrr}} + +% Abbreviations for binary branches: + +\newcommand{\V}[1][0]{\DL[#1]\DR[#1]} +\newcommand{\VV}[1][0]{\DLL[#1]\DRR[#1]} +\newcommand{\VR}[1][0]{\DL[#1]\DRR[#1]} +\newcommand{\VL}[1][0]{\DLL[#1]\DR[#1]} +\newcommand{\VVV}[1][0]{\DLLL[#1]\DRRR[#1]} +\newcommand{\VVR}[1][0]{\DLL[#1]\DRRR[#1]} +\newcommand{\VVL}[1][0]{\DLLL[#1]\DRR[#1]} +\newcommand{\VLL}[1][0]{\DLLL[#1]\DR[#1]} +\newcommand{\VRR}[1][0]{\DL[#1]\DRRR[#1]} + +% Define more if you need them. + +% Let's make further abbreviations. A default VP has a +% \V branch. So let's define \VP accordingly, and likewise +% Vbar, IP, CP etc.: + +\newcommand{\VP}[1][]{\K{VP$_{#1}$}\V} +\newcommand{\Vbar}{\K[.5]{V$'$}\V} + +\newcommand{\IP}[1][]{\K{IP$_{#1}$}\V} +\newcommand{\Ibar}{\K[.5]{I$'$}\V} + +\newcommand{\CP}[1][]{\K{CP$_{#1}$}\V} +\newcommand{\Cbar}{\K[.5]{C$'$}\V} +\newcommand{\Nbar}{\K[.5]{N$'$}\V} + +\newcommand{\PP}[1][]{\K{PP$_{#1}$}\V} +\newcommand{\DP}[1][]{\K{DP$_{#1}$}\V} + +\newcommand{\AuxP}[1][]{\K{IP$_{#1}$}\V} +\newcommand{\Auxbar}{\K[.5]{I$'$}\V} + +% Nodes reasonably without branch: + +\newcommand{\NP}[1][]{\K{NP$_{#1}$}} +\newcommand{\Nzero}[1][]{\K[1]{N$^{0}_{#1}$}} +\newcommand{\Vzero}[1][]{\K[1]{V$^{0}_{#1}$}} +\newcommand{\Izero}[1][]{\K{I$^{0}_{#1}$}} +\newcommand{\Auxzero}[1][]{\K{I$^{0}_{#1}$}} +\newcommand{\Czero}[1][]{\K{C$^{0}_{#1}$}} +\newcommand{\Pzero}[1][]{\K{P$^{0}_{#1}$}} +\newcommand{\Dzero}[1][]{\K{D$^{0}_{#1}$}} + +% Note that all of these commands, except for the +% Xbar nodes, have an optional argument for an index. +% If you use indices longer than one letter, you might +% need to do horizontal adjustment and have to use +% \K instead. + +% This default system only needs new nodes for the +% terminals. Let's define \T parallel to \K. +% \T has a vertical branch to the upper node, text is +% italicised. The optional argument, as before, +% allows for horizontal adjustment of the text: + +\newcommand{\T}[2][0]{\POS[]\POS+(0,2) +\ar@{-}[u]-(0,4) \POS[]\K[#1]{\textit{#2}}} +\end{verbatim} + +The code for the tree on page \pageref{firsttree} can now be reduced +dramatically: + +\begin{verbatim} +\Tree { & \VP \\ + \NP & & \Vbar \\ + \T{John} & \Vzero & & \NP \\ + & \T{loves} & & \T{Mary} + } +\end{verbatim} + +Here is the tree, just to assure you: + +\begin{center} + \Tree { & \VP \\ + \NP & & \Vbar \\ + \T{John}&\Vzero & & \NP \\ + &\T{loves} & & \T{Mary} } + \end{center} + +Chomskyan syntacticians like movement traces, here is one: + +\begin{verbatim} +\newcommand{\Trace}[1][i]{\K[0.5]{t$_{#1}$}} +\end{verbatim} + +The optional argument, as with the \verb|\XP|, \verb|\Xzero| commands above, is +the index, here defaulted to `\texttt{i}'. + + + +\section{Triangles} +\label{sec:triangles} + +Phrase structure trees often use triangles as abbreviations for larger +structures which shall not be fledged out in full detail. The command +\verb|\TRi| can be used instead of branching commands, introducing a +triangle:\footnote{Notice that the top node in this tree, S, is inserted exactly + in the middle between two columns -- due to the horizontal adjustment of + 5.2pc. The horizontal distance between the centers of two neighbour fields is + 10.4pc. The command \texttt{\textbackslash Bkk} is then used to get symmetric + branches from this position, by adjusting the starting position horizontally + by 5.2pc. You see that the label and branch placement are not limited to the + possibilities specified by the grid. It only provides a usually satisfactory + default.} + +\begin{center} + \Tree{ && \K[5.2]{S}\Bkk{5.2,0}{0,0}{dl}\Bkk{5.2,0}{0,0}{drr}\\ + &\NP\TRi &&& \VP \\ +& \K{\emph{my beloved}}\Below{\emph{wife}} &&\Vzero && \NP\TRi[2] \\ +& && \T{likes}&&\K{\emph{our old house}} + } +\end{center} + +\begin{verbatim} + \Tree{ && \K[5.2]{S}\Bkk{5.2,0}{0,0}{dl} + \Bkk{5.2,0}{0,0}{drr} \\ + &\NP\TRi && & \VP \\ +& \K{\emph{my beloved}}\Below{\emph{wife}} && + \Vzero && \NP\TRi[2] \\ + &&& \T{likes} && \K{\emph{our old house}} + } +\end{verbatim} + +Triangles need the nodes they refer to in the next lower row, in particular, +don't forget the node [d] from the insertion point of the triangle. You will +get an error message otherwise. The text below the triangle is inserted in the +field [d] from the insertion point + +Notice also that the first column in the tree is empty. It's only purpose is +providing a field for the left bottom edge of the left triangle. + +\verb|\TRi| is a symmetric triangle. It has an optional argument, the horizontal +adjustment, negative value makes it narrower, positive value makes it wider, as +exemplified in the triangle for `\emph{our old house}' in the tree above. + + +\verb|\DTRi| and \verb|\TRiD| are rectangles, \verb|\DTRi| has a [d] branch on +the left, \verb|\TRiD| on the right, the optional argument allows for horizontal +adjustment. + +The kontrolled version of the triangle, \verb|\Trik|, has two obligatory +arguments for the left and right horizontal adjustment, which can be specified +separately here. This potentially leads to asymmetric triangles. The syntax +is:\newline \verb|\TRik{left}{right}|, where \verb|\TRik{0}{0} = \TRi[0] = \TRi|. + + + +\section{Links} +\label{sec:links} + +It occurs very frequently that relations between elements of a tree shall be +indicated with linking arrows, for instance to illustrate syntactic movement. +Links are inserted with the commands \verb|\Link| and \verb|Linkk|. Both have as +optional argument the line style, which could be one of +\verb|-,->,<-,.,.>,<.,--,|\linebreak \verb|-->,<--,| a.o. \verb|\Linkk| has as +its first argument the curving specification. It is defaulted to 1.33pc in +\verb|\Link|. This might not be sufficient in many cases. The second obligatory +argument of \verb|\Linkk| and the first obligatory argument of \verb|\Link| is +the destination field specification. + +\begin{center} + \Tree{ & \CP \\ + \NP[j] && \Cbar \\ + \T{What}& \Czero[i] && \IP \\ + &\T{did} & \NP && \Ibar \\ + & &\T{John}&\Trace\Linkk[-->]{2.5}{llu}&&\VP \\ + & & &&\Vzero && \Trace[j]\Linkk[.>]{4.5}{-3,-6}\\ + & & &&\T{say}&& } +\end{center} + +The code is as follows: + +\begin{verbatim} +\Tree{ & \CP \\ + \NP[j] && \Cbar \\ + \T{What}& \Czero[i] && \IP \\ + &\T{did} & \NP && \Ibar \\ + & &\T{John}&\Trace + \Linkk[-->]{2.5}{llu}&&\VP \\ + & & &&\Vzero && \Trace[j] + \Linkk[.>]{4.5}{-3,-6}\\ + & & &&\T{say}&& } + +\end{verbatim} + +Note that it is possible to specify the target location in terms of the number +of `hops', as done for the long link here: \verb|\Linkk[.>]{4.5}{-3,-6}| states +that the target of the link is 3 fields up and 6 fields left of the current +field. This is shorter than specifying it with ``\texttt{uuullllll}''. + +English affix hopping according to Chomsky (1981): + +\begin{minipage}[t]{5cm} + \Tree{ & \IP \\ + \NP & & \Ibar \\ + &\Izero\D& & \VP \\ + &\Trace &\Vzero\D & & \NP \\ + & &\K[6]{V+INFL}\Link[<-]{-1,-1} + } +\end{minipage} +\begin{minipage}[t]{9cm} +\begin{verbatim} + \Tree{ & \IP \\ + \NP & & \Ibar \\ + &\Izero\D& & \VP \\ + &\Trace &\Vzero\D & & \NP \\ + & &\K[6]{V+INFL} \Link[<-]{ul} + } +\end{verbatim} +\end{minipage} + +Finally, the commands \verb|\Link| and \verb|\Linkk| link labels to the left of +the tree. Links which are to the right of the tree, on its top, are specified +with \verb|\UpLink| and \verb|\UpLinkk|: + +\begin{minipage}[t]{4cm} + \Tree{ & \IP \\ \NP &&\Ibar \\ & \Izero &&\K{VP} \UpLink{-2,-2}} +\end{minipage} +\begin{minipage}[t]{8cm} +\begin{verbatim} +\Tree{ & \IP \\ + \NP & &\Ibar \\ + & \Izero &&\K{VP} \UpLink{-2,-2}} +\end{verbatim} +\end{minipage} + + + +\section{Highlighting} +\label{sec:highlighting} + +Node labels are often highlighted with surrounding circles or squares, and, in +particular in presentations, with colours. Several ways of doing this are +integrated in \texttt{xyling}. + + +\subsection{Highlighting sections of a tree with a rectangle} +\label{sec:treesection} + +The command \verb|\QS| draws a rectangle around two fields of the tree specified +by their absolute address. The syntax of the command is: \\ +\verb|\QS[line style]{top left corner}{bottom right corner}|. The absolute +address of a field is a number pair. The field ``1,1'' is the top left field of +the grid. The fields in the first row are 1,1 1,2 1,3 etc. Those in the second +row are 2,1 2,2 2,3 etc. Because the field addresses are given in absolute +terms, it makes no difference where within the \verb|\Tree| specification a +\verb|\QS| command appears: + +\begin{minipage}[t]{4cm} + \Tree{ & \VP \\ \NP && \Vbar \\ & \Vzero && \NP \QS{1,1}{2,3} + \QS[.]{2,2}{3,4} + } +\end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} + \Tree{ & \VP \\ + \NP & & \Vbar \\ + & \Vzero && \NP \QS{1,1}{2,3} + \QS[.]{2,2}{3,4} + } +\end{verbatim} +\end{minipage} + + +\subsection{Highlighting node labels with circles and squares} +\label{sec:circles} + +The command \verb|\OO| draws a circle around the node label in the current +field. The command \verb|\QQ| draws a square around it: + +\begin{minipage}[t]{4cm} + \Tree{ & \VP \\ + \NP\OO & & \Vbar \\ + & \Vzero && \NP\QQ } + \end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} + \Tree{ & \VP \\ + \NP\OO & & \Vbar \\ + & \Vzero && \NP\QQ } +\end{verbatim} +\end{minipage} + +As you can see, the branches go inside the circles and squares. We need to define +branches which start and/or end at circles or squares. + +The following are branches that always work. Starting point for all branches is +the same point on the circle. This makes branches rather short, and changes the +angles of diagonal branches: + + +\begin{verbatim} +\newcommand{\BoO}[1]{\Bk{-1.2}{1.2}{#1}} +% branch with circled start and target + +\newcommand{\Bo}[1]{\Bk{-1.2}{0}{#1}} +% branch with circled start + +\newcommand{\BO}[1]{\Bk{0}{1.2}{#1}} +% branch with circled target +\end{verbatim} + +\begin{minipage}[t]{4cm} + \Tree{ & \K{VP}\OO\Bo{dl}\Bo{dr} \\ + \NP & & \Vbar \\ + & \Vzero && \NP\QQ } + \end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} + \Tree{ & \K{VP}\OO\Bo{dl}\Bo{dr} \\ + \NP & & \Vbar \\ + & \Vzero && \NP\QQ } +\end{verbatim} +\end{minipage} + +The two \texttt{[dl]} and \texttt{[dr]} branches are no longer parallel. To get +this, the branches should start at different sides of the circle, as if they +initiated at the old position within the circle: + +\begin{verbatim} +\newcommand{\DRo}[1][dr]{\Bkk{1.6,-1}{0,0}{#1}} +\newcommand{\DLo}[1][dl]{\Bkk{-1.6,-1.0}{0,0}{#1}} + +\newcommand{\DRoO}[1][dr]{\Bkk{1.6,-1}{-1.8,1}{#1}} +\newcommand{\DLoO}[1][dl]{\Bkk{-1.6,-1}{1.8,1}{#1}} + +\newcommand{\DRO}[1][dr]{\Bkk{0,0}{-1.8,1}{#1}} +\newcommand{\DLO}[1][dl]{\Bkk{0,0}{1.8,1}{#1}} +\end{verbatim} + +This helps: + +\begin{minipage}[t]{4cm} + \Tree{ & \K{VP}\OO\DLo\DRo \\ + \NP & & \Vbar \\ + & \Vzero && \NP\QQ } + \end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} + \Tree{ & \K{VP}\OO\DLo\DRo \\ + \NP & & \Vbar \\ + & \Vzero && \NP\QQ } +\end{verbatim} +\end{minipage} + +The same has to be done with branches to and from squares: + +\begin{verbatim} +\newcommand{\DRq}[1][dr]{\Bkk{1.5,-1}{0,0}{#1}} +\newcommand{\DLq}[1][dl]{\Bkk{-1.5,-1}{0,0}{#1}} + +\newcommand{\DRQ}[1][dr]{\Bkk{0,0}{-2,1}{#1}} +\newcommand{\DLQ}[1][dl]{\Bkk{0,0}{2,1}{#1}} + +\newcommand{\DRqQ}[1][dr]{\Bkk{1.5,-1}{-2,1}{#1}} +\newcommand{\DLqQ}[1][dl]{\Bkk{1.5,-1}{2,1}{#1}} + +\newcommand{\DRoQ}[1][dr]{\Bkk{1.5,-1}{-2,1}{#1}} +\newcommand{\DLoQ}[1][dl]{\Bkk{-1.5,-1}{2,1}{#1}} + +\newcommand{\DRqO}[1][dr]{\Bkk{1.6,-1}{-1.8,1}{#1}} +\newcommand{\DLqO}[1][dl]{\Bkk{1.6,-1}{1.8,1}{#1}} + +\newcommand{\Dq}{\Dk{-1.1}{0}} + % only squared starting node +\newcommand{\DQ}{\Dk{0}{1}} + % only squared target node +\newcommand{\DqO}{\Dk{-1.1}{1.2}} + % squared start and circled target +\newcommand{\DoQ}{\Dk{-1.3}{1}} + % circled start and squared target +\newcommand{\DqQ}{\Dk{-1.1}{1}} + % square start and squared target +\end{verbatim} + +\begin{minipage}[t]{4cm} + \Tree{ & \K{VP}\OO\DLo\DRo \\ + \NP & & \K{V$'$}\DL\DRQ \\ + & \Vzero && \NP\QQ } + \end{minipage} +\begin{minipage}[t]{10cm} +\begin{verbatim} + \Tree{ & \K{VP}\OO\DLo\DRo \\ + \NP & & \K{V$'$}\DL\DRQ \\ + & \Vzero && \NP\QQ } +\end{verbatim} +\end{minipage} + +The style file contains many abbreviations for the branch commands including +circles and squares around node labels. + + + +\subsection{Highlighting with Colours} +\label{sec:colours} + +Especially in presentations, colours are an option for highlighting +parts of a tree. \texttt{xypic} uses the postscript extensions to make this +possible. Check the \texttt{xypic} documentation for more on colours, especially +for defining new colours. I defined blue, red, green and gray versions of the +standard commands \verb|\Bkk| and \verb|\Kk| and the commands derived from +them. So it is quite painless to integrate colour: + +\begin{minipage}[t]{5cm} + \Tree{ & \Kred{IP}\Vred \\ + \Kblue{NP}\Bblue{d} & & \Kred{I$'$}\Vred \\ + \Tblue{John} & \Kred{I$^{0}$} && \Kgray{VP} \Vgray \\ + && \Kgreen{t}\Linkblue{ull}&&\Kgray{V$'$}\Vgray\\ + &&&\Kgray{V$^{0}$}&& \Kgray{NP} } +\end{minipage} +\begin{minipage}[t]{8cm} +\begin{verbatim} +\Tree{ + & \Kred{IP}\Vred \\ + \Kblue{NP}\Bblue{d} && + \Kred{I$'$}\Vred \\ + \Tblue{John}& \Kred{I$^{0}$} && + \Kgray{VP} \Vgray \\ + && \Kgreen{t}\Linkblue{ull}&& + \Kgray{V$'$}\Vgray\\ + &&&\Kgray{V$^{0}$}&& \Kgray{NP} } +\end{verbatim} +\end{minipage} + +There also are macros for coloured circles and squares around nodes. They are +called \verb|\OOred, \QQred| etc. But they do not fully function yet. They have +to be inserted as first element within a field, right after the \verb|&|, and +must be followed by an empty group, \verb|{}|. + +\section{Other Structures} +\label{sec:other} + +\subsection{Lexical Functional Grammar} + +On the basis of the general commands for grids, labels and branches, it is easy +to define commands for other phrase structure formats, or any kind of graphical +object that mixes text and lines. The following macros help drawing LFG trees: + +\begin{verbatim} +\newcommand{\Treelfg}[2][0]{\Treek[#1]{3}{#2}} +\newcommand{\Klfg}[2][]{% + \K{$\uparrow _{\textsc{\scriptsize #1}}=\downarrow$}\Below{#2}} +\newcommand{\Blfg}[1]{\Bk{-5}{0}{#1}} +\newcommand{\Vlfg}{\Blfg{dl}\Blfg{dr}} +\end{verbatim} + +Note that \verb|\Klfg| produces two lines: The inheritance specification and the +category label. The optional argument is the grammatical function, which, if +available, is indexed to the \verb|$\uparrow$| in the first line. Here comes an +example: \vspace*{-3ex} + +\begin{minipage}[t]{4.5cm} +\Treelfg{ & \Kk{-5}{S}\Vlfg\\ + \Klfg[su]{NP}\Blfg{d} & &\Klfg{VP} \Vlfg\\ + \Klfg{N$^{0}$}\Blfg{d}&\Klfg{V$^{0}$}\Blfg{d} && \Klfg[ob]{NP}\Blfg{d} \\ + \K{\emph{John}} &\K{\emph{loves}}& & \K{\emph{Mary}}} +\end{minipage} +\begin{minipage}[t]{9cm} +\begin{verbatim} + +\Treelfg{ + & \Kk{-5}{S}\Vlfg \\ +\Klfg[su]{NP}\Blfg{d} & &\Klfg{VP}\Vlfg\\ +\Klfg{N$^{0}$}\Blfg{d}&\Klfg{V$^{0}$} +\Blfg{d} && \Klfg[ob]{NP}\Blfg{d} \\ +\K{\emph{John}} &\K{\emph{loves}}& & + \K{\emph{Mary}} + } +\end{verbatim} +\end{minipage} + +Much of this can be abbreviated in the manner exemplified above. Feel free to do +so. Command names like \verb|\Klfg| etc. could, of course, also be shortened. + + +\subsection{Head Driven Phrase Structure Grammar} + +The following structure is from the HPSG introduction book ``Syntactic +Theory. A Formal Introduction'' (second edition, 2003) by Sag, Wasow \&\ +Bender, page 207: + +\newcommand{\AVMone}{\begin{avm}\@1NP$_{i}$\end{avm}} +\newcommand{\AVMtwo}{\begin{avm} \[ SPR & \q< \@1 \q> \\ COMPS & \q<~ \q> \] \end{avm}} +\newcommand{\AVMthree}{\begin{avm} \[ SPR & \q< \@1 \q> \\ COMPS & \q< \@2 \q> \\ + ARG-ST & \q< \@1 , \@2 \q> \] \end{avm}} +\newcommand{\AVMfour}{\begin{avm}\@2NP$_{i}$\end{avm}} + + \Treek[3]{3}{ & \K{S}\V \\ \Kk{-1}{\AVMone}\D && \K{VP} + \Below[-4]{\AVMtwo}\B[-13]{ddl}\B[-13]{ddr} + \\\K{They} \\ + & \K{V} \Below[-6]{\AVMthree} && \Kk{-1}{\AVMfour}\B{dd}\\ &\K{}\D[-1] \\ &\K{saw} && \K{themselves}} + +How did we draw the tree? First, we use Christopher Manning's avm.sty to define the AVM +structures of each node separately: + +\begin{verbatim} +\newcommand{\AVMone}{\begin{avm}\@1NP$_{i}$\end{avm}} +\newcommand{\AVMtwo}{\begin{avm} + \[ SPR & \q< \@1 \q> \\ + COMPS & \q<~ \q> \] \end{avm}} +\newcommand{\AVMthree}{\begin{avm} + \[ SPR & \q< \@1 \q> \\ + COMPS & \q< \@2 \q> \\ + ARG-ST & \q< \@1 , \@2 \q> \] \end{avm}} +\newcommand{\AVMfour}{\begin{avm}\@2NP$_{i}$\end{avm}} +\end{verbatim} + +Next, we make up the tree, and call the four AVM nodes within \verb|\K| or +\verb|\Below|. The most tricky issue is the determination for the tree widths and how to +deal with the unequal sizes of the nodes. As you see in the code below, I exploited +three features of xyling: setting row and column distance to a new value, adjusting +branches, and the huge nodes VP and V were extended over two rows! + +\footnotesize +\begin{verbatim} + \Treek[3]{3}{ & \K{S}\V \\ % adjust grid! +\Kk{-1}{\AVMone}\D && \K{VP} + \Below[-4]{\AVMtwo}\B[-13]{ddl}\B[-13]{ddr}\\ % Branches go ddr/ddl! + \K{They} \\ % skipped row for VP! + & \K{V} + \Below[-6]{\AVMthree} && \Kk{-1}{\AVMfour}\B{dd}\\ % Branch goes dd! + &\K{}\D[-1] \\ % Branch starts here! + &\K{saw} && \K{themselves}} + +\end{verbatim} +\normalsize + +Note an incompatibility of avm.sty: When I first experimented with xyling.sty and +avm.sty, the linebraks in my avm's disappeared. It took me a while to figure out that +this was not due to xyling, but caused by the tabularx package which I had loaded for +another purpose. So, if you use avm.sty, don't use tabularx! + +\subsection{Arrows in Text} +\label{sec:text} + +Even when we do not use trees, but only strings or bracketed notations, we +sometimes want to express relations between elements within these notations by +arrows. It is possible to use \texttt{xyling} macros for this, too. We first +define a new grid, \verb|\TExt|. It has an obligatory argument -- the text, +which can be split into several fields by the field separator \verb|&|. The +distance between fields is set to 0, such that even parts of words can be put in +subsequent fields without visible effect: + +\begin{minipage}[t]{3cm} + \TExt{\textnormal{nood} & \textnormal{les}&\textnormal{~~}& + \textnormal{noodles}} +\end{minipage} +\begin{minipage}[t]{8cm} +\begin{verbatim} + \TExt{\textnormal{nood} & \textnormal{les} & + \textnormal{~~} & \textnormal{noodles}}\end{verbatim} +\end{minipage} + +The fields within the \verb|\TExt| environment are inserted with \verb|\Txt| or +\verb|\TXT|. They mainly provide a strut to yield correct horizontal alignment. +\verb|\Txt| has a blank before the text, \verb|\TXT| has none. I.e., if a word +is split over two fields, the second part of the word should be introduced with +\verb|\TXT|. Likewise, the first word of the whole string. + +The arrows differ in their depths, such that several arrows can be used within +one \verb|\TExt| without overlapping. The narrowest connector is called +\verb|SCOn|, we then have \verb|\COn, \COnn| and \verb|\COnnn|. They have an +optional argument for the line style, \verb|-| for solid, \verb|--| for dashed, +\verb|.| for dotted. The commands are inserted at the starting point of the +arrow. The obligatory argument is the target field destination, e.g. +\texttt{[ll]}, \texttt{[r]} etc. A simple example: + +\begin{minipage}[t]{5cm} + \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COn{ll} & \Txt{?}} +\end{minipage} +\begin{minipage}[t]{9cm} +\begin{verbatim} +\TExt{\TXT{What} & \Txt{did you see} & +\Txt{t}\COn{ll} & \Txt{?}} +\end{verbatim} +\end{minipage} + +The command \verb|\COnk| allows for control of the link depth with its first +obligatory argument. The other arguments are as before. + +We also have connectors with labels, which can be above or below the arrow. This +depends on whether the arrow goes from left to right or vice versa. \verb|\COnl| +with right to left yields a label above the arrow: + +\begin{minipage}[t]{5cm} + \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COnl{ll}{movement} & \Txt{?}} +\end{minipage} +\begin{minipage}[t]{9cm} +\begin{verbatim} +\TExt{\TXT{What} & \Txt{did you see} & +\Txt{t}\COnl{ll}{movement} & \Txt{?}} +\end{verbatim} +\end{minipage} + +\begin{minipage}[t]{5cm} + \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COnr{ll}{movement} & \Txt{?}} +\end{minipage} +\begin{minipage}[t]{9cm} +\begin{verbatim} +\TExt{\TXT{What} & \Txt{did you see} & +\Txt{t}\COnr{ll}{movement} & \Txt{?}} +\end{verbatim} +\end{minipage} + +\subsection{Autosegmental Phonology} + +Not being an phonologist, I can only offer some beginner's applications, but I will +gladly add macros that you might supply. Just send them to me. Here is one application +that is based on the previously introduced \verb|\TExt| matrix. It is not limited to +having just one row, and one application of this feature are the structures used in +autosegmental phonology. Have a look at this: + +\TExtk[1]{1}{ +\Tname[5]{Root tier:}& +\Sl{k} & & \Sl{t} & &\Sl{b} & \\ +\Tname[5]{Skeletal tier:}& +\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}\\ +\Tname[5]{Vocalic melody tier:}& + & \Sl{a}\Lnu\Lnd{urr}\Lnd{urrrr} +} + +The code uses the kontrolled matrix for text, \verb|\TExtk|, with inter-column +space in pc as mandatory argument, and inter-row space in pc as optional argument. The +command \verb|\Sl| provides the slots of the tier. At the beginning of each row, the +tier's name is given with the macro \verb|\Tname| which has as optional argument the +name width in cm. Links between slots are variants of our branch commands, \verb|\Ln| +draws a solid line, and \verb|\Lnd| a dashed line. \verb|\Lnu| is an abbreviation for +\verb|\Ln{u}|. Define more macros, if you need them. By the way, the example above is +Arabic for `he/she wrote'. This is the code:\newpage + +\begin{verbatim} +\TExtk[1]{1}{ +\Tname[5]{Root tier:}& +\Sl{k} & & \Sl{t} & &\Sl{b} & \\ +\Tname[5]{Skeletal tier:}& +\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}\\ +\Tname[5]{Vocalic melody tier:}& + & \Sl{a}\Lnu\Lnd{urr}\Lnd{urrrr} +} +\end{verbatim} + + +\subsection{Graphical Schemata -- Arrows instead of lines} + +The branching command is based on the \texttt{xypic} arrow command +\verb|\ar|. It can do a lot more than just drawing solid lines. It can, for +instance, draw arrows. As this is sometimes useful, we integrate an arrow +command, \verb|\AR|: + +\begin{verbatim} +\newcommand{\ARkk}[3]{\POS[]-(0,4)+(#1)\ar@{->}[#3]+(0,2)+(#2)} +\newcommand{\ARk}[3]{\ARkk{0,#1}{0,#2}{#3}} +\newcommand{\AR}[2][0]{\ARk{#1}{0}{#2}} +\end{verbatim} + +This helps us draw the GB schema: + +\begin{minipage}[t]{4cm} +\fbox{% + \Treek[.5]{3}{ & \K{D-Structure}\AR{d} \\ + & \K{S-Structure} \AR{dl}\AR{dr}\\ + \K{LF} & & \K{PF} }} +\end{minipage} +\begin{minipage}[t]{10cm} + The code is rather small: +\begin{verbatim} +\fbox{ + \Treek[.5]{3}{ + & \K{D-Structure}\AR{d} \\ + & \K{S-Structure} \AR{dl}\AR{dr}\\ + \K{LF} & & \K{PF} } + } +\end{verbatim} +\end{minipage} + +We can also use alternative line styles, like dashes, dots, and waves: + + +\begin{verbatim} +\newcommand{\Bdot}[2][0]{\POS[]-(0,4)\POS+(0,#1)% + \ar@{.}[#2]+(0,2)} +\newcommand{\ARdot}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)% + \ar@{.>}[#2]+(0,2)} + +\newcommand{\Bdash}[2][0]{\POS[]-(0,4)\POS+(0,#1)% + \ar@{--}[#2]+(0,2)} +\newcommand{\ARdash}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)% + \ar@{-->}[#2]+(0,2)} + +\newcommand{\Bwav}[2][0]{\POS[]-(0,4)\POS+(0,#1)% + \ar@{~}[#2]+(0,2)} +\newcommand{\ARwav}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)% + \ar@{~>}[#2]+(0,2)} +\end{verbatim}\enlargethispage{-2\baselineskip} + +Joost Kremers, University of Frankfurt/Main, $<$j.kremers@em.uni-frankfurt.de$>$, has +kindfully defined a ``generalised branch'' command that I happily integrate here: + +\begin{verbatim} +\newcommand{\GBkk}[4]{\POS[]-(0,4)+(#1)\ar@{#4}[#3]+(0,2)+(#2)} +\newcommand{\GBk}[4]{\GBkk{0,#1}{0,#2}{#3}{#4}} +\newcommand{\GB}[3][0]{\GBk{#1}{0}{#2}{#3}} +\end{verbatim} + +The branch commands are the same as the \verb|\Bkk|, \verb|\Bk| and \verb|\B| commands, +except that they have one more mandatory argument, and the final mandatory argument is +the line style, which can be as follows: + + +\begin{tabular}[t]{ll} + - &solid line \\ + -- &dashed line \\ + = &double line \\ + == &dashed double line \\ + . &dotted line \\ + : &dotted double line \\ + \texttildelow &wavy line \\ + \texttildelow\texttildelow &dashed wavy line \\ +\end{tabular} + +To yield arrows, you only need to extend the line style with leading or final \verb|<| +or \verb|>|, as e.g. in \verb|\GB{=>}{dl}|. + +\Tree{ & \K{VP}\GB{dl}{=}\GB{dr}{=}\\ && } +\begin{minipage}{.5\linewidth} +\begin{verbatim} +\Tree{ & \K{VP}\GB{dl}{=}\GB{dr}{=}\\ && } +\end{verbatim} + \end{minipage} + +The minimalist syntax model is often schematised with a dashed arrow to PF: + +\begin{minipage}[t]{3.5cm} + \fbox{ + \Treek{2.5}{ \K{\emph{Lexicon}}\AR{dd} \\ + \ARdash[3]{dr} & \K{\emph{Spell-out}}\\ + \K{LF} & \K{PF} } } + \end{minipage} + \begin{minipage}[t]{10cm} +\begin{verbatim} +\fbox{ + \Treek{2.5}{ + \K{\emph{Lexicon}}\AR{dd} \\ + \ARdash[3]{dr} & \K{\emph{Spell-out}}\\ + \K{LF} & \K{PF} } }\end{verbatim} + \end{minipage} + +It might sometimes be useful to have branches and arrows to the field on the +right in the same row. The command \verb|\R| makes this possible. The syntax is: +\verb|\R[line style]{destination}|. If you want to, you can write phrase +structure rules that way {\ldots} {\large\smiley} {\ldots} : + +\Tree[-1]{\K{S}\R[->]{rr} && \K[5]{NP~~VP}} + +\verb|\Tree[-1]{\K{S}\R[->]{rr} && \K[5]{NP~~VP}}| + +Versions of \verb|\R| that link circles and squares are also defined in +\texttt{xyling.sty}. Another funny application are neural nets: +\begin{center} +\fbox{ + \begin{minipage}[t]{.75\textwidth}~\\ + \Treek[.5]{4}{\K[-2]{\emph{Layer 1}}&&& + \OO \DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO\DRoO[drrrr]& + \OO \DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO & + \OO \DLoO[dllll]\DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO \\ + \K[-2]{\emph{Layer 2}}& + \OO \BoO{drr}\BoO{drrr}\BoO{drrrr} \RoO{r} & + \OO \BoO{dr}\BoO{drr}\BoO{drrr} \RoO{r} & + \OO \BoO{d}\BoO{dr}\BoO{drr} \RoO{r} & + \OO \BoO{dl}\BoO{d}\BoO{dr} \RoO{r} & + \OO \BoO{dll}\BoO{dl}\BoO{d} \RoO{r} & + \OO \BoO{dlll}\BoO{dll}\BoO{dl} \RoO{r} & + \OO \BoO{dllll}\BoO{dlll}\BoO{dll} \\ + \K[-2]{\emph{Layer 3}} &&&\OO & \OO & \OO } + \end{minipage} + } + \end{center} + +\begin{verbatim} + \Treek[.5]{4}{ + \K[-2]{\emph{Layer 1}}&&& + \OO \DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO\DRoO[drrrr]& + \OO \DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO & + \OO \DLoO[dllll]\DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO \\ + \K[-2]{\emph{Layer 2}}& + \OO \BoO{drr}\BoO{drrr}\BoO{drrrr} \RoO{r} & + \OO \BoO{dr}\BoO{drr}\BoO{drrr} \RoO{r} & + \OO \BoO{d}\BoO{dr}\BoO{drr} \RoO{r} & + \OO \BoO{dl}\BoO{d}\BoO{dr} \RoO{r} & + \OO \BoO{dll}\BoO{dl}\BoO{d} \RoO{r} & + \OO \BoO{dlll}\BoO{dll}\BoO{dl} \RoO{r} & + \OO \BoO{dllll}\BoO{dlll}\BoO{dll} \\ + \K[-2]{\emph{Layer 3}} &&&\OO & \OO & \OO } +\end{verbatim} + +Compare the two different connection styles between layers 1,2 and 2,3, +respectively. + + + + +\section{Some Extras} +\label{sec:extras} + +These are two handy macros for constructing metrical grids and glosses. They +have nothing to do with \texttt{xypic}. I include them because I find them +useful. + +\paragraph{Metrical Grids} + +The command \verb|\PX| has one obligatory argument, the piece of text which is +to receive grid marks, and, as optional argument, the number of grid marks, +defaulted to 1: + +\begin{minipage}[t]{4cm} + \PX[2]{Fa}rah \PX{Faw}cett \PX[3]{Ma}jors +\end{minipage} +\begin{minipage}[t]{5cm} +\begin{verbatim} + \PX[2]{Fa}rah \PX{Faw}cett \PX[3]{Ma}jors +\end{verbatim} +\end{minipage} + +\verb|\PX| has center alignment of text and mark, for left and right alignment +use \verb|\PXl| and \verb|PXr|. These macros require the \texttt{ifthen} +package. + + +\paragraph{Glosses} +For linguistic glosses, I normally use \texttt{cgloss4e.sty}. But when I want to +gloss only one or two words within an example, \texttt{cgloss} is not that +handy, as you must make as many glosses as there are words within an example, +which leads to a sequence of empty groups. \verb|\PG| has two arguments for the +word and its gloss: + +\begin{minipage}[t]{3cm} + \PG{John}{\textsc{nom}} loves \PG{Mary}{\textsc{acc}} +\end{minipage} +\begin{minipage}[t]{7cm} +\begin{verbatim} + \PG{John}{\textsc{nom}} loves + \PG{Mary}{\textsc{acc}} +\end{verbatim} +\end{minipage} + +\verb|\PG| aligns word and gloss at the left edge, for center and right +alignment use \verb|\PGc| and \verb|\PGr|. + + +\bigskip + +For bug reports, comments and suggestions, contact:\\ +\texttt{rvogel@ling.uni-potsdam.de} + + + +\end{document} + -- cgit v1.2.3