# Tag Info

23

This is not commonly the way trees are represented in the linguistic literature, so none of the regular tree drawing packages (qtree and tikz-qtree) do this by default. Specifically, the way trees are drawn in the linguistics literature, the terminal nodes are not drawn at the same level (i.e. with the words along a baseline and the tree growing up from ...

23

Get used to this error, it's a common one with tikz-qtree: tikz-qtree requires a space before a node's contents and its closing ]. So you need to insert some spaces before each ] in your tree. \Tree [.{Boolean Groups} [.{Abelian Groups} [.Groups ] % Here ] [.{Class 3} [.{Class 5} ] % Here etc. [.{Class 1} ] [.{...

21

The real trick here is how to put the outer boxes around the inner nodes. As you may have already discovered, it's not possible to embed a \node inside another \node. It is also a really bad idea to embed one tikzpicture inside another (which might appear to be another solution to this problem. Here's a solution that is based on Mark Everitt's answer to ...

19

You need to encourage \missing to expand at the right time: \documentclass{article} \usepackage{tikz} \usepackage{tikz-qtree} \makeatletter \let\old@@children\@@children \def\@@children{\futurelet\my@next\my@@children} \def\my@@children{% \ifx\my@next\missing\else \expandafter\@gobble \fi \expandafter\old@@children} \makeatother \newcommand{\missing}{ \...

18

An answer from the future (using lualatex and incoming graphdrawing libraries from CVS version of TikZ/pgf): \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{graphdrawing,graphdrawing.trees} \begin{document} \begin{tikzpicture} \begin{scope}% [tree layout,level distance=10mm,text depth=.1em,text height=.8em] \node{country} child{...

17

The spacing in the tree is by design. The package tries to minimize the total width of the tree. If you centred node E, you would have to move F further to the right, making the whole tree bigger. Even if you make the nodes further apart with [sibling distance=30pt] (as an example) it will still give you an angled middle branch. This way the space between ...

17

The modifications suggested in this answer have now been subsumed into the tikz-qtree package (version 1.2 or higher). See the documentation for details on how to accomplish this with the latest version. (This happened in April 2012.) Looking through the code for tikz-qtree then it appears* that it completely reimplements the tree-planting routines. ...

17

Maybe not as nice looking a tree, but a lot faster to input. The tikz-qtree package is designed to optimize the spacing between nodes. \documentclass{article} \usepackage{tikz-qtree,tikz-qtree-compat} \begin{document} \begin{tikzpicture}[level 1/.style={level distance=1.5cm}] \Tree [.country [.name France ] [.city Paris ] [.region ...

17

Here's a tree with randomly chosen and sized snowflakes on the edges of nodes. If you can find more snowflake characters, they can be added to the list. Each time you compile the document the pattern will change. I've used LuaTeX to compile, since XeTeX doesn't provide good access to any quickly changing time value to seed the random number generator. PGF ...

16

Multi-dominance "trees" are not really trees, but graphs, and the standard tree drawing packages are really not designed to handle them. Depending on the complexity of the tree, it's possible to draw these trees, however, but it requires some manual intervention. I would use one of the TikZ based tree drawing packages for this rather than qtree. The two ...

16

Just for the record, the tree as produced using the powerful forest package; notice the economy in code: \documentclass[border=5pt]{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={ draw, minimum height=2cm, anchor=north, align=center, child anchor=north }, [{Supplier\\Selection}, align=center, name=SS [{Production\\...

16

Impossible to see a tree and not to give an option using the powerful forest package: \documentclass[svgnames]{standalone} \usepackage{forest} \def\GG{\textcolor{DarkGreen}{G}} \def\YY{\textcolor{Gold}{Y}} \begin{document} \begin{forest} for tree={ edge path={ \noexpand\path[\forestoption{edge}] (!u.parent anchor) -- +(0,-15pt) -| (....

15

Name the nodes and use the fit library: \documentclass{article} \usepackage{tikz} \usetikzlibrary{fit,shapes} \begin{document} \begin{tikzpicture}[every fit/.style={ellipse,draw,red,inner sep=-2pt},] \tikzstyle{level 1}=[sibling distance=40mm] \tikzstyle{level 2}=[sibling distance=20mm] \tikzstyle{level 3}=[sibling distance=10mm] \node (S) {S} ...

14

UPDATE Although this is the accepted answer, tikz-qtree was updated in 2012 to allow this. See Loop Space's answer. Original answer: There isn't a way that I know of to specify the level distance for particular levels using tikz-qtree. Of course you could use the regular tikz methods, but tikz-qtree is generally much more efficient in its input. The ...

14

You need to do \begin{forest} for tree={edge path=<your path>}} (without []!). I adjusted the distance a little bit, better would be to use for example half the level distance and not a fixed distance. One can also use my paths.ortho library (needs both tikzlibarypaths.ortho.code.tex and tikzlibarypaths.ortho.tex) and be available to use |-| instead ...

14


13

I don't see any problems if I manually tune and do some structuring in the code. Actually if I remove the scale everything works just fine. If you want to scale the picture, you need to add transform shape option next to the scaling option. \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{arrows,positioning,automata,shadows,fit,shapes} \begin{...

12

To do this in forest you also need to tell it to align node text as center. I've added a qtree style which does this for every node and also makes the branches join unlike the default forest style, which is IMO somewhat ugly. \documentclass[12pt]{article} \usepackage{forest} \forestset{qtree/.style={for tree={parent anchor=south, child anchor=...

11

For the captions, you can draw a second tree to the right of the first tree with the branch style set to [draw=none]. This will ensure that the captions line up. For underlining sets of nodes, you need to make the starting and ending nodes using the \node command, and then draw the underline. For this part, I've used some very useful code supplied by Jake,...

11

I think this question reveals a bug in the tikz-qtree package. I've contacted the author about it and pointed him to this question. I'm confident that he will fix it. In the meantime, here's a temporary solution. To understand the problem, we need to know a little about how tikz-qtree works. It renders a tree in a recursive fashion. Each subtree is ...

11

This isn't too hard to do with tikz-qtree. In order to get the movement arrow from T to C to go under the VP, I made the object DP a node and used that as a reference point to create an intermediate node that the line passes through. Thanks very much to both Peter Grill and percusse for suggesting elegant ways to avoid the VP structure. The final solution ...

11

To use line breaks you can use every tree node key and use center alignment. \tikzset{every tree node/.style={align=center}} You can shorten the sibling distance to make it more compact. \tikzset{sibling distance=6pt} You can also set the level distance \tikzset{level distance=60pt} With these applied, you have: Code 1 \documentclass{standalone} \...

11

You could use the option midway, like so: \edge node[midway,left] {$[b]$}; Code \documentclass{article} \usepackage{tikz} \usepackage{tikz-qtree} \begin{document} \begin{tikzpicture}[every tree node/.style={draw,circle}, level distance=1.25cm,sibling distance=1cm, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}] \Tree [.a \edge ...

11

Here's a version using forest. \documentclass{article} \usepackage[edges]{forest} \forestset{ declare count register=labelcount, enumerate/.style={labelcount=#1, for tree={content/.pgfmath=labelcount, labelcount-=1}, } } \begin{document} \begin{forest}for tree={grow=north,forked edge,math content} [ [s,no edge [n [s [s/(n) ...

10

You can add a node with a dot and instead of using in and out angles, use the bend parameter. \documentclass{standalone} \usepackage{tikz} \usepackage{tikz-qtree} \usepackage{tikz-qtree-compat} \usetikzlibrary{positioning} \newcommand\TR[1]{\textlangle#1\textrangle} \usepackage{ textcomp } \begin{document} \begin{tikzpicture} \Tree [ .TP [ .T\1 \...

10

Another option would be to use package forest, its syntax is similar, although not the same, to the one used with tikz-qtree and its main goal is to build compact trees. Take a look at next code and compare the results with the images provided by the other answerers. Forest already loads TikZ and environment forest creates a tikzpicture. \documentclass{...

10

Wide trees were precisely why I developed forest! \documentclass{standalone} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{forest} \begin{document} \tikzset{>=latex} \begin{forest} for tree={align=center,edge=->,} [Métodos de otimização [Métodos exatos [Branch-and-X,for children={l+=2ex} [Branch-\\and-...

10

You can just make the text of the roof a node. (I also simplified the arrow syntax a bit.) \documentclass{article} \usepackage{tikz-qtree,tikz-qtree-compat} \tikzset{every tree node/.style={align=center, anchor=north}} \begin{document} \begin{tikzpicture} \Tree [.TP [.DP \edge[roof]; \node (J) {John}; ] [.T$'$ [.T ] [.\emph{v}P ...

10

\documentclass[tikz]{standalone} \usepackage{helvet} \usetikzlibrary{calc} \newcounter{M} \setcounter{M}{0} \newcommand{\Mend}[5][]{% \begin{scope}[#1] \draw (-1.5,0) -- (1.5,0) node[pos=0,below=5pt] (\theM1) {#2} node[pos=.333,below=5pt] (\theM2) {#3} node[pos=.5,coordinate] (\theM3) {} node[pos=.666,below=5pt] (\...

Only top voted, non community-wiki answers of a minimum length are eligible