summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/linguex/ps-trees.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/linguex/ps-trees.sty')
-rw-r--r--macros/latex/contrib/linguex/ps-trees.sty83
1 files changed, 83 insertions, 0 deletions
diff --git a/macros/latex/contrib/linguex/ps-trees.sty b/macros/latex/contrib/linguex/ps-trees.sty
new file mode 100644
index 0000000000..6f31dffcf9
--- /dev/null
+++ b/macros/latex/contrib/linguex/ps-trees.sty
@@ -0,0 +1,83 @@
+%% Copyright 1999 Wolfgang Sternefeld
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt; either
+%% version 1 of the License, or any later version.
+%% ps-trees.sty version 2.0
+%% Author: Wolfgang.Sternefeld@uni-tuebingen.de
+%% filedate 99/27/04
+\ProvidesPackage{ps-trees}[1999/04/27 Linguistic trees in tabular form v. 2.0]
+\RequirePackage{tree-dvips}
+\newtoks\AllNodes
+\newtoks\CollectedNodes
+\newtoks\CollectedTNodes
+\newif\ifIsElement
+\newlength{\MinNodeWidth}
+\newlength{\NodeWidth}
+\newcommand{\NodeWidthNo}[1]{\setlength{\MinNodeWidth}{\the\wd#1}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newif\ifTNode
+\newcommand{\AddToToks}[2]{%
+ \expandafter\expandafter\expandafter%
+ \global#1\expandafter{%
+ \the#1#2}}
+\def\TestAndAdd#1{\def\yy{#1}%
+ \ifx\yy\empty\relax\else%
+ \ifTNode\AddToToks{\CollectedTNodes}{\\{#1}}%
+ \else\AddToToks{\CollectedNodes}{\\{#1}}\fi\fi
+ \IfIsNodeName{#1}%
+ \typeout{*** Warning: Node Name `#1' already exists ***}\fi
+ }
+\let\oldnode=\node
+\newenvironment{psTree}{\tabcolsep0pt\nodemargin0pt%
+ \def\node##1##2{\AddToToks{\AllNodes}{\\{##1}}\oldnode{##1}{##2\strut}}%
+ }%
+ {\let\\=\EveryNode\the\CollectedNodes%
+ \let\\=\EveryTNode\the\CollectedTNodes%
+ \global\AllNodes={}\global\CollectedNodes={}\global\CollectedTNodes={}%
+ \global\setlength{\MinNodeWidth}{0pt}%\hspace{\fill}
+ }
+\newcommand{\EveryNode}[1]{\ConnectNode#1 }
+\newcommand{\EveryTNode}[1]{\ConnectTNode#1 }
+\def\ConnectNode#1#2 {\IfIsNodeName{#2}\nodeconnect{#2}{#1#2}%
+ \else\NoNodeWarning{#2}\fi}
+\def\ConnectTNode#1#2 {\IfIsNodeName{#2}\nodeconnect{#2}[tl]{#1#2}%
+ \nodeconnect{#2}[tr]{#1#2}\nodeconnect[tl]{#1#2}[tr]{#1#2}%
+ \else\NoNodeWarning{#2}\fi}
+\newcommand{\IsElementOf}[2]{\IsElementfalse\def\xx{#1}\bgroup
+ \let\\=\Compare\the#2\egroup}
+\newcommand{\IfIsNodeName}[1]{\IsElementOf{#1}{\AllNodes}\ifIsElement}
+\newcommand{\Compare}[1]{\def\yy{#1}\ifx\yy\xx\global\IsElementtrue\fi}
+\newcommand{\NoNodeWarning}[1]{\typeout{*** Fatal Error. Node Name `#1'
+ does'nt exist ***}}
+\newenvironment{treetab}{\begin{psTree}\begin{tabular}}{\end{tabular}%
+ \end{psTree}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\Node}{\@ifnextchar[{\OptionNode}{\@Node}}
+\newcommand{\@Node}[2]{\TestAndAdd{#1}\settowidth{\NodeWidth}{#2}%
+ \ifdim\NodeWidth<\MinNodeWidth%
+ \makebox[\MinNodeWidth]{\hfill\node{#1}{#2}\hfill}%
+ \else\node{#1}{#2}%
+ \fi}
+\def\OptionNode[#1]#2#3{\TestAndAdd{#2}\makebox[\the\wd#1]{\hfill
+ \node{#2}{#3}\hfill}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\NodeNo}[1]{\@ifnextchar[{\OptionNodeNo{#1}}{\@NodeNo{#1}}}
+\newcommand{\@NodeNo}[2]{\@Node{#2}{\unhcopy#1}}
+\def\OptionNodeNo#1[#2]#3{\TestAndAdd{#3}%
+ \makebox[\the\wd#2]{\hfill\node{#3}{\unhcopy#1}\hfill}}
+\newcommand{\NodeZ}[2]{\TestAndAdd{#1}%
+ \hfill\node{#1}{\makebox[0pt]{#2\strut}}}
+\newcommand{\NodeT}[2]{\TNodetrue
+ \Node{#1}{#2}\TNodefalse}
+\newcommand{\NodeZT}[2]{\TNodetrue\TestAndAdd{#1}%
+ \hfill\makebox[0pt]{\node{#1}{#2\strut}}\TNodefalse}
+\let\NodeTZ=\NodeZT
+\newcommand{\NodeTNo}[2]{\TNodetrue\NodeNo{#1}{#2}\TNodefalse}
+\newcommand{\NodeZTNo}[2]{\hfill\makebox[0pt]{\NodeTNo{#1}{#2}}}
+\let\NodeTZNo=\NodeZTNo
+\newcommand{\nodeZ}[2]{\IfIsNodeName{#1}%
+ \typeout{*** Warning: Node Name `#1' already exists ***}\fi
+ \hfill\node{#1}{\makebox[0pt]{#2}}}
+%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+