LingTrees Linguistics Tree-formatting Preprocessor and Macros
Avery D Andrews, March 2006
Purpose:
This is a LateX2e package for formatting linguistics trees (upside-down,
hanging by the root, with slanted branches from mother to daughters),
consisting of a prepreprocessor written in Python (freely downloadable from
http://www.python.org or http://www.activestate.com; the latter might be
easier to get working in Linux), and some LaTeX .sty files. The preprocessor
allows trees to be entered as indented lists (no brackets to worry about),
and also deploys line-drawing and various other commands. The macros are
responsible for the details of positioning. Plain TeX is currently not
supported.
In addition to the preprocessor itself (trees.py), there's a simple
GUI for running it by pushing a button in the GUI subdirectory.
Free-standing executables for Windows may be found at:
http://arts.anu.edu.au/Linguistics/People/AveryAndrews/Software/latex
The package is probably most suitable for irregularly-branching trees
with wide and complex node-labels, such as are prevalent for example in
LFG and HPSG. Other packages that might be worth looking at are pst-jtree
(good for heavily right-branching trees with small node-labels) and
qtree (which works with pdflatex). It is an upwards-compatible
successor to the 'trees' package at CTAN/latex209/contrib/pstrees/trees.
Dependencies:
It requires either the pst-nodes module of the PSTricks, or Emma Pease's
tree-dvips (with less functionality), both available on CTAN. The source
for the documentation file lingtrees.doc.txp also requires Chris
Manning's avm.sty, of which version 1.02 is also included here with
permission.
License:
LaTeX macros: LaTeX Project Public License
trees.py: GPL 2
Documentation:
The documentation for the macros and preprocessor commands is in the
file lingtrees.doc.pdf. pst-nodes is accessed thru a partial emulation
of tree-dvips, documented in pst-tree-dvips-emu.doc.pdf.
Installation:
The .sty files are:
lingtrees.sty
pst-tree-dvips-emu.sty
lingrees-without-pstricks.sty
avm.sty and cm-lingamcros (by Chris Manning), needed for generating the
docs; see http://nlp.stanford.edu/~manning/tex/ for more information.
put them whereever you put your custom LaTeX files. You will
also need to have Pstricks or tree-dvips installed (both available
on CTAN, and already present in many LaTeX distributions).
For the preprocessor itself, script trees.py can be
run directly with Python. Or, Windows users can collect a free-standing
executable with an installer from
http://arts.anu.edu.au/Linguistics/People/AveryAndrews/Software/latex
The exact procedure for running trees.py depends on the OS. A rather
generic procedure that should always work is:
1. put trees.py in some folder, say c:\bin
2. have a terminal/dos window cd'd to the folder where your work is
3. have the input file called something like work.txp (.txp
being the assumed extension for the input file)
4. type:
python c:\bin\trees.py work
(no extension; assumes the Python executable is on your PATH)
5. the output should be written to work.tex (.tex being
the supplied extension for the output file)
It should however usually be possible to get the script to run just
by typing their names.
For Linux, Unix, etc. you can place the script somewhere on your PATH
variable, make it executable, and perhaps edit the 'shebang' line at
the top to reflect exactly where Python is (and maybe remove the .py
extension from the name).
For Windows 2000 and XP, you can again put the script somewhere on your
path, and then select Start|Settings|Control Panel|System|Advanced|
Environment Variables, and edit or add PATHEXT so that it ends with
.PY;.PYW. If you have Administrator privileges you can do this in the
System Variables for everybody; otherwise only in the User Variables for
yourself.
trees.py will also run as a filter, but due to a bug in the handling of
io-redirection in Windoze with PATHEXT, you have to explicitly invoke
Python in order for this to work, i.e.:
python c:\exe\trees.py < work.txp > work.tex
Win9x users can use the generic method above, or get the free-standing
executable. Frederik Lundh's exemaker program would also be a way
to avoid invoking Python explicitly (although it does require
python to be installed).
Generating the Docs:
The docs sources are in the Samples folder. To generate them you'll
need cm-lingmacros.sty and amv.sty, included here in the CDM folder,
and:
urls.sty ([CTAN]macros/latex/contrib/misc/url.sty)
PStricks ([CTAN]graphics/pstricks; pst-node and pst-coil modules)
Both included in MikTeX large.