다음 그림을 설정하고 싶습니다.
다음 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
설정하는 트릭을 사용하는 대신 빈 노드(단지 )에 대한 팬텀 콘텐츠를 생성하고 트리의 모든 노드에 대해 표준 텍스트 높이를 사용하여 정렬을 유지합니다.shape
coordinate
X
\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}