diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex |
Initial commit
Diffstat (limited to 'graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex')
-rw-r--r-- | graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex | 1110 |
1 files changed, 1110 insertions, 0 deletions
diff --git a/graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex b/graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex new file mode 100644 index 0000000000..24b0fd5405 --- /dev/null +++ b/graphics/pstricks/contrib/pst-tree/tex/pst-tree.tex @@ -0,0 +1,1110 @@ +%% $Id: pst-tree.tex 466 2011-02-28 17:13:11Z herbert $ +%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu. +%% COPYRIGHT 2000-2003 by Denis Girou. +%% Copyright 2004- Herbert Voss +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2003/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Herbert Voss +% +% This work consists of the file pstricks.tex, PostScript macros +% for Generic TeX. +% See the PSTricks User's Guide for description. +% +\csname PSTreeLoaded\endcsname +\let\PSTreeLoaded\endinput +\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi\relax +\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi +% +\def\fileversion{1.13} +\def\filedate{2017/02/18} +\message{ v\fileversion, \filedate (tvz,dg,hv)} +% +\edef\TheAtCode{\the\catcode`\@} +\catcode`\@=11 +% +\pst@addfams{pst-tree} +\newbox\pstree@rootbox +\newbox\pstree@box +\def\pstree@succrow{% + \ifpstreeflip\def\pssubtree@vertical{\pssubtree@vertical@vflip}% + \else\def\pssubtree@vertical{\pssubtree@vertical@v}\fi +% +\def\pstree@node{\pstree@node@v}% +% +\def\pssubtree@horizontal{\pssubtree@horizontal@v}}% +% +\def\pssubtree@vertical@v{% + \vrule height \pst@dimc depth \pst@dimd width \z@ + \ifnum\psnodecnt=\z@ + \global\let\pstree@theleftprofile\pstree@leftprofile + \global\let\pstree@therightprofile\pstree@rightprofile + \else + \psk@thistreefit\pstree@therightprofile\pstree@leftprofile + \kern\the\pst@cnth sp + \pstree@zip\pstree@therightprofile + \pstree@rightprofile\pstree@therightprofile + \global\advance\pstree@cnt\pst@cnth + \pst@cnth=\pstree@cnt + \pstree@zip\pstree@leftprofile + \pstree@theleftprofile\pstree@theleftprofile + \fi + \box\pstree@box + \global\advance\psnodecnt 1\relax}% +% +\def\pssubtree@vertical@vflip{% + \vrule height \pst@dimc depth \pst@dimd width \z@ + \ifnum\psnodecnt=\z@ + \global\let\pstree@theleftprofile\pstree@leftprofile + \global\let\pstree@therightprofile\pstree@rightprofile + \else + \psk@thistreefit\pstree@theleftprofile\pstree@rightprofile + \kern-\pst@cnth sp + \pstree@zip\pstree@theleftprofile + \pstree@leftprofile\pstree@theleftprofile + \global\advance\pstree@cnt\pst@cnth + \pst@cnth=\pstree@cnt + \pstree@zip\pstree@rightprofile + \pstree@therightprofile\pstree@therightprofile + \fi + \box\pstree@box + \global\advance\psnodecnt 1\relax}% +% +\def\pstree@node@v{% + \edef\pstree@leftprofile{\psk@thistreenodesize\pst@dima,\pstree@stop,}% + \edef\pstree@rightprofile{\psk@thistreenodesize\pst@dimb,\pstree@stop,}% + \pssubtree@vertical} +% +\def\pssubtree@horizontal@v{% + \pstree@max\pstree@upprofile\pst@cntg + \pst@dimc=\pst@cntg sp + \pstree@max\pstree@downprofile\pst@cntg + \pst@dimd=\pst@cntg sp + \pstree@treebboxadjust + \edef\pstree@leftprofile{\number\pst@dima,\pstree@stop,}% + \edef\pstree@rightprofile{\number\pst@dimb,\pstree@stop,}% + \pssubtree@vertical}% +% +\def\pstree@tightfit#1#2{% + \pst@cnth=\z@ + \edef\next{\noexpand\pstree@@tightfit#1\noexpand\@nil#2\noexpand\@nil}% + \next + \advance\pst@cnth\psk@thistreesep\relax + \advance\pst@cnth\pstree@tspace\relax + \gdef\pstree@tspace{\z@}} +% +\def\pstree@@tightfit#1,#2\@nil#3,#4\@nil{% + \ifnum#1=\pstree@stop + \let\next\relax + \else + \ifnum#3=\pstree@stop\let\next\relax + \else + \pst@cntg=#1 + \advance\pst@cntg#3 + \ifnum\pst@cntg>\pst@cnth\pst@cnth=\pst@cntg\fi + \def\next{\pstree@@tightfit#2\@nil#4\@nil}% + \fi + \fi + \next} +% +\def\pstree@loosefit#1#2{% + \pstree@max{#1}\pst@cnth + \pstree@max{#2}\pst@cntg + \advance\pst@cnth\pst@cntg + \advance\pst@cnth\psk@thistreesep\relax + \advance\pst@cnth\pstree@tspace\relax + \gdef\pstree@tspace{\z@}} +% +\def\tspace#1{% + \pst@@killglue + \pssetlength\pst@dimg{#1}% + \xdef\pstree@tspace{\number\pst@dimg}% + \ignorespaces} +% +\define@key[psset]{pst-tree}{treefit}[tight]{% + \@ifundefined{pstree@#1fit}% + {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}% + {\expandafter\let\expandafter\psk@treefit\csname pstree@#1fit\endcsname}} +\psset[pst-tree]{treefit=tight} +% +\define@key[psset]{pst-tree}{thistreefit}[tight]{% + \@ifundefined{pstree@#1fit}% + {\@pstrickserr{Bad `treefit' parameter value: `#1'}\@ehpa}% + {\expandafter\let\expandafter\psk@thistreefit\csname pstree@#1fit\endcsname}} +\psset[pst-tree]{thistreefit=tight} +% +\def\pstree@zip#1#2#3{% + \def\pst@tempg{}% + \edef\next{\noexpand\pstree@@zip#1\noexpand\@nil#2\noexpand\@nil}% + \next + \global\let#3\pst@tempg} +% +\def\pstree@@zip#1,#2\@nil#3,#4\@nil{% + \ifnum#1=\pstree@stop + \edef\pst@tempg{\pst@tempg#3,#4}% + \let\next\relax + \else + \ifnum#3=\pstree@stop + \pst@cntg=#1 + \advance\pst@cntg-\pst@cnth + \edef\pst@tempg{\pst@tempg\the\pst@cntg,}% + \def\next{\pstree@@zip#2\@nil\pstree@stop,\@nil}% + \else + \edef\pst@tempg{\pst@tempg#3,}% + \def\next{\pstree@@zip#2\@nil#4\@nil}% + \fi + \fi + \next} +% +\def\pstree@max#1#2{% + \pst@cntg=\z@ + \expandafter\pstree@@max#1#2=\pst@cntg}% +% +\def\pstree@@max#1,{% + \ifnum#1=\pstree@stop\else + \ifnum#1>\pst@cntg \pst@cntg=#1 \fi + \expandafter\pstree@@max + \fi} +% +\def\pstree@add#1{% + \def\pst@tempg{}% + \expandafter\pstree@@add#1% + \xdef#1{\pst@tempg\pstree@stop,}} +% +\def\pstree@@add#1,{% + \ifnum#1=\pstree@stop\else + \pst@cnth=#1 + \advance\pst@cnth\pst@cntg + \xdef\pst@tempg{\pst@tempg\the\pst@cnth,}% + \expandafter\pstree@@add + \fi} +% +\newcount\psnodecnt +\let\c@psnodecnt\psnodecnt +\newcount\pstreelevel +\let\c@pstreelevel\pstreelevel +\newcount\pstreecnt +\let\c@pstreecnt\pstreecnt +\newcount\pstree@cnt +% +\def\pstree{\def\pst@par{}\pst@object{pstree}} +\def\pstree@i{\def\pstree@makebox{\pst@@makebox}\pstree@ii} +% +\def\psTree{\def\pst@par{}\pst@object{psTree}} +\def\psTree@i{\def\pstree@makebox{\pst@makelongbox}\pstree@ii} +% hv --begin 1.00 2007-01-03 make it LaTeX-compatible +%\def\endpsTree{\pst@endlongbox\ignorespaces} +\def\endpsTree{\pst@endlongbox\csname ignorespacesafterend\endcsname} +% hv --end +\def\pstree@ii{% + \ifnum\pstreelevel=\z@ + \let\pstree@savedshortput\pst@shortput + \psset{shortput=tab}% + \else + \pst@@killglue + \fi + \begingroup + \begingroup + \def\pstree@node{% + \xdef\pstree@next{% + \noexpand\@psttrue + \noexpand\def\noexpand\pst@tempa{\number\pst@dima}% + \noexpand\def\noexpand\pst@tempb{\number\pst@dimb}% + \noexpand\def\noexpand\pst@tempc{\number\pst@dimc}% + \noexpand\def\noexpand\pst@tempd{\number\pst@dimd}}% + \box\pstree@box}% + \def\pssubtree@horizontal{\pssubtree@horizontal@o}% + \def\pssubtree@vertical{\pssubtree@vertical@o}% + \global\let\pstree@next\relax + \pst@makebox\pstree@iii} +% +\def\pstree@iii{% + \global\setbox\pst@boxg=\box\pst@hbox + \endgroup + \setbox\pstree@rootbox=\box\pst@boxg + \@pstfalse + \pstree@next + \if@pst + \ifdim\wd\pstree@rootbox=\z@\else + \@pstrickserr{Extraneous space in root node}\@ehpa + \typeout{===>\the\wd\pst@hbox (rootbox)} + \wd\pstree@rootbox=\z@ + \fi + \else + \@pstrickserr{Missing or bad root node + (level \the\pstreelevel, node \the\psnodecnt)}\@ehpa + \def\pstree@next{% + \def\pst@tempa{0}% + \def\pst@tempb{0}% + \def\pst@tempc{0}% + \def\pst@tempd{0}}% + \wd\pstree@rootbox=\z@ + \fi + \pstree@savevalues + \begingroup + \pstree@initsuccvalues + \pstree@setlevelpar + \pstree@do} +% +\def\pstree{\def\pst@par{}\pst@object{pstree}} +\def\pstree@i{\def\pstree@makebox{\pst@@makebox}\pstree@ii} +% +\def\psTree{\def\pst@par{}\pst@object{psTree}} +\def\psTree@i{\def\pstree@makebox{\pst@makelongbox}\pstree@ii} +% hv --begin 1.00 2007-01-03 make it LaTeX-compatible +%\def\endpsTree{\pst@endlongbox\ignorespaces} +\def\endpsTree{\pst@endlongbox\csname ignorespacesafterend\endcsname} +% hv --end +\def\pstree@ii{% + \ifnum\pstreelevel=\z@ + \let\pstree@savedshortput\pst@shortput + \psset{shortput=tab}% + \else + \pst@@killglue + \fi + \begingroup + \begingroup + \def\pstree@node{% + \xdef\pstree@next{% + \noexpand\@psttrue + \noexpand\def\noexpand\pst@tempa{\number\pst@dima}% + \noexpand\def\noexpand\pst@tempb{\number\pst@dimb}% + \noexpand\def\noexpand\pst@tempc{\number\pst@dimc}% + \noexpand\def\noexpand\pst@tempd{\number\pst@dimd}}% + \box\pstree@box}% + \def\pssubtree@horizontal{\pssubtree@horizontal@o}% + \def\pssubtree@vertical{\pssubtree@vertical@o}% + \global\let\pstree@next\relax + \pst@makebox\pstree@iii} +% +\def\pstree@iii{% + \global\setbox\pst@boxg=\box\pst@hbox + \endgroup + \setbox\pstree@rootbox=\box\pst@boxg + \@pstfalse + \pstree@next + \if@pst + \ifdim\wd\pstree@rootbox=\z@\else + \@pstrickserr{Extraneous space in root node}\@ehpa + \typeout{===>\the\wd\pst@hbox (rootbox)} + \wd\pstree@rootbox=\z@ + \fi + \else + \@pstrickserr{Missing or bad root node + (level \the\pstreelevel, node \the\psnodecnt)}\@ehpa + \def\pstree@next{% + \def\pst@tempa{0}% + \def\pst@tempb{0}% + \def\pst@tempc{0}% + \def\pst@tempd{0}}% + \wd\pstree@rootbox=\z@ + \fi + \pstree@savevalues + \begingroup + \pstree@initsuccvalues + \pstree@setlevelpar + \pstree@do} + +% +\def\pstree@setlevelpar{% + \advance\pstreelevel1 + \let\psk@thislevelsep\relax + \let\psk@thistreesep\relax + \let\psk@thistreefit\relax + \let\psk@thistreenodesize\relax + \csname pstreehook\romannumeral\pstreelevel\endcsname + \use@par + \ifx\psk@thistreesep\relax \let\psk@thistreesep\psk@treesep\fi + \ifx\psk@thistreenodesize\relax \let\psk@thistreenodesize\psk@treenodesize\fi + \ifx\psk@thistreefit\relax \let\psk@thistreefit\psk@treefit\fi + \ifx\psk@thislevelsep\relax \let\psk@thislevelsep\psk@levelsep + \let\psk@thislevelsepmode\psk@levelsepmode + \fi + \ifnum\psk@treemode=\pstree@predmode\else + \global\advance\pstreecnt1 + \edef\pstree@thetree{\the\pstreecnt}% + \let\pstree@predmode\psk@treemode + \fi + \ifx\psk@thislevelsepmode\relax + \pst@dimg=\psk@thislevelsep\relax + \pst@cntg=0\@nameuse{pstree@levelsepadjust-\pstree@thetree-\the\pstreelevel}% + \advance\pst@dimg\pst@cntg sp + \edef\psk@thislevelsep{\number\pst@dimg sp}% + \fi + \ifnum\psk@treemode>1 \def\pst@tposflip{1 sub neg }\else\def\pst@tposflip{}\fi + \ifx\pstree@bboxadjust\@empty\else + \xdef\pstree@treebboxadjust{% + \pstree@bboxadjust + \ifpsshowbbox\noexpand\pstree@showbbox\fi}% + \gdef\pstree@bboxadjust{}% + \fi + \let\pst@thispsbox\@skiplevelfalse} +% +\def\pstree@predmode{-1} +\def\pstree@savevalues{% + \edef\pstree@restorevalues{% + \noexpand\gdef\noexpand\pstree@theleftprofile{\pstree@theleftprofile}% + \noexpand\gdef\noexpand\pstree@therightprofile{\pstree@therightprofile}% + \noexpand\gdef\noexpand\pstree@theupprofile{\pstree@theupprofile}% + \noexpand\gdef\noexpand\pstree@thedownprofile{\pstree@thedownprofile}% + \noexpand\gdef\noexpand\pstree@tspace{\pstree@tspace}% + \noexpand\gdef\noexpand\pssucc{\pssucc}% + \global\psnodecnt=\the\psnodecnt\relax + \global\pstree@cnt=\the\pstree@cnt\relax}% + \let\pstree@savebboxadjust\pstree@treebboxadjust} + \def\pstree@initsuccvalues{% + \def\pstree@therightprofile{\pstree@stop,}% + \let\pstree@theleftprofile\pstree@therightprofile + \let\pstree@theupprofile\pstree@therightprofile + \let\pstree@thedownprofile\pstree@therightprofile + \psnodecnt=\z@ + \pstree@cnt\z@ + \gdef\pstree@tspace{\z@}% + \let\pspred\pssucc} + \def\pssucc{T} + \pstree@initsuccvalues + \def\pstree@down{% + \pstree@succrow + \pstree@makebox{\pstree@vertical{\lower}}} + \def\pstree@up{% + \pstree@succrow + \pstree@makebox{\pstree@vertical{\raise}}} + \def\pstree@levelsepadjust#1#2{% +% DG/SR modification begin - May 14, 1997 - Patch 1 +% Problem with levelsep=*... +%\pst@cntg=0\@nameuse{pstree@levelsepadjust-#1}% + \pst@cntg=0\@nameuse{pstree@levelsepadjust-#1} +% DG/SR modification end + \ifnum#2>\pst@cntg + \expandafter\xdef\csname pstree@levelsepadjust-#1\endcsname{#2}% + \fi} +% DG/SR modification begin - October 28, 1999 - Patch 5 - For plain TeX + \ifx\@undefined\@auxout\newwrite\@auxout\fi +% DG/SR modification end + \def\pstree@initlevelsepadjust{% + \@ifundefined{@latexerr}{% + \immediate\openin1 \jobname.pst + \ifeof1 \else\input \jobname.pst\fi + \immediate\closein1 + \csname newwrite\endcsname\pstree@auxout + \immediate\openout\pstree@auxout \jobname.pst }{\let\pstree@auxout\@auxout}% + \global\let\pstree@initlevelsepadjust\relax} + \newcount\pstree@stop + \pstree@stop=-987654321 + \def\pstree@vertical#1{% + \pst@cntg=\ifpstreeflip-\fi\wd\pst@hbox + \divide\pst@cntg 2 + \pstree@add\pstree@theleftprofile + \pstree@add\pstree@therightprofile + \pst@dimg=\psk@thislevelsep\relax + \ifx\psk@thislevelsepmode\relax \pstree@vertlevelsepadjust{#1}\fi + \global\setbox\pstree@box=\hbox{% + \vrule height \pst@tempc sp depth \pst@tempd sp width \z@ + \unhbox\pstree@rootbox + #1\pst@dimg\hbox to\z@{\hss\unhbox\pst@hbox\hss}}% + \if@skiplevel\skiplevel@vertical\else\endgroup\fi + \edef\pstree@leftprofile{\pst@tempa,\pstree@theleftprofile}% + \edef\pstree@rightprofile{\pst@tempb,\pstree@therightprofile}% + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \ifpsshowbbox + \pstree@max\pstree@leftprofile\pst@cntg + \pst@dima=\pst@cntg sp + \pstree@max\pstree@rightprofile\pst@cntg + \pst@dimb=\pst@cntg sp + \pstree@showbbox + \fi + \ifPst@draft + \pstree@max\pstree@leftprofile\pst@cntg + \pst@dima=\pst@cntg sp + \pstree@max\pstree@rightprofile\pst@cntg + \pst@dimb=\pst@cntg sp + \pstree@draft + \fi + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \pstree@restorevalues + \pssubtree@vertical + \global\let\pstree@treebboxadjust\pstree@savebboxadjust + \endgroup + \ifnum\pstreelevel>\z@\expandafter\ignorespaces\fi} +% +\def\pstree@vertlevelsepadjust#1{% + \ifx\if@filesw\iffalse\else + \ifx#1\lower + \pst@dimh=\pst@tempd sp + \advance\pst@dimh\ht\pst@hbox + \else + \pst@dimh=\pst@tempc sp + \advance\pst@dimh\dp\pst@hbox + \fi + \immediate\write\@auxout{% + \string\pstree@levelsepadjust{\pstree@thetree-\the\pstreelevel}{\number\pst@dimh}}% + \fi} +% +\def\pstree@succcolumn{% + \def\pssubtree@vertical{\pssubtree@vertical@h}% + \def\pssubtree@horizontal{\pssubtree@horizontal@h}% + \def\pstree@node{\pstree@node@h}}% +% + \def\pssubtree@horizontal@h{% + \xdef\pstree@theleftprofile{\number\pst@dima,\pstree@theleftprofile}% + \xdef\pstree@therightprofile{\number\pst@dimb,\pstree@therightprofile}% + \ifnum\psnodecnt=\z@ + \global\let\pstree@theupprofile\pstree@upprofile + \global\let\pstree@thedownprofile\pstree@downprofile + \box\pstree@box + \else + \ifpstreeflip\pssubtree@horizontal@@hflip\else\pssubtree@horizontal@@h\fi + \fi + \global\advance\psnodecnt 1\relax} +% +\def\pssubtree@horizontal@@h{% + \psk@thistreefit\pstree@thedownprofile\pstree@upprofile + \global\advance\pstree@cnt\pst@cnth + \lower\the\pstree@cnt sp\box\pstree@box + \pstree@zip\pstree@thedownprofile\pstree@downprofile\pstree@thedownprofile + \pst@cnth=\pstree@cnt + \pstree@zip\pstree@upprofile\pstree@theupprofile\pstree@theupprofile} +% +\def\pssubtree@horizontal@@hflip{% + \psk@thistreefit\pstree@theupprofile\pstree@downprofile + \global\advance\pstree@cnt\pst@cnth + \raise\the\pstree@cnt sp\box\pstree@box + \pstree@zip\pstree@theupprofile\pstree@upprofile\pstree@theupprofile + \pst@cnth=\pstree@cnt + \pstree@zip\pstree@downprofile\pstree@thedownprofile\pstree@thedownprofile} +% +\def\pstree@node@h{% + \edef\pstree@upprofile{\psk@thistreenodesize\pst@dimc,\pstree@stop,}% + \edef\pstree@downprofile{\psk@thistreenodesize\pst@dimd,\pstree@stop,}% + \pssubtree@horizontal@h}% +% +\def\pssubtree@vertical@h{% + \pstree@max\pstree@leftprofile\pst@cntg + \pst@dima=\pst@cntg sp + \pstree@max\pstree@rightprofile\pst@cntg + \pst@dimb=\pst@cntg sp + \pstree@treebboxadjust + \edef\pstree@upprofile{\number\pst@dimc,\pstree@stop,}% + \edef\pstree@downprofile{\number\pst@dimd,\pstree@stop,}% + \pssubtree@horizontal@h}% +% +\newif\if@psrighttree +\def\pstree@right{% + \@psrighttreetrue + \pstree@succcolumn + \pstree@makebox\pstree@horizontal} +% +\def\pstree@left{% + \@psrighttreefalse + \pstree@succcolumn + \pstree@makebox\pstree@horizontal} +% +\def\pstree@horizontal{% + \ifdim\wd\pst@hbox=\z@\else + \@pstrickserr{Extraneous space in tree successors}\@ehpa + \typeout{===>\the\wd\pst@hbox (hbox)} + \fi + \pst@cntg=\ifpstreeflip\ht\else\dp\fi\pst@hbox + \divide\pst@cntg 2 + \pstree@add\pstree@theupprofile + \pstree@add\pstree@thedownprofile +% DG/SR modification begin - Sep. 24, 1997 - Patch 3 +%\ifx\psk@thislevelsepmode\relax +%\pstree@horizlevelsepadjust +%\fi +% DG/SR modification end + \pst@dimg\psk@thislevelsep\relax + \global\setbox\pstree@box=\hbox{% + \unhbox\pstree@rootbox + \kern\if@psrighttree\else-\fi\pst@dimg + \ifpstreeflip\lower\else\raise\fi\pst@cntg sp\box\pst@hbox}% +% DG/SR modification begin - Sep. 24, 1997 - Patch 3 + \ifx\psk@thislevelsepmode\relax + \pstree@horizlevelsepadjust + \fi +% DG/SR modification end + \if@psrighttree + \pst@dimh=\pst@dimg + \pstree@max\pstree@therightprofile\pst@cntg + \global\advance\pst@dimh\pst@cntg sp + \global\pst@dimg=\pst@tempa sp + \else + \pstree@max\pstree@theleftprofile\pst@cntg + \global\advance\pst@dimg\pst@cntg sp + \global\pst@dimh=\pst@tempb sp + \fi + \if@skiplevel\skiplevel@horizontal\else\endgroup\fi + \pst@dima=\pst@dimg + \pst@dimb=\pst@dimh + \edef\pstree@upprofile{\pst@tempc,\pstree@theupprofile}% + \edef\pstree@downprofile{\pst@tempd,\pstree@thedownprofile}% + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \wd\pstree@box=\z@ + \ifpsshowbbox + \pstree@max\pstree@upprofile\pst@cntg + \pst@dimc=\pst@cntg sp + \pstree@max\pstree@downprofile\pst@cntg + \pst@dimd=\pst@cntg sp + \pstree@showbbox + \fi + \ifPst@draft + \pstree@max\pstree@upprofile\pst@cntg + \pst@dimc=\pst@cntg sp + \pstree@max\pstree@downprofile\pst@cntg + \pst@dimd=\pst@cntg sp + \pstree@draft + \fi + \pstree@restorevalues + \pssubtree@horizontal + \endgroup + \ifnum\pstreelevel>\z@\expandafter\ignorespaces\fi} +% +% DG/SR modification begin - Sep. 24, 1997 - Patch 2 +%\def\pstree@horizlevelsepadjust#1{% +\def\pstree@horizlevelsepadjust{% +% DG/SR modification end + \ifx\if@filesw\iffalse\else + \if@psrighttree + \pst@dimh=\pst@tempb sp + \pstree@max\pstree@theleftprofile\pst@cntg + \advance\pst@dimh\pst@cntg sp + \else + \pst@dimh=\pst@tempa sp + \pstree@max\pstree@therightprofile\pst@cntg + \advance\pst@dimh\pst@cntg sp + \fi + \immediate\write\@auxout{% + \string\pstree@levelsepadjust{\pstree@thetree-\the\pstreelevel}{\number\pst@dimh}}% + \fi} +% +\define@key[psset]{pst-tree}{treemode}[0]{% + \pst@cntg=\ifx#1U\@empty2\else\ifx#1R\@empty1\else\ifx#1L\@empty3\else0\fi\fi\fi + \relax + \edef\psk@treemode{\the\pst@cntg}% + \ifcase\pst@cntg + \let\pstree@do\pstree@down\or + \let\pstree@do\pstree@right\or + \let\pstree@do\pstree@up\or + \let\pstree@do\pstree@left + \fi} +\psset[pst-tree]{treemode=0} +% +\let\pstree@do\pstree@down +\define@key[psset]{pst-tree}{treesep}[0.75cm]{% + \pssetlength\pst@dimg{#1}% + \edef\psk@treesep{\number\pst@dimg}}% +\psset[pst-tree]{treesep=.75cm} +% +\define@key[psset]{pst-tree}{thistreesep}{% + \pssetlength\pst@dimg{#1}% + \edef\psk@thistreesep{\number\pst@dimg}}% +%\psset[pst-tree]{thistreesep=.75cm} +% +\define@key[psset]{pst-tree}{treenodesize}[-1pt]{% + \pssetlength\pst@dimg{#1}% + \ifdim\pst@dimg<\z@ + \let\psk@treenodesize\number + \else + \edef\psk@treenodesize{\number\pst@dimg\noexpand\@gobble}% +\fi} +\psset[pst-tree]{treenodesize=-1pt} +% +\define@key[psset]{pst-tree}{thistreenodesize}[-1pt]{% + \pssetlength\pst@dimg{#1}% + \ifdim\pst@dimg<\z@ + \let\psk@thistreenodesize\number + \else + \edef\psk@thistreenodesize{\number\pst@dimg\noexpand\@gobble}% + \fi} +\psset[pst-tree]{thistreenodesize=-1pt} +% +\define@key[psset]{pst-tree}{levelsep}[2cm]{% + \pst@expandafter{\pst@ifstar\psset@@levelsep}{#1}\@nil} +\def\psset@@levelsep#1\@nil{% + \pst@@getlength{#1}\psk@levelsep + \if@star + \pstree@initlevelsepadjust + \let\psk@levelsepmode\relax + \else + \def\psk@levelsepmode{}% + \fi} +\psset[pst-tree]{levelsep=2cm} +\define@key[psset]{pst-tree}{thislevelsep}{% + \pst@expandafter{\pst@ifstar\psset@@thislevelsep}{#1}\@nil} +\def\psset@@thislevelsep#1\@nil{% + \pst@@getlength{#1}\psk@thislevelsep + \if@star + \pstree@initlevelsepadjust + \let\psk@thislevelsepmode\relax + \else + \def\psk@thislevelsepmode{}% +\fi} +% +\define@boolkey[psset]{pst-tree}[ps]{treeflip}[true]{} +\psset[pst-tree]{treeflip=false} +% +\def\pstree@node@o{% + \leavevmode + \hbox{% + \vrule height \pst@dimc depth \pst@dimd width \z@ + \kern\pst@dima + \box\pstree@box + \kern\pst@dimb}} +% +\def\pssubtree@vertical@o{% + \pstree@max\pstree@leftprofile\pst@cntg + \pst@dima=\pst@cntg sp + \pstree@max\pstree@rightprofile\pst@cntg + \pst@dimb=\pst@cntg sp + \pstree@treebboxadjust + \pstree@node} +% +\def\pssubtree@horizontal@o{% + \pstree@max\pstree@upprofile\pst@cntg + \pst@dimc=\pst@cntg sp + \pstree@max\pstree@downprofile\pst@cntg + \pst@dimd=\pst@cntg sp + \pstree@treebboxadjust + \pstree@node} +% +\def\pstree@outer{% + \def\pstree@node{\pstree@node@o}% + \def\pssubtree@vertical{\pssubtree@vertical@o}% + \def\pssubtree@horizontal{\pssubtree@horizontal@o}% + \pstreelevel=\z@ + \def\pstree@predmode{-1}% + \def\pst@tposflip{}% + \let\pst@thisbox\relax + \let\pst@shortput\pstree@savedshortput} +% +\let\pstree@savedshortput\ignorespaces +\pstree@outer +% +\define@boolkey[psset]{pst-tree}[ps]{showbbox}[true]{} +\psset[pst-tree]{showbbox=false} +% +\def\pstree@showbbox{% + \setbox\pstree@box=\hbox{% + \psframe[linewidth=0,linecolor=black,linestyle=solid,fillstyle=none]% + (-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)% + \box\pstree@box}}% +% +\def\pstree@draft{% + \setbox\pstree@box=\hbox{% + \psframe[linewidth=0,linecolor=black,linestyle=solid,fillstyle=none]% + (-\pst@dima,-\pst@dimd)(\pst@dimb,\pst@dimc)}}% +% +\define@key[psset]{pst-tree}{edge}[\ncline]{% + \def\psedge{#1}% + \ifx\psedge\@none\def\psedge##1##2{}\fi} +\psset[pst-tree]{edge=\ncline} +% +\def\pspred{T} +\def\pstree@makenodebox{% + \pst@@killglue + \let\pst@thispsbox\pstree@outer + \pst@makebox} +% +\def\begin@treenode{% + \pst@@killglue + \begingroup + \use@par + \global\let\pstree@edge\psedge + \xdef\pssucc{\pspred-\the\psnodecnt}} +% +\def\MakeShortTnput#1{\def\end@treenode{\@ifnextchar#1{\tnput@}{\end@@treenode}}} +\MakeShortTnput{~} +% +\def\end@@treenode{% + \pstree@bboxadjust + \gdef\pstree@bboxadjust{}% + \ifpsshowbbox\pstree@showbbox\fi + \pstree@node + \endgroup + \ifnum\pstreelevel>\z@ + \pstree@edge{\pspred}{\pssucc}% + \expandafter\pst@shortput + \else + \expandafter\ignorespaces + \fi} +% +\def\pstree@bboxadjust{} +\def\pstree@setbboxadjust#1#2{% + \pssetlength\pst@dimg{#1}% + \xdef\pstree@bboxadjust{% + \pstree@bboxadjust#2\number\pst@dimg sp\relax}} +% +\define@key[psset]{pst-tree}{bbl}{\pstree@setbboxadjust{#1}{\pst@dima=}} +\define@key[psset]{pst-tree}{bbr}{\pstree@setbboxadjust{#1}{\pst@dimb=}} +\define@key[psset]{pst-tree}{bbh}{\pstree@setbboxadjust{#1}{\pst@dimc=}} +\define@key[psset]{pst-tree}{bbd}{\pstree@setbboxadjust{#1}{\pst@dimd=}} +\define@key[psset]{pst-tree}{xbbl}{\pstree@setbboxadjust{#1}{\advance\pst@dima}} +\define@key[psset]{pst-tree}{xbbr}{\pstree@setbboxadjust{#1}{\advance\pst@dimb}} +\define@key[psset]{pst-tree}{xbbh}{\pstree@setbboxadjust{#1}{\advance\pst@dimc}} +\define@key[psset]{pst-tree}{xbbd}{\pstree@setbboxadjust{#1}{\advance\pst@dimd}} +% +\let\pstree@treebboxadjust\relax +\def\Tn{\def\pst@par{}\pst@object{Tn}} +\def\Tn@i{% + \pst@@killglue + \global\let\pssucc\pspred + \begingroup + \pst@dima=\z@ + \pst@dimb=\z@ + \pst@dimc=\z@ + \pst@dimd=\z@ + \setbox\pstree@box=\hbox{}%% + \pstree@node + \endgroup + \ignorespaces} +% +\def\Tp{\def\pst@par{}\pst@object{Tp}} +\def\Tp@i{% + \begin@treenode + \pst@dima=\z@ + \pst@dimb=\z@ + \pst@dimc=\z@ + \pst@dimd=\z@ + \setbox\pstree@box=\hbox{% + \pst@newnode{\pssucc}{10}{0 0 }{\tx@InitPnode}}% + \end@treenode} +% +\def\Tc{\def\pst@par{}\pst@object{Tc}} +\def\Tc@i#1{% + \begin@treenode + \pssetlength\pst@dima{#1}% + \pst@dimb=\pst@dima + \pst@dimc=\pst@dima + \pst@dimd=\pst@dima + \Pst@nodealignfalse + \setbox\pstree@box=\hbox{\cnode@ii(\z@,\z@){#1}{\pssucc}}% + \end@treenode} +% +\def\TC{\def\pst@par{}\pst@object{TC}} +\def\TC@i{\Tc@i{\psk@radius}} +% +\def\Toval{\def\pst@par{}\pst@object{Toval}} +\def\Toval@i{\pstree@makenodebox{\Toval@ii\ovalnode@ii}} +\def\Toval@ii#1{% + \begin@treenode + \Pst@nodealigntrue + \setbox\pstree@box=\hbox{#1\pssucc}% + \pst@dima=\wd\pstree@box + \divide\pst@dima 2 + \pst@dimb=\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}% + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \end@treenode% +} +% +\def\Tcircle{\def\pst@par{}\pst@object{Tcircle}} +\def\Tcircle@i{\pstree@makenodebox{\Toval@ii\circlenode@ii}} +% DG/SR modification begin - Mar. 7, 2003 - Patch 6 +\def\TCircle{\pst@object{TCircle}} +\def\TCircle@i{\pst@@killglue\pst@makebox{\Toval@ii\Circlenode@ii}} +% DG/SR modification end +% +\def\Tf{\def\pst@par{}\pst@object{Tf}} +\def\Tf@i{\Toval@ii{\fnode@ii()}} +% +\def\Tdia{\def\pst@par{}\pst@object{Tdia}} +\def\Tdia@i{\pstree@makenodebox{\Toval@ii\dianode@ii}} +% +\def\Ttri{\def\pst@par{}\pst@object{Ttri}} +\def\Ttri@i{\pstree@makenodebox{\Ttri@ii}} +\def\Ttri@ii{% + \begin@treenode + \Pst@nodealigntrue + \setbox\pstree@box=\hbox{\trinode@ii\pssucc}% + \pst@dima=\pst@dimg % Set by \pst@triboxsep + \pst@dimb=\wd\pstree@box + \advance\pst@dimb-\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box=\hbox to\z@{\hss\unhbox\pstree@box\hss}% + \dp\pstree@box=\z@ + \ht\pstree@box=\z@ + \end@treenode% +} +\def\Tr{\def\pst@par{}\pst@object{Tr}} +% SR modification begin - Oct. 27, 1996 +%\def\Tr@i{\pstree@makenodebox{\Tr@ii{\begingroup\rnode@ii}}} +\def\Tr@i{\pstree@makenodebox{\Tr@ii{\rnode@iii\rnode@iv}}} +% SR modification end +\def\Tr@ii#1{% + \begin@treenode + \def\pstree@nodehook{% + \xdef\pstree@next{\pst@dima=\number\pst@dima sp\relax}}% + \Pst@nodealigntrue + \setbox\pstree@box\hbox{#1\pssucc}% + \pstree@next + \pst@dimb=\wd\pstree@box + \advance\pst@dimb-\pst@dima + \pst@dimc=\ht\pstree@box + \pst@dimd=\dp\pstree@box + \setbox\pstree@box\hbox to\z@{\kern-\pst@dima\unhbox\pstree@box\hss}% + \ht\pstree@box=\z@ + \dp\pstree@box=\z@ + \end@treenode} +% +\def\TR{\def\pst@par{}\pst@object{TR}} +% DG modification begin - Oct. 25, 1996 +%\def\TR@i{\pstree@makenodebox{\Tr@ii{\Rnode@ii}}} +\def\TR@i{\pstree@makenodebox{\Tr@ii{\rnode@iii\Rnode@ii}}} +% DG modification end +\def\Tdot{\def\pst@par{}\pst@object{Tdot}} +\def\Tdot@i{% + \begin@treenode + \def\pstree@nodehook{\xdef\pstree@next{% + \pst@dima=\number\pst@dima sp\relax + \pst@dimc=\number\pst@dimb sp\relax}}% + \Pst@nodealignfalse + \setbox\pstree@box=\hbox{\dotnode@ii(\z@,\z@)\pssucc}% + \pstree@next + \pst@dimb=\pst@dima + \pst@dimd=\pst@dimc + \end@treenode} +% +\define@key[psset]{pst-tree}{fansize}[1cm]{\pst@@getlength{#1}\psk@fansize} +\psset[pst-tree]{fansize=1cm} +\def\Tfan{\def\pst@par{}\pst@object{Tfan}} +\def\Tfan@i{% + \addto@par{edge=none}% + \begin@treenode + \solid@star + \pst@dimb=\psk@fansize + \pst@dimd=\pslinewidth + \advance\pst@dimb-\pst@dimd + \divide\pst@dimb 2 + \divide\pst@dimd 2 + \ifodd\psk@treemode\relax + \pst@dima=\pst@dimd + \pst@dimc=\pst@dimb + \else + \pst@dima=\pst@dimb + \pst@dimc=\pst@dimd + \fi + \setbox\pstree@box=\hbox{% + \pst@newnode{\pssucc}{16}{}{% + /Y 0 def + /X 0 def + /l \pst@number\pst@dima def + /r l def + /u \pst@number\pst@dimc def + /d u def + /NodePos { \tx@GetRnodePos } def}% + \def\pst@linetype{1}% + \nc@object{Closed}{\pspred}{\pssucc}{.5}{% + tx@Dict begin \psline@iii pop end + /w \pst@number\pst@dimb CLW 2 div sub def + /m \ifodd\psk@treemode false \else true \fi def + \tx@Tfan}}% + \pst@dimb=\pst@dima + \pst@dimd=\pst@dimc + \end@treenode} +% +\define@key[psset]{pst-tree}{tnsep}[{}]{% + \def\pst@tempg{#1}% + \ifx\pst@tempg\@empty + \def\psk@tnsep{\number\pslabelsep sp}% + \else + \pst@@getlength{#1}\psk@tnsep +\fi} +\psset[pst-tree]{tnsep={}} +% +\define@key[psset]{pst-tree}{tnyref}[{}]{\def\psk@tnyref{#1}}% +\psset[pst-tree]{tnyref={}} +% +\define@key[psset]{pst-tree}{tnheight}[\ht\strutbox]{\edef\psk@tnheight{#1}} +\psset[pst-tree]{tnheight=\ht\strutbox} +% +\define@key[psset]{pst-tree}{tndepth}[\dp\strutbox]{\edef\psk@tndepth{#1}} +\psset[pst-tree]{tndepth=\dp\strutbox} +% +\define@key[psset]{pst-tree}{tnpos}[{}]{% + \def\pst@tempg{#1}% + \ifx\pst@tempg\@empty + \def\psk@tnpos{% + \ifcase\psk@treemode b\or r\or a\or l\fi}% + \else + \@ifundefined{pstree@tnput@#1}% + {\@pstrickserr{Bad tnpos: `#1'}\@ehpa}% + {\edef\psk@tnpos{#1}}% + \fi} +\psset[pst-tree]{tnpos={}} +% +\def\tnput@#1{\def\pst@par{}\pst@object{tnput}} +\def\tnput@i{\pstree@makenodebox{\tnput@ii}} +\def\tnput@ii{% + \begingroup + \use@par + \xdef\next{% + \if@star\noexpand\pst@starbox\fi + \noexpand\def\noexpand\psk@thistndepth{\psk@tndepth}% + \noexpand\def\noexpand\psk@thistnheight{\psk@tnheight}% + \noexpand\def\noexpand\psk@thistnyref{\psk@tnyref}% + \noexpand\def\noexpand\psk@thistnsep{\psk@tnsep}% + \expandafter\noexpand\csname pstree@tnput@\psk@tnpos\endcsname}% + \endgroup + \next + \end@treenode} +% +\@namedef{pstree@tnput@b}{% +\pstree@tnput@@v\pst@dimd\ht\dp\lower\psk@thistnheight} +\@namedef{pstree@tnput@a}{% +\pstree@tnput@@v\pst@dimc\dp\ht\raise\psk@thistndepth} +% +\def\pstree@tnput@@v#1#2#3#4#5{% + \pst@dimh=\wd\pst@hbox + \pst@dimg=\psk@href\pst@dimh + \advance\pst@dimg\pst@dimh + \divide\pst@dimg 2 + \advance\pst@dimh-\pst@dimg + \ifdim\pst@dimg>\pst@dima \pst@dima=\pst@dimg\fi + \ifdim\pst@dimh>\pst@dimb \pst@dimb=\pst@dimh\fi + \pst@dimh=\psk@thistnsep\relax + \ifdim\pst@dimh<\z@ \pst@dimh=-\pst@dimh + \else\advance\pst@dimh#1\fi + \pssetlength\dimen@{#5}% + \ifdim\dimen@>#2\pst@hbox + \advance\pst@dimh\dimen@\relax + \else + \advance\pst@dimh#2\pst@hbox + \fi + \setbox\pstree@box=\hbox{% + \box\pstree@box + #4\pst@dimh\hbox to\z@{\kern-\pst@dimg\unhbox\pst@hbox\hss}}% + #1=#3\pstree@box + \dp\pstree@box=\z@ + \ht\pstree@box=\z@} +% +\@namedef{pstree@tnput@l}{% + \pstree@tnput@@h\pst@dima{% + \hss + \lower\pst@dimg\box\pst@hbox + \kern\pst@dimh + \box\pstree@box}} +% +\@namedef{pstree@tnput@r}{% + \pstree@tnput@@h\pst@dimb{% + \box\pstree@box + \kern\pst@dimh + \lower\pst@dimg\box\pst@hbox + \hss}}% +% +\def\pstree@tnput@@h#1#2{% + \ifx\psk@thistnyref\@empty + \pssetlength\pst@dimg\psk@vref + \else + \pst@dimg=\ht\pst@hbox + \advance\pst@dimg\dp\pst@hbox + \pst@dimg=\psk@thistnyref\pst@dimg + \advance\pst@dimg-\dp\pst@hbox + \fi + \pst@dimh=\psk@thistnsep\relax + \ifdim\pst@dimh<\z@ \pst@dimh=-\pst@dimh\else\advance\pst@dimh#1\fi + #1=\pst@dimh + \advance#1\wd\pst@hbox + \setbox\pstree@box=\hbox to\z@{#2}% + \ifdim\ht\pstree@box>\pst@dimc \pst@dimc=\ht\pstree@box\fi + \ifdim\dp\pstree@box>\pst@dimd \pst@dimd=\dp\pstree@box\fi + \dp\pstree@box=\z@ + \ht\pstree@box=\z@} +% +\newif\if@skiplevel +\def\skiplevel{\def\pst@par{}\pst@object{skiplevel}} +\def\skiplevel@i{\def\pstree@makebox{\pst@@makebox}\skiplevel@ii} +\def\skiplevel@ii{% + \pst@@killglue + \begingroup + \let\pssucc\pspred + \def\pst@tempa{0}% + \def\pst@tempb{0}% + \def\pst@tempc{0}% + \def\pst@tempd{0}% + \setbox\pstree@rootbox=\hbox{}% + \pstree@savevalues + \begingroup + \pstree@initsuccvalues + \pstree@setlevelpar + \@skipleveltrue + \pstree@do} +% DG/SR modification begin - Aug. 31, 1999 - Patch 4 +%\def\pstree@gettop#1{\expandafter\pstree@@gettop#1\@nil} +%\def\pstree@@gettop#1,#2\@nil{#1} +% DG/SR modification end +\def\skiplevel@horizontal{% +% DG/SR modification begin - Aug. 31, 1999 - Patch 4 +%\pst@dimc=\pstree@gettop\pstree@theupprofile sp +%\pst@dimd=\pstree@gettop\pstree@thedownprofile sp + \edef\pstree@upprofile{\pst@tempc,\pstree@theupprofile}% + \edef\pstree@downprofile{\pst@tempd,\pstree@thedownprofile}% + \pstree@max\pstree@upprofile\pst@cntg + \pst@dimc=\pst@cntg sp + \pstree@max\pstree@downprofile\pst@cntg + \pst@dimd=\pst@cntg sp +% DG/SR modification end + \pstree@treebboxadjust + \gdef\pstree@treebboxadjust{}% + \xdef\pstree@next{% + \noexpand\def\noexpand\pst@tempc{\number\pst@dimc}% + \noexpand\def\noexpand\pst@tempd{\number\pst@dimd}}% + \endgroup + \pstree@next} +% +\def\skiplevel@vertical{% +% DG/SR modification begin - Aug. 31, 1999 - Patch 4 +%\pst@dima=\pstree@gettop\pstree@theleftprofile sp +%\pst@dimb=\pstree@gettop\pstree@therightprofile sp + \edef\pstree@leftprofile{\pst@tempa,\pstree@theleftprofile}% + \edef\pstree@rightprofile{\pst@tempb,\pstree@therightprofile}% + \pstree@max\pstree@leftprofile\pst@cntg + \pst@dima=\pst@cntg sp + \pstree@max\pstree@rightprofile\pst@cntg + \pst@dimb=\pst@cntg sp +% DG/SR modification end + \pstree@treebboxadjust + \gdef\pstree@treebboxadjust{}% + \xdef\pstree@next{% + \noexpand\def\noexpand\pst@tempa{\number\pst@dima}% + \noexpand\def\noexpand\pst@tempb{\number\pst@dimb}}% + \endgroup + \pstree@next} +% +\def\skiplevels{\def\pst@par{}\pst@object{skiplevels}} +\def\skiplevels@i#1{% + \pst@@killglue + \begingroup + \pst@cnta=#1\relax + \edef\skiplevels@num{\the\pst@cnta}% + \def\pstree@makebox{\pst@makelongbox}% + \def\endskiplevels{}% + \loop + \ifnum\pst@cnta>\z@ + \advance\pst@cnta-1 + \expandafter\def\expandafter\endskiplevels\expandafter{% + \endskiplevels\pst@endlongbox} + \skiplevel@ii + \repeat + \expandafter\def\expandafter\endskiplevels\expandafter{% + \endskiplevels\endgroup\ignorespaces} + \ignorespaces} +% +\catcode`\@=\TheAtCode\relax +\endinput +%% +%% END: pst-tree.tex |