フォレスト内の空ノードのサイズを変更する

フォレスト内の空ノードのサイズを変更する

次のような画像を設定します。

ここに画像の説明を入力してください

次のforestコードでほぼ実現できます。

\documentclass{article}

\usepackage{forest}


\begin{document}

\begin{forest}
for tree={fit=band,parent anchor=south,child anchor=north}
[ForceP
        []
        [Force$'$
                [Force$^0$]
                [TopP
                        []
                        [Top$'$
                                [Top$^0$]
                                [FocP
                                        []
                                        [Foc$'$
                                                [Foc$^0$]
                                                [TopP
                                                        []
                                                        [Top$'$
                                                                [Top$^0$]
                                                                [FinP
                                                                        []
                                                                        [Fin$'$
                                                                                [Fin$^0$]
                                                                                [IP/AgrSP]]]]]]]]]]]
\end{forest}


\end{document}

ただし、左に向かう円弧は直角ではありません。

ここに画像の説明を入力してください

さて、質問は、\strutすべての s に sを追加する必要があるのか​​、それともs が右側の姉妹品と同じ高さであるempty nodeことを示すより適切な方法があるかということです。empty node

答え1

sn edgesツリーにスタイルも追加すると、より見栄えが良くなる別の方法があります。を にnice empty nodes設定するというトリックを使用するのではなく、空のノードにファントム コンテンツ ( のみ) を作成し、ツリー内のすべてのノードに標準のテキストの高さを使用して位置合わせを維持します。shapecoordinateX

\documentclass[tikz,border=5pt]{standalone}
\usepackage{forest,calc}

\begin{document}
\newlength\mytextheight
\settototalheight{\mytextheight}{XpX$^0$X$'$}
\begin{forest}
  delay={
    where content={}{
      content={\phantom{X}}
    }{},
  },
  for tree={
    text height=\mytextheight,
    fit=band,
    parent anchor=south,
    child anchor=north,
  }
  [ForceP
    []
    [Force$'$
      [Force$^0$]
      [TopP
        []
        [Top$'$
          [Top$^0$]
          [FocP
            []
            [Foc$'$
              [Foc$^0$]
              [TopP
                []
                [Top$'$
                  [Top$^0$]
                  [FinP
                    []
                    [Fin$'$
                      [Fin$^0$]
                      [IP/AgrSP]
                    ]
                  ]
                ]
              ]
            ]
          ]
        ]
      ]
    ]
  ]
\end{forest}
\end{document}

より良い空のノード?

答え2

nice empty nodesマニュアルの 52 ページのようにスタイルを定義できますforest

\documentclass{article}

\usepackage{forest}
\forestset{
nice empty nodes/.style={
for tree={calign=fixed edge angles},
delay={where content={}{for parent={for children={anchor=north}}}{}}
}}

\begin{document}

\begin{forest}
for tree={fit=band}
[ForceP, nice empty nodes
        []
        [Force$'$
                [Force$^0$]
                [TopP
                        []
                        [Top$'$
                                [Top$^0$]
                                [FocP
                                        []
                                        [Foc$'$
                                                [Foc$^0$]
                                                [TopP
                                                        []
                                                        [Top$'$
                                                                [Top$^0$]
                                                                [FinP
                                                                        []
                                                                        [Fin$'$
                                                                                [Fin$^0$]
                                                                                [IP/AgrSP]]]]]]]]]]]
\end{forest}


\end{document}

ここに画像の説明を入力してください

関連情報