diff options
author | Karl Berry <karl@freefriends.org> | 2010-12-30 23:50:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-12-30 23:50:24 +0000 |
commit | e62f8e9bbbd4c6360b4f2b054505c13c5cfc05e7 (patch) | |
tree | a69e10b9bdf68821e8bf72434ba33b0374a695bb /Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex | |
parent | 58679cc130f6f05e33c54456b379a2b878211c29 (diff) |
tikz-qtree
git-svn-id: svn://tug.org/texlive/trunk@20895 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex b/Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex index a3fca8b0b48..8173ed13cb8 100644 --- a/Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex +++ b/Master/texmf-dist/tex/latex/tikz-qtree/pgftree.tex @@ -87,7 +87,7 @@ \def\pgftree#1{% \def\nodename{r}% -#1 +#1% \pgfplacesubpicture } @@ -100,7 +100,6 @@ % Token 2n in the sequence draws the nth subtree. Its root must be named \nodename. \pgfnewsubpicture{children} -\pgfnewsubpicture{child} \newdimen\pgftree@lastchildx \newdimen\pgftree@lastchildy @@ -109,30 +108,26 @@ \pgftree@savechildx=\pgftree@childx \pgftree@savechildy=\pgftree@childy \pgftree@savechildi=\pgftree@childi -% Build subpicture with all the children and their subtrees. Save it in "children" +% Build subpicture with all the children and their subtrees {\pgftree@childx=0pt% \pgftree@childy=0pt% \pgftree@childi=0% \process@children #2}% -\ifnum\pgftree@childi>0% \begin{pgfsubpicture}% -% Create root node -#1 +% Create node +#1% +\ifnum\pgftree@childi>0% % Place children % move down \levelsep {\pgftransformshift{\pgftree@levelshift}% % center so that parent is midway between origins of first and last children -\pgftransformshift{\pgfpointscale{-0.5}{\pgfpoint{\the\pgftree@childx}{\the\pgftree@childy}}}% -\pgfplacesubpicture} +\pgftransformshift{\pgfpointscale{-0.5}{\pgfqpoint{\the\pgftree@childx}{\the\pgftree@childy}}}% +\pgfplacesubpicture}% % Draw the edges {\pgftree@childi=0% \process@edges #2}% -\end{pgfsubpicture}% -\else % leaf node -\begin{pgfsubpicture}% -#1 -\end{pgfsubpicture}% \fi +\end{pgfsubpicture}% \global\pgftree@childi=\pgftree@savechildi \global\pgftree@childx=\pgftree@savechildx \global\pgftree@childy=\pgftree@savechildy @@ -144,34 +139,33 @@ \global\pgftree@childx\pgftree@lastchildx \global\pgftree@childy\pgftree@lastchildy \global\pgftree@childi\pgftree@childi +\ifnum\pgftree@childi>0% \pgfrestoresubpicture{children}% pass children back to caller +\fi }% {\@process@children}% } \def\@process@children#1#2{% #1 is the edge, #2 is the child -% Build the current child and save it as "child" +% Build the current child {\edef\nodename{\parentnodename-\the\pgftree@childi}% #2}% -\pgfsavesubpicture{child}% -\begin{pgfsubpicture} -% Place previous children (if any) -\ifnum\pgftree@childi>0% -\pgfrestoresubpicture{children}% -\pgfplacesubpicture -\fi +\begin{pgfsubpicture}% % Place current child -\pgfrestoresubpicture{child}% \ifnum\pgftree@childi>0% the first child is always at 0 \pgftree@presiblingshift \global\advance\pgftree@childx\pgf@x \global\advance\pgftree@childy\pgf@y \fi +{\pgftransformshift{\pgfqpoint{\the\pgftree@childx}{\the\pgftree@childy}}% +\pgfplacesubpicture}% \global\pgftree@lastchildx\pgftree@childx \global\pgftree@lastchildy\pgftree@childy -{\pgftransformshift{\pgfpoint{\the\pgftree@childx}{\the\pgftree@childy}}% -\pgfplacesubpicture}% \pgftree@postsiblingshift \global\advance\pgftree@childx\pgf@x \global\advance\pgftree@childy\pgf@y -\end{pgfsubpicture}% % Save the augmented row of children back into "children" +\end{pgfsubpicture} +\ifnum\pgftree@childi>0% +\pgfmergesubpicture{children} +\else \pgfsavesubpicture{children}% +\fi \advance\pgftree@childi by 1% \process@children } |