diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:58:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:58:05 +0000 |
commit | 1a113fd171e6547a74bd0693796692fac7494d63 (patch) | |
tree | 58f7fc77c1c8f3f96ede7b25fbf7d9853c3fef76 /Master/texmf-dist/tex/latex/linguex/ps-trees.sty | |
parent | 440d102927608f99ff10892dc8754b4f432f4aab (diff) |
linguex
git-svn-id: svn://tug.org/texlive/trunk@1042 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/linguex/ps-trees.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/linguex/ps-trees.sty | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/linguex/ps-trees.sty b/Master/texmf-dist/tex/latex/linguex/ps-trees.sty new file mode 100644 index 00000000000..00855bd4417 --- /dev/null +++ b/Master/texmf-dist/tex/latex/linguex/ps-trees.sty @@ -0,0 +1,82 @@ +%% 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 +%% Author: Wolfgang.Sternefeld@uni-tuebingen.de +%% filedate 99/27/04 +\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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + |