Debian Codegraph @

texmf-dist/doc/latex/xyling/xyli-doc.tex

raw
1 \documentclass[12pt,a4paper]{article}
2 \usepackage{avm}
3 \usepackage{xyling}
4 \usepackage{textcomp}
5 \usepackage{mflogo}
6 \usepackage{wasysym}
7
8
9 \setlength{\parindent}{0pt}
10 \setlength{\parskip}{1.5ex}
11
12 \title{\texttt{xyling} -- \LaTeX\ macros for linguistic graphics using the
13 \texttt{xypic} module\\ version 1.1, July 31, 2006}
14
15 \author{Ralf Vogel\\Institut f\"ur Linguistik, Universit\"at Potsdam\\\tt
16 [email protected]\\\tt http://www.ling.uni-potsdam.de/\~{}rvogel/xyling
17 } \date{December 31, 2004}
18 \frenchspacing\raggedbottom
19
20
21 \begin{document}\maketitle
22
23 This file explains the usage of the tree drawing macros in
24 \texttt{xyling.sty}. Please also inspect the style file which contains detailed
25 comments of the macros. These macros build on the \texttt{xypic} package by
26 Kristoffer H. Rose, version 3.7.
27
28 \fbox{\parbox{.975\textwidth}{ \texttt{xypic} is loaded by \texttt{xyling.sty}
29 with the \texttt{dvips} option in order to be able to produce coloured
30 branches. This has a bad side effect: The use of the dvips option might
31 cause branches to disappear when you produce a pdf file with
32 \texttt{pdflatex}. Likewise, other packages that use postscript, like
33 \texttt{pstricks}, might have such side effects. If you experience this,
34 there are two ways of overcoming it:
35
36 \begin{enumerate}
37 \item erase the dvips option in the \texttt{xypic} call in line 57 of
38 \texttt{xyling.sty}, i.e., use: \texttt{\textbackslash
39 RequirePackage[color,all]\{xy\}}. You will no longer be able to use
40 coloured branches now, however. Similarly, you might have to avoid using
41 other postscript packages, too.
42 \item create the pdf file via dvips and ps2pdf conversion. This is how this
43 documentation pdf file is created.
44 \end{enumerate} }}
45
46 Load \texttt{xyling} with \verb|\usepackage{xyling}|.
47
48 The macros in this package model the construction of syntactic tree structures
49 as a genuinely graphical problem: they contain three types of objects:
50
51 \begin{itemize}
52 \item the \emph{grid}
53 \item the \emph{node labels}
54 \item the \emph{branches}
55 \end{itemize}
56
57 The branches and nodes are positioned relative to the grid. It is
58 essential that each of these three elements is constructed independent of the
59 other two. They can be modified without unwanted side effects. This
60 is, to my mind, the most important difference to other tree drawing macro
61 packages, where, in particular, the label width often changes the angles of the
62 branches.
63
64 A second major advantage to my mind lies in using the excellent \texttt{xypic}
65 package. \texttt{xypic} generates \MF\ code, so the drawing of trees is not
66 dependent on postscript specials, as, e.g., in Wolfgang Sternefeld's
67 \texttt{ps-trees}. Hence, no postprocessing is required. The trees generated by
68 postscript specials can neither be seen in a dvi previewer (at least not in my
69 current version of \texttt{xdvi} for linux), nor can they be taken over into a
70 pdf file by \texttt{pdflatex} (but it works in dvi to pdf conversion with
71 \texttt{dvipdf}, or ps to pdf conversion with \texttt{ps2pdf}).
72
73
74 \section{The Grid}
75 \label{sec:grid}
76
77 A tree is a simple macro of the form \verb|\Tree{ ... }|. It is an \texttt{xymatrix}, with
78 \verb|&| as column separator and \verb|\\| as row separator. You should be
79 familiar with this structure from tabulars and similar structures.
80
81 \verb|\Tree| has an optional argument that can be used for changing the space
82 between columns. The default is 0, wich does not actually mean 0 space, but
83 rather the default space. A negative value makes the tree smaller, a positive
84 value makes it wider:
85
86 \begin{minipage}{.5\linewidth}
87 \begin{tabular}{l@{~~=~~}l}
88 \Tree{A & B} & \verb|\Tree{A & B}|\\
89 \Tree[1]{A & B} & \verb|\Tree[1]{A & B}|\\
90 \Tree[-1]{A & B} & \verb|\Tree[-1]{A & B}|
91 \end{tabular}
92 \end{minipage}
93
94
95 The distance between rows can also be controlled using the ``k''ontrolled version of
96 \verb|\Tree|, \verb|\Treek|, which has one more obligatory argument, the distance
97 between rows, which is defaulted to 2pc in \verb|\Tree|. Check the examples in table
98 \ref{tab:treek}.
99
100 \begin{table}[htbp]
101 \begin{center}
102 \begin{tabular}{|l@{~~=~~}p{.5\linewidth}|}\hline
103 \Tree{ & VP \\ V && NP } & \verb|\Tree{ & VP \\ Vzero && NP }|\\\hline
104 \Treek{1}{ & VP \\ V && NP } & \verb|\Treek{1}{ & VP \\ V && NP }|\\\hline
105 \Treek{3}{ & VP \\ V && NP } & \verb|\Treek{3}{ & VP \\ V && NP }|\\\hline
106 \Treek{4}{ & VP \\ V && NP } & \verb|\Treek{4}{ & VP \\ V && NP }|\\\hline
107 \end{tabular}\\\medskip
108 \caption{Effects of the first argument of \textbackslash \texttt{Treek}}
109 \label{tab:treek}
110 \end{center}
111 \end{table}
112 \section{The Nodes}
113 \label{sec:nodes}
114
115 A node is introduced with the command \verb|\K{...}|. Text is centered, both
116 horizontally and vertically! This means that text boxes might not be aligned on
117 the same baseline in \texttt{xypic}, using its standard command for text
118 insertion, \verb|\txt|. You can see this here:
119
120 \underline{\Tree{\txt{muss~~} \txt{musg~~} \txt{must~~} \txt{Muss~~} \txt{Musg~~}}}
121
122 The code:\\
123 \verb|\Tree{\txt{muss~~}| \verb|\txt{musg~~}| \verb|\txt{must~~}| \newline
124 \verb|\txt{Muss~~}| \verb|\txt{Musg~~}}|
125
126 The command \verb|\K| contains a strut of 18pt to prevent this. This is perfect
127 for up to 12pt fonts:
128
129 \underline{\Tree{\K{muss~~} & \K{musg~~} & \K{must~~} &\K{Muss~~} & \K{Musg~~}}}
130
131 The code:\\ \verb|\Tree{\K{muss~~}&| \verb|\K{musg~~}&| \verb|\K{must~~}&|
132 \verb|\K{Muss~~}&| \verb|\K{Musg~~}}|
133
134 Node labels have the width 2pc, which is fine, because most node labels consist
135 of two upright letters, like NP, VP etc. Extremely wide labels do not affect the
136 matrix, because the node width is determined independently of the content of the
137 node -- by the value \verb|@W=2pc| in the definition of \verb|\Tree| and
138 \verb|\Treek|.
139
140 \verb|\K| has an optional argument to move text freely horizontally -- measured
141 in pc. Positive values move the label to the right, negative values to the
142 left. 1pc is about 0.5 em in a 12pt font. Horizontal adjustments are necessary
143 for wide nodes:
144
145 \Tree{
146 & \K{VP} \B{dl}\B{dr} \\
147 \K{\emph{very very very wide node}} & & \K{V$^0$} }
148
149 The code:\vspace{-2ex}
150 \begin{verbatim}
151 \Tree{ & \K{VP} \B{dl}\B{dr} \\
152 \K{\emph{very very very wide node}} & & \K{V$^0$} }
153 \end{verbatim}
154
155 We have two solutions to this problem. The global one is widen the inter-column
156 space with the optional argument of \verb|\Tree|:
157
158 \Tree[1]{
159 & \K{VP} \B{dr}\B{dl} \\
160 \K{\emph{very very very wide node}} & & \K{V$^0$} \\
161 }
162
163 The code:\vspace{-2ex}
164 \begin{verbatim}
165 \Tree[1]{ & \K{VP} \B{dr}\B{dl} \\
166 \K{\emph{very very very wide node}} & & \K{V$^0$} }
167 \end{verbatim}
168
169 The second solution is moving the wide node a bit to the left, using the
170 optional argument of \verb|\K|:
171
172 \Tree{
173 & \K{VP} \B{dl}\B{dr} \\
174 \K[-5]{\emph{very very very wide node}} & & \K{V$^0$} }
175
176 The code:\vspace{-2ex}
177 \begin{verbatim}
178 \Tree{ & \K{VP} \B{dr}\B{dl} \\
179 \K[-5]{\emph{very very very wide node}} & & \K{V$^0$} }
180 \end{verbatim}
181
182 \verb|\Kk| offers full control over the vertical and horizontal dimension. The
183 optional argument of \verb|\Kk| is the same as that of \verb|\K|, but there is
184 an additional obligatory argument denoting the vertical adjustment. So the
185 syntax is: \verb|\Kk[horizontal adjustment]{vertical adjustment}{node label}|.
186 The command \verb|\Kk[1]{1}{VP}| places the node VP 1pc right of and 1pc higher
187 than the standard position. This in fact allows you to put anything anywhere in
188 the tree. You can add comments to the side of the tree etc.
189
190 Often, especially in the terminal nodes, you might need more than one line of
191 text. Use the command \verb|\Below| for putting text below text inserted by
192 \verb|\K|. Check the following example:
193
194 \begin{minipage}[t]{2cm}
195 \Tree{\K{NP}\B{d} \\ \K{the}\Below{little}\Below{dog}}
196 \end{minipage}
197 \begin{minipage}[t]{10cm}
198 \begin{verbatim}
199 \Tree{\K{NP}\B{d} \\
200 \K{the}\Below{little}\Below{dog}} \end{verbatim}
201 \end{minipage}
202
203 \verb|\Below| has an optional argument for the vertical adjustment, negative
204 value lowers the text, positive value raises it. There also exists a kontrolled
205 version, \verb|Belowk|, which has the horizontal adjustment as its first
206 obligatory argument in addition.
207
208
209 \section{The Branches}
210 \label{sec:branches}
211
212 Branch commands are inserted in the same field as their dominating node. The
213 simplest command is \verb|\B|. It has one obligatory argument, the description
214 of the target field. It is given in the steps it takes to reach it. For
215 instance, \verb|\B{dl}| draws a branch to the field one step down and one step
216 left from the current field. Use \texttt{u} and \texttt{r} for upwards and
217 rightwards steps. Upwards branches will strike through the label, however, so
218 this is not very useful. Branches should always go downwards.
219
220 We are now ready to draw our first tree:
221
222 \begin{center} \label{firsttree}
223 \Tree{ & \K{VP}\B{dl}\B{dr} \\
224 \K{NP}\B{d} & & \K{V$'$}\B{dl}\B{dr} \\
225 \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\
226 & \K{\emph{loves}} & & \K{\emph{Mary}} }
227 \end{center}
228 This is the code:
229
230 \begin{verbatim}
231 \Tree{ & \K{VP}\B{dl}\B{dr} \\
232 \K{NP}\B{d} & & \K{V$'$}\B{dl}\B{dr} \\
233 \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\
234 & \K{\emph{loves}} & & \K{\emph{Mary}} }\end{verbatim}
235
236 \verb|\B| has an optional argument, the vertical adjustment of the starting
237 position of the branch, negative value, e.g. \verb|\B[-1]{d}|, lowers the
238 starting position, positive value raises it.
239
240 Some grammar formalisms, require labels on branches -- like HPSG, where head
241 and complement are explicitly denoted with the labels $H$ and $C$. This is
242 quite easy to integrate. The command \verb|\B| is based on the \texttt{xypic}
243 command \verb|\ar| which has the option of putting a label on a line. It uses
244 the syntax of subscripting and superscripting, i.e., \verb|^{}| and
245 \verb|_{}|. If you put these commands right behind a branch command, you will
246 get labels on the branch, \verb|_{}| puts it on the branches left side, and
247 \verb|^{}| on its right. The label is written in math mode, i.e., slanted,
248 unless you specify it to be in normal text font with, e.g.
249 \verb|\textnormal{}|. Here comes an example:\footnote{Thanks to Doug Arnold
250 for his suggestion to include this feature.}
251
252 \begin{center}
253 \Tree{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\
254 \K{NP}\B{d} & & \K{V$'$}\B{dl}_H\B{dr}^C \\
255 \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\
256 & \K{\emph{loves}} & & \K{\emph{Mary}} }
257 \end{center}
258 \begin{verbatim}
259 \Tree{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\
260 \K{NP}\B{d} & & \K{V$'$}\B{dl}_H\B{dr}^C \\
261 \K{\emph{John}}& \K{V$^{0}$}\B{d} & & \K{NP}\B{d} \\
262 & \K{\emph{loves}} & & \K{\emph{Mary}} }
263 \end{verbatim}
264
265 There is no limitation on the number of branches either:
266
267 \Tree{ & \K{S} \B{dl}\B{d}\B{dr}\B{drr} \\
268 \K{NP}\B{d} & \K{V}\B{d} & \K{NP}\B{d} & \K{NP}\B{d} & \\
269 \K{John} & \K{gave} & \K{Mary} & \K[2]{cookies} }
270 \begin{verbatim}
271 \Tree{ & \K{S} \B{dl}\B{d}\B{dr}\B{drr} \\
272 \K{NP}\B{d} & \K{V}\B{d} & \K{NP}\B{d} & \K{NP}\B{d} \\
273 \K{John} & \K{gave} & \K{Mary} & \K[2]{cookies} }
274 \end{verbatim}
275
276 HPSG is also famous for crossing branches in cases where the linear order
277 and the hierarchical structure do not match. You can, of course, also let
278 branches cross. There are no system specific limits to what kinds of trees
279 you might want to draw. An admittedly ugly looking example is the
280 following German object initial sentence:
281
282 \Tree[.5]{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\
283 \K{Subject}\B{dddrr} && \K{V$'$}\B{dl}_{H}\B{dr}^{C} \\
284 & \K{V$^{0}$}\B{dd} && \K{Object}\B{ddlll} \\ \\
285 \K{B\"ucher}\Below{books} & \K{kaufte} \Below{bought}
286 & \K{Maria}\Below{Maria}
287 }
288 \begin{verbatim}
289 \Tree[.5]{ & \K{VP}\B{dl}_{C}\B{dr}^{H} \\
290 \K{Subject}\B{dddrr} && \K{V$'$}\B{dl}_{H}\B{dr}^{C} \\
291 & \K{V$^{0}$}\B{dd} && \K{Object}\B{ddlll} \\ \\
292 \K{B\"ucher}\Below{books} & \K{kaufte} \Below{bought}
293 & \K{Maria}\Below{Maria} }
294 \end{verbatim}
295
296
297 We also have two kontrolled versions of the branching command, \verb|\Bkk| and
298 \verb|\Bk|. Both adjust the starting and target positions of branches. They have
299 three arguments, 1: adjustment of starting position, 2: adjustment of target
300 position, 3: destination. \verb|\Bk| only allows for vertical adjustments and
301 has numbers as its first two arguments. \verb|\Bkk| has comma-separated number
302 pairs as its first two arguments, for horizontal and vertical adjustment of
303 starting and target position. This gives you full control over the branches.
304 Some examples:
305
306 \begin{minipage}[t]{3cm}
307 \fbox{\Treek{3} {\K{DP}\Below{[+definite]}\B[-5]{d}\\
308 \K{\emph{the~bible}}}}
309 \end{minipage}
310 \begin{minipage}[t]{10cm}
311 \begin{verbatim}
312 \fbox{\Treek{3}{\K{DP}\Below{[+definite]}
313 \B[-5]{d}\\ \K{\emph{the~bible}} }}
314 \end{verbatim}
315 \end{minipage}
316
317 \begin{minipage}[t]{3cm}
318 \Tree{ & \K{XP} \B{dl}\B{dr}\Bkk{2,0}{2,0}{dr} \\
319 \K{YP} & & \K{ZP}}
320 \end{minipage}
321 \begin{minipage}[t]{10cm}
322 \begin{verbatim}
323 \Tree{ & \K{XP}\B{dl}\B{dr}\Bkk{2,0}{2,0}{dr} \\
324 \K{YP}& & \K{ZP}}\end{verbatim}
325 \end{minipage}
326
327
328 \section{Abbreviations}
329 \label{sec:abbreviations}
330
331 The usage of branching commands can be made much easier by the definition of
332 macros for most frequently used combinations. These are the ones defined in
333 \texttt{xyling.sty}. Define new ones if you need them and/or change those given
334 here:
335
336 \begin{verbatim}
337 % \D goes to the position in the same column, one row below.
338 % The optional argument is the vertical adjustment of the
339 % starting position.
340
341 \newcommand{\D}[1][0]{\B[#1]{d}}
342 \newcommand{\Dk}[2]{\Bk{#1}{#2}{d}}
343
344 % \Dk is the \Bk version, i.e., it has two obligatory arguments
345 % defining the vertical adjustments of starting position and
346 % target position.
347
348 \newcommand{\DL}[1][0]{\B[#1]{dl}}
349 \newcommand{\DLL}[1][0]{\B[#1]{dll}}
350 \newcommand{\DLLL}[1][0]{\B[#1]{dlll}}
351 \newcommand{\DR}[1][0]{\B[#1]{dr}}
352 \newcommand{\DRR}[1][0]{\B[#1]{drr}}
353 \newcommand{\DRRR}[1][0]{\B[#1]{drrr}}
354
355 \newcommand{\DLk}[2][0]{\Bk{#1}{#2}{dl}}
356 \newcommand{\DLLk}[2][0]{\Bk{#1}{#2}{dll}}
357 \newcommand{\DLLLk}[2][0]{\Bk{#1}{#2}{dlll}}
358 \newcommand{\DRk}[2][0]{\Bk{#1}{#2}{dr}}
359 \newcommand{\DRRk}[2][0]{\Bk{#1}{#2}{drr}}
360 \newcommand{\DRRRk}[2][0]{\Bk{#1}{#2}{drrr}}
361
362 % Abbreviations for binary branches:
363
364 \newcommand{\V}[1][0]{\DL[#1]\DR[#1]}
365 \newcommand{\VV}[1][0]{\DLL[#1]\DRR[#1]}
366 \newcommand{\VR}[1][0]{\DL[#1]\DRR[#1]}
367 \newcommand{\VL}[1][0]{\DLL[#1]\DR[#1]}
368 \newcommand{\VVV}[1][0]{\DLLL[#1]\DRRR[#1]}
369 \newcommand{\VVR}[1][0]{\DLL[#1]\DRRR[#1]}
370 \newcommand{\VVL}[1][0]{\DLLL[#1]\DRR[#1]}
371 \newcommand{\VLL}[1][0]{\DLLL[#1]\DR[#1]}
372 \newcommand{\VRR}[1][0]{\DL[#1]\DRRR[#1]}
373
374 % Define more if you need them.
375
376 % Let's make further abbreviations. A default VP has a
377 % \V branch. So let's define \VP accordingly, and likewise
378 % Vbar, IP, CP etc.:
379
380 \newcommand{\VP}[1][]{\K{VP$_{#1}$}\V}
381 \newcommand{\Vbar}{\K[.5]{V$'$}\V}
382
383 \newcommand{\IP}[1][]{\K{IP$_{#1}$}\V}
384 \newcommand{\Ibar}{\K[.5]{I$'$}\V}
385
386 \newcommand{\CP}[1][]{\K{CP$_{#1}$}\V}
387 \newcommand{\Cbar}{\K[.5]{C$'$}\V}
388 \newcommand{\Nbar}{\K[.5]{N$'$}\V}
389
390 \newcommand{\PP}[1][]{\K{PP$_{#1}$}\V}
391 \newcommand{\DP}[1][]{\K{DP$_{#1}$}\V}
392
393 \newcommand{\AuxP}[1][]{\K{IP$_{#1}$}\V}
394 \newcommand{\Auxbar}{\K[.5]{I$'$}\V}
395
396 % Nodes reasonably without branch:
397
398 \newcommand{\NP}[1][]{\K{NP$_{#1}$}}
399 \newcommand{\Nzero}[1][]{\K[1]{N$^{0}_{#1}$}}
400 \newcommand{\Vzero}[1][]{\K[1]{V$^{0}_{#1}$}}
401 \newcommand{\Izero}[1][]{\K{I$^{0}_{#1}$}}
402 \newcommand{\Auxzero}[1][]{\K{I$^{0}_{#1}$}}
403 \newcommand{\Czero}[1][]{\K{C$^{0}_{#1}$}}
404 \newcommand{\Pzero}[1][]{\K{P$^{0}_{#1}$}}
405 \newcommand{\Dzero}[1][]{\K{D$^{0}_{#1}$}}
406
407 % Note that all of these commands, except for the
408 % Xbar nodes, have an optional argument for an index.
409 % If you use indices longer than one letter, you might
410 % need to do horizontal adjustment and have to use
411 % \K instead.
412
413 % This default system only needs new nodes for the
414 % terminals. Let's define \T parallel to \K.
415 % \T has a vertical branch to the upper node, text is
416 % italicised. The optional argument, as before,
417 % allows for horizontal adjustment of the text:
418
419 \newcommand{\T}[2][0]{\POS[]\POS+(0,2)
420 \ar@{-}[u]-(0,4) \POS[]\K[#1]{\textit{#2}}}
421 \end{verbatim}
422
423 The code for the tree on page \pageref{firsttree} can now be reduced
424 dramatically:
425
426 \begin{verbatim}
427 \Tree { & \VP \\
428 \NP & & \Vbar \\
429 \T{John} & \Vzero & & \NP \\
430 & \T{loves} & & \T{Mary}
431 }
432 \end{verbatim}
433
434 Here is the tree, just to assure you:
435
436 \begin{center}
437 \Tree { & \VP \\
438 \NP & & \Vbar \\
439 \T{John}&\Vzero & & \NP \\
440 &\T{loves} & & \T{Mary} }
441 \end{center}
442
443 Chomskyan syntacticians like movement traces, here is one:
444
445 \begin{verbatim}
446 \newcommand{\Trace}[1][i]{\K[0.5]{t$_{#1}$}}
447 \end{verbatim}
448
449 The optional argument, as with the \verb|\XP|, \verb|\Xzero| commands above, is
450 the index, here defaulted to `\texttt{i}'.
451
452
453
454 \section{Triangles}
455 \label{sec:triangles}
456
457 Phrase structure trees often use triangles as abbreviations for larger
458 structures which shall not be fledged out in full detail. The command
459 \verb|\TRi| can be used instead of branching commands, introducing a
460 triangle:\footnote{Notice that the top node in this tree, S, is inserted exactly
461 in the middle between two columns -- due to the horizontal adjustment of
462 5.2pc. The horizontal distance between the centers of two neighbour fields is
463 10.4pc. The command \texttt{\textbackslash Bkk} is then used to get symmetric
464 branches from this position, by adjusting the starting position horizontally
465 by 5.2pc. You see that the label and branch placement are not limited to the
466 possibilities specified by the grid. It only provides a usually satisfactory
467 default.}
468
469 \begin{center}
470 \Tree{ && \K[5.2]{S}\Bkk{5.2,0}{0,0}{dl}\Bkk{5.2,0}{0,0}{drr}\\
471 &\NP\TRi &&& \VP \\
472 & \K{\emph{my beloved}}\Below{\emph{wife}} &&\Vzero && \NP\TRi[2] \\
473 & && \T{likes}&&\K{\emph{our old house}}
474 }
475 \end{center}
476
477 \begin{verbatim}
478 \Tree{ && \K[5.2]{S}\Bkk{5.2,0}{0,0}{dl}
479 \Bkk{5.2,0}{0,0}{drr} \\
480 &\NP\TRi && & \VP \\
481 & \K{\emph{my beloved}}\Below{\emph{wife}} &&
482 \Vzero && \NP\TRi[2] \\
483 &&& \T{likes} && \K{\emph{our old house}}
484 }
485 \end{verbatim}
486
487 Triangles need the nodes they refer to in the next lower row, in particular,
488 don't forget the node [d] from the insertion point of the triangle. You will
489 get an error message otherwise. The text below the triangle is inserted in the
490 field [d] from the insertion point
491
492 Notice also that the first column in the tree is empty. It's only purpose is
493 providing a field for the left bottom edge of the left triangle.
494
495 \verb|\TRi| is a symmetric triangle. It has an optional argument, the horizontal
496 adjustment, negative value makes it narrower, positive value makes it wider, as
497 exemplified in the triangle for `\emph{our old house}' in the tree above.
498
499
500 \verb|\DTRi| and \verb|\TRiD| are rectangles, \verb|\DTRi| has a [d] branch on
501 the left, \verb|\TRiD| on the right, the optional argument allows for horizontal
502 adjustment.
503
504 The kontrolled version of the triangle, \verb|\Trik|, has two obligatory
505 arguments for the left and right horizontal adjustment, which can be specified
506 separately here. This potentially leads to asymmetric triangles. The syntax
507 is:\newline \verb|\TRik{left}{right}|, where \verb|\TRik{0}{0} = \TRi[0] = \TRi|.
508
509
510
511 \section{Links}
512 \label{sec:links}
513
514 It occurs very frequently that relations between elements of a tree shall be
515 indicated with linking arrows, for instance to illustrate syntactic movement.
516 Links are inserted with the commands \verb|\Link| and \verb|Linkk|. Both have as
517 optional argument the line style, which could be one of
518 \verb|-,->,<-,.,.>,<.,--,|\linebreak \verb|-->,<--,| a.o. \verb|\Linkk| has as
519 its first argument the curving specification. It is defaulted to 1.33pc in
520 \verb|\Link|. This might not be sufficient in many cases. The second obligatory
521 argument of \verb|\Linkk| and the first obligatory argument of \verb|\Link| is
522 the destination field specification.
523
524 \begin{center}
525 \Tree{ & \CP \\
526 \NP[j] && \Cbar \\
527 \T{What}& \Czero[i] && \IP \\
528 &\T{did} & \NP && \Ibar \\
529 & &\T{John}&\Trace\Linkk[-->]{2.5}{llu}&&\VP \\
530 & & &&\Vzero && \Trace[j]\Linkk[.>]{4.5}{-3,-6}\\
531 & & &&\T{say}&& }
532 \end{center}
533
534 The code is as follows:
535
536 \begin{verbatim}
537 \Tree{ & \CP \\
538 \NP[j] && \Cbar \\
539 \T{What}& \Czero[i] && \IP \\
540 &\T{did} & \NP && \Ibar \\
541 & &\T{John}&\Trace
542 \Linkk[-->]{2.5}{llu}&&\VP \\
543 & & &&\Vzero && \Trace[j]
544 \Linkk[.>]{4.5}{-3,-6}\\
545 & & &&\T{say}&& }
546
547 \end{verbatim}
548
549 Note that it is possible to specify the target location in terms of the number
550 of `hops', as done for the long link here: \verb|\Linkk[.>]{4.5}{-3,-6}| states
551 that the target of the link is 3 fields up and 6 fields left of the current
552 field. This is shorter than specifying it with ``\texttt{uuullllll}''.
553
554 English affix hopping according to Chomsky (1981):
555
556 \begin{minipage}[t]{5cm}
557 \Tree{ & \IP \\
558 \NP & & \Ibar \\
559 &\Izero\D& & \VP \\
560 &\Trace &\Vzero\D & & \NP \\
561 & &\K[6]{V+INFL}\Link[<-]{-1,-1}
562 }
563 \end{minipage}
564 \begin{minipage}[t]{9cm}
565 \begin{verbatim}
566 \Tree{ & \IP \\
567 \NP & & \Ibar \\
568 &\Izero\D& & \VP \\
569 &\Trace &\Vzero\D & & \NP \\
570 & &\K[6]{V+INFL} \Link[<-]{ul}
571 }
572 \end{verbatim}
573 \end{minipage}
574
575 Finally, the commands \verb|\Link| and \verb|\Linkk| link labels to the left of
576 the tree. Links which are to the right of the tree, on its top, are specified
577 with \verb|\UpLink| and \verb|\UpLinkk|:
578
579 \begin{minipage}[t]{4cm}
580 \Tree{ & \IP \\ \NP &&\Ibar \\ & \Izero &&\K{VP} \UpLink{-2,-2}}
581 \end{minipage}
582 \begin{minipage}[t]{8cm}
583 \begin{verbatim}
584 \Tree{ & \IP \\
585 \NP & &\Ibar \\
586 & \Izero &&\K{VP} \UpLink{-2,-2}}
587 \end{verbatim}
588 \end{minipage}
589
590
591
592 \section{Highlighting}
593 \label{sec:highlighting}
594
595 Node labels are often highlighted with surrounding circles or squares, and, in
596 particular in presentations, with colours. Several ways of doing this are
597 integrated in \texttt{xyling}.
598
599
600 \subsection{Highlighting sections of a tree with a rectangle}
601 \label{sec:treesection}
602
603 The command \verb|\QS| draws a rectangle around two fields of the tree specified
604 by their absolute address. The syntax of the command is: \\
605 \verb|\QS[line style]{top left corner}{bottom right corner}|. The absolute
606 address of a field is a number pair. The field ``1,1'' is the top left field of
607 the grid. The fields in the first row are 1,1 1,2 1,3 etc. Those in the second
608 row are 2,1 2,2 2,3 etc. Because the field addresses are given in absolute
609 terms, it makes no difference where within the \verb|\Tree| specification a
610 \verb|\QS| command appears:
611
612 \begin{minipage}[t]{4cm}
613 \Tree{ & \VP \\ \NP && \Vbar \\ & \Vzero && \NP \QS{1,1}{2,3}
614 \QS[.]{2,2}{3,4}
615 }
616 \end{minipage}
617 \begin{minipage}[t]{10cm}
618 \begin{verbatim}
619 \Tree{ & \VP \\
620 \NP & & \Vbar \\
621 & \Vzero && \NP \QS{1,1}{2,3}
622 \QS[.]{2,2}{3,4}
623 }
624 \end{verbatim}
625 \end{minipage}
626
627
628 \subsection{Highlighting node labels with circles and squares}
629 \label{sec:circles}
630
631 The command \verb|\OO| draws a circle around the node label in the current
632 field. The command \verb|\QQ| draws a square around it:
633
634 \begin{minipage}[t]{4cm}
635 \Tree{ & \VP \\
636 \NP\OO & & \Vbar \\
637 & \Vzero && \NP\QQ }
638 \end{minipage}
639 \begin{minipage}[t]{10cm}
640 \begin{verbatim}
641 \Tree{ & \VP \\
642 \NP\OO & & \Vbar \\
643 & \Vzero && \NP\QQ }
644 \end{verbatim}
645 \end{minipage}
646
647 As you can see, the branches go inside the circles and squares. We need to define
648 branches which start and/or end at circles or squares.
649
650 The following are branches that always work. Starting point for all branches is
651 the same point on the circle. This makes branches rather short, and changes the
652 angles of diagonal branches:
653
654
655 \begin{verbatim}
656 \newcommand{\BoO}[1]{\Bk{-1.2}{1.2}{#1}}
657 % branch with circled start and target
658
659 \newcommand{\Bo}[1]{\Bk{-1.2}{0}{#1}}
660 % branch with circled start
661
662 \newcommand{\BO}[1]{\Bk{0}{1.2}{#1}}
663 % branch with circled target
664 \end{verbatim}
665
666 \begin{minipage}[t]{4cm}
667 \Tree{ & \K{VP}\OO\Bo{dl}\Bo{dr} \\
668 \NP & & \Vbar \\
669 & \Vzero && \NP\QQ }
670 \end{minipage}
671 \begin{minipage}[t]{10cm}
672 \begin{verbatim}
673 \Tree{ & \K{VP}\OO\Bo{dl}\Bo{dr} \\
674 \NP & & \Vbar \\
675 & \Vzero && \NP\QQ }
676 \end{verbatim}
677 \end{minipage}
678
679 The two \texttt{[dl]} and \texttt{[dr]} branches are no longer parallel. To get
680 this, the branches should start at different sides of the circle, as if they
681 initiated at the old position within the circle:
682
683 \begin{verbatim}
684 \newcommand{\DRo}[1][dr]{\Bkk{1.6,-1}{0,0}{#1}}
685 \newcommand{\DLo}[1][dl]{\Bkk{-1.6,-1.0}{0,0}{#1}}
686
687 \newcommand{\DRoO}[1][dr]{\Bkk{1.6,-1}{-1.8,1}{#1}}
688 \newcommand{\DLoO}[1][dl]{\Bkk{-1.6,-1}{1.8,1}{#1}}
689
690 \newcommand{\DRO}[1][dr]{\Bkk{0,0}{-1.8,1}{#1}}
691 \newcommand{\DLO}[1][dl]{\Bkk{0,0}{1.8,1}{#1}}
692 \end{verbatim}
693
694 This helps:
695
696 \begin{minipage}[t]{4cm}
697 \Tree{ & \K{VP}\OO\DLo\DRo \\
698 \NP & & \Vbar \\
699 & \Vzero && \NP\QQ }
700 \end{minipage}
701 \begin{minipage}[t]{10cm}
702 \begin{verbatim}
703 \Tree{ & \K{VP}\OO\DLo\DRo \\
704 \NP & & \Vbar \\
705 & \Vzero && \NP\QQ }
706 \end{verbatim}
707 \end{minipage}
708
709 The same has to be done with branches to and from squares:
710
711 \begin{verbatim}
712 \newcommand{\DRq}[1][dr]{\Bkk{1.5,-1}{0,0}{#1}}
713 \newcommand{\DLq}[1][dl]{\Bkk{-1.5,-1}{0,0}{#1}}
714
715 \newcommand{\DRQ}[1][dr]{\Bkk{0,0}{-2,1}{#1}}
716 \newcommand{\DLQ}[1][dl]{\Bkk{0,0}{2,1}{#1}}
717
718 \newcommand{\DRqQ}[1][dr]{\Bkk{1.5,-1}{-2,1}{#1}}
719 \newcommand{\DLqQ}[1][dl]{\Bkk{1.5,-1}{2,1}{#1}}
720
721 \newcommand{\DRoQ}[1][dr]{\Bkk{1.5,-1}{-2,1}{#1}}
722 \newcommand{\DLoQ}[1][dl]{\Bkk{-1.5,-1}{2,1}{#1}}
723
724 \newcommand{\DRqO}[1][dr]{\Bkk{1.6,-1}{-1.8,1}{#1}}
725 \newcommand{\DLqO}[1][dl]{\Bkk{1.6,-1}{1.8,1}{#1}}
726
727 \newcommand{\Dq}{\Dk{-1.1}{0}}
728 % only squared starting node
729 \newcommand{\DQ}{\Dk{0}{1}}
730 % only squared target node
731 \newcommand{\DqO}{\Dk{-1.1}{1.2}}
732 % squared start and circled target
733 \newcommand{\DoQ}{\Dk{-1.3}{1}}
734 % circled start and squared target
735 \newcommand{\DqQ}{\Dk{-1.1}{1}}
736 % square start and squared target
737 \end{verbatim}
738
739 \begin{minipage}[t]{4cm}
740 \Tree{ & \K{VP}\OO\DLo\DRo \\
741 \NP & & \K{V$'$}\DL\DRQ \\
742 & \Vzero && \NP\QQ }
743 \end{minipage}
744 \begin{minipage}[t]{10cm}
745 \begin{verbatim}
746 \Tree{ & \K{VP}\OO\DLo\DRo \\
747 \NP & & \K{V$'$}\DL\DRQ \\
748 & \Vzero && \NP\QQ }
749 \end{verbatim}
750 \end{minipage}
751
752 The style file contains many abbreviations for the branch commands including
753 circles and squares around node labels.
754
755
756
757 \subsection{Highlighting with Colours}
758 \label{sec:colours}
759
760 Especially in presentations, colours are an option for highlighting
761 parts of a tree. \texttt{xypic} uses the postscript extensions to make this
762 possible. Check the \texttt{xypic} documentation for more on colours, especially
763 for defining new colours. I defined blue, red, green and gray versions of the
764 standard commands \verb|\Bkk| and \verb|\Kk| and the commands derived from
765 them. So it is quite painless to integrate colour:
766
767 \begin{minipage}[t]{5cm}
768 \Tree{ & \Kred{IP}\Vred \\
769 \Kblue{NP}\Bblue{d} & & \Kred{I$'$}\Vred \\
770 \Tblue{John} & \Kred{I$^{0}$} && \Kgray{VP} \Vgray \\
771 && \Kgreen{t}\Linkblue{ull}&&\Kgray{V$'$}\Vgray\\
772 &&&\Kgray{V$^{0}$}&& \Kgray{NP} }
773 \end{minipage}
774 \begin{minipage}[t]{8cm}
775 \begin{verbatim}
776 \Tree{
777 & \Kred{IP}\Vred \\
778 \Kblue{NP}\Bblue{d} &&
779 \Kred{I$'$}\Vred \\
780 \Tblue{John}& \Kred{I$^{0}$} &&
781 \Kgray{VP} \Vgray \\
782 && \Kgreen{t}\Linkblue{ull}&&
783 \Kgray{V$'$}\Vgray\\
784 &&&\Kgray{V$^{0}$}&& \Kgray{NP} }
785 \end{verbatim}
786 \end{minipage}
787
788 There also are macros for coloured circles and squares around nodes. They are
789 called \verb|\OOred, \QQred| etc. But they do not fully function yet. They have
790 to be inserted as first element within a field, right after the \verb|&|, and
791 must be followed by an empty group, \verb|{}|.
792
793 \section{Other Structures}
794 \label{sec:other}
795
796 \subsection{Lexical Functional Grammar}
797
798 On the basis of the general commands for grids, labels and branches, it is easy
799 to define commands for other phrase structure formats, or any kind of graphical
800 object that mixes text and lines. The following macros help drawing LFG trees:
801
802 \begin{verbatim}
803 \newcommand{\Treelfg}[2][0]{\Treek[#1]{3}{#2}}
804 \newcommand{\Klfg}[2][]{%
805 \K{$\uparrow _{\textsc{\scriptsize #1}}=\downarrow$}\Below{#2}}
806 \newcommand{\Blfg}[1]{\Bk{-5}{0}{#1}}
807 \newcommand{\Vlfg}{\Blfg{dl}\Blfg{dr}}
808 \end{verbatim}
809
810 Note that \verb|\Klfg| produces two lines: The inheritance specification and the
811 category label. The optional argument is the grammatical function, which, if
812 available, is indexed to the \verb|$\uparrow$| in the first line. Here comes an
813 example: \vspace*{-3ex}
814
815 \begin{minipage}[t]{4.5cm}
816 \Treelfg{ & \Kk{-5}{S}\Vlfg\\
817 \Klfg[su]{NP}\Blfg{d} & &\Klfg{VP} \Vlfg\\
818 \Klfg{N$^{0}$}\Blfg{d}&\Klfg{V$^{0}$}\Blfg{d} && \Klfg[ob]{NP}\Blfg{d} \\
819 \K{\emph{John}} &\K{\emph{loves}}& & \K{\emph{Mary}}}
820 \end{minipage}
821 \begin{minipage}[t]{9cm}
822 \begin{verbatim}
823
824 \Treelfg{
825 & \Kk{-5}{S}\Vlfg \\
826 \Klfg[su]{NP}\Blfg{d} & &\Klfg{VP}\Vlfg\\
827 \Klfg{N$^{0}$}\Blfg{d}&\Klfg{V$^{0}$}
828 \Blfg{d} && \Klfg[ob]{NP}\Blfg{d} \\
829 \K{\emph{John}} &\K{\emph{loves}}& &
830 \K{\emph{Mary}}
831 }
832 \end{verbatim}
833 \end{minipage}
834
835 Much of this can be abbreviated in the manner exemplified above. Feel free to do
836 so. Command names like \verb|\Klfg| etc. could, of course, also be shortened.
837
838
839 \subsection{Head Driven Phrase Structure Grammar}
840
841 The following structure is from the HPSG introduction book ``Syntactic
842 Theory. A Formal Introduction'' (second edition, 2003) by Sag, Wasow \&\
843 Bender, page 207:
844
845 \newcommand{\AVMone}{\begin{avm}\@1NP$_{i}$\end{avm}}
846 \newcommand{\AVMtwo}{\begin{avm} \[ SPR & \q< \@1 \q> \\ COMPS & \q<~ \q> \] \end{avm}}
847 \newcommand{\AVMthree}{\begin{avm} \[ SPR & \q< \@1 \q> \\ COMPS & \q< \@2 \q> \\
848 ARG-ST & \q< \@1 , \@2 \q> \] \end{avm}}
849 \newcommand{\AVMfour}{\begin{avm}\@2NP$_{i}$\end{avm}}
850
851 \Treek[3]{3}{ & \K{S}\V \\ \Kk{-1}{\AVMone}\D && \K{VP}
852 \Below[-4]{\AVMtwo}\B[-13]{ddl}\B[-13]{ddr}
853 \\\K{They} \\
854 & \K{V} \Below[-6]{\AVMthree} && \Kk{-1}{\AVMfour}\B{dd}\\ &\K{}\D[-1] \\ &\K{saw} && \K{themselves}}
855
856 How did we draw the tree? First, we use Christopher Manning's avm.sty to define the AVM
857 structures of each node separately:
858
859 \begin{verbatim}
860 \newcommand{\AVMone}{\begin{avm}\@1NP$_{i}$\end{avm}}
861 \newcommand{\AVMtwo}{\begin{avm}
862 \[ SPR & \q< \@1 \q> \\
863 COMPS & \q<~ \q> \] \end{avm}}
864 \newcommand{\AVMthree}{\begin{avm}
865 \[ SPR & \q< \@1 \q> \\
866 COMPS & \q< \@2 \q> \\
867 ARG-ST & \q< \@1 , \@2 \q> \] \end{avm}}
868 \newcommand{\AVMfour}{\begin{avm}\@2NP$_{i}$\end{avm}}
869 \end{verbatim}
870
871 Next, we make up the tree, and call the four AVM nodes within \verb|\K| or
872 \verb|\Below|. The most tricky issue is the determination for the tree widths and how to
873 deal with the unequal sizes of the nodes. As you see in the code below, I exploited
874 three features of xyling: setting row and column distance to a new value, adjusting
875 branches, and the huge nodes VP and V were extended over two rows!
876
877 \footnotesize
878 \begin{verbatim}
879 \Treek[3]{3}{ & \K{S}\V \\ % adjust grid!
880 \Kk{-1}{\AVMone}\D && \K{VP}
881 \Below[-4]{\AVMtwo}\B[-13]{ddl}\B[-13]{ddr}\\ % Branches go ddr/ddl!
882 \K{They} \\ % skipped row for VP!
883 & \K{V}
884 \Below[-6]{\AVMthree} && \Kk{-1}{\AVMfour}\B{dd}\\ % Branch goes dd!
885 &\K{}\D[-1] \\ % Branch starts here!
886 &\K{saw} && \K{themselves}}
887
888 \end{verbatim}
889 \normalsize
890
891 Note an incompatibility of avm.sty: When I first experimented with xyling.sty and
892 avm.sty, the linebraks in my avm's disappeared. It took me a while to figure out that
893 this was not due to xyling, but caused by the tabularx package which I had loaded for
894 another purpose. So, if you use avm.sty, don't use tabularx!
895
896 \subsection{Arrows in Text}
897 \label{sec:text}
898
899 Even when we do not use trees, but only strings or bracketed notations, we
900 sometimes want to express relations between elements within these notations by
901 arrows. It is possible to use \texttt{xyling} macros for this, too. We first
902 define a new grid, \verb|\TExt|. It has an obligatory argument -- the text,
903 which can be split into several fields by the field separator \verb|&|. The
904 distance between fields is set to 0, such that even parts of words can be put in
905 subsequent fields without visible effect:
906
907 \begin{minipage}[t]{3cm}
908 \TExt{\textnormal{nood} & \textnormal{les}&\textnormal{~~}&
909 \textnormal{noodles}}
910 \end{minipage}
911 \begin{minipage}[t]{8cm}
912 \begin{verbatim}
913 \TExt{\textnormal{nood} & \textnormal{les} &
914 \textnormal{~~} & \textnormal{noodles}}\end{verbatim}
915 \end{minipage}
916
917 The fields within the \verb|\TExt| environment are inserted with \verb|\Txt| or
918 \verb|\TXT|. They mainly provide a strut to yield correct horizontal alignment.
919 \verb|\Txt| has a blank before the text, \verb|\TXT| has none. I.e., if a word
920 is split over two fields, the second part of the word should be introduced with
921 \verb|\TXT|. Likewise, the first word of the whole string.
922
923 The arrows differ in their depths, such that several arrows can be used within
924 one \verb|\TExt| without overlapping. The narrowest connector is called
925 \verb|SCOn|, we then have \verb|\COn, \COnn| and \verb|\COnnn|. They have an
926 optional argument for the line style, \verb|-| for solid, \verb|--| for dashed,
927 \verb|.| for dotted. The commands are inserted at the starting point of the
928 arrow. The obligatory argument is the target field destination, e.g.
929 \texttt{[ll]}, \texttt{[r]} etc. A simple example:
930
931 \begin{minipage}[t]{5cm}
932 \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COn{ll} & \Txt{?}}
933 \end{minipage}
934 \begin{minipage}[t]{9cm}
935 \begin{verbatim}
936 \TExt{\TXT{What} & \Txt{did you see} &
937 \Txt{t}\COn{ll} & \Txt{?}}
938 \end{verbatim}
939 \end{minipage}
940
941 The command \verb|\COnk| allows for control of the link depth with its first
942 obligatory argument. The other arguments are as before.
943
944 We also have connectors with labels, which can be above or below the arrow. This
945 depends on whether the arrow goes from left to right or vice versa. \verb|\COnl|
946 with right to left yields a label above the arrow:
947
948 \begin{minipage}[t]{5cm}
949 \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COnl{ll}{movement} & \Txt{?}}
950 \end{minipage}
951 \begin{minipage}[t]{9cm}
952 \begin{verbatim}
953 \TExt{\TXT{What} & \Txt{did you see} &
954 \Txt{t}\COnl{ll}{movement} & \Txt{?}}
955 \end{verbatim}
956 \end{minipage}
957
958 \begin{minipage}[t]{5cm}
959 \TExt{\TXT{What} & \Txt{did you see} & \Txt{t}\COnr{ll}{movement} & \Txt{?}}
960 \end{minipage}
961 \begin{minipage}[t]{9cm}
962 \begin{verbatim}
963 \TExt{\TXT{What} & \Txt{did you see} &
964 \Txt{t}\COnr{ll}{movement} & \Txt{?}}
965 \end{verbatim}
966 \end{minipage}
967
968 \subsection{Autosegmental Phonology}
969
970 Not being an phonologist, I can only offer some beginner's applications, but I will
971 gladly add macros that you might supply. Just send them to me. Here is one application
972 that is based on the previously introduced \verb|\TExt| matrix. It is not limited to
973 having just one row, and one application of this feature are the structures used in
974 autosegmental phonology. Have a look at this:
975
976 \TExtk[1]{1}{
977 \Tname[5]{Root tier:}&
978 \Sl{k} & & \Sl{t} & &\Sl{b} & \\
979 \Tname[5]{Skeletal tier:}&
980 \Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}\\
981 \Tname[5]{Vocalic melody tier:}&
982 & \Sl{a}\Lnu\Lnd{urr}\Lnd{urrrr}
983 }
984
985 The code uses the kontrolled matrix for text, \verb|\TExtk|, with inter-column
986 space in pc as mandatory argument, and inter-row space in pc as optional argument. The
987 command \verb|\Sl| provides the slots of the tier. At the beginning of each row, the
988 tier's name is given with the macro \verb|\Tname| which has as optional argument the
989 name width in cm. Links between slots are variants of our branch commands, \verb|\Ln|
990 draws a solid line, and \verb|\Lnd| a dashed line. \verb|\Lnu| is an abbreviation for
991 \verb|\Ln{u}|. Define more macros, if you need them. By the way, the example above is
992 Arabic for `he/she wrote'. This is the code:\newpage
993
994 \begin{verbatim}
995 \TExtk[1]{1}{
996 \Tname[5]{Root tier:}&
997 \Sl{k} & & \Sl{t} & &\Sl{b} & \\
998 \Tname[5]{Skeletal tier:}&
999 \Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}&\Sl{C}\Lnu&\Sl{V}\\
1000 \Tname[5]{Vocalic melody tier:}&
1001 & \Sl{a}\Lnu\Lnd{urr}\Lnd{urrrr}
1002 }
1003 \end{verbatim}
1004
1005
1006 \subsection{Graphical Schemata -- Arrows instead of lines}
1007
1008 The branching command is based on the \texttt{xypic} arrow command
1009 \verb|\ar|. It can do a lot more than just drawing solid lines. It can, for
1010 instance, draw arrows. As this is sometimes useful, we integrate an arrow
1011 command, \verb|\AR|:
1012
1013 \begin{verbatim}
1014 \newcommand{\ARkk}[3]{\POS[]-(0,4)+(#1)\ar@{->}[#3]+(0,2)+(#2)}
1015 \newcommand{\ARk}[3]{\ARkk{0,#1}{0,#2}{#3}}
1016 \newcommand{\AR}[2][0]{\ARk{#1}{0}{#2}}
1017 \end{verbatim}
1018
1019 This helps us draw the GB schema:
1020
1021 \begin{minipage}[t]{4cm}
1022 \fbox{%
1023 \Treek[.5]{3}{ & \K{D-Structure}\AR{d} \\
1024 & \K{S-Structure} \AR{dl}\AR{dr}\\
1025 \K{LF} & & \K{PF} }}
1026 \end{minipage}
1027 \begin{minipage}[t]{10cm}
1028 The code is rather small:
1029 \begin{verbatim}
1030 \fbox{
1031 \Treek[.5]{3}{
1032 & \K{D-Structure}\AR{d} \\
1033 & \K{S-Structure} \AR{dl}\AR{dr}\\
1034 \K{LF} & & \K{PF} }
1035 }
1036 \end{verbatim}
1037 \end{minipage}
1038
1039 We can also use alternative line styles, like dashes, dots, and waves:
1040
1041
1042 \begin{verbatim}
1043 \newcommand{\Bdot}[2][0]{\POS[]-(0,4)\POS+(0,#1)%
1044 \ar@{.}[#2]+(0,2)}
1045 \newcommand{\ARdot}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)%
1046 \ar@{.>}[#2]+(0,2)}
1047
1048 \newcommand{\Bdash}[2][0]{\POS[]-(0,4)\POS+(0,#1)%
1049 \ar@{--}[#2]+(0,2)}
1050 \newcommand{\ARdash}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)%
1051 \ar@{-->}[#2]+(0,2)}
1052
1053 \newcommand{\Bwav}[2][0]{\POS[]-(0,4)\POS+(0,#1)%
1054 \ar@{~}[#2]+(0,2)}
1055 \newcommand{\ARwav}[2][0]{\POS[]\POS-(0,4)\POS+(0,#1)%
1056 \ar@{~>}[#2]+(0,2)}
1057 \end{verbatim}\enlargethispage{-2\baselineskip}
1058
1059 Joost Kremers, University of Frankfurt/Main, $<[email protected]$>$, has
1060 kindfully defined a ``generalised branch'' command that I happily integrate here:
1061
1062 \begin{verbatim}
1063 \newcommand{\GBkk}[4]{\POS[]-(0,4)+(#1)\ar@{#4}[#3]+(0,2)+(#2)}
1064 \newcommand{\GBk}[4]{\GBkk{0,#1}{0,#2}{#3}{#4}}
1065 \newcommand{\GB}[3][0]{\GBk{#1}{0}{#2}{#3}}
1066 \end{verbatim}
1067
1068 The branch commands are the same as the \verb|\Bkk|, \verb|\Bk| and \verb|\B| commands,
1069 except that they have one more mandatory argument, and the final mandatory argument is
1070 the line style, which can be as follows:
1071
1072
1073 \begin{tabular}[t]{ll}
1074 - &solid line \\
1075 -- &dashed line \\
1076 = &double line \\
1077 == &dashed double line \\
1078 . &dotted line \\
1079 : &dotted double line \\
1080 \texttildelow &wavy line \\
1081 \texttildelow\texttildelow &dashed wavy line \\
1082 \end{tabular}
1083
1084 To yield arrows, you only need to extend the line style with leading or final \verb|<|
1085 or \verb|>|, as e.g. in \verb|\GB{=>}{dl}|.
1086
1087 \Tree{ & \K{VP}\GB{dl}{=}\GB{dr}{=}\\ && }
1088 \begin{minipage}{.5\linewidth}
1089 \begin{verbatim}
1090 \Tree{ & \K{VP}\GB{dl}{=}\GB{dr}{=}\\ && }
1091 \end{verbatim}
1092 \end{minipage}
1093
1094 The minimalist syntax model is often schematised with a dashed arrow to PF:
1095
1096 \begin{minipage}[t]{3.5cm}
1097 \fbox{
1098 \Treek{2.5}{ \K{\emph{Lexicon}}\AR{dd} \\
1099 \ARdash[3]{dr} & \K{\emph{Spell-out}}\\
1100 \K{LF} & \K{PF} } }
1101 \end{minipage}
1102 \begin{minipage}[t]{10cm}
1103 \begin{verbatim}
1104 \fbox{
1105 \Treek{2.5}{
1106 \K{\emph{Lexicon}}\AR{dd} \\
1107 \ARdash[3]{dr} & \K{\emph{Spell-out}}\\
1108 \K{LF} & \K{PF} } }\end{verbatim}
1109 \end{minipage}
1110
1111 It might sometimes be useful to have branches and arrows to the field on the
1112 right in the same row. The command \verb|\R| makes this possible. The syntax is:
1113 \verb|\R[line style]{destination}|. If you want to, you can write phrase
1114 structure rules that way {\ldots} {\large\smiley} {\ldots} :
1115
1116 \Tree[-1]{\K{S}\R[->]{rr} && \K[5]{NP~~VP}}
1117
1118 \verb|\Tree[-1]{\K{S}\R[->]{rr} && \K[5]{NP~~VP}}|
1119
1120 Versions of \verb|\R| that link circles and squares are also defined in
1121 \texttt{xyling.sty}. Another funny application are neural nets:
1122 \begin{center}
1123 \fbox{
1124 \begin{minipage}[t]{.75\textwidth}~\\
1125 \Treek[.5]{4}{\K[-2]{\emph{Layer 1}}&&&
1126 \OO \DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO\DRoO[drrrr]&
1127 \OO \DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO &
1128 \OO \DLoO[dllll]\DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO \\
1129 \K[-2]{\emph{Layer 2}}&
1130 \OO \BoO{drr}\BoO{drrr}\BoO{drrrr} \RoO{r} &
1131 \OO \BoO{dr}\BoO{drr}\BoO{drrr} \RoO{r} &
1132 \OO \BoO{d}\BoO{dr}\BoO{drr} \RoO{r} &
1133 \OO \BoO{dl}\BoO{d}\BoO{dr} \RoO{r} &
1134 \OO \BoO{dll}\BoO{dl}\BoO{d} \RoO{r} &
1135 \OO \BoO{dlll}\BoO{dll}\BoO{dl} \RoO{r} &
1136 \OO \BoO{dllll}\BoO{dlll}\BoO{dll} \\
1137 \K[-2]{\emph{Layer 3}} &&&\OO & \OO & \OO }
1138 \end{minipage}
1139 }
1140 \end{center}
1141
1142 \begin{verbatim}
1143 \Treek[.5]{4}{
1144 \K[-2]{\emph{Layer 1}}&&&
1145 \OO \DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO\DRoO[drrrr]&
1146 \OO \DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO\DRRRoO &
1147 \OO \DLoO[dllll]\DLLLoO\DLLoO\DLoO \DoO \DRoO\DRRoO \\
1148 \K[-2]{\emph{Layer 2}}&
1149 \OO \BoO{drr}\BoO{drrr}\BoO{drrrr} \RoO{r} &
1150 \OO \BoO{dr}\BoO{drr}\BoO{drrr} \RoO{r} &
1151 \OO \BoO{d}\BoO{dr}\BoO{drr} \RoO{r} &
1152 \OO \BoO{dl}\BoO{d}\BoO{dr} \RoO{r} &
1153 \OO \BoO{dll}\BoO{dl}\BoO{d} \RoO{r} &
1154 \OO \BoO{dlll}\BoO{dll}\BoO{dl} \RoO{r} &
1155 \OO \BoO{dllll}\BoO{dlll}\BoO{dll} \\
1156 \K[-2]{\emph{Layer 3}} &&&\OO & \OO & \OO }
1157 \end{verbatim}
1158
1159 Compare the two different connection styles between layers 1,2 and 2,3,
1160 respectively.
1161
1162
1163
1164
1165 \section{Some Extras}
1166 \label{sec:extras}
1167
1168 These are two handy macros for constructing metrical grids and glosses. They
1169 have nothing to do with \texttt{xypic}. I include them because I find them
1170 useful.
1171
1172 \paragraph{Metrical Grids}
1173
1174 The command \verb|\PX| has one obligatory argument, the piece of text which is
1175 to receive grid marks, and, as optional argument, the number of grid marks,
1176 defaulted to 1:
1177
1178 \begin{minipage}[t]{4cm}
1179 \PX[2]{Fa}rah \PX{Faw}cett \PX[3]{Ma}jors
1180 \end{minipage}
1181 \begin{minipage}[t]{5cm}
1182 \begin{verbatim}
1183 \PX[2]{Fa}rah \PX{Faw}cett \PX[3]{Ma}jors
1184 \end{verbatim}
1185 \end{minipage}
1186
1187 \verb|\PX| has center alignment of text and mark, for left and right alignment
1188 use \verb|\PXl| and \verb|PXr|. These macros require the \texttt{ifthen}
1189 package.
1190
1191
1192 \paragraph{Glosses}
1193 For linguistic glosses, I normally use \texttt{cgloss4e.sty}. But when I want to
1194 gloss only one or two words within an example, \texttt{cgloss} is not that
1195 handy, as you must make as many glosses as there are words within an example,
1196 which leads to a sequence of empty groups. \verb|\PG| has two arguments for the
1197 word and its gloss:
1198
1199 \begin{minipage}[t]{3cm}
1200 \PG{John}{\textsc{nom}} loves \PG{Mary}{\textsc{acc}}
1201 \end{minipage}
1202 \begin{minipage}[t]{7cm}
1203 \begin{verbatim}
1204 \PG{John}{\textsc{nom}} loves
1205 \PG{Mary}{\textsc{acc}}
1206 \end{verbatim}
1207 \end{minipage}
1208
1209 \verb|\PG| aligns word and gloss at the left edge, for center and right
1210 alignment use \verb|\PGc| and \verb|\PGr|.
1211
1212
1213 \bigskip
1214
1215 For bug reports, comments and suggestions, contact:\\
1216 \texttt{[email protected]}
1217
1218
1219
1220 \end{document}
1221