summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-12-31 01:40:09 +0000
committerKarl Berry <karl@freefriends.org>2009-12-31 01:40:09 +0000
commitf84374dfd46b282099b639296e3b952f4d52746f (patch)
tree5494a9c99e49aad4e33ed49bc04f36b78bb03b6e /Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty
parente70f23cf27d400ee9d1cd7afa8fa7de6896c1b69 (diff)
tikz-qtree update (26dec09)
git-svn-id: svn://tug.org/texlive/trunk@16546 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty72
1 files changed, 72 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty b/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty
new file mode 100644
index 00000000000..f60ae32838b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-qtree/tikz-qtree-compat.sty
@@ -0,0 +1,72 @@
+% tikz-qtree-compat.tex
+% Version 1.1, 25 Dec 2009
+
+\RequirePackage{tikz-qtree}
+
+\let\orig@Tree\Tree
+\def\Tree{\automath \qtreeprimes@internal \orig@Tree}
+
+\def\qsetw#1{\message{\noexpand\qsetw is not supported, sorry!}}
+\def\faketreewidth#1{\message{\noexpand\faketreewidth is not supported, sorry!}}
+\def\qbalance{\message{\noexpand\qbalance is not supported, sorry!}}
+\def\qframesubtree{\message{\noexpand\qframesubtree is not supported, sorry!}}
+
+% Implement \qroof as a fancy leaf node
+\newtoks\@qrooflabel
+
+\def\qroof#1.{%
+\begin{tikzpicture}[baseline]
+{\pgftransformshift{\pgftree@levelshift}%
+\node(qroofbot){#1};}
+\@qroof
+}
+\def\@qroof{\@ifnextchar\egroup{%
+% since we are putting the qroof inside a node, we already have an inner sep
+% so for the purposes of defining our bounding box, we must eliminate inner sep
+\begin{pgfsubpicture}
+\node [inner sep=0pt] {\the\@qrooflabel};%
+\end{pgfsubpicture}
+\pgfpathrectanglecorners{\pgfpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}%
+\pgfusepath{use as bounding box}%
+\node (qrooftop) {\the\@qrooflabel};
+\draw \roof@edge{qrooftop}{qroofbot};%
+\end{tikzpicture}}
+{\@@qroof}}
+\def\@@qroof#1{\expandafter\@qrooflabel\expandafter{\the\@qrooflabel #1}\@qroof}
+
+%%% This is lifted straight from qtree.sty
+
+% and another odd convenience:
+%
+% Make _, ^ go into math mode automatically in the scope of \automath
+%
+{ % Temporarily change catcodes
+\catcode`\_=\active
+\catcode`\^=\active
+
+ \global\def\automath{%
+ \catcode`\_=\active
+ \catcode`\^=\active
+ \def_##1{\@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
+ \def^##1{\@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}}
+}
+\def\automath@two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}}
+% Restore default catcodes for ^, _
+\def\noautomath{\catcode`\_=8 \catcode`\^=7 }
+
+
+% Let \0, \1, \2 produce ^0, $'$, $''$
+% The \rlap results in better centering of the label (ignoring the
+% superscript)
+\def\qtreeprimes@internal{%
+ \def\0{\ifmmode ^0\else \rlap{$^0$}\fi}%
+ \def\1{\ifmmode '\else \rlap{$'$}\fi}%
+ \def\2{\ifmmode ''\else \rlap{$''$}\fi}%
+}
+
+% Same commands, but without the \rlap feature
+\def\qtreeprimes{%
+ \def\0{\ensuremath{^0}}%
+ \def\1{\ensuremath{'}}%
+ \def\2{\ensuremath{''}}}
+