[Tex/LaTex] Dimension too large with tikz-qtree

linguisticstikz-pgftikz-qtreetikz-trees

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}

Best Answer

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