next up previous
Next: About this document ...

\ensuremath{\mathrm{SY^{N}}}TEX

\ensuremath{\mathrm{SY^{N}}}TEX was written by Matt Chisholm <matt (at) theory.org>. It is available at http://www.theory.org/~adric/syntex/. It is licensed under the GNU GPL ( http://www.gnu.org/copyleft/gpl.txt ). It requires LATEX and Perl 5 to run. It should run under *nix without much modification; it should also run under other operating systems if they have LATEX and Perl support.

\ensuremath{\mathrm{SY^{N}}}TEX is a LATEX preprocessor that draws syntactic trees. The preprocessor reads the comments in a LATEX file and draws the tree based on commands that it finds there. The program looks for lines that begin with the string %#tree:. The program expects to find a line which is a list of options, specifying things like type style, type size, and layout algorithm, followed by a line which specifies the content of the tree.

For example, these two lines together:

%#tree: -f4
%#tree: S(NP(D(the), N'(N(farmer))), VP(V(killed), NP(D(the), N'(N(pig)), PP(P(with), NP(D(a) N'(N(pitchfork)) ) ) ) ) )

will draw this tree:


\begin{picture}(213,159)(0,0)
\put(65.25, 149){\makebox(0,10){\small\textrm{S}}}...
...29)(105.75,124)(117,119)
\qbezier(65.25,149)(79.875,144)(94.5,139)
\end{picture}

Tree Content

The line that specifies the tree content is a list of nodes. For example, a single node, called XP, which has one child node, called X, is drawn by inserting this text in your document:

%#tree:
%#tree: XP(X)


\begin{picture}(18,39)(0,0)
\put(9, 29){\makebox(0,10){\small\textrm{XP}}}
\put(9, 9){\makebox(0,10){\small\textrm{X}}}
\qbezier(9,29)(9,24)(9,19)
\end{picture}

Nodes can contain any characters except ``('', ``)'', ``|'', or ``,'' (they also can't contain newline or tab characters), and they cannot begin or end with a space. The ``('' and ``)'' characters begin and end a node's list of children. The ``|'' character is explained in the Options section.

The comma character is usually not needed, but I find it useful to use anyway. The only place where the comma character is needed is to mark the boundaries between nodes that do not have any children. Notice that the first two examples are trees where S has three children: in the third example, S has one child with three words.

%#tree: S(resistance, is, futile) %#tree: S(resistance() is() futile()) %#tree: S(resistance is futile)

\begin{picture}(108,39)(0,0)
\put(60, 29){\makebox(0,10){\small\textrm{S}}}
\put...
...akebox(0,10){\small\textrm{futile}}}
\qbezier(60,29)(75,24)(90,19)
\end{picture}

\begin{picture}(108,39)(0,0)
\put(60, 29){\makebox(0,10){\small\textrm{S}}}
\put...
...akebox(0,10){\small\textrm{futile}}}
\qbezier(60,29)(75,24)(90,19)
\end{picture}

\begin{picture}(120,39)(0,0)
\put(60, 29){\makebox(0,10){\small\textrm{S}}}
\put...
...all\textrm{resistance\ is\ futile}}}
\qbezier(60,29)(60,24)(60,19)
\end{picture}

Options

Type style can be changed by the -style=??,??,?? option. Arguments are tt, bf, it, and sf, corresponding to LATEX's \texttt, \texttt, \textbf, \textit, \textsf commands.

%#tree: -style=bf,it,tt
%#tree: S(NP(D(the), N'(N(farmer))), VP(V'(V(killed), NP(D(the), N'(pig)) ) PP(P'(P(with), NP(D(a), N'(N(pitchfork))) ) ) ) )


