summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/tikz-qtree
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/doc/latex/tikz-qtree
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/doc/latex/tikz-qtree')
-rw-r--r--Master/texmf-dist/doc/latex/tikz-qtree/README15
-rw-r--r--Master/texmf-dist/doc/latex/tikz-qtree/test.pdfbin0 -> 6035 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tikz-qtree/test.tex45
-rw-r--r--Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdfbin107819 -> 128672 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.tex98
5 files changed, 149 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-qtree/README b/Master/texmf-dist/doc/latex/tikz-qtree/README
index 6d1fa677a8f..ac07f36ac05 100644
--- a/Master/texmf-dist/doc/latex/tikz-qtree/README
+++ b/Master/texmf-dist/doc/latex/tikz-qtree/README
@@ -1,6 +1,6 @@
-tikztree
+tikz-qtree
David Chiang <chiang at isi dot edu>
-Version 1 (22 Dec 2009)
+Version 1.1 (Christmas 2009)
This package provides a macro for drawing trees with TikZ using the
easy syntax of Alexis Dimitriadis' Qtree. It improves on TikZ's
@@ -11,6 +11,17 @@ pst-qtree in being usable with pdfTeX and XeTeX.
Please see tikztree-manual.pdf for instructions and examples.
+Version history:
+
+1.1 (2009/12/25):
+ - much deeper trees can be typeset without exceeding capacity
+ - sideways trees
+ - extra package for improved Qtree compatibility
+ - connections can be drawn to whole subtrees instead of nodes
+
+1 (2009/12/22):
+ - initial release
+
-----
Copyright (C) 2002, 2009 by David Chiang
diff --git a/Master/texmf-dist/doc/latex/tikz-qtree/test.pdf b/Master/texmf-dist/doc/latex/tikz-qtree/test.pdf
new file mode 100644
index 00000000000..ca86b5ba74e
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/tikz-qtree/test.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tikz-qtree/test.tex b/Master/texmf-dist/doc/latex/tikz-qtree/test.tex
new file mode 100644
index 00000000000..77220a844db
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/tikz-qtree/test.tex
@@ -0,0 +1,45 @@
+\documentclass{article}
+
+\usepackage{tikz,tikz-qtree}
+\usepackage{pgf,pgfsubpic}
+
+\begin{document}
+
+\fbox{%
+\begin{pgfpicture}
+\pgfnode{rectangle}{center}{Hello}{hellonode}{\pgfusepath{stroke}}
+\begin{pgfsubpicture}
+\pgfpathcircle{\pgfpointorigin}{4pt}\pgfusepath{stroke}
+\pgfnode{rectangle}{center}{there}{therenode}{\pgfusepath{stroke}}
+\end{pgfsubpicture}
+\pgftransformshift{\pgfpoint{1in}{-1in}}
+\pgftransformscale{2}
+\pgftransformrotate{45}
+\pgfpathcircle{\pgfpointorigin}{2pt}\pgfusepath{fill}
+\pgfplacesubpicture
+
+\pgfmoveto{\pgfpointanchor{hellonode}{south}}
+\pgflineto{\pgfpointanchor{therenode}{north}}
+\pgfusepath{stroke}
+
+\end{pgfpicture}%
+}
+
+\begin{tikzpicture}
+\begin{pgfscope}
+\begin{pgfsubpicture}
+\draw (-1in,0)--(2in,0)--(2in,2in)--(0,2in)--cycle;
+\end{pgfsubpicture}
+\pgffitsubpicture{\pgfpointorigin}{\pgfpoint{1in}{1in}}
+\pgfplacesubpicture
+\end{pgfscope}
+
+\draw (0,0)--(1in,0)--(1in,1in)--(0,1in)--cycle;
+
+
+\end{tikzpicture}
+
+
+
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdf b/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdf
index 8cbca53ce45..9d4d073d0bc 100644
--- a/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdf
+++ b/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.tex b/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.tex
index 46c795fb1c7..88f91b7d2eb 100644
--- a/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.tex
+++ b/Master/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.tex
@@ -19,9 +19,11 @@
\newcommand\tikztree{\texttt{tikz-qtree}}
+\tikzset{>=latex}
+
\title{\tikztree: better trees with TikZ}
\author{David Chiang}
-\date{Version 1 (22 Dec 2009)}
+\date{Version 1.1 (Christmas 2009)}
\begin{document}
@@ -70,9 +72,8 @@ below require the explicit \verb|tikzpicture| environment.
\paragraph{Options} Some options for standard TikZ trees work for \verb|\Tree| as
well:
\begin{itemize}
-\item \verb|level distance|: vertical distance between the anchors of a parent and child
+\item \verb|level distance|: vertical distance between the anchors of a parent and its children
\item \verb|sibling distance|: horizontal distance between the boundaries of sister subtrees (not the anchors of their roots, as in standard TikZ trees). Note that TikZ nodes already have some horizontal space around them (\verb|inner xsep|, by default \verb|0.3333em|), so even \verb|sibling distance=0pt| leaves some room.
-\item \verb|grow=up| or \verb|down|: trees grow up or down from their root. Other directions are not currently supported. The \verb|grow'| option is the same, but children appear clockwise with respect to their parent instead of counterclockwise.
\end{itemize}
These are set either by writing
\verb|\tikzset{|\textit{option}\verb|=|\textit{value}\verb|}| or by
@@ -88,11 +89,33 @@ no way to disambiguate the two uses of square brackets.} For example:
\Tree [.NP [.Adj tall ] [.N tree ] ]
\end{tikzpicture}
%
+\begin{tikzpicture}[sibling distance=72pt]
+\Tree [.NP [.Adj fat ] [.N tree ] ]
+\end{tikzpicture}
+\end{SideBySideExample}
+\end{center}
+
+The \verb|grow=|\textit{direction}\/ and \verb|grow'=|\textit{direction}\/ options control the orientation of trees just as for standard TikZ trees. However, \textit{direction}\/ must be one of \verb|up|, \verb|down|, \verb|left|, or \verb|right|. The difference between \verb|grow| and \verb|grow'| is that \verb|grow| places children counterclockwise with respect to their parent and \verb|grow'| places them clockwise:
+\begin{center}
+\begin{SideBySideExample}
+\begin{tikzpicture}[grow'=down]
+\Tree [.NP [.Adj reverse ] [.N tree ] ]
+\end{tikzpicture}
+%
\begin{tikzpicture}[grow'=up]
\Tree [.NP [.Adj upside-down ] [.N tree ] ]
\end{tikzpicture}
\end{SideBySideExample}
+\vspace{3ex}
+\begin{SideBySideExample}
+\begin{tikzpicture}[grow=left]
+\tikzset{level distance=60pt,sibling distance=18pt}
+\tikzset{execute at begin node=\strut}
+\Tree [.NP [.Adj sideways ] [.N tree ] ]
+\end{tikzpicture}
+\end{SideBySideExample}
\end{center}
+Note that in sideways trees, \verb|level distance| is horizontal and \verb|sibling distance| is vertical. Sideways trees do take a little extra adjusting to look right, since the defaults are geared towards vertically growing trees. The meaning of the option \verb|execute at begin node=\strut| is, before typesetting the label of every node, insert the command \verb|\strut|, which is an invisible box that maximizes the height and depth of the node.
\paragraph{Styles} TikZ lets you define \emph{styles}\/ which encapsulate multiple options:
\begin{Verbatim}
@@ -136,14 +159,46 @@ this font:
\end{tikzpicture}
\end{SideBySideExample}
\end{center}
-If you want the edges to be darker:
+
+You can make the nodes in a sideways tree line up on their left edge using \verb|anchor=base west|:
+\begin{center}
+\begin{SideBySideExample}
+\begin{tikzpicture}
+\tikzset{grow'=right,level distance=32pt}
+\tikzset{execute at begin node=\strut}
+\tikzset{every tree node/.style={anchor=base west}}
+\Tree [.S [.NP [.Det the ] [.N cat ] ]
+ [.VP [.V sat ]
+ [.PP [.P on ]
+ [.NP [.Det the ] [.N mat ] ] ] ] ]
+\end{tikzpicture}
+\end{SideBySideExample}
+\end{center}
+
+In Qtree, it was allowed to use a line break (\verb|\\|) inside a node, but TikZ nodes by default don't allow this. You can enable it like so:
+\begin{center}
+\begin{SideBySideExample}
+\begin{tikzpicture}
+\tikzset{every tree node/.style={text width=2em,text centered}}
+\Tree [.S [.NP Det\\the N\\cat ]
+ [.VP V\\sat
+ [.PP P\\on
+ [.NP Det\\the N\\mat ] ] ] ]
+\end{tikzpicture}
+\end{SideBySideExample}
+\end{center}
+The downside is that you must specify a fixed node width. In the next release of TikZ, it will be possible to use instead a new \verb|align=center| option without the fixed width.\footnote{Thanks to Alan Munn for figuring this out.}
+
+You can also define a style for all the edges in a tree. For example, if you want the edges to be a little darker:
\begin{center}
\begin{SideBySideExample}
+\begin{tikzpicture}
\tikzset{edge from parent/.style={draw,thick}}
\Tree [.S [.NP [.Det the ] [.N cat ] ]
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ] [.N mat ] ] ] ] ]
+\end{tikzpicture}
\end{SideBySideExample}
\end{center}
The \verb|draw| option is necessary, as by default they will not be
@@ -154,6 +209,7 @@ the edge. Its value is a TikZ path expressed in terms of
the child node.
\begin{center}
\begin{SideBySideExample}
+\begin{tikzpicture}
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.south)
@@ -163,6 +219,7 @@ the child node.
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ] [.N mat ] ] ] ] ]
+\end{tikzpicture}
\end{SideBySideExample}
\end{center}
@@ -183,7 +240,6 @@ the appearance of the node; for example, the \verb|draw| option draws
a border around the node. The \verb|(|\textit{name}\verb|)|, which is
also optional, can be used for drawing lines/arrows to/from the node.
\begin{center}
-\tikzset{>=latex}
\begin{Example}
\begin{tikzpicture}
\Tree [.CP [.NP \node(wh){what}; ]
@@ -200,7 +256,25 @@ also optional, can be used for drawing lines/arrows to/from the node.
\end{Example}
\end{center}
-\clearpage
+You can also refer to the whole subtree rooted at the node named \textit{name}\/ using \verb|\subtreeof{|\textit{name}\verb|}|:
+\begin{center}
+\begin{SideBySideExample}
+\begin{tikzpicture}
+\Tree [.S [.NP [.Det the ] [.N cat ] ]
+ [.\node(site){VP}; [.V sat ] ] ]
+\begin{scope}[shift={(1in,0.5in)}]
+\Tree [.\node(root){VP}; VP$^\ast$
+ [.PP [.P on ]
+ [.NP [.Det the ] [.N mat ] ] ] ]
+
+\end{scope}
+
+\draw[->](\subtreeof{root}.140) ..
+ controls +(west:1) and +(east:1) .. (site);
+
+\end{tikzpicture}
+\end{SideBySideExample}
+\end{center}
\noindent Another example for machine translation people:
\begin{center}
@@ -288,8 +362,18 @@ There is a predefined style that draws a ``roof'' over a node, like Qtree's \ver
\end{Example}
\end{center}
+\section{Qtree compatibility}
+
+For basic trees, \tikztree{} can be used as a drop-in replacement for Qtree, but most of Qtree's advanced features are either not accessed in the same way in \tikztree{} or not implemented at all. There is a package \verb|tikz-qtree-compat| which can be loaded to improve compatibility. Supported so far are:
+\begin{itemize}
+\item Superscripts and subscripts outside of math mode, and \verb|\automath|
+\item The \verb|\0|, \verb|\1|, and \verb|\2| commands, and \verb|\qtreeprimes|
+\item The \verb|\qroof| command
+\end{itemize}
+For unsupported commands, warning messages are printed, but at least your file should compile.
+
\section*{Acknowledgements}
-This was all Dan Gildea's idea.
+This was all Dan Gildea's idea. Thanks to Alan Munn for his very helpful suggestions.
\section*{Contact}
Please send suggestions to \verb|chiang@isi.edu|.