# Using tree-dvips with XeLaTeX

I try to switch to XeLaTeX, but the package tree-dvips causes problems. It seems to require PostScript and pdftricks which causes a lot of other problems (puts a \begin{center} environment around everything, which adds to much space and so on).

I can run the following code under latex + dvips + ps2pdf but when I call XeLaTeX I get warnings and the connections between the nodes are not drawn.

** WARNING ** Unknown token "@beginspec"
** WARNING ** Interpreting PS code failed!!! Output might be broken!!!
** WARNING ** Interpreting special command ps: (ps:) failed.
** WARNING ** >> at page="1" position="(261.137, 712.838)" (in PDF)
** WARNING ** >> xxx "ps:@beginspec/nodemargin 2.0 pt def 0.3 pt setlinewidth [] 0..."
** WARNING ** >> Reading special command stopped around >>/nodemargin 2.0 pt def 0.3 pt setlinewidth [] 0 setdash/arro...<<
** WARNING ** Unknown token "@beginspec"
** WARNING ** Interpreting PS code failed!!! Output might be broken!!!
** WARNING ** Interpreting special command ps: (ps:) failed.
** WARNING ** >> at page="1" position="(117.303, 680.041)" (in PDF)
** WARNING ** >> xxx "ps:@beginspec/nodemargin 2.0 pt def 0.3 pt setlinewidth [] 0..."
** WARNING ** >> Reading special command stopped around >>/nodemargin 2.0 pt def 0.3 pt setlinewidth [] 0 setdash/arro...<<
** WARNING ** Unknown token "@beginspec"


Any suggestions for fixing this or for getting rid of tree-dvips in a painless way (I have tons of trees already done ...) are welcome.

Here is my code:

\documentclass{scrbook}

\usepackage{graphicx}

\usepackage{tree-dvips}

\begin{document}

This is some text and the figure should be the size of the text not larger and not smaller.
\begin{figure}[h]
\resizebox{\linewidth}{!}{
\begin{tabular}{@{}ccccc@{}}
\multicolumn{5}{c}{\node{sign}{sign}}\\[5ex]
\multicolumn{2}{c}{\node{root}{root}} &        & \node{word}{word}       & \node{phrase}{phrase}\\[3ex]
\node{noun}{noun-root} & \multicolumn{2}{c}{\node{verb}{verb-root}}  &  & \node{hp}{headed-phrase} \\[3ex]
& \node{iv}{intransitive-verb} & \multicolumn{2}{c}{\node{tv}{transitive-verb}}            & \node{hap}{head-complement-phrase}\\[3ex]
& \node{siv}{strict-intr-verb}                 & \node{stv}{strict-transitive-verb} & \node{dv}{ditransitive-verb} \\[3ex]
& \node{schlaf}{schlaf-}           & \node{lieb}{lieb-}                  & \node{geb}{geb-}\\
& (to sleep') & (to love') & (to give')\\
\end{tabular}%
\nodeconnect{sign}{root}\nodeconnect{sign}{word}\nodeconnect{sign}{phrase}%
\nodeconnect{root}{noun}\nodeconnect{root}{verb}\nodeconnect{phrase}{hp}%
\nodeconnect{hp}{hap}%
\nodeconnect{verb}{iv}\nodeconnect{verb}{tv}\nodeconnect{tv}{stv}\nodeconnect{tv}{dv}%
\nodeconnect{iv}{siv}%
{\makedash{4pt}%
\nodeconnect{siv}{schlaf}\nodeconnect{stv}{lieb}\nodeconnect{dv}{geb}%
}%
}
\end{figure}

This is some text and the figure should be the size of the text not larger and not smaller.

\end{document}

-
Honestly, I would redo this using tikz-qtree. It has a much easier syntax and gives you pretty much all of the same functionality as tree-dvips. – Alan Munn Sep 11 '12 at 19:01
Ok. Can I also connect arbitrary nodes on a page? My coauthors use this to draw lines and ovals in linguistic examples. – Stefan Müller Sep 11 '12 at 19:03
I've added an example to my answer. P.S. where do unaccusative verbs fit in your taxonomy? :) – Alan Munn Sep 11 '12 at 19:51

Here's a version of your tree using tikz-qtree. You can circle nodes, connect them with arrows etc. If you search for tikz-qtree questions on the site you'll find lots of examples; there are also plenty in the tikz-qtree documentation. Just to show what you can do I've put boxes around a couple of nodes and connected them with an arrow.

\documentclass{scrbook}

\usepackage{fontspec}
\usepackage{tikz-qtree}

\begin{document}

This is some text and the figure should be the size of the text not larger and not smaller.

\begin{tikzpicture}[every node/.style={align=center}]
\Tree [.sign
[.root
[.noun-root ]
[.verb-root
[.intransitive-verb
[.strict-intr-verb
\edge[dashed]; [.{schlaf-\\(to sleep')} ] ] ]
[.transitive-verb
\edge[dashed]; [.\node[draw,red] (Lieb) {lieb-\\(to love')}; ] ]
[.ditransitive-verb
\edge[dashed]; [.{geb\\(to give')} ] ]]] ]
[.\node[draw,red] (Wd) {word}; ]
[.phrase
\draw[thick] (Lieb.south) edge [bend right=40,->] (Wd);
\end{tikzpicture}
\end{document}


-

I found a really simple way: Use pst-nodes and replace all \node by \rnode and all \nodeconnect by \ncline. \anodeconnecthas to be replaced by \ncline{->}. This gave me a processable document in a few minutes.

Nevertheless I fell in love with the triz-qtree package yesterday. The trees look much more uniform than what I managed to do with tree-dvips and it is way easier to draw the trees. The code even fits on one screen now. So the hint towards this package definitely changed my live! Thanks again!

But some things just cannot be done automatically and it it good to know that the pst-node solution is still around.

-
there is also a pst-qtree. And, of course, a pst-jtree for Linguistics – Herbert Sep 12 '12 at 13:24