From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/xyling/README | 18 + macros/latex/contrib/xyling/xyli-doc.pdf | Bin 0 -> 156680 bytes macros/latex/contrib/xyling/xyli-doc.tex | 1221 ++++++++++++++++++++++++++++++ macros/latex/contrib/xyling/xyling.sty | 968 +++++++++++++++++++++++ 4 files changed, 2207 insertions(+) create mode 100644 macros/latex/contrib/xyling/README create mode 100644 macros/latex/contrib/xyling/xyli-doc.pdf create mode 100644 macros/latex/contrib/xyling/xyli-doc.tex create mode 100644 macros/latex/contrib/xyling/xyling.sty (limited to 'macros/latex/contrib/xyling') diff --git a/macros/latex/contrib/xyling/README b/macros/latex/contrib/xyling/README new file mode 100644 index 0000000000..83b0133d49 --- /dev/null +++ b/macros/latex/contrib/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/macros/latex/contrib/xyling/xyli-doc.pdf b/macros/latex/contrib/xyling/xyli-doc.pdf new file mode 100644 index 0000000000..af65abf165 Binary files /dev/null and b/macros/latex/contrib/xyling/xyli-doc.pdf differ diff --git a/macros/latex/contrib/xyling/xyli-doc.tex b/macros/latex/contrib/xyling/xyli-doc.tex new file mode 100644 index 0000000000..4721c505ff --- /dev/null +++ b/macros/latex/contrib/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} + diff --git a/macros/latex/contrib/xyling/xyling.sty b/macros/latex/contrib/xyling/xyling.sty new file mode 100644 index 0000000000..a35353f02c --- /dev/null +++ b/macros/latex/contrib/xyling/xyling.sty @@ -0,0 +1,968 @@ +%%%%%%%%% Work in progress, version 1.1 +% This set of macros is published under the LaTeX Project Public License: + +% This software is copyright but you are granted a license which gives you, the +% "user" of the software, legal permission to copy, distribute, and/or modify +% the software. However, if you modify the software and then distribute it (even +% just locally) you must change the name of the software, or use other technical +% means to avoid confusion. + +% For linguists only -- this set of macros uses the xypic-module to draw +% syntactic trees and similar graphical objects used in linguistics literature +% in LaTeX files. + +%% Please send your bug reports, comments and suggestions to Ralf Vogel +%% (rvogel@ling.uni-potsdam.de). I hope this set of macros will be useful for +%% you. In case you make further use of these macros in some of your +%% programming, please do not forget to mention who you copied them from. + +%% This style file comes with a documentation, xyli-doc.tex, which +%% contains further hints, comments, and examples. + +%% +% General description: +% The macros in this package model the construction of syntactic +% tree structures as a genuinely graphical problem: they contain two types of +% objects, BRANCHES and NODE LABELS, and these are positioned relative to a +% GRID. It is essential that each of these three elements is constructed +% independent of the other two, and hence 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 important advantage lies +% in the xypic package. xypic generates Metafont code, so the drawing of trees is +% not dependent on postscript specials, as, e.g., in 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 +% xdvi for linux), nor can they be taken over into a pdf file by pdflatex +% (but it works in dvi to pdf conversion with dvipdf, or ps to pdf conversion +% with ps2pdf). +%% + +%% Earlier xyling users: +% I tried to systematise the definitions of node labels and branches. The easy +% commands are now defined in terms of the kontrolled commands, i.e., \K is +% defined via \Kk etc. I also defined a general branching command, \Bkk in its +% most kontrolled version. It underlies all the branching commands. I redefined +% all old commands in terms of the new ones. You should not see a difference, +% however. The commands should be fully backwards compatible. Commands that have +% been renamed are included via simple \let instructions. Please check the list +% at the end of this file. If there is anything going wrong for you, or you miss +% a command that has been there earlier, please let me know. + +% load xyling - +% put the following into the preamble: +% +% \usepackage{xyling} + +% here we start. First of all, we load the xy package, with all options +% (although most options might not be necessary), including use of colours: + +\RequirePackage[color,all,dvips]{xy} +\UseCrayolaColors + +% IMPORTANT NOTE: +% The use of the dvips option might cause branches to disappear when you +% preoduce a pdf file with pdflatex. If this is so, there are two ways of +% overcoming this: +% +% 1. erase the dvips option above, i.e., use instead: +% \RequirePackage[color,all]{xy} +% You will no longer be able to use coloured branches now, however. +% +% 2. create the pdf file via dvips and ps2pdf conversion. This is how the +% documentation pdf file is created. + + +% A tree is a simple macro of the form "\Tree{ ... }" +% It is an xymatrix, with "&" as column separator and "\\" as row separator, +% just like tabular: + +\makeatother +\newcommand{\Tree}[2][0]{\raisebox{1ex}{\xymatrix @H=.3pc @W=2pc @R=2pc @C=#1pc {#2}}} +\newcommand{\Treek}[3][0]{\raisebox{1ex}{\xymatrix @H=.3pc @W=2pc @R=#2pc @C=#1pc {#3}}} + +% \Tree has an optional argument that can be used for changing the space between +% columns. The default is 0. A negative value makes the tree smaller, +% a positive value makes it wider. + +% Space between rows is set to a default of 2pc (defined in "@R=2pc"). \Treek +% gives you "k"ontrol over the distance between rows. \Treek{2}{} = +% \Tree{}. Values higher than 2 raise the row distance, smaller ones shrink it. + +% You can use \Tree and \Treek for objects other than syntactic trees, of +% course. Be it phonological structures or simply any other graphical object +% that mixes words and lines in a graphical way. + +% @R=2pc is fine for one-row node labels, it might be too small for +% multi-row labels. LFG has trees with two-row labels. To include these, you +% will have to enlarge @R, define two-line labels, and branches originating from +% two-line labels. See below for an example. + +% Node labels have the width of 2pc, as determined by the @W variable. This is +% nearly the width of two upright letters, like NP, VP etc. Extremely wide +% labels do not affect the matrix, because the node width is determined +% independent of the content of the node. If you need something different, +% change the @W value here. + +% For the placement of node labels, we use the commands, \Kk, and \K. \Kk +% offers you full control over the horizontal and vertical placement of the +% label. + +\newcommand{\Kk}[3][0]{% + \POS[]+(#1,-1.5)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}#3}} + \restore} + +\newcommand{\K}[2][0]{% + \Kk[#1]{0}{#2}} + +% A node should usually be introduced with the command \K{...}. The optional argument +% is the horizontal adjustment in pc. Positive values move the label to the +% right, negative values to the left. +% Text is centered, both horizontally and vertically! +% 1pc is about .5em in a 12pt font. + +% I inserted a strut (i.e., \rule[-6pt]{0pt}) to make indexed labels behave like +% non-indexed ones. It works for up to 12pt fonts. Might have to be adjusted for +% other font sizes. +% The node is inserted at the center of the box, the center with respect to +% both the horizontal and the vertical dimension! Boxes with indices, like +% NP$_{i}$, are higher than an ordinary NP box. As a consequence of this, the +% NP of an indexed box would appear slightly higher than a sister node label +% without the strut. + +% \Kk offers full `k'ontrol over the vertical and horizontal dimension. The +% optional argument of \Kk is the same as that of \K, but there is an additional +% obligatory argument denoting the vertical adjustment. So the syntax is: +% \Kk[horizontal adjustment]{vertical adjustment}{node label} +% The command \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. + +% Branch commands are inserted immediately after their dominating node. They are +% defined with respect to their target position in the matrix. We again start +% with the controlled version: + +\newcommand{\Bkk}[3]{\POS[]-(0,4)+(#1)\ar@{-}[#3]+(0,2)+(#2)} + +% The three arguments are: 1=adjustment of starting position, 2=adjustment of +% target position, 3=target location. The first two arguments are value pairs +% for the x- and y-axis: (horizontal,vertical). + +% The third argument describes the target location of the branch, a string +% containing some of the following letters: d +% for one step down, l for one step left, r for one step right, u for one step +% up - but don't use u, because it will result in striking out the label name +% ... :-) branches always go downwards. dr = 1 down, 1 right, drr = 1 down, 2 +% right etc. + +% \Bk only controls vertical adjustment of the starting and target +% positions, and keeps the horizontal dimension fixed: + +\newcommand{\Bk}[3]{\Bkk{0,#1}{0,#2}{#3}} + +% \Bk again has 3 obligatory arguments: the vertical adjustment of the starting +% position, that of the target position, and the target location. Positive value +% lifts the starting position, negative value lowers it. + +% The simpler version, which you should normally use, only allows for the vertical +% adjustment of the starting position with its optional argument: + +\newcommand{\B}[2][0]{\Bk{#1}{0}{#2}} + +% an arrow version of \B: + +\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}} + + +% Dashed, dotted and wavy versions of \B and \AR: + +\newcommand{\Bkkdash}[3]{\POS[]-(0,4)+(#1)\ar@{--}[#3]+(0,2)+(#2)} +\newcommand{\Bkkdot}[3]{\POS[]-(0,4)+(#1)\ar@{.}[#3]+(0,2)+(#2)} +\newcommand{\Bkkwav}[3]{\POS[]-(0,4)+(#1)\ar@{.}[#3]+(0,2)+(#2)} + +\newcommand{\Bkdash}[3]{\Bkkdash{0,#1}{0,#2}{#3}} +\newcommand{\Bkdot}[3]{\Bkkdot{0,#1}{0,#2}{#3}} +\newcommand{\Bkwav}[3]{\Bkkwav{0,#1}{0,#2}{#3}} + +\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)} + +% Joost Kremers, University of Frankfurt/Main, +% , has kindfully defined a "generalised +% branch" command that I happily integrate here: + +\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}} + +% The branch commands are the same as the \Bkk, \Bk and \B commands, except +% that they have one more mandatory argument, and the first mandatory argument +% is the line style, which can be as follows: + +% - solid line +% -- dashed line +% = double line +% == dashed double line +% . dotted line +% : dotted double line +% ~ wavy line +% ~~ dashed wavy line + + + + +% Here come a couple of abbreviations for often used branching commands: + +% \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}}} + +% An entry could consist of several rows, especially terminal nodes, but we don't +% want them to influence the lengths of branches. The following defines entries +% that are typed below an entry. It can be used repeatedly: + +\newcommand{\Below}[2][0]{\POS-(0,5)+(0,#1)% +\save*\hbox{\textnormal{\rule[-6pt]{0pt}{18pt}% +#2}}\restore} + +% The optional argument is the vertical distance to the upper entry. +% \below[vertical]{blablabla} + +\newcommand{\Belowk}[3][4]{\POS+(#2,#1)% +\save*\hbox{\textnormal{\rule[-6pt]{0pt}{18pt}% +#3}}\restore} + +% \Belowk command has an additional obligatory argument for horizontal +% adjustment: \Belowk[vertical]{horizontal}{blablabla} + +% Let's define a trace: + +\newcommand{\Trace}[1][i]{\K[0.5]{t$_{#1}$}} + + +% Alternative phrase structure tree commands can easily be built with \Treek, +% \Bkk and \Kk. These are LFG macros: + +\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}} + +% Note that \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 $\uparrow$ in the first line. + +% This completes the basics of our trees with the most frequently used +% functions. Now come some extensions, in particular, circled nodes with +% adjusted branches, triangles and arrows linking nodes. + + +% Here come some coloured versions of \K and \B: + +\RequirePackage{color} +\definecolor{gray}{gray}{.5} +\newcommand{\Kkblue}[3][0]{% + \POS[]+(#1,-1.5)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}\color{blue}#3}} + \restore} +\newcommand{\Kblue}[2][0]{% + \Kk[#1]{0}{\color{blue}#2}} + +\newcommand{\Kkred}[3][0]{% + \POS[]+(#1,-1.5)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}\color{red}#3}} + \restore} +\newcommand{\Kred}[2][0]{% + \Kk[#1]{0}{\color{red}#2}} + +\newcommand{\Kkgreen}[3][0]{% + \POS[]+(#1,-1.5)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}\color{green}#3}} + \restore} +\newcommand{\Kgreen}[2][0]{% + \Kk[#1]{0}{\color{green}#2}} + +\newcommand{\Kkgray}[3][0]{% + \POS[]+(#1,-1.5)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}\color{gray}#3}} + \restore} +\newcommand{\Kgray}[2][0]{% + \Kk[#1]{0}{\color{gray}#2}} + +\newcommand{\Bkkblue}[3]{% + \POS[]-(0,4)+(#1)\ar@{-}@[blue][#3]+(0,2)+(#2)} +\newcommand{\Bkblue}[3]{% +\Bkkblue{0,#1}{0,#2}{#3}} +\newcommand{\Bblue}[2][0]{\Bkblue{#1}{0}{#2}} + +\newcommand{\Bkkred}[3]{% + \POS[]-(0,4)+(#1)\ar@{-}@[red][#3]+(0,2)+(#2)} +\newcommand{\Bkred}[3]{% +\Bkkred{0,#1}{0,#2}{#3}} +\newcommand{\Bred}[2][0]{\Bkred{#1}{0}{#2}} + +\newcommand{\Bkkgreen}[3]{% + \POS[]-(0,4)+(#1)\ar@{-}@[green][#3]+(0,2)+(#2)} +\newcommand{\Bkgreen}[3]{% +\Bkkgreen{0,#1}{0,#2}{#3}} +\newcommand{\Bgreen}[2][0]{\Bkgreen{#1}{0}{#2}} + +\newcommand{\Bkkgray}[3]{% + \POS[]-(0,4)+(#1)\ar@{-}@[gray][#3]+(0,2)+(#2)} +\newcommand{\Bkgray}[3]{% +\Bkkgray{0,#1}{0,#2}{#3}} +\newcommand{\Bgray}[2][0]{\Bkgray{#1}{0}{#2}} + +\newcommand{\Vblue}{\Bblue{dl}\Bblue{dr}} +\newcommand{\Vred}{\Bred{dl}\Bred{dr}} +\newcommand{\Vgreen}{\Bgreen{dl}\Bgreen{dr}} +\newcommand{\Vgray}{\Bgray{dl}\Bgray{dr}} + +\newcommand{\Tblue}[2][0]{\POS[]\POS+(0,2) \ar@{-}@[blue][u]-(0,4)% +\K[#1]{\textit{\color{blue}#2}}} +\newcommand{\Tred}[2][0]{\POS[]\POS+(0,2) \ar@{-}@[red][u]-(0,4)% +\K[#1]{\textit{\color{red}#2}}} +\newcommand{\Tgreen}[2][0]{\POS[]\POS+(0,2) \ar@{-}@[green][u]-(0,4)% +\K[#1]{\textit{\color{green}#2}}} +\newcommand{\Tgray}[2][0]{\POS[]\POS+(0,2) \ar@{-}@[gray][u]-(0,4)% +\K[#1]{\textit{\color{gray}#2}}} + +% Coloured versions of arrows, just examples. They are made a bit +% thicker. This is useful in pdf presentations, e.g. with seminar.sty or +% prosper.sty: + +\newcommand{\ARblue}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Blue]@[thicker][#2]+(0,2)} +\newcommand{\ARdotblue}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Blue]@[thicker]@{.>}[#2]+(0,2)} +\newcommand{\ARdashblue}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Blue]@[thicker]@{-->}[#2]+(0,2)} + +\newcommand{\ARred}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Red]@[thicker][#2]+(0,2)} +\newcommand{\ARdotred}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Red]@[thicker]@{.>}[#2]+(0,2)} +\newcommand{\ARdashred}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1) \ar@[Red]@[thicker]@{-->}[#2]+(0,2)} + + +% Extension Nr. 1: +% Circles and squares around nodes with branches: + +% First, we define the circle, to be added after the \K{}, like the branch. It +% is designed to fit two-letter nodes, like VP a.o. Optional argument: line +% style: dot . for dotted, dash - for dashed, nothing for solid. + +\newcommand{\OO}[1][]{\POS[]+(0,-1)\drop\frm<1pc>{#1o}} + +% the radius of the circle is set to 1pc. if you need a different radius, +% use \OOk. In addition to the optional line style argument, it has an +% obligatory argument for the radius. + +\newcommand{\OOk}[2][]{ \POS[]+(0,-1)\drop\frm<#2pc>{#1o}} + +% Colored versions: + +\newcommand{\OOred}[2][o]{{}\POS[]+(0,-1)\save *+<2pc>[#1][F:red]\txt{}\restore} +\newcommand{\OOblue}[2][o]{{}\POS[]+(0,-1)\save *+<2pc>[#1][F:blue]\txt{}\restore} +\newcommand{\OOgreen}[2][o]{{}\POS[]+(0,-1)\save *+<2pc>[#1][F:green]\txt{}\restore} +\newcommand{\OOgray}[2][o]{{}\POS[]+(0,-1)\save *+<2pc>[#1][F:gray]\txt{}\restore} + +%% This is hacked: must be first in the field, before the \K command, and +%% followed by an empty group, {}. + +% Now comes the boring stuff. Branches that start or end at circles are +% shorter. So let's define macros for all kinds of short branches. Some +% commands include the circles already. + +% This is a branch that always works, starting point for all branches is the +% same point on the circle. This makes branches rather short, and changes their +% angle: + +\newcommand{\BoO}[1]{\Bk{-1.2}{1.2}{#1}} % branch with circled start and target, + % from middle position +\newcommand{\Bo}[1]{\Bk{-1.2}{0}{#1}} % branch with circled start, + % from middle position +\newcommand{\BO}[1]{\Bk{0}{1.2}{#1}} % branch with circled target, + % from middle position + + +\newcommand{\Do}{\Dk{-1.2}{0}} % only circled starting node +\newcommand{\DO}{\Dk{0}{1.2}} % only circled target +\newcommand{\DoO}{\Dk{-1.2}{1.2}} % circled start and target + +\newcommand{\ODO}{\OO\DoO} % circle plus downwards branch to circled node +\newcommand{\OD}{\OO\Do} % Circle with downwards branch + +\newcommand{\DRo}[1][dr]{\Bkk{1.5,-.9}{0,0}{#1}} +\newcommand{\DLo}[1][dl]{\Bkk{-1.5,-.9}{0,0}{#1}} + +\newcommand{\DRoO}[1][dr]{\Bkk{1.5,-.9}{-1.8,1}{#1}} +\newcommand{\DLoO}[1][dl]{\Bkk{-1.5,-.9}{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}} + +\newcommand{\DRRo}{\DRo[drr]} +\newcommand{\DLLo}{\DLo[dll]} + +\newcommand{\DRRoO}{\DRoO[drr]} +\newcommand{\DLLoO}{\DLoO[dll]} + +\newcommand{\DRRO}{\DRO[drr]} +\newcommand{\DLLO}{\DLO[dll]} + +\newcommand{\DRRRo}{\DRo[drrr]} +\newcommand{\DLLLo}{\DLo[dlll]} + +\newcommand{\DRRRoO}{\DRoO[drrr]} +\newcommand{\DLLLoO}{\DLoO[dlll]} + +\newcommand{\DRRRO}{\DRO[drrr]} +\newcommand{\DLLLO}{\DLO[dlll]} + +\newcommand{\VoO}{\DLO\DRO} % uncircled starting node, circled targets left + % and right +\newcommand{\VO}{\DL\DRO} % circled right target only +\newcommand{\Vo}{\DLO\DR} % circled left target only + +\newcommand{\VVoO}{\DLLO\DRRO} % same as above, two steps left/right +\newcommand{\VVO}{\DLL\DRRO} +\newcommand{\VVo}{\DLLO\DRR} + +\newcommand{\VVVoO}{\DLLLO\DRRRO} % same as above, three steps left/right +\newcommand{\VVVO}{\DLLL\DRRRO} +\newcommand{\VVVo}{\DLLLO\DRRR} + +\newcommand{\OV}{\OO\DLo\DRo} % circle plus branches from circled + % starting node +\newcommand{\OVoO}{\OO\DLoO\DRoO} % circled targets +\newcommand{\OVO}{\OO\DLo\DRoO} % circled right target +\newcommand{\OVo}{\OO\DLoO\DRo} % circled left target + +% Define more, if you need them! + +% For instance, how about a square instead of a circle: + +\newcommand{\QQ}[1][-]{\POS[]+(0,-1)-(4,4);\POS[]+(0,-1)+(4,4)**\frm{#1}} + +% And coloured versions: + +\newcommand{\QQred}[2][o]{{}\POS[]+(0,-1)\save *+<1.9pc>[#1][F:red]\txt{}\restore} +\newcommand{\QQblue}[2][o]{{}\POS[]+(0,-1)\save *+<1.9pc>[#1][F:blue]\txt{}\restore} +\newcommand{\QQgreen}[2][o]{{}\POS[]+(0,-1)\save *+<1.9pc>[#1][F:green]\txt{}\restore} +\newcommand{\QQgray}[2][o]{{}\POS[]+(0,-1)\save *+<1.9pc>[#1][F:gray]\txt{}\restore} + +% Again: These are not fully functioning. It only works, if the \QQ +% command is the first one in the field, right after the &, and is followed by +% an empty group {}. + +% you need branches to and from squared nodes: + +\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,-.9}{-2,1}{#1}} +\newcommand{\DLoQ}[1][dl]{\Bkk{-1.5,-.9}{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 + + +% Sometimes, it is useful to highlight sections of the tree with a +% rectangle. Let's define such a rectangle: + +\newcommand{\QS}[3][-]{{}\POS"#2";\POS"#3"+(4,-4)**\frm{#1}} + +% Syntax: \QS[line style]{absolue address of top left corner}{absolue address of +% bottom right corner} +% The absolute address is a number pair: Field 1,1 is the top left field. The +% fields in the first row are 1,1 1,2 1,3 etc. Those in the second row +% 2,1 2,2 2,3 etc. + +% Extension 2: +% Drawing links between nodes + +% We have two versions, one version, \Link, for links drawn below the +% tree, and one for links drawn above the tree, \UpLink. The kontrolled +% version is \Linkk / \UpLinkk: + +\newcommand{\Linkk}[3][->]{% +\POS[]-(3.33,2) \ar@{#1}@/^{#2pc}/[#3]-(1,3.33)} + +\newcommand{\UpLinkk}[3][->]{% +\POS[]+(1.33,2) \ar@{#1}@/_{#2pc}/[#3]+(2,-2)} + +% \Linkk[style]{curving}{target} +% The curving ratio controls the curving of the link. In the commands \Link +% and \UpLink, it is defaulted to 1.33. The curving will differ from tree +% to tree, so a default might be quite useless. +% Style can be . for dotted, - for solid, -- for dashed, with leading or +% following < or > for the arrows. Default is a solid arrow to the target, `->'. + +% Links are defined such that they point from the lower position in the tree +% to the higher position, not the other way around. But it's all a matter of +% where they initiate relative to their source and target fields (left/right, +% top/bottom). Redefine it for your needs. + +\newcommand{\Link}[2][->]{% + \Linkk[#1]{1.33}{#2}} + +\newcommand{\UpLink}[2][->]{% +\UpLinkk[#1]{1.33}{#2}} + +% Syntax: \Link[style]{target} + +%% Extension in version 1.0.1: adjusting starting and target postions: + +\newcommand{\LINKK}[5][->]{% +\POS[]-(3.33,2)+(#4) \ar@{#1}@/^{#2pc}/[#3]-(1,3.33)+(#5)} + +\newcommand{\UPLINKK}[5][->]{% +\POS[]+(1.33,2)+(#4) \ar@{#1}@/_{#2pc}/[#3]+(2,-2)+(#5)} + +\newcommand{\LINK}[4][->]{% + \LINKK[#1]{1.33}{#2}{#3}{#4}} + +\newcommand{\UPLINK}[4][->]{% +\UpLinkk[#1]{1.33}{#2}{#3}{#4}} + +% argument number 4 and 5 are comma separated value pairs for the x and y +% dimensions. + + +% Here come red and blue links. Might be useful for pdf presentations: + +\newcommand{\Linkkblue}[3][->]{% +\POS[]-(3.33,2) \ar@[Blue]@[thicker]@{#1}@/^{#2pc}/[#3]-(1,3.33)} + +\newcommand{\Linkblue}[2][->]{% +\Linkkblue[#1]{1.33}{#2}} + +\newcommand{\Linkkred}[3][->]{% +\POS[]-(3.33,2) \ar@[Red]@[thicker]@{#1}@/^{#2pc}/[#3]-(1,3.33)} + +\newcommand{\Linkred}[2][->]{% +\Linkkred[#1]{1.33}{#2}} + + +% Links between circled nodes: + +\newcommand{\LinkkoO}[3][->]{% +\POS[]-(4.25,2) \ar@{#1}@/^{#2pc}/[#3]-(0,6)} + +\newcommand{\UpLinkkoO}[3][->]{% +\POS[]-(3.33,-2) \ar@{#1}@/_{#2pc}/[#3]+(4,-2)} + +% Link starting at circle + +\newcommand{\Linkko}[3][->]{% +\POS[]-(4.25,2) \ar@{#1}@/^{#2pc}/[#3]-(1,3.33)} + +% Link targeting circle + +\newcommand{\LinkkO}[3][->]{% +\POS[]-(3.33,2) \ar@{#1}@/^{#2pc}/[#3]-(0,6)} + + + +% This is included from the older documentation: + +% Advanced usage of arrows: study the examples, and read the xypic documentation +% for further details: + +% \baum{ & \K{VP}\V \\ +% \K{V} \POS[]+(2,0)\ar[r] \POS[]+(-1,2) +% \ar@{.>}@/^/[ur]-(2.5,0) +% && \K{NP} \POS[]-(3,0) \ar[l] +% \ar@{-->}@/_{2pc}/[ul]_{\textsc{agr}} +% \POS[]-(2,2)\ar@{<-}@/^/[ll]-(0,2)_{\textsc{\tiny case}} +% } + +% \POS[] is the position of the actual entry +% \POS"1,1" is the position of the entry in row 1, column 1. +% \POS[dl] is the position one step down, one step left from current position +% an arrow consists of an optional start position, the command \ar wit +% modifiers, and a target position (the target is written without \POS. the +% simplest arrow is like \ar[l] or \ar[dr] etc. several modifiers are possible: +% @{style}, where style is: +% @{.} dotted line | @{-} line | @{--} dashed line +% these can be combined with arrows, symbolized by < and >: +% @{.>} , @{<--} etc. +% the arrow can be curved, modifiers: +% @/_/ downwards curved , @/^/ upwards curved +% an optional argument makes wider or narrower curves: +% @/_{3pt}/ @/^{3pc}/ etc +% arrow labels can occur above or below the arrow: +% _{text} , ^{text} +% \POS[]+(-1,2) \ar@{-->}@/_{2pc}/[ul]_{\textsc{agr}} +% start pos. | | | | | +% arrow sty curve target label +% commd. le pos. + +% frames + +% \Tree{ & {}\drop\frm<0.8pc>{-o} \K{VP} \POS[]-(0,4)\ar@{-}[dl]+(2,2) +% \POS[]-(0,4)\ar@{-}[dr] \\ +% \K{V} && {}\POS[]-(3,3);\POS+(3,3)**\frm{.} \K{NP} +% \POS[]+(6,2);\POS[ll]-(2,2)**\frm<8pt>{-}} + + +% Extension 3: +% Triangles + +% 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 otherwise. The text below the triangle is to be inserted in the +% field [d] from the insertion point. + +% The fully kontrolled command \TRikk has three arguments. The two obligatory +% arguments for horizontal adjustments of the left and right edge of the +% triangle, and the optional argument for the vertical adjustment: + +% \TRikk[vertical]{left}{right} +\newcommand{\TRikk}[3][0]{% +\POS[d]+(-10.4,0)+(-#2,2)+(0,#1)\ar@{-}[d]+(10.4,0)+(#3,2)+(0,#1) +\POS[]\POS+(0,-4);\POS[d]\POS+(-10.4,0)+(-#2,2)+(0,#1)**\dir{-}% +\POS[]\POS+(0,-4);\POS[d]\POS+(10.4,0)\POS+(#3,2)+(0,#1)**\dir{-}% +} + +% Simpler commands are defined on the basis of \TRikk. \TRik has no vertical +% adjustment: + +\newcommand{\TRik}[2]{\TRikk{#1}{#2}} + +% Syntax: \TRik{left}{right} + +% \TRi is a symmetric triangle with the optional argument of the horizontal +% adjustment, negative value makes it narrower, positive value makes it wider. + +\newcommand{\TRi}[1][0]{\TRik{#1}{#1}} + +% \TRi[left/right] + +% Note: \TRikk{0}{0} = \TRik{0}{0} = \TRi + +% These triangles are rectangles, DTRi has a [d] branch on the left, \TRiD on +% the right: + +\newcommand{\DTRi}[1][0]{\TRik{-10.4}{#1}} +\newcommand{\TRiD}[1][0]{\TRik{#1}{-10.4}} + + +% Extension 4: Sideways branches and arrows: + +\newcommand{\R}[2][-]{\POS[]+(3.7,-1.2)\ar@{#1}[#2]-(3.7,1.2)} +\newcommand{\RoO}[2][-]{\POS[]+(4.2,-1.2)\ar@{#1}[#2]-(4.2,1.2)} +\newcommand{\Ro}[2][-]{\POS[]+(4.2,-1.2)\ar@{#1}[#2]-(3.7,1.2)} +\newcommand{\RO}[2][-]{\POS[]+(3.7,-1.2)\ar@{#1}[#2]-(4.2,1.2)} + +\newcommand{\RqQ}[2][-]{\POS[]+(4,-1.2)\ar@{#1}[#2]-(4,1.2)} +\newcommand{\Rq}[2][-]{\POS[]+(4,-1.2)\ar@{#1}[#2]-(3.7,1.2)} +\newcommand{\RQ}[2][-]{\POS[]+(3.7,-1.2)\ar@{#1}[#2]-(4,1.2)} + +\newcommand{\RoQ}[2][-]{\POS[]+(4.2,-1.2)\ar@{#1}[#2]-(4,1.2)} +\newcommand{\RqO}[2][-]{\POS[]+(4,-1.2)\ar@{#1}[#2]-(4.2,1.2)} + +%% New in 1.0.1: \Rk and \Rkk +\newcommand{\Rkk}[4][-]{\POS[]+(3.7,-1.2)+(#3)\ar@{#1}[#2]-(3.7,1.2)+(#4)} +\newcommand{\Rk}[4][-]{\POS[]+(3.7,-1.2)+(#3,0)\ar@{#1}[#2]-(3.7,1.2)+(#4,0)} +\newcommand{\Rkt}[4][-]{\POS[]+(3.7,-1.2)+(#3,0)\ar@[|(2)]@{#1}[#2]-(3.7,1.2)+(#4,0)} + +% Extension 5: +% Arrows in bracketed notations of syntactic structures + +% This requires a new matrix, we call it \TExt. Here the inter-column space is +% set to zero. This means that we have horizontal space with the insertion of +% a `&'. I.e., we could let arrows point to letters within words. The +% controlled version, \Textk, allows you to control for inter-column space +% with the first mandatory argument. The optional argument adjusts inter-row +% space. + +\newcommand{\TExtk}[3][0]{\raisebox{3pt}{\xymatrix @R=#1pc @C=0pt @M=#2pc {#3}}} +\newcommand{\TExt}[2][0]{\TExtk{0}{#2}} + +% \TExtk has three arguments: +% \Textk[inter row distance]{inter column distance}{matrix} + +% The fields within the \TExt environment are inserted with \Txt or \TXT. They +% mainly provide a strut to yield correct horizontal alignment. \Txt has a +% blank before the text, \TXT has none. I.e., if a word is split over two +% fields, the second part of the word should be introduced with \TXT. +% Likewise, the first word: + +\newcommand{\Txt}[1]{\txt{\rule[-6pt]{0pt}{18pt} #1}} +\newcommand{\TXT}[1]{\txt{\rule[-6pt]{0pt}{18pt}#1}} + +% Here come the arrows, they differ in their depths, such that several arrows +% can be used within one \TExt without overlapping: + +\newcommand{\COn}[2][-]{% +\POS[]+(0,-2);\POS[]+(0,-6)**\dir{#1} \POS[]+(0,-6);\POS[#2]+(0,-6)**\dir{#1} +\POS[#2]+(0,-6) \ar@{#1>}[#2]+(0,-2)} +\newcommand{\COnn}[2][-]{% +\POS[]+(0,-2);\POS[]+(0,-8)**\dir{#1} \POS[]+(0,-8);\POS[#2]+(0,-8)**\dir{#1} +\POS[#2]+(0,-8) \ar@{#1>}[#2]+(0,-2)} +\newcommand{\COnnn}[2][-]{% +\POS[]+(0,-2);\POS[]+(0,-10)**\dir{#1} \POS[]+(0,-10);\POS[#2]+(0,-10)**\dir{#1} +\POS[#2]+(0,-10) \ar@{#1>}[#2]+(0,-2)} + +% Syntax: \COn[style]{target} +% SCOn is a small connector: + +\newcommand{\SCOn}[2][-]{% +\POS[]+(0,-2);\POS[]+(0,-5)**\dir{#1} \POS[]+(0,-5);\POS[#2]+(0,-5)**\dir{#1} +\POS[#2]+(0,-5) \ar@{#1>}[#2]+(0,-2)} + +\newcommand{\COnk}[3][-]{% +\POS[]+(0,-2);\POS[]+(0,-#2)**\dir{#1} \POS[]+(0,-#2);\POS[#3]+(0,-#2)**\dir{#1} +\POS[#3]+(0,-#2) \ar@{#1>}[#3]+(0,-2)} + +% Example: +% +% \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COn{ll} & \Txt{?}} +% + +% Connectors with labels, above or below (depending on whether the arrow goes +% from left to right or vice versa, \COnl with left to right gives label below +% the arrow): + +\newcommand{\COnl}[3][-]{% +\POS[]+(0,-2)\ar@{#1}[]+(0,-6) \POS[]+(0,-6) \ar@{#1}[#2]+(0,-6)_{#3} +\POS[#2]+(0,-6) \ar@{#1>}[#2]+(0,-2)} + +\newcommand{\COnr}[3][-]{% +\POS[]+(0,-2)\ar@{#1}[]+(0,-6) \POS[]+(0,-6) \ar@{#1}[#2]+(0,-6)^{#3} +\POS[#2]+(0,-6) \ar@{#1>}[#2]+(0,-2)} + +% Syntax: \COnl[style]{target}{label} + + + +%%% Autosegmental Phonology: Tier structures +% We have to define links and slots. The slot command is \Slk in its +% kontrolled version: + +\newcommand{\Slk}[3][0]{% + \POS[]+(#1,0)+(0,#2) \save*\txt{\textnormal{\rule[-6pt]{0pt}{18pt}#3}} + \restore} + +% Syntax \Slk[horizontal displaycement]{vertical displacement}{text} + +\newcommand{\Sl}[2][0]{% + \Slk[#1]{0}{#2}} + +% \Sl[horizontal displacement]{text} +% Sometimes we want to give names to the tiers/rows: + +\newcommand{\Tname}[2][3]{% + \Slk{0}{\makebox[#1cm][l]{#2\rule[-6pt]{0pt}{18pt}}}} + +% \Tname[name width]{name text} + +% This command provides a de-link, i.e. strikes through a downwards line with +% a '='. + +\newcommand{\Del}[1][4.825]{\Slk{#1}{=}} + +% Links + +\newcommand{\Lnk}[3]{\Bkk{0,#1}{0,#2}{#3}} +\newcommand{\Ln}[2][7]{\Lnk{#1}{-4}{#2}} + +\newcommand{\Lnd}[2][0]{\POS[]+(0,3)\POS+(0,#1)\ar@{--}[#2]+(0,-2)} +\newcommand{\Lnu}{\Ln{u}} +\newcommand{\Lndu}{\Lnd{u}} + + + + + + +% old stuff - some backwards compatibility: + +\let\M\D +\let\Mk\Dk +\let\LL\DL +\let\LLk\DLk +\let\LLL\DLL +\let\RR\DR +\let\RRk\DRk +\let\RRR\DRR + +\let\baum\Tree +\let\drunter\Below +\let\DRUNTER\BELOW +\let\ATRi\TRik +\let\BELOW\Belowk +\let\CON\COnk + +%% Extras: Metrical Grids +\RequirePackage{ifthen} + +\newcounter{PXcnt} +\newcommand{\PX}[2][1]{% +\shortstack[c]{% +\whiledo{\value{PXcnt}<#1} +{\stepcounter{PXcnt}$\times$\\}#2\strut% +}\setcounter{PXcnt}{0}} + +\newcommand{\PXl}[2][1]{% +\shortstack[l]{% +\whiledo{\value{PXcnt}<#1} +{\stepcounter{PXcnt}$\times$\\}#2\strut% +}\setcounter{PXcnt}{0}} + +\newcommand{\PXr}[2][1]{% +\shortstack[r]{% +\whiledo{\value{PXcnt}<#1} +{\stepcounter{PXcnt}$\times$\\}#2\strut% +}\setcounter{PXcnt}{0}} + + +% Syntax: \PX[number of grid marks]{expression} +% An example: +% \PX[2]{Fa}rah \PX{Faw}cett \PX[3]{Ma}jors + + +%% Single word glosses: + +\newlength{\TXTwidth} +\newlength{\GLOSSwidth} +\newlength{\PGwidth} + +% Default is left alignment: +\newcommand{\PG}[2]{% +\settowidth{\TXTwidth}{#1}% +\settowidth{\GLOSSwidth}{#2}% +\ifthenelse{\lengthtest{\TXTwidth > \GLOSSwidth}}% +{\settowidth{\PGwidth}{#1}}{\settowidth{\PGwidth}{#2}}% +\begin{minipage}[t]{\PGwidth} +\raggedright +#1 \\ #2 +\end{minipage}\smallskip% +} + +% This is center alignment: +\newcommand{\PGc}[2]{% +\settowidth{\TXTwidth}{#1}% +\settowidth{\GLOSSwidth}{#2}% +\ifthenelse{\lengthtest{\TXTwidth > \GLOSSwidth}}% +{\settowidth{\PGwidth}{#1}}{\settowidth{\PGwidth}{#2}}% +\begin{minipage}[t]{\PGwidth} +\centering +#1 \\ #2 +\end{minipage}\smallskip% +} + +% This is right alignment: + +\newcommand{\PGr}[2]{% +\settowidth{\TXTwidth}{#1}% +\settowidth{\GLOSSwidth}{#2}% +\ifthenelse{\lengthtest{\TXTwidth > \GLOSSwidth}}% +{\settowidth{\PGwidth}{#1}}{\settowidth{\PGwidth}{#2}}% +\begin{minipage}[t]{\PGwidth} +\raggedleft +#1 \\ #2 +\end{minipage}\smallskip +} + +% Syntax: \PG{word}{gloss} + + +% Out of use: metrical grids. +%% \newcommand{\Grid}[2][0]{\raisebox{1ex}{\xymatrix @R=.5pc @C=#1pc {#2}}} +%% \newcommand{\Gtxt}[1]{\txt{\rule[-6pt]{0pt}{18pt} #1}} + + +% Comments and suggestions: rvogel@ling.uni-potsdam.de +% http://www.ling.uni-potsdam.de/~rvogel/xyling + -- cgit v1.2.3