Added first part of ex3.
1 % tikz-qtree-compat.tex
2 % Version 1.1, 25 Dec 2009
4 \RequirePackage{tikz-qtree}
7 \def\Tree{\automath \qtreeprimes@internal \orig@Tree}
9 \def\qsetw#1{\message{\noexpand\qsetw is not supported, sorry!}}
10 \def\faketreewidth#1{\message{\noexpand\faketreewidth is not supported, sorry!}}
11 \def\qbalance{\message{\noexpand\qbalance is not supported, sorry!}}
12 \def\qframesubtree{\message{\noexpand\qframesubtree is not supported, sorry!}}
14 % Implement \qroof as a fancy leaf node
18 \begin{tikzpicture}[baseline]
19 {\pgftransformshift{\pgftree@levelshift}%
23 \def\@qroof{\@ifnextchar\egroup{%
24 % since we are putting the qroof inside a node, we already have an inner sep
25 % so for the purposes of defining our bounding box, we must eliminate inner sep
27 \node [inner sep=0pt] {\the\@qrooflabel};%
29 \pgfpathrectanglecorners{\pgfpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}%
30 \pgfusepath{use as bounding box}%
31 \node (qrooftop) {\the\@qrooflabel};
32 \draw \roof@edge{qrooftop}{qroofbot};%
35 \def\@@qroof#1{\expandafter\@qrooflabel\expandafter{\the\@qrooflabel #1}\@qroof}
37 %%% This is lifted straight from qtree.sty
39 % and another odd convenience:
41 % Make _, ^ go into math mode automatically in the scope of \automath
43 { % Temporarily change catcodes
47 \global\def\automath{%
50 \def_##1{\@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
51 \def^##1{\@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}}
53 \def\automath@two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}}
54 % Restore default catcodes for ^, _
55 \def\noautomath{\catcode`\_=8 \catcode`\^=7 }
58 % Let \0, \1, \2 produce ^0, $'$, $''$
59 % The \rlap results in better centering of the label (ignoring the
61 \def\qtreeprimes@internal{%
62 \def\0{\ifmmode ^0\else \rlap{$^0$}\fi}%
63 \def\1{\ifmmode '\else \rlap{$'$}\fi}%
64 \def\2{\ifmmode ''\else \rlap{$''$}\fi}%
67 % Same commands, but without the \rlap feature
69 \def\0{\ensuremath{^0}}%
70 \def\1{\ensuremath{'}}%
71 \def\2{\ensuremath{''}}}