特定の終端ノードに続くすべてのノードを色分けする

特定の終端ノードに続くすべてのノードを色分けする

いくつかのノードを塗りつぶされたドットで色付けしようとしています。しかし、フォレスト パッケージのガイドラインに従って、最初の 2 行しか塗りつぶすことができず、行き詰まっています。

私がやろうとしていること:

私がしたいこと

私は最初と 2 番目しかできませんでした。これが私の最小限のコードです:

\documentclass[border=3mm]{standalone}
\usepackage[linguistics,edges]{forest} 
\forestset{
ned/.style={%
    for tree={calign=fixed edge angles},
    delay={%
      where content={}{%
        shape=coordinate,
        for nodewalk={%
          Nodewalk={%
            on invalid=fake,
          }{%
            parent,
          }{%
            for children={anchor=north},
          }
        }{},
      }{},
    },
},
}

\begin{document}

\begin{forest}
ned
[DP
  [
    [
      [pro]
      [
        [VP
          [NP\\ t\textsubscript{1}]
          [V\\Tuttukları]
        ]
        [T]
      ]
    ]
    [C]
  ]
  [
    [NP\\aşçı]
    [D]
  ]
]
\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=red] (!1.child anchor) circle[radius=2pt];
\end{forest}

\end{document}

答え1

理解しやすくするために、ノードごとに 1 つの色を選択しました (必要に応じて赤に変更できます)。

上から下まで:

\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=black] (!1.child anchor) circle[radius=2pt];
\path[fill=green] (!11.child anchor) circle[radius=2pt];
\path[fill=blue] (!112.child anchor) circle[radius=2pt];
\path[fill=yellow] (!1121.south) circle[radius=2pt];
\path[fill=orange] (!11212.child anchor) circle[radius=2pt];

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

MWE:

\documentclass[border=3mm]{standalone}
\usepackage[linguistics,edges]{forest} 
\forestset{
ned/.style={%
    for tree={calign=fixed edge angles},
    delay={%
      where content={}{%
        shape=coordinate,
        for nodewalk={%
          Nodewalk={%
            on invalid=fake,
          }{%
            parent,
          }{%
            for children={anchor=north},
          }
        }{},
      }{},
    },
},
}

\begin{document}

\begin{forest}
ned
[DP
  [
    [
      [pro]
      [
        [VP
          [NP\\ t\textsubscript{1}]
          [V\\Tuttukları]
        ]
        [T]
      ]
    ]
    [C]
  ]
  [
    [NP\\aşçı]
    [D]
  ]
]
\path[fill=red] (.parent anchor) circle[radius=2pt];
\path[fill=black] (!1.child anchor) circle[radius=2pt];
\path[fill=green] (!11.child anchor) circle[radius=2pt];
\path[fill=blue] (!112.child anchor) circle[radius=2pt];
\path[fill=yellow] (!1121.south) circle[radius=2pt];
\path[fill=orange] (!11212.child anchor) circle[radius=2pt];
\end{forest}

\end{document}

説明不要だと思いますが、そうでない場合はお知らせください。

関連情報