sawine@0: % tikz-qtree-compat.tex sawine@0: % Version 1.1, 25 Dec 2009 sawine@0: sawine@0: \RequirePackage{tikz-qtree} sawine@0: sawine@0: \let\orig@Tree\Tree sawine@0: \def\Tree{\automath \qtreeprimes@internal \orig@Tree} sawine@0: sawine@0: \def\qsetw#1{\message{\noexpand\qsetw is not supported, sorry!}} sawine@0: \def\faketreewidth#1{\message{\noexpand\faketreewidth is not supported, sorry!}} sawine@0: \def\qbalance{\message{\noexpand\qbalance is not supported, sorry!}} sawine@0: \def\qframesubtree{\message{\noexpand\qframesubtree is not supported, sorry!}} sawine@0: sawine@0: % Implement \qroof as a fancy leaf node sawine@0: \newtoks\@qrooflabel sawine@0: sawine@0: \def\qroof#1.{% sawine@0: \begin{tikzpicture}[baseline] sawine@0: {\pgftransformshift{\pgftree@levelshift}% sawine@0: \node(qroofbot){#1};} sawine@0: \@qroof sawine@0: } sawine@0: \def\@qroof{\@ifnextchar\egroup{% sawine@0: % since we are putting the qroof inside a node, we already have an inner sep sawine@0: % so for the purposes of defining our bounding box, we must eliminate inner sep sawine@0: \begin{pgfsubpicture} sawine@0: \node [inner sep=0pt] {\the\@qrooflabel};% sawine@0: \end{pgfsubpicture} sawine@0: \pgfpathrectanglecorners{\pgfpoint{\the\pgf@subpicminx}{\the\pgf@subpicminy}}{\pgfpoint{\the\pgf@subpicmaxx}{\the\pgf@subpicmaxy}}% sawine@0: \pgfusepath{use as bounding box}% sawine@0: \node (qrooftop) {\the\@qrooflabel}; sawine@0: \draw \roof@edge{qrooftop}{qroofbot};% sawine@0: \end{tikzpicture}} sawine@0: {\@@qroof}} sawine@0: \def\@@qroof#1{\expandafter\@qrooflabel\expandafter{\the\@qrooflabel #1}\@qroof} sawine@0: sawine@0: %%% This is lifted straight from qtree.sty sawine@0: sawine@0: % and another odd convenience: sawine@0: % sawine@0: % Make _, ^ go into math mode automatically in the scope of \automath sawine@0: % sawine@0: { % Temporarily change catcodes sawine@0: \catcode`\_=\active sawine@0: \catcode`\^=\active sawine@0: sawine@0: \global\def\automath{% sawine@0: \catcode`\_=\active sawine@0: \catcode`\^=\active sawine@0: \def_##1{\@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}% sawine@0: \def^##1{\@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}} sawine@0: } sawine@0: \def\automath@two#1#2#3#4{\ensuremath{#1{#2}\relax #3{#4}}} sawine@0: % Restore default catcodes for ^, _ sawine@0: \def\noautomath{\catcode`\_=8 \catcode`\^=7 } sawine@0: sawine@0: sawine@0: % Let \0, \1, \2 produce ^0, $'$, $''$ sawine@0: % The \rlap results in better centering of the label (ignoring the sawine@0: % superscript) sawine@0: \def\qtreeprimes@internal{% sawine@0: \def\0{\ifmmode ^0\else \rlap{$^0$}\fi}% sawine@0: \def\1{\ifmmode '\else \rlap{$'$}\fi}% sawine@0: \def\2{\ifmmode ''\else \rlap{$''$}\fi}% sawine@0: } sawine@0: sawine@0: % Same commands, but without the \rlap feature sawine@0: \def\qtreeprimes{% sawine@0: \def\0{\ensuremath{^0}}% sawine@0: \def\1{\ensuremath{'}}% sawine@0: \def\2{\ensuremath{''}}} sawine@0: