summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex53
1 files changed, 29 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex b/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex
index 6114da8468b..09282e63e09 100644
--- a/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex
+++ b/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree.tex
@@ -1,5 +1,5 @@
-% tikztree.tex
-% Version 1, 22 Dec 2009
+% tikz-qtree.tex
+% Version 1.1, 25 Dec 2009
% Copyright (C) 2002, 2009 by David Chiang
@@ -17,6 +17,10 @@
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+% New in version 1.1:
+
+% - sideways trees
+
%% These macros facilitate building up an object recursively before
%% putting it into the input stream.
@@ -32,7 +36,11 @@
\def\Tree{\@call\@subtree\@Tree}
\def\@Tree{%
%\showthe\@result %debug
-\ifpgfpicture\the\@result\else\tikzpicture\the\@result\endtikzpicture\fi % is there a test for tikzpicture?
+\ifpgfpicture % is there a test for tikzpicture?
+\pgftree{\the\@result}%
+\else
+\tikzpicture[baseline]\pgftree{\the\@result}\endtikzpicture
+\fi
}
%% scan a subtree
@@ -64,9 +72,9 @@
}
\def\@@@@@@subtree{%
\@ifequal{\the\root@node}{\pgfutil@empty}
-\edef\act{\noexpand\@result={\noexpand\pgftree{\noexpand\path coordinate (\noexpand\nodename);}{\the\child@list}}}%
+\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\noexpand\path coordinate (\noexpand\nodename);}{\the\child@list}}}%
\else
-\edef\act{\noexpand\@result={\noexpand\pgftree{\the\root@node}{\the\child@list}}}%
+\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\the\root@node}{\the\child@list}}}%
\fi
\act
\@return}
@@ -105,7 +113,8 @@
\def\@interior.{\@result{\node[alias=\nodename][every tree node,every internal node]}\@label}
-\def\@leaf{\@result{\node[alias=\nodename][every tree node,every leaf node]}\@label}
+\def\@leaf{\@call\@label\@@leaf}
+\def\@@leaf{\edef\act{\noexpand\@result{\noexpand\pgfsubtree{\noexpand\node[alias=\noexpand\nodename][every tree node,every leaf node]\the\@result}{}}}\act\@return}
\def\@edge\edge #1;{%
\@result{\edge@adapter{#1}}%
@@ -130,21 +139,13 @@
% predefined edges
-\def\tree@edge#1#2{%
-\ifupsidedown
-(#1.north) -- (#2.south)
-\else
-(#1.south) -- (#2.north)
-\fi
-}
+\def\tree@edge#1#2{(#1.\pgftree@parentanchor) -- (#2.\pgftree@childanchor)}
-\def\roof@edge#1#2{
-\ifupsidedown
-(#1.north) -- (#2.south west) -- (#2.south east) -- cycle
-\else
-(#1.south) -- (#2.north west) -- (#2.north east) -- cycle
-\fi
-}
+\def\roof@edge#1#2{\csname roof@edge@\leveldirection\endcsname{#1}{#2}}
+\def\roof@edge@down#1#2{(#1.south) -- (#2.north west) -- (#2.north east) -- cycle}
+\def\roof@edge@up#1#2{(#1.north) -- (#2.south west) -- (#2.south east) -- cycle}
+\def\roof@edge@left#1#2{(#1.west) -- (#2.north east) -- (#2.south east) -- cycle}
+\def\roof@edge@right#1#2{(#1.east) -- (#2.north west) -- (#2.south west) -- cycle}
%%% Options
@@ -154,10 +155,14 @@
% I don't really like this scheme
\tikzoption{grow}{\csname grow@#1\endcsname}
\tikzoption{grow'}{\csname growprime@#1\endcsname}
-\def\grow@up{\upsidedowntrue\righttolefttrue}
-\def\grow@down{\upsidedownfalse\righttoleftfalse}
-\def\growprime@up{\upsidedowntrue\righttoleftfalse}
-\def\growprime@down{\upsidedownfalse\righttolefttrue}
+\def\grow@up{\def\leveldirection{up}\def\siblingdirection{left}}
+\def\grow@down{\def\leveldirection{down}\def\siblingdirection{right}}
+\def\growprime@up{\def\leveldirection{up}\def\siblingdirection{right}}
+\def\growprime@down{\def\leveldirection{down}\def\siblingdirection{left}}
+\def\grow@left{\def\leveldirection{left}\def\siblingdirection{down}}
+\def\grow@right{\def\leveldirection{right}\def\siblingdirection{up}}
+\def\growprime@left{\def\leveldirection{left}\def\siblingdirection{up}}
+\def\growprime@right{\def\leveldirection{right}\def\siblingdirection{down}}
% defaults appropriate for linguistic trees
\tikzset{every tree node/.style={anchor=base}}