我安装了森林2016/03/04 v2.0.2
。我适应了我如何使用森林或其他东西来排版命题逻辑公式的解析树?满足我的需求,得到以下代码。以下代码引入了两个全局选项,wff
和connective
。
\documentclass[convert={size=640}]{standalone}
\usepackage{microtype}
\usepackage[T1]{fontenc}
% forest
\usepackage{forest}
% parsing tree
\forestset{
declare toks={wff}{},
declare toks={connective}{},
parsing tree/.style={
declare dimen register={parsing tree sep},
parsing tree sep=5pt,
% Append the current root to a new phantom root.
for root'={
replace by={[,phantom,append=!last dynamic node]}
},
% `for tree` applies only to the subtree of the new phantom root.
for tree={
math content,
parent anchor=children,
child anchor=parent,
inner sep=0pt,
if n children=1{!first.calign with current edge}{},
delay={
content=\circ,
insert before/.wrap pgfmath arg={
[##1,no edge,math content,anchor=base east,
before computing xy={
s/.pgfmath={s("!n")-\forestregister{parsing tree sep}}
}]
}{wff},
if connective={}{connective/.option=wff}{},
insert after/.wrap pgfmath arg={
[##1,no edge,math content,anchor=base west,
before computing xy={
s/.pgfmath={s("!p")+\forestregister{parsing tree sep}}
}]
}{connective},
}
}
}
}
\begin{document}
\begin{forest}
parsing tree
[,wff=p_0\wedge q_0,connective=\wedge
[,wff=p_0] [,wff=q_0 []]]
\end{forest}
\end{document}
我不喜欢它declare toks={option}{}
扰乱全局命名空间。我只想定义parsing tree
样式选项。如何将选项放在安全命名空间内,而不会使森林树木变得杂乱?