\begin{picture}(301.75,191)(0,0)
\put(76.5, 179){\makebox(0,12){\large\textbf{\t...
...155)(148.75,149)(195.5,143)
\qbezier(76.5,179)(89.25,173)(102,167)
\end{picture}

Font size is changed with the -f? command. ``?'' must be a number from 1 to 10, corresponding to the 10 LATEX type sizes. The default type size is 5, \large.

%#tree: -f2
%#tree: S(NP(D(the), N'(N(farmer))), VP(V'(V(killed), NP(D(the), N'(pig)) ) PP(P'(P(with), NP(D(a), N'(N(pitchfork))) ) ) ) )


\begin{picture}(177.5,127)(0,0)
\put(45, 119){\makebox(0,8){\scriptsize\textrm{S...
...bezier(60,103)(87.5,99)(115,95)
\qbezier(45,119)(52.5,115)(60,111)
\end{picture}

The -x=prime or -x=bar options specify how you want X' to be drawn; either with a $'$ or with a bar over the top of the letter. The default is to draw a bar.

%#tree: -x=prime
%#tree: S(NP(D(the), N'(N(farmer))), VP(V'(V(killed), NP(D(the), N'(pig)) ) PP(P'(P(with), NP(D(a), N'(N(pitchfork))) ) ) ) )


\begin{picture}(301.75,191)(0,0)
\put(76.5, 179){\makebox(0,12){\large\textrm{S}...
...155)(148.75,149)(195.5,143)
\qbezier(76.5,179)(89.25,173)(102,167)
\end{picture}

The -h and -H options turn ``head balancing'' on and off. ``Head balancing'' means that a projection is aligned directly above it's head. Head balancing is on by default.

Items in brackets are interpreted as ``features'' and placed into subscripts. A node can be given multiple ``features'' by separating individual features with a \ character.

%#tree: -h
%#tree: TP(NP(D(the), N'(N(farmer))), T'(T[+past](0), VP(V'(killed), NP(D(the), N'(N(pig)), PP(P'(P(with), NP(D(a), N'(N(pitchfork))) ) ) ) ) ) )


\begin{picture}(365.5,239)(0,0)
\put(108.375, 227){\makebox(0,12){\large\textrm{...
...5,197)(165.75,191)
\qbezier(108.375,227)(108.375,221)(108.375,215)
\end{picture}

The -t and -T options turn ``triangles'' on and off. If triangles are on, a terminal node that contains more than one word will have a triangle above it, instead of a single line. Triangles are on by default. Coreferent noun phrases indicated by subscripts are made by typing ``NPi,'' ``NPj'' or ``NPk.''

%#tree: -t
%#tree: S( NPi(the farmer), VP(V'(V(killed), NPi(himself)), PP(P'(P(with), NP(a pitchfork) )) ) )


\begin{picture}(323,143)(0,0)
\put(76.5, 131){\makebox(0,12){\large\textrm{S}}}
...
...,107)(161.5,101)(212.5,95)
\qbezier(76.5,131)(93.5,125)(110.5,119)
\end{picture}

Terminal nodes can be aligned against the bottom of the graph with the -a option. Vertical lines are drawn whenever the program encounters a ``|'' in the input string.

%#tree: -a
%#tree: S(NP(D(the), N(N'(farmer))),| VP(V(killed), | NP(D(the), N'(N(pig)), PP(P(with), NP(D(a) N'(N(pitchfork)) ) ) ) ) )


\begin{picture}(301.75,191)(0,0)
\put(82.875, 179){\makebox(0,12){\large\textrm{...
...25,149)(165.75,143)
\qbezier(82.875,179)(108.375,173)(133.875,167)
\end{picture}

The -line=? option specifies what type of line to draw between nodes. The options are line, convex, concave, curly, square, and mondrian. The line option is default; the square option is nice for genealogical trees. The others are mostly for fun.

%#tree: -line=square -T -f2
%#tree: Hans+ValborgBjerrum( Vera+MaxChisholm( Elizabeth+Delphey(John, Chris), Derelle+JimGartland(Mark+Claudia(Gabe, Isabel), Ron, Dave+Carrie), Charlie+LindaKramer(Matt, Alex) ))


\begin{picture}(315,79)(0,0)
\put(153.75, 71){\makebox(0,8){\scriptsize\textrm{H...
...1)(266.25,49)(266.25,47)
\qbezier(153.75,71)(153.75,67)(153.75,63)
\end{picture}

Logicial structures can be represented as well. There is something of a shorthand to express $\wedge$(^), $\vee$(`), $\to$(->), and $\neg$(!).

%#tree: -paren=[] -f4 -H
%#tree: (p^q)->!(p`q)[p^q[p, q], !(p\`q)[p\`q[p, q]]]


\begin{picture}(57,79)(0,0)
\put(26.25, 69){\makebox(0,10){\small\textrm{(p$\wed...
...\qbezier(36,49)(36,44)(36,39)
\qbezier(26.25,69)(31.125,64)(36,59)
\end{picture}




next up previous
Next: About this document ...
Adric 2001-03-23