Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to draw a tree with tikz-qtree, but it bails with Dimension too large.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pdflscape}
\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}

\begin{landscape}
\Tree [.CP [.TP [.NP [ ] [.N' [ ] [.N Abelard ] ] ] [.T has ] [.V' [.V written ] [.NP [.D a ] [.N volume ] [.PP [.P' [.P of ] [.NP [ ] [.N' [.N poems ] [ ] ] ] ] ] ] [.PP [.P' [.P in [.NP [ ] [.N' [.N Latin ] [ ] ] ] ] ] ] [.PP [.P' [.P for ] [.NP [ ] [.N' [.N Héloïse ] [ ] ] ] ] ] ] ] ]
\end{landscape}

\end{document}
share|improve this question
    
Please tell (description of the wanted tree) or show us (image or drawing) what you want to achieve. Only to see your code not compiling is not very helpful for us ... –  Kurt Oct 8 '12 at 22:54
    
@Kurt In this case I think Tass's example is entirely appropriate. Anyone who is familiar with the package can identify the problem with the minimal examples that he has posted. There is no need to have anything else. –  Alan Munn Oct 9 '12 at 3:42
add comment

1 Answer

up vote 7 down vote accepted

As percusse has noted (answer now deleted) the problem is with completely empty nodes. Filling them with a space element such as \, would add an empty terminal node, which would remove the error, but also yields extra vertical branches in the tree, which is not really what you probably want. A better solution is to add empty node labels instead of using spaces as terminal nodes:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pdflscape}
\usepackage{tikz}
\usepackage{tikz-qtree}

\begin{document}

\begin{landscape}
\Tree [.CP [.TP 
       [.NP [.{} ] [.N' [.N Abelard ] ] ] 
       [.T has ] 
       [.V' [.V written ] 
            [.NP [.D a ] 
                 [.N volume ] 
                 [.PP [.P' [.P of ] 
                      [.NP [.{} ] 
                      [.N' [.N poems ] [.{} ] ] ] ] ] ] 
            [.PP [.P' [.P in [.NP [.{} ] 
                      [.N' [.N Latin ] 
                      [.{} ] ] ] ] ] ] 
            [.PP [.P' [.P for ] 
                      [.NP [.{} ] 
                      [.N' [.N Heloise ] 
                      [.{} ] ] ] ] ] ] ] ]
\end{landscape}

\end{document}

output of code

Personally, as a linguist, I would just leave the empty nodes out of the tree altogether:

(code omitted)

second output

share|improve this answer
    
It was good enough, but yours @AlanMunn looks clearly better. Well, we were instructed to draw empty branches in this one exercise. –  Reactormonk Oct 9 '12 at 16:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.