1

The following code produces nice trees with pst-trees. I have to gloss the leaves of the tree, so I put tabular environments in there and added the glosses. The problem is that the code does not align the nodes towards the top but centers them. This means that the N above David is between is and AUX. But it should be at the hight of is as in the left example. Is this possible? enter image description here

\documentclass{article}


\usepackage{pst-tree}

\psset{nodesep=5pt}
\psset{linewidth=0.5pt}

\makeatletter
\def\tree{\@ifnextchar[{\@tree}{\@tree[top]}}
\def\@tree[#1]#2#3{%
  \renewcommand\psedge{\ncdiag[arm=0,angleA=270,angleB=90,linewidth=.5pt]}
  \pstree[levelsep=*2.8ex,nodesep=3pt,treesep=.5cm]{\TR[name=#1]{\small #2}}{#3}}


\def\le{\@ifnextchar[{\@le}{\@le[lex]}}
\def\@le[#1]#2{\renewcommand\psedge{\ncdiag[arm=0,angleA=270,angleB=90,linewidth=.5pt]}
               \TR[name={#1}]{\begin{tabular}{@{}c@{}}#2\end{tabular}}}
\makeatother


\begin{document}


\tree[a]{IP}{%
  \tree{NP}{\tree{N$'$}{%
    \tree{N}{\le{David}}}}
  \tree[b]{I$'$}{%
    \tree[c]{I}{\le{is}}
    \tree[d]{VP}{\tree[e]{V$'$}{\tree[f]{V}{\le{yawning}}}}}}%
\hfill
\tree[a]{IP}{%
  \tree{NP}{\tree{N$'$}{%
    \tree{N}{\le{David\\David}}}}
  \tree[b]{I$'$}{%
    \tree[c]{I}{\le{is\\\textsc{aux}}}
    \tree[d]{VP}{\tree[e]{V$'$}{\tree[f]{V}{\le{yawning\\gloss}}}}}}%


\end{document}
3

Just add the option[t]$ to thetabular_ environment:

\documentclass{article}

\usepackage{pst-tree}

\psset{nodesep=5pt}
\psset{linewidth=0.5pt}

\makeatletter
\def\tree{\@ifnextchar[{\@tree}{\@tree[top]}}
\def\@tree[#1]#2#3{%
  \renewcommand\psedge{\ncdiag[arm=0,angleA=270,angleB=90,linewidth=.5pt]}
  \pstree[levelsep=*2.8ex,nodesep=3pt,treesep=.5cm]{\TR[name=#1]{\small #2}}{#3}}

\def\le{\@ifnextchar[{\@le}{\@le[lex]}}
\def\@le[#1]#2{\renewcommand\psedge{\ncdiag[arm=0,angleA=270,angleB=90,linewidth=.5pt]}
               \TR[name={#1}]{\begin{tabular}{@{}c@{}}#2\end{tabular}}}
\makeatother

\begin{document}

\tree[a]{IP}{%
  \tree{NP}{\tree{N$'$}{%
    \tree{N}{\le{David}}}}
  \tree[b]{I$'$}{%
    \tree[c]{I}{\le{is}}
    \tree[d]{VP}{\tree[e]{V$'$}{\tree[f]{V}{\le{yawning}}}}}}%
\hfill
\tree[a]{IP}{%
  \tree{NP}{\tree{N$'$}{%
    \tree{N}{\le{David\\David}}}}
  \tree[b]{I$'$}{%
    \tree[c]{I}{\le{is\\\textsc{aux}}}
    \tree[d]{VP}{\tree[e]{V$'$}{\tree[f]{V}{\le{yawning\\gloss}}}}}}%

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.