I installed forest 2016/03/04 v2.0.2. I adapted How do I typeset this parsing tree for propositional logic formula with forest or something else? to my needs to get the following code. The following code introduces two global options, wff and 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}
I don't like the fact that declare toks={option}{} messes with the global namespace. I want to define options for only parsing tree style. How can I put an option inside a safe namespace without making clutters in forest trees?
If you want reference to your source code, I can provide. I just updated my question to include the reference.
– May 04 '16 at 23:01