我希望除最远的孩子之外的所有级别的字体都较小(在下面的例子中,除了我看到了简。)我如何使用forestset
?
\documentclass{article}
\usepackage[linguistics, edges]{forest}
\begin{document}
\begin{center}
\begin{forest}
forked edges,
[S
[subject
[pronoun [I]]
]
[predicate,before computing xy={s/.average={s}{siblings}}
[verb [saw]]
] [object
[noun
[Jane.]
]
]
]
\end{forest}
\end{center}
\end{document}
答案1
使用forestset
:
\documentclass{article}
\usepackage[linguistics, edges]{forest}
\forestset{ % <---
my tree/.style={for tree={forked edge,
where n children=0{font=\large} % <---
{font=\small} % <---
}
}
}% end of forestset
\begin{document}
\begin{center}
\begin{forest} my tree % <---
[S
[subject
[pronoun
[I]
]
]
[predicate,before computing xy={s/.average={s}{siblings}}
[verb
[saw]
]
]
[object
[noun
[Jane.]
]
]
]
\end{forest}
\end{center}
\end{document}
答案2
\documentclass{article}
\usepackage[linguistics, edges]{forest}
\begin{document}
\begin{center}
\begin{forest}for tree={font=\tiny},where n children=0{font=\normalsize}{},
forked edges,
[S
[subject
[pronoun [I]]
]
[predicate,before computing xy={s/.average={s}{siblings}}
[verb [saw]]
] [object
[noun
[Jane.]
]
]
]
\end{forest}
\end{center}
\end{document}