摆脱默认的 where 规范

摆脱默认的 where 规范

我指定了一个where声明,以便将树中的所有单词在基层对齐。我的书可能包含一棵树,它不符合此默认设置。我该如何摆脱默认设置,以便 Specifier 和 Adjunct 不会被推到基线?

\documentclass{minimal}

\usepackage{forest}

\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,align=center,base=bottom,where n children=0{tier=word}{}}}, 
background tree/.style={for tree={text opacity=0.2,draw opacity=0.2,edge={draw opacity=0.2}}}
}


\begin{document}

\begin{forest}
sn edges
[XP
  [Specifier]
  [X'
    [Adjunct]
    [X'
      [Complement] [X] ] ] ]
\end{forest}

\end{document}

答案1

您可以在本地将设置tier为空:

\documentclass{article}

\usepackage{forest}

\forestset{
sn edges/.style={for tree={parent anchor=south, child anchor=north,align=center,base=bottom,where n children=0{tier=word}{}}}, 
background tree/.style={for tree={text opacity=0.2,draw opacity=0.2,edge={draw opacity=0.2}}}
}

\begin{document}

\begin{forest}
sn edges,
where n children=0{tier=}{}
[X
  [Specifier]
  [X'
    [Adjunct]
    [X'
      [Complement] [X] ] ] ]
\end{forest}

\end{document}

在此处输入图片描述

相关内容