我想用 tikz-qtree 画一棵树,但是它用 失败了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}
答案1
正如 percusse 所指出的(答案现已删除),问题在于完全空的节点。用空格元素填充它们,例如\,
将添加一个空的终端节点,这将消除错误,但也会在树中产生额外的垂直分支,这可能不是您真正想要的。更好的解决方案是添加空节点标签而不是使用空格作为终端节点:
\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}
就我个人而言,作为一名语言学家,我会把空节点完全排除在树之外:
(省略代码)