tree-dvips Tree Macros |
[ This is Emma Pease's original documentation, slightly edited and adapted for the Web by Doug Arnold ]
This documentation is available as a PostScript File
The tree-dvips
package is available at the usual places
(follow this link for some suggestions. ]
The tree macros package allows one to integrate TeX and Postscript. For example, one can use TeX to layout a tree and have Postscript draw the lines.
These macros work by defining locations on a page and then manipulating them in a variety of ways. The commands that created the above tree are as follows:
\begin{tabular}{ccc} &\node{a}{top node}\\[3ex] \node{b}{left node} & & \node{c}{right node}\\[3ex] & & \node{d}{odd node} \end{tabular} \nodeconnect{a}{b} \nodeconnect{a}{c} \nodeconnect{c}{d} \nodecurve[r]{a}[r]{d}{1in} \anodeconnect[b]{b}[l]{d} \anodecurve[l]{a}[l]{b}{1in}You will notice that four nodes are defined, a, b, c, and d, using the
\node
command. These nodes are then connected using the
\nodeconnect
and \nodecurve
commands.
Location commands are those that deal with defining a location on a page. The basic command
\node{nodename}{object}
\nodepoint{nodename}[horizontal displace][vertical displace]
These commands connect two or more nodes. The two basic ones are
\nodeconnect[fromloc]{fromnodename}[toloc]{tonodename} \nodecurve[fromloc]{fromnodename}[toloc]{tonodename}{depth}
Other connecting commands are
\barnodeconnect[depth]{fromnodename}{tonodename} \anodeconnect[fromloc]{fromnodename}[toloc]{tonodename} \anodecurve[fromloc]{fromnodename}[toloc]{tonodename}{depth}For example,
\node{c}{\strut This} \node{a}{\strut is} a \node{b}{\strut test} of barnodeconnect. \barnodeconnect{a}{b} \barnodeconnect[-5pt]{a}{c} \bigskip\bigskip \node{c}{\strut This} \node{a}{\strut is} a \node{b}{\strut test} \node{d}{\strut of} abarnodeconnect. \node{e}{\strut Note} arrows. \abarnodeconnect[10pt]{a}{b} \abarnodeconnect[-10pt]{a}{c} \abarnodeconnect[-10pt]{b}{d} \abarnodeconnect[10pt]{e}{d}A negative depth places the bar below the line; a positive depth (or the default, which is 5pt) places the bar above the line.
A few odd commands
\nodetriangle{fromnodename}{tonodename}This creates a triangle whose apex is the bottom of
fromnodename
and whose base is the top of tonodename
.
\anodeconnect
and \anodecurve
are the same as
\nodeconnect
and \node-
curve
except that the connecting
line has a arrowhead on it pointing to the second node.
These commands adjust something around a single node rather than connecting nodes. The basic commands are
\nodebox{nodename} \nodecircle[depth]{nodename} \nodeoval{nodename}
At the moment there are three parameters that can be changed. They are
\nodemargin
- A node's height and width are defined as
the height plus depth and width of an hbox enclosing the object plus the
nodemargin on each side. The default is 2pt.
\treelinewidth
- The width of the lines. The default is .3pt.
\dashlength
- The length of the dash, if you are using
dashed lines. The default is 0pt (solid line).1
\arrowwidth
- the width of the arrowhead in the
\anodeconnect
and \anodecurve
commands. Default is
4 pt.
\arrowlength
- the length of the arrowhead. Default is
4pt.
In the preamble, put:
\usepackage{tree-dvips}Run through LaTeX and send to a postscript printer using dvips
A series of examples follow.
\let\mc=\multicolumn \begin{tabular}[t]{@{}lllllllll@{}} & & & &\node{a}{VP} \\[2ex] &\node{b}{PP} & & & & &\mc{2}{c}{\node{c}{V$'$}}\\[2ex] & & &\node{d}{NP} \\[2ex] & &\nodepoint{e} & &\node{f}{NP} \\ & & &\hfill\nodepoint{r}[0pt][3pt] \\ &\hfil\node{g}{AP} & &\hfil\node{h}{NP} & & & &\hfil\node{i}{NP}\\[2ex] \node{j}{P} &\hfil\node{k}{A} & \node{l}{Prt} &\hfil\node{m}{N} &\node{n}{Prt} &\node{o}{N} &\node{p}{V} &\hfil\node{q}{N}\\[2ex] `zaw&`oN &`geq&?njiaw&`geq&`dou& khe &tshjaN \\ toward &red & & bird & &head& open&gun \\[1ex] \mc{9}{@{}l}{`shoot at the red head of the bird'} \\ \end{tabular} \nodeconnect{a}{b} \nodeconnect{e}{l} \nodeconnect{a}{c} \nodeconnect{d}{f} \nodeconnect{b}{d} \nodeconnect{g}{k} \nodeconnect{b}{j} \nodeconnect{f}{r} \nodeconnect{c}{p} \nodeconnect{r}{h} \nodeconnect{c}{i} \nodeconnect{r}{n} \nodeconnect{d}{e} \nodeconnect{f}{o} \nodeconnect{e}{g} \nodeconnect{h}{m} \nodeconnect{i}{q}
The following two examples use \outerfs
and
\modsmalltree
; these are both part of the lingmacros package.
See lingmacros.sty
for more information.
\enumsentence[(100)]{\evnup[2pt] {\outerfs{ Focus & \outerfs{subj & \outerfs{\ \nodepoint{a}\ }\\[1ex] obl$_{th}$ & \outerfs{Pred & `Pro'\\ Refl & +}\\[1ex] Pred & `proud$\langle(\uparrow {\rm subj}) (\uparrow {\rm obl}_{th})\rangle$'}% \nodepoint{d}[-3pt][0pt]\\[2ex] Subj & \outerfs{Pred & `Max'}\\[1ex] Comp & \outerfs{Subj &\outerfs{Pred & `Larry'}% \nodepoint{c}[-3pt][0pt]\\[1ex] Xcomp&\outerfs{\ \nodepoint{b}\ }\\[1ex] Pred & `be$\langle(\uparrow {\rm xcomp}) (\uparrow {\rm subj})\rangle$'}\\[1ex] Pred & `think$\langle(\uparrow {\rm subj}) (\uparrow {\rm comp})\rangle$'}\\ } \nodecurve[r]{a}[r]{c}{2in}[.5in] \anodecurve[r]{d}[r]{b}{1in}[2in] }
\enumsentence{\modsmalltree{6}{ & & &\ns\node{a}{\begin{tabular}[t]{@{}c@{}}S\\ {}[+R]\end{tabular}} \\ &\node{b}{NP} & & && \node{c}{VP} \\ \node{d}{Det} & &\node{e}{N$^1$} \\ \node{h}{the} &\node{i}{N} & &\node{f}{PP} &&\node{g}{are totally false}\\ &\node{n}{rumors} &\node{j}{P} & &\ns\node{k}{\begin{tabular}[t]{@{}c@{}}NP\\ {}[+R] \end{tabular}}\\ & &\node{l}{about} & &\node{m}{whom}} \nodeconnect{a}{b} \nodeconnect{e}{f} \nodeconnect{a}{c} \nodeconnect{i}{n} \nodeconnect{b}{d} \nodeconnect{f}{j} \nodeconnect{b}{e} \nodeconnect{f}{k} \nodeconnect{d}{h} \nodeconnect{j}{l} \nodeconnect{e}{i} \nodeconnect{k}{m} \nodetriangle{c}{g} {\makedash{4pt} \anodecurve[t]{b}[l]{a}{10pt} \anodecurve[t]{f}[r]{e}{10pt} \anodecurve[t]{e}[r]{b}{10pt} \anodecurve[t]{k}[r]{f}{10pt} }}
A multitude of caveats.