tree-dvips Tree Macros

[ LaTeX for Linguists , .dvi, .ps, .pdf]

Emma Pease

  • Locating Commands
  • Connecting Commands
  • Single Node commands
  • Parameters
  • How to Run
  • Examples
  • Errors
  • Footnotes

  • [ 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:

                        &\node{a}{top node}\\[3ex]
    \node{b}{left node} &     & \node{c}{right node}\\[3ex]
                        &     & \node{d}{odd node}
    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.

    Locating Commands

    Location commands are those that deal with defining a location on a page. The basic command

    Each node has its name, height, width, and the location of the lower left hand corner point passed down to postscript where it will remain until needed. Note that the object will be printed by TeX but the lines drawn by Postscript. A variant of this command is
    \nodepoint{nodename}[horizontal displace][vertical displace]
    The node's height and width are 0pts, but the location can be displaced.

    Connecting Commands

    These commands connect two or more nodes. The two basic ones are

    fromnodename and tonodename must be the names of two existing nodes. Imagine the node as a box, fromloc and toloc are the locations on that box to draw the connecting lines. The present choices are t [top], b [bottom], l [left], r [right], tl [topleft], tr [topright], bl [bottomleft], and br [bottomright]. These could be expanded.

    Other connecting commands are

    For example,
    \node{c}{\strut This} \node{a}{\strut is} a \node{b}{\strut test} 
    of barnodeconnect.  
    \node{c}{\strut This} \node{a}{\strut is} a \node{b}{\strut test}
    \node{d}{\strut of} abarnodeconnect.  \node{e}{\strut Note} arrows.
    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

    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.

    Single Node commands

    These commands adjust something around a single node rather than connecting nodes. The basic commands are

    They draw, respectively, a box, circle, or oval around the given node. You will probably wish to call these commands after you have called all the connecting commands you will be using in a particular diagram.


    At the moment there are three parameters that can be changed. They are

    How to Run

    In the preamble, put:

    Run through LaTeX and send to a postscript printer using dvips


    A series of examples follow.

        &    &    &      &\node{a}{VP} \\[2ex]
             &    &      &    &    &\mc{2}{c}{\node{c}{V$'$}}\\[2ex]
        &    &    &\node{d}{NP} \\[2ex]
        &    &\nodepoint{e}   
                  &      &\node{f}{NP} \\
        &    &    &\hfill\nodepoint{r}[0pt][3pt]   \\
             &    &\hfil\node{h}{NP}
                         &    &    &     &\hfil\node{i}{NP}\\[2ex]
             & \node{l}{Prt}
    `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'} \\
    \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}

    The following two examples use \outerfs and \modsmalltree; these are both part of the lingmacros package. See lingmacros.sty for more information.

    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$'}%
    Subj & \outerfs{Pred & `Max'}\\[1ex]
    Comp & \outerfs{Subj &\outerfs{Pred & `Larry'}%
                    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$'}\\

         &       &   &\ns\node{a}{\begin{tabular}[t]{@{}c@{}}S\\ 
                            {}[+R]\end{tabular}}   \\
                 &   &  && \node{c}{VP} \\
         &       &\node{e}{N$^1$} \\
                 &   &\node{f}{PP} 
                        &&\node{g}{are totally false}\\
                     &  &\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}
    \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.

    LaTeX for Linguists ,
    Doug Arnold,,
    January 19, 2005.