What is the correct way to wrap the specification for the tree below into the my binomial style defined in \forestset and why?
The following code works fine:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\def\p{.25}
\begin{document}
\begin{forest}
before typesetting nodes={
for tree={
if level=0{
content={1},
}{
content/.wrap pgfmath arg={#1}{content("!u")*\p},
},
}
},
[A
[B
[D
]
[E
]
]
[C
[F
]
[G
]
]
]
\end{forest}
\end{document}
while the following does not:
\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\forestset{
my binomial/.style={
before typesetting nodes={
for tree={
if level=0{
content={1},
}{
content/.wrap pgfmath arg={#1}{content("!u")*\p},
},
}
},
},
}
\def\p{.25}
\begin{document}
\begin{forest}
my binomial,
[A
[B
[D
]
[E
]
]
[C
[F
]
[G
]
]
]
\end{forest}
\end{document}
Specifically, I get a Missing number, treated as zero \end{forest} error. I'm presuming this has something to do with expansion which I know very little about. If possible, I'd like to understand the problem, independently of whether there's a workaround.
\forestsetis not to blame. It is the handler.stylethat introduces another macro argument layer... – Paul Gaborit Apr 09 '15 at 07:19