使用 tikz-qtree 在基线和半空中设置节点

使用 tikz-qtree 在基线和半空中设置节点

我想要绘制以下树: 洛恩斯坦的树(2007)

到目前为止,我拥有的是以下内容,但此代码将所有节点都放在基线上。我想保持 T° 和 Foc° 不变。有办法实现这一点吗?

\documentclass{scrbook} 

\usepackage{tikz-qtree}
\tikzset{every roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}}


\usepackage{graphicx}

\begin{document}

\resizebox{\linewidth}{!}{%
\begin{tikzpicture}
\tikzset{level 1+/.style={level distance=2\baselineskip}}
\tikzset{every tree node/.style={align=center,anchor=north}} % enables \\ in nodes
\tikzset{frontier/.style={distance from root=30\baselineskip}}
\Tree[.TopP
       [.SpecT left\\dislocated\\elements ]
       [.T$'$ T$^0$ 
         [.FocP
           [.SpFoc {[+wh]-phrases} ]
           [.Foc$'$ Foc$^0$ 
             [.TopP 
               [.SpecT {[$-$wh]-phrases} 
               [.T$'$ Top$^0$ 
                 [.AgrP SpecAgr
                   [.Agr$'$ 
                     [.MoodP
                       [.{} ]
                       [.Mood$'$ 
                         [.TenseP
                           [.{} ]
                           [.Tense$'$ 
                             [.vP theta-layer ]
                             Tense$^0$ ] ] 
                         [.Mood$^0$ {verbal mood\\factive vs.\\epistemic} ] ] ]
                      Agr$^0$ ] ] ] ] ] ] ] ] ]
\end{tikzpicture}}

\end{document}

答案1

您需要保持屋顶节点结构,即使是空的节点也是如此。修改代码后,结果如下;请注意这里和那里的额外括号

\documentclass{scrbook} 
\usepackage{tikz-qtree}
\usetikzlibrary{calc}
\tikzset{every roof node/.append style={inner sep=0.1pt,text height=2ex,text depth=0.3ex}}
\begin{document}
\resizebox{\linewidth}{!}{%
\begin{tikzpicture}[level 1+/.style={level distance=2\baselineskip},
                    every tree node/.style={align=center,anchor=north},
                    frontier/.style={distance from root=30\baselineskip}]
\Tree[.TopP
       [.SpecT left\\dislocated\\elements ] 
       [.T$'$ [.T$^0$ ] 
         [.FocP
           [.SpFoc {[+wh]-phrases} ]
           [.Foc$'$ [.Foc$^0$ ] 
             [.TopP 
               [.SpecT {[$-$wh]-phrases} ] 
               [.T$'$ [.Top$^0$ ] 
                 [.\node(a){AgrP}; [.\node(b){SpecAgr}; ]
                   [.Agr$'$ 
                     [.MoodP
                       [.{} ]
                       [.Mood$'$ 
                         [.TenseP
                           [.{} ]
                           [.Tense$'$ 
                             [.vP theta-layer ]
                             [.Tense$^0$ ] ] ] 
                         [.Mood$^0$ {verbal mood\\factive vs.\\epistemic} ] ] ]
                      [.Agr$^0$ ] ] ] ] ] ] ] ] ] ]
\draw[ultra thick,dashed] ($(a.north west)!-3cm!([yshift=-1cm]b.north west)$)  
                        --($(a.north west)!1.5!(b.north west)$);
\end{tikzpicture}%
}

\end{document}

在此处输入图片描述

相关内容