texlive[42750] Master/texmf-dist: forest (19dec16)
commits+karl at tug.org
commits+karl at tug.org
Mon Dec 19 23:12:23 CET 2016
Revision: 42750
http://tug.org/svn/texlive?view=revision&revision=42750
Author: karl
Date: 2016-12-19 23:12:23 +0100 (Mon, 19 Dec 2016)
Log Message:
-----------
forest (19dec16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/forest/README
trunk/Master/texmf-dist/doc/latex/forest/forest-doc.pdf
trunk/Master/texmf-dist/doc/latex/forest/forest-doc.tex
trunk/Master/texmf-dist/doc/latex/forest/forest.pdf
trunk/Master/texmf-dist/source/latex/forest/forest-index.dtx
trunk/Master/texmf-dist/source/latex/forest/forest.dtx
trunk/Master/texmf-dist/tex/latex/forest/forest-index.sty
trunk/Master/texmf-dist/tex/latex/forest/forest.sty
Modified: trunk/Master/texmf-dist/doc/latex/forest/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/forest/README 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/doc/latex/forest/README 2016-12-19 22:12:23 UTC (rev 42750)
@@ -1,4 +1,4 @@
-LaTeX package: forest [2016/12/05 v2.1 Drawing (linguistic) trees]
+LaTeX package: forest [2016/12/18 v2.1.1 Drawing (linguistic) trees]
Copyright (c) 2016 Saso Zivanovic
(Sa\v{s}o \v{Z}ivanovi\'{c})
Modified: trunk/Master/texmf-dist/doc/latex/forest/forest-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/forest/forest-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/forest/forest-doc.tex 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/doc/latex/forest/forest-doc.tex 2016-12-19 22:12:23 UTC (rev 42750)
@@ -39,6 +39,19 @@
\IndexPrologue{Color legend: \textcolor{red}{definition}, \textcolor{darkgreen}{example}, \textcolor{blue}{other}. If an entry belongs to a library, the library name is given in parenthesis. All page numbers are hyperlinks, and definitions in text are hyperlinked to this index.}
\makeindex
+\makeatletter
+\def\bigbadforlist{}
+\def\forest@@doc@@hook at bigbadforlist{\aftergroup\forest@@doc@@hook at bigbadforlist@}
+\def\forest@@doc@@hook at bigbadforlist@{%
+ \forestset{define long step/.append code={%
+ \ifforest at nodewalkstephandler@makefor
+ \appto\bigbadforlist{[##1]}%
+ \fi
+ }%
+ }%
+}
+\def\bigbadprocesslist{}
+\makeatother
\usepackage[external]{forest}
\useforestlibrary{edges}
\useforestlibrary{linguistics}
@@ -212,6 +225,7 @@
\indexset[
form={},
+ index key={},
for first={
for first={
key+/.option=!parent.argument,
@@ -232,6 +246,7 @@
\indexset[
form={},
+ index key={},
for first={
for first={
+key/.option=!parent.argument,
@@ -252,6 +267,7 @@
\indexset[
form={},
+ index key={},
for first={
for first={
key/.process={OOw2} {key} {!parent,parent.argument} {##1 ##2},
@@ -273,6 +289,7 @@
\indexset[
form={},
+ index key={},
for first={
for first={
key/.process={OOw2} {key} {!parent,parent.argument} {##2 ##1},
@@ -4849,9 +4866,29 @@
index format={result=if \protect\meta{count option}<,pgfkey},
print format={result/.option=argument,+result={if\ },result+={<}, pgfkey},
}]{conditional>if count LT=\protect\meta{count option}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=if \protect\meta{dimen register}\protect\greaterthan,pgfkey},
+ print format={result/.option=argument,+result={if\ },result+={>}, pgfkey},
+}]{conditional>if dimen register GT=\protect\meta{dimen register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=if \protect\meta{dimen register}<,pgfkey},
+ print format={result/.option=argument,+result={if\ },result+={<}, pgfkey},
+}]{conditional>if dimen register LT=\protect\meta{dimen register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=if \protect\meta{count register}\protect\greaterthan,pgfkey},
+ print format={result/.option=argument,+result={if\ },result+={>}, pgfkey},
+}]{conditional>if count register GT=\protect\meta{count register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=if \protect\meta{count register}<,pgfkey},
+ print format={result/.option=argument,+result={if\ },result+={<}, pgfkey},
+}]{conditional>if count register LT=\protect\meta{count register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
-If the current value of the dimen/count option is greater/less than or equal to \meta{value},
-execute \meta{true keylist}; else, execute \meta{false keylist}.
+If the current value of the dimen/count option/register is greater/less than or equal to
+\meta{value}, execute \meta{true keylist}; else, execute \meta{false keylist}.
\indexitem{conditional>if nodewalk valid}|=|\meta{keylist: test nodewalk}\meta{true keylist}\meta{false keylist}
@@ -4907,7 +4944,7 @@
\end{advise}
\begin{syntax}
-\indexitem{propagator>where}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\indexitem{conditional>where}|=|\meta{value}\meta{true keylist}\meta{false keylist}
\itemnosep
\indexitem{word prefix=option>conditional>where=\meta{option}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
\itemnosep
@@ -4922,7 +4959,7 @@
\itemnosep
\indexitem[set={
index format={result=where \protect\meta{dimen option}<,pgfkey},
- print format={result/.option=argument,+result={where\ },result+={>}, pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={<}, pgfkey},
}]{conditional>where dimen LT=\protect\meta{dimen option}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
\itemnosep
\indexitem[set={
@@ -4932,14 +4969,34 @@
\itemnosep
\indexitem[set={
index format={result=where \protect\meta{count option}<,pgfkey},
- print format={result/.option=argument,+result={where\ },result+={>}, pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={<}, pgfkey},
}]{conditional>where count LT=\protect\meta{count option}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
\itemnosep
-\indexitem{step>where nodewalk valid}|=|\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
+\indexitem[set={
+ index format={result=where \protect\meta{dimen register}\protect\greaterthan,pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={>}, pgfkey},
+}]{conditional>where dimen register GT=\protect\meta{dimen register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=where \protect\meta{dimen register}<,pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={<}, pgfkey},
+}]{conditional>where dimen register LT=\protect\meta{dimen register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=where \protect\meta{count register}\protect\greaterthan,pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={>}, pgfkey},
+}]{conditional>where count register GT=\protect\meta{count register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem[set={
+ index format={result=where \protect\meta{count register}<,pgfkey},
+ print format={result/.option=argument,+result={where\ },result+={<}, pgfkey},
+}]{conditional>where count register LT=\protect\meta{count register}}|=|\meta{value}\meta{true keylist}\meta{false keylist}
+\itemnosep
+\indexitem{conditional>where nodewalk valid}|=|\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
\itemnosep
-\indexitem{step>where nodewalk empty}|=|\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
+\indexitem{conditional>where nodewalk empty}|=|\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
\itemnosep
-\indexitem{step>where in saved nodewalk}|=|\meta{nodewalk}\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
+\indexitem{conditional>where in saved nodewalk}|=|\meta{nodewalk}\meta{toks: nodewalk name}\meta{true keylist}\meta{false keylist}
\end{syntax}
@@ -5253,33 +5310,78 @@
For a gentle(r) introduction to the argument processor, see \S\ref{tut:wrapping}.
The argument processor takes a sequence of instructions and an arbitrary number of arguments and
-transforms the given arguments according to the instructions. There are two ways to invoke the
-argument processor:
+transforms the given arguments according to the instructions. This is the generic form of a process
+expression:
\begin{syntax}
+ \item \indexdef{meta>process} = \meta{instructions}\meta{arg $1$}\dots\meta{arg $n$}
+\end{syntax}
+
+There are three ways to invoke the argument processor: via handler \index{handler>process}, as one
+of the two alternatives of a \index{forestmath} expression and recursively, by its instruction
+\index{processor>P}.
+
+\begin{syntax}
-\indexitem{handler>process}|=|\meta{instructions}\meta{arg $1$}\dots\meta{arg $n$}
+\indexitem{handler>process}|=|\index{meta>process}
-The result of the computation is passed on to the handled key as a sequence of arguments. Any
-number of arguments can be returned.\footnote{For backward compatibility, \index{handler>process} is also
- available as \indexdef{handler>process args}.}
+The result of the computation is passed on to the handled key as a sequence of arguments. When the
+argument processor is invoked this way, any number of items can be returned.\footnote{For backward
+ compatibility, \index{handler>process} is also available as \indexdef{handler>process args}.}
-\item \indexdef{meta>forestmath} = \meta{pgfmath}\OR|>|\meta{instructions}\meta{arg
- $1$}\dots\meta{arg $n$}
+\item \indexdef{meta>forestmath} = \meta{pgfmath}\OR|>|\index{meta>process}
In words, a \index{forestmath} expression is either a \meta{pgfmath} expression or an argument
- processor expression prefixed by |>|.
+ processor expression (\index{meta>process}) prefixed by |>|.
- In other words, \FoRest; accepts an argument processor expression anywhere\footnote{The only
- exceptions to the above rule are handler \index{pgfmath} and argument processor instruction
- \index{processor>P}.} it accepts a \meta{pgfmath} expression. To indicate that we're providing
- an argument processor expression, we prefix it with |>|.
+ In other words, \FoRest; accepts an argument processor expression anywhere it accepts a
+ \meta{pgfmath} expression.\footnote{The only exceptions to the above rule are handler
+ \index{pgfmath} and argument processor instruction \index{processor>P}.} To indicate that we're
+ providing an argument processor expression, we prefix it with |>|.
- The result of argument processor's computation should be a single item.
+ When the argument processor is invoked this way, it should return a single item.
\end{syntax}
+\begin{table}
+ \centering
+ \tikzexternaldisable
+ \bracketset{action character=!}%
+ \begin{forest}
+ phantom,
+ for tree={
+ grow'=0, no edge, inner sep=0, outer sep=0,
+ },
+ delay={
+ sort by={>O+t+c{content}},
+ sort,
+ },
+ before typesetting nodes={
+ for children={
+ content={\index{processor>#1}},
+ for children={
+ content+={\phantom{(%)
+ }}}}},
+ define long step={from to}{n args=2}{
+ tempcounta=#2,
+ n=#1,
+ while/.process=Rw{tempcounta}{n()<##1}{next}
+ },
+ draw tree stage/.style={
+ for root'={
+ draw tree processing order/.nodewalk style={branch={{from to={1}{round(n_children()/3)}},tree}}, draw tree, TeX={~~},
+ draw tree processing order/.nodewalk style={branch={{from to={1+round(n_children()/3)}{2*round(n_children()/3)}},tree}}, draw tree, TeX={~~},
+ draw tree processing order/.nodewalk style={branch={{from to={1+2*round(n_children()/3)}{n_children()}},tree}}, draw tree,
+ }
+ }
+ [!\bigbadprocesslist]
+ \end{forest}%
+ \caption{Argument processor instructions}
+ \label{tab:allargprocins}
+\end{table}
+
+
The syntax of argument processor is a cross between |expl3|'s function argument specification and a
Turing machine, spiced with a bit of reversed Polish notation. ;-)
@@ -5342,22 +5444,27 @@
\end{itemize}
\end{itemize}
-
+\makeatletter
\NewDocumentEnvironment{indexitemprocessinstruction}{
D(){} % default
O{} % \index []
m % instruction char
+ o % form of instruction char, if different from #3
D(){} % instruction modifiers
m % first line
>{\ReverseBoolean} s % typeset processor signature?
>{\SplitArgument {3} {&} } m % processor signature
- o % instruction in signature
}{%
- \indexitem(#1)[set={#2}]{processor>#3}#4 #5%
- \edef\ins{\noexpand\texttt{\IfNoValueTF{#8}{\detokenize{#3}}{#8}}}%
- \IfBooleanT{#6}{\hfill\processorsignature#7}%
+ \write\@auxout{\unexpanded{\gappto\bigbadprocesslist{[{#3}[{#6}]]}}}%
+ \IfValueTF{#4}{%
+ \indexitem(#1)[set={form={#4},index form={#4{\protect\ \protect\rm\protect\scriptsize (#6)}},#2}]{processor>#3}#5 #6%
+ }{%
+ \indexitem(#1)[set={index form={#3{\protect\ \protect\rm\protect\scriptsize (#6)}},#2}]{processor>#3}#5 #6%
+ }%
+ \IfBooleanT{#7}{\hfill\processorsignature#8}%
}{}
+\makeatother
\newcommand\processorsignature[4]{%
#1 \textcolor{darkgreen}{\eye} #2
@@ -5368,8 +5475,8 @@
\begin{syntax}
-\begin{indexitemprocessinstruction}[form=\_,index key=_]{noop}([$n$]){no-op}
- {&\meta{arg}&\meta{arg}&}[\_]
+\begin{indexitemprocessinstruction}[index key=_]{noop}[\_]([$n$]){no-op}
+ {&\meta{arg}&\meta{arg}&}
The argument is not processed, but simply skipped over. In other words, this instruction only
moves the head one item to the right. (This is like |expl3|'s argument specifier |n|.)
@@ -5381,7 +5488,7 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{o}([$n$]){expand \emph{o}nce}
+\begin{indexitemprocessinstruction}{o}([$n$]){expand \protect\emph{o}nce}
{&\meta{arg}&\meta{result}&}
\meta{arg} is expanded once. (This is like |expl3|'s argument specifier |o|).
@@ -5390,13 +5497,13 @@
repetition. For example, |o3| expands the argument three times (and then moves the head right).
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{x}{fully e\emph{x}pand}
+\begin{indexitemprocessinstruction}{x}{fully e\protect\emph{x}pand}
{&\meta{arg}&\meta{result}&}
\meta{arg} is fully expanded using |\edef|. (This is like |expl3|'s argument specifier |x|.)
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{O}([$n$]){\emph{o}ption}
+\begin{indexitemprocessinstruction}{O}([$n$]){\protect\emph{o}ption}
{&\meta{option}&\meta{result}&}
\meta{option}=\alternative{\meta{option name},\meta{relative node name}\texttt{.}\meta{option name}}
@@ -5408,7 +5515,7 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{R}([$n$]){\emph{r}egister}
+\begin{indexitemprocessinstruction}{R}([$n$]){\protect\emph{r}egister}
{&\meta{register}&\meta{result}&}
\meta{result} is the value of register \meta{register}.
@@ -5417,9 +5524,34 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{P}([$n$]){\emph{p}gfmath}
- {&\meta{pgfmath expr}&\meta{result}&}
+\begin{indexitemprocessinstruction}{p}([$n$]){\protect\emph{p}process}
+ {&\index{meta>process}&\meta{result}&}
+ Execute an embedded call of the argument processor.
+ The embedded argument processor may return any number of items.
+
+ $n$ means repetition.
+
+\begin{forestexample}[index={processor>p,processor>O,processor>w,processor>noop,grow',forked edges,content,handler>process}]
+ \begin{forest}
+ grow'=0, phantom,
+ delay={for children={
+ content/.process={_O= ? ~p~}
+ {}{content}
+ {_{No content was given, so there's nothing to do.}}
+ {Ow1{content}{We have content (##1), so we compute:
+ $##1+42=\the\numexpr ##1+42$}}
+ }}
+ [[][3][][5]]
+ \end{forest}
+\end{forestexample}
+
+
+\end{indexitemprocessinstruction}
+
+\begin{indexitemprocessinstruction}{P}([$n$]){\protect\emph{p}gfmath}
+ {&\meta{pgfmath}&\meta{result}&}
+
\meta{result} is the result of evaluating \meta{pgfmath expr} using |\pgfmathparse|.
$n$ means repetition.
@@ -5459,7 +5591,7 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{n}([$n$]){\emph{n}umexpr}
+\begin{indexitemprocessinstruction}{n}([$n$]){\protect\emph{n}umexpr}
{&\meta{numexpr}&\meta{result}&}
\meta{result} is the result of evaluating \meta{dimexpr} using e\TeX's |\number\numexpr|.
@@ -5468,7 +5600,7 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{d}([$n$]){\emph{d}imexpr}
+\begin{indexitemprocessinstruction}{d}([$n$]){\protect\emph{d}imexpr}
{&\meta{dimexpr}&\meta{result}&}
\meta{result} is the result of evaluating \meta{dimexpr} using e\TeX's |\the\dimexpr|.
@@ -5498,11 +5630,11 @@
\end{forestexample}
-\begin{indexitemprocessinstruction}{w}([$n$]){(consuming) \emph{w}rap}
+\begin{indexitemprocessinstruction}{w}([$n$]){(consuming) \protect\emph{w}rap}
{\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&\meta{macro body}&\meta{result}&}
\end{indexitemprocessinstruction}
\itemnosep[2pt]
-\begin{indexitemprocessinstruction}{W}([$n$]){(non-consuming) \emph{w}rap}
+\begin{indexitemprocessinstruction}{W}([$n$]){(non-consuming) \protect\emph{w}rap}
{\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&\meta{macro body}&
\meta{arg$_{1}$}\dots\meta{arg$_{n}$}\meta{result}&}
@@ -5517,11 +5649,11 @@
Default $n$ is 1. (Specifying $n>9$ raises an error.)
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}[form={\&},index key=\&]{and}([$n$]){boolean ``and''}*{}
+\begin{indexitemprocessinstruction}[index key=\&]{and}[\&]([$n$]){boolean ``and''}*{}
\end{indexitemprocessinstruction}
\itemnosep[2pt]
-\begin{indexitemprocessinstruction}[form={\protect\indexpipe},index key=\&or]{or}([$n$]){boolean ``or''}
- {\meta{arg$_{1}$}\meta{arg$_{2}$}&&\meta{result}&}
+\begin{indexitemprocessinstruction}[index key=\&or]{or}[\protect\indexpipe]([$n$]){boolean ``or''}
+ {\protect\meta{arg$_{1}$}\protect\meta{arg$_{2}$}&&\meta{result}&}
\meta{result} is a boolean conjunction/disjunction of $n$ arguments. The arguments are taken from
the left. They should be numbers (positive integers): |0| means false, any other number means
@@ -5530,7 +5662,7 @@
Default $n$ is 2.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}[form={!},index key=!]{not}{boolean ``not''}
+\begin{indexitemprocessinstruction}[index key=!]{not}[!]{boolean ``not''}
{\meta{arg}&&\meta{result}&}
\meta{result} is a boolean negation of the argument. The argument is taken from the left. It
@@ -5538,7 +5670,7 @@
\meta{result} is always |0| or |1|.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{?}{conditional (if \dots\ then\dots\ else)}
+\begin{indexitemprocessinstruction}{?}{conditional (if \protect\dots\ then \protect\dots\ else)}
{\meta{condition}&\meta{true arg}\meta{false arg}&&\meta{result}}
\meta{result} is \meta{true arg} is \meta{condition} is true (non-zero), otherwise \meta{false
@@ -5548,13 +5680,13 @@
where the winner is left as well.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}[form={=},index key={=}]{equal}{comparison: $\meta{arg$_{1}$}=\meta{arg$_{2}$}$?}*{}
+\begin{indexitemprocessinstruction}[index key={=}]{equal}[=]{comparison: $\protect\meta{arg$_{1}$}=\protect\meta{arg$_{2}$}$?}*{}
\end{indexitemprocessinstruction}
\itemnosep[1pt]
-\begin{indexitemprocessinstruction}[form={<},index key={<}]{lt}{comparison: $\meta{arg$_{1}$}<\meta{arg$_{2}$}$?}*{}
+\begin{indexitemprocessinstruction}[index key={<}]{lt}[<]{comparison: $\protect\meta{arg$_{1}$}<\protect\meta{arg$_{2}$}$?}*{}
\end{indexitemprocessinstruction}
\itemnosep[1pt]
-\begin{indexitemprocessinstruction}[form={\protect\greaterthan},index key={<<}]{gt}{comparison: $\meta{arg$_{1}$}>\meta{arg$_{2}$}$?}
+\begin{indexitemprocessinstruction}[index key={<<}]{gt}[\protect\greaterthan]{comparison: $\protect\meta{arg$_{1}$}\protect\greaterthan\protect\meta{arg$_{2}$}$?}
{\meta{arg$_{1}$}\meta{arg$_{2}$}&&\meta{result}&}
Compare \meta{arg$_{1}$} and \meta{arg$_{2}$}, returning |1| (true) if \meta{arg$_{1}$} is equal
@@ -5588,7 +5720,7 @@
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{t}{mark as \emph{t}ext}
+\begin{indexitemprocessinstruction}{t}{mark as \protect\emph{t}ext}
{&\meta{arg}&\meta{arg}&}
The result is not changed, only its type is changed to text. This is relevant only for
@@ -5616,7 +5748,7 @@
For generic type arguments, this operation is a no-op.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{u}{\emph{u}ngroup}
+\begin{indexitemprocessinstruction}{u}{\protect\emph{u}ngroup}
{&\meta{arg}&&\meta{item$_1$}\dots\meta{item$_n$}}
As every \TeX\ undelimited macro argument, \meta{arg} is a list of tokens or braced token lists.
@@ -5623,11 +5755,11 @@
This instruction puts those items back to the right as ``separate arguments''.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{s}([$n$]){(consuming) \emph{s}ave}
+\begin{indexitemprocessinstruction}{s}([$n$]){(consuming) \protect\emph{s}ave}
{\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&&&}
\end{indexitemprocessinstruction}
\itemnosep[2pt]
-\begin{indexitemprocessinstruction}{S}([$n$]){(non-consuming) \emph{s}ave}
+\begin{indexitemprocessinstruction}{S}([$n$]){(non-consuming) \protect\emph{s}ave}
{\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&&\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&}
Saves the last $n$ arguments from the left into a ``special place''.
@@ -5638,14 +5770,14 @@
Default $n$ is 1.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{l}([$n$]){(consuming) \emph{l}oad}
+\begin{indexitemprocessinstruction}{l}([$n$]){(consuming) \protect\emph{l}oad}
{&&\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&}
\end{indexitemprocessinstruction}
\itemnosep[2pt]
-\begin{indexitemprocessinstruction}{L}([$n$]){(non-consuming) \emph{l}oad}
+\begin{indexitemprocessinstruction}{L}([$n$]){(non-consuming) \protect\emph{l}oad}
{&&\meta{arg$_{1}$}\dots\meta{arg$_{n}$}&}
- Loads $n$ arguments from the ``special place'' to the left.
+ Loads last $n$ arguments from the ``special place'' to the left.
With |l|, \meta{arg$_{1}$}\dots\meta{arg$_{n}$} are ``consumed'', i.e.\ they are removed from the
special place. |S| keeps \meta{arg$_{1}$}\dots\meta{arg$_{n}$} in the special place.
@@ -5653,7 +5785,7 @@
The default $n$ is 0 and indicates that the entire special place should be loaded.
\end{indexitemprocessinstruction}
-\begin{indexitemprocessinstruction}{r}{\emph{r}everse (key)list}
+\begin{indexitemprocessinstruction}{r}{\protect\emph{r}everse (key)list}
{&\meta{list}&\meta{result}&}
\meta{list} should be a comma-separated list (\emph{not} a name of a keylist option or register).
@@ -6254,6 +6386,23 @@
\subsubsection{v2.1}
\begin{description}
+\item[v2.1.1 (2016/12/18)] \mbox{}
+
+ Minor improvements:
+ \begin{itemize}
+ \item Implemented argument processor instruction \index{processor>p}.
+ \end{itemize}
+
+ Bugfixes:
+ \begin{itemize}
+ \item Argument processor instruction \index{processor>u} introduced an extra layer of braces
+ around each result item.
+ \item Argument processor instructions \index{processor>l} and \index{processor>L} did not always
+ load the desided number of arguments.
+ \item Argument processor instructions \index{processor>and} and \index{processor>or} were taking
+ the arguments from the start of the left side instead of its end.
+ \end{itemize}
+
\item[v2.1 (2016/12/05)] \mbox{}
Backward incompatible changes (with a \index{compat} key):
Modified: trunk/Master/texmf-dist/doc/latex/forest/forest.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/forest/forest-index.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/forest/forest-index.dtx 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/source/latex/forest/forest-index.dtx 2016-12-19 22:12:23 UTC (rev 42750)
@@ -1,4 +1,4 @@
-% \CheckSum{756}
+% \CheckSum{755}
% \iffalse meta-comment
% forest-index.dtx
%% `forest-index' is an indexing system for the documentation of package `forest', using the package itself.
@@ -222,7 +222,7 @@
% \begin{macrocode}
declare boolean register=print,
declare boolean register=index,
- declare boolean register=short, short,
+ declare boolean register=short,
% \end{macrocode}
% Options |name|, |content|, |key| and |argument| hold info about the
% current entry. We need to declare only the latter two, the former
@@ -295,7 +295,7 @@
% \end{macrocode}
% Set the defaults.
% \begin{macrocode}
- print, index, index entry type=normal, set'={},
+ print, index, index entry type=normal, set'={}, short,
% \end{macrocode}
% Create the tree structure:
% |[entry[subentry[subsubentry...]]]|. Three options of every node
@@ -402,10 +402,17 @@
% \end{enumerate*}
% \begin{macrocode}
if index={
- index at hypertarget/.expanded={.\forestoption{index key}},
+ index at hypertarget/.process={OS_= ? l_ w2}
+ {index key}
+ {}
+ {}{.}
+ {##2##1},
for descendants={
- index at hypertarget/.process= {OOw2}
- {!parent.index at hypertarget} {index key} {##1.##2},
+ index at hypertarget/.process={OO S _l1= ? w2 }
+ {!parent.index at hypertarget}{index key}
+ {}
+ {##1} % empty index key
+ {##1.##2} % otherwise
},
}{},
% \end{macrocode}
@@ -590,8 +597,8 @@
\noexpand\immediate\noexpand\write\noexpand\forestindex at out{%
\noexpand\string\noexpand\indexdefineshortkey\noexpand\unexpanded{{\forestoption{key}}{\forestoption{content}}}%
}%
- }{}%
- }
+ }%
+ }{}
}
}
}
Modified: trunk/Master/texmf-dist/source/latex/forest/forest.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/forest/forest.dtx 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/source/latex/forest/forest.dtx 2016-12-19 22:12:23 UTC (rev 42750)
@@ -1,4 +1,4 @@
-% \CheckSum{16573}
+% \CheckSum{16606}
% \iffalse meta-comment
% forest.dtx
%% `forest' is a `pgf/tikz'-based package for drawing (linguistic) trees.
@@ -83,7 +83,7 @@
%
% \section{Identification}
% \begin{macrocode}
-\ProvidesPackage{forest}[2016/12/05 v2.1 Drawing (linguistic) trees]
+\ProvidesPackage{forest}[2016/12/18 v2.1.1 Drawing (linguistic) trees]
\RequirePackage{tikz}[2013/12/13]
\usetikzlibrary{shapes}
@@ -860,7 +860,7 @@
\noexpand\fi
}%
% \end{macrocode}
-% Puts all items until |\forest at eov| into the array. After that is done, execute |\forest at topextend@next|. This code is difficult and not run often, so it doesn't need specialized control sequences.
+% Puts all items until |\forest at eov| into the array. After that is done, execute |\forest at topextend@next| (Why this macro? So that we can extend the array by tokens never seen before.). This code is difficult and not run often, so it doesn't need specialized control sequences.
% \begin{macrocode}
\csdef{#1topextend}{\def\forest at array@currentarray{#1}\forest at array@topextend}%
}
@@ -1151,17 +1151,18 @@
\def\forestmathtype at unitless{P} % <decimal> (a unitless dimension) (P because pgfmath returns such numbers)
\def\forestmathtype at textasc{t} % text (ascending)
\def\forestmathtype at textdesc{T} % text (descending)
-\def\forestmathtype at array{a} % array - internal
\def\forestmathtype at none{} % internal (for requests - means whatever)
\def\forestmathresult{}
\let\forestmathresulttype\forestmathtype at generic
% \end{macrocode}
-% |\forest at tryprocess| takes three ``arguments''. The first is a forestmath expression, delimited
-% by |\forest at spacegen|: if it starts with a |>|, we take it to be a |.process| expression, evaluate
-% it using |\forest at process|, and execute the second argument; it it doesn't, we execute the third
-% argument.
+% |\forest at tryprocess| takes four ``arguments''. The first is a true/false switch telling whether
+% to return the full result array in case we have a |.process| expression. The second is a
+% forestmath expression, delimited by |\forest at spacegen|: if it starts with a |>|, we take it to be
+% a |.process| expression, evaluate it using |\forest at process|, and execute the third argument; it
+% it doesn't, we execute the fourth argument.
% \begin{macrocode}
-\def\forest at tryprocess{%
+\def\forest at tryprocess#1{%
+ \def\forest at tryprocess@returnarray{#1}%
\expandafter\forest at tryprocess@a\romannumeral-`0}
\def\forest at tryprocess@a{\futurelet\forest at temp@token\forest at tryprocess@b}
\def\forest at tryprocess@b{%
@@ -1173,7 +1174,7 @@
}
\def\forest at spacegen{ \forest at spacegen}
\def\forest at tryprocess@yes#1#2\forest at spacegen{%
- \forest at process{false}#2\forest at eov
+ \expandafter\forest at process\expandafter{\forest at tryprocess@returnarray}#2\forest at eov
\@firstoftwo
}
\def\forest at tryprocess@no#1\forest at spacegen{\@secondoftwo}
@@ -1184,7 +1185,7 @@
% track.)
% \begin{macrocode}
\def\forestmathsetcount#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
#1=\forest at process@result\relax
}{%
\forestmathsetcount@#1{#2}%
@@ -1198,7 +1199,7 @@
}%
}
\def\forestmathsetlength#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
#1=\forest at process@result\relax
}{%
\forestmathsetlength@#1{#2}%
@@ -1212,7 +1213,7 @@
}%
}
\def\forestmathtruncatemacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\forest at temp@count=\forest at process@result\relax
\edef#1{\the\forest at temp@count}%
}{%
@@ -1227,7 +1228,7 @@
}%
}
\def\forestmathsetlengthmacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\forest at temp@dimen=\forest at process@result\relax
\edef#1{\the\forest at temp@dimen}%
}{%
@@ -1242,12 +1243,12 @@
}%
}
\def\forestmathsetmacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\let#1\forest at process@result
\let\forestmathresulttype\forest at process@result at type
}{%
\forestmathsetmacro@#1{#2}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
\def\forestmathsetmacro@#1#2{%
@@ -1258,12 +1259,12 @@
}%
}
\def\forestmathparse#1{%
- \forest at tryprocess#1\forest at spacegen{%
+ \forest at tryprocess{false}#1\forest at spacegen{%
\let\forestmathresult\forest at process@result
\let\forestmathresulttype\forest at process@result at type
}{%
\forestmathparse@{#1}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
\def\forestmathparse@#1{%
@@ -1274,6 +1275,20 @@
}%
}
% \end{macrocode}
+% The following macro, which is the only place that sets |\forest at tryprocess|'s |#1| to |true|, is
+% actually not used anywhere. It was meant for an argument processor instruction accepting
+% \meta{forestmath}, but that got separated into P and p. Not much harm is done by keeping it,
+% however, so we do, just in case.
+% \begin{macrocode}
+ %\def\forestmathparse at returnarray#1{% same as above, but returns the result as an array (used only internally)
+ % \forest at tryprocess{true}#1\forest at spacegen{}{%
+ % \forestmathparse@{#1}%
+ % \let\forest at process@result at type\forestmathtype at unitless
+ % \forest at process@result at clear
+ % \forest at process@result at letappend\forestmathresult
+ % }%
+ %}
+% \end{macrocode}
% Evaluates |#1| to a boolean: if true execute |#2|, otherwise |#3|. |#2| and |#3| are \TeX\ code.
% Includes a shortcut for some common values.
% \begin{macrocode}
@@ -1328,11 +1343,11 @@
% \begin{macrocode}
\def\forestmathsettypefrom#1{%
\forest at isnumdim{%
- \let\forestmathresulttype\forest at result@type at numexpr
+ \let\forestmathresulttype\forestmathtype at count
}{%
- \let\forestmathresulttype\forest at result@type at dimexpr
+ \let\forestmathresulttype\forestmathtype at dimen
}{%
- \let\forestmathresulttype\forest at result@type at pgfmath
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
% \end{macrocode}
@@ -1819,7 +1834,7 @@
% \end{macrocode}
%
% |\bracketParse| is the macro that should be called to parse a
-% balanced bracket representation. It takes five parameters: |#1| is the code that will be run
+% balanced bracket representation. It takes two parameters: |#1| is the code that will be run
% after parsing the bracket; |#2| is a control sequence that will receive the id of the root of the
% created tree structure. (The bracket representation should follow (after optional spaces), but is
% is not a formal parameter of the macro.)
@@ -3515,12 +3530,12 @@
\forest at process@right at clear
\forest at process@saved at clear
\let\forest at process@savedtype\forestmathtype at generic
- \ExpandIfT{forestdebug}{%
- \edef\forest at process@debug at args{\unexpanded{#2}}%
- \typeout{[forest .process] Start "\unexpanded{#2}"}%
- }%
\csname forest at process@returnarray@#1\endcsname
\def\forest at topextend@next{%
+ \ExpandIfT{forestdebug}{%
+ \edef\forest at process@debug at args{\unexpanded{#2}}%
+ \forest at processor@debuginfo at template{Start "\unexpanded{#2}}%
+ }%
\forest at process@catregime
\endlinechar=-1
\scantokens{#2}%
@@ -3540,10 +3555,10 @@
\def\forest at process@finish{%
\ifforest at process@returnarray@
\forest at process@finish at array
- \global\let\forest at process@result at type\forest at result@type at array
\else
\forest at process@finish at single
\fi
+ \global\let\forest at process@result at type\forestmathresulttype
\ifforestdebugprocess\forest at process@debug at end\fi
\endgroup
}
@@ -3558,7 +3573,6 @@
\else
\forest at process@lengtherror
\fi
- \global\let\forest at process@result at type\forestmathresulttype
}
\csdef{forest at process@finish at single@10}{\forest at process@left at toppop\forest at temp}
\csdef{forest at process@finish at single@01}{\forest at process@right at toppop\forest at temp}
@@ -3591,7 +3605,7 @@
}
\fi
\def\forest at process@debug at end{%
- \typeout{[forest .process] \space\space\space End "\expandonce{\forest at process@debug at args}" -> "\forest at process@left at values\forest at process@right at values"}%
+ \typeout{[forest .process] End "\expandonce{\forest at process@debug at args}" -> "\forest at process@left at values\forest at process@right at values"}%
}
\def\forest at process@lengtherror{%
\PackageError{forest}{%
@@ -3687,7 +3701,7 @@
}
\def\forest at def@processor at debuginfo#1{% #1 = instruction call
\ifforestdebug
- \expandonce{\forest at processor@debuginfo at template{#1}}%
+ \expandonce{\forest at processor@debuginfo at template{\space\space After #1}}%
\fi
}
\def\forest at processor@debuginfo at template#1{%
@@ -3695,7 +3709,7 @@
\edef\forest at temp@left{\forest at process@left at values}%
\edef\forest at temp@right{\forest at process@right at values}%
\edef\forest at temp@saved{\forest at process@saved at values}%
- \typeout{[forest .process]\space\space\space\space After #1: left="\expandonce{\forest at temp@left}", right="\expandonce{\forest at temp@right}", saved="\expandonce{\forest at temp@saved}", type=\forestmathresulttype}%
+ \typeout{[forest .process] #1: left="\expandonce{\forest at temp@left}", right="\expandonce{\forest at temp@right}", saved="\expandonce{\forest at temp@saved}", type=\forestmathresulttype}%
\fi
}
% \end{macrocode}
@@ -3737,6 +3751,15 @@
\forest at process@left at letappend\pgfmathresult
\let\forestmathresulttype\forestmathtype at unitless
}
+\forest at def@processor{p}{1}*{}{% process expression
+ \forest at process@right at bottompop\forest at temp@a
+ \def\forest at temp{\forest at process{true}}%
+ \expandafter\forest at temp\forest at temp@a\forest at eov
+ \let\forest at topextend@next\relax
+ \edef\forest at temp{\forest at process@result at values}%
+ \expandafter\forest at process@left at topextend\forest at temp\forest at eov
+ \let\forestmathresulttype\forest at process@result at type
+}
\forest at def@processor{t}{1}*{}{% text
\forest at process@right at bottompop\forest at temp
\forest at process@left at letappend\forest at temp
@@ -3821,7 +3844,7 @@
\forest at loop
\ifnum\forest at temparray@N>0
\forest at temparray@toppop\forest at temp
- \expandafter\forest at process@right at setprepend\expandafter{\expandafter{\forest at temp}}%
+ \expandafter\forest at process@right at setprepend\expandafter{\forest at temp}%
\forest at repeat
}
\def\forest at process@check at mn#1#2#3#4{%
@@ -3923,7 +3946,7 @@
\forest at process@n\forest at process@saved at N\relax
\fi
\expandafter\forest at processor@U@@@\expandafter{%
- \the\numexpr\forest at process@saved at N-\forest at temp@count}%
+ \the\numexpr\forest at process@saved at N-\forest at process@n}%
}
\def\forest at processor@U@@@#1{%
\forest at temp@count#1
@@ -3935,7 +3958,7 @@
\forest at repeat
\let\forestmathresulttype\forest at process@savedtype
\ifforest at temp
- \let\forest at process@savedtype\forest at result@type at any
+ \let\forest at process@savedtype\forestmathtype at none
\forest at process@saved at N#1
\fi
}
@@ -3945,7 +3968,7 @@
\forest at def@processor{&}{2}{}{% and
\def\forest at tempa{1}%
\forest at repeat@n at times{\forest at process@n}{%
- \forest at process@left at bottompop\forest at tempb
+ \forest at process@left at toppop\forest at tempb
\edef\forest at tempa{\ifnum10<\forest at tempa\forest at tempb\space 1\else0\fi}%
}%
\forest at process@left at esetappend{\forest at tempa}%
@@ -3954,7 +3977,7 @@
\forest at def@processor{|}{2}{}{% or
\def\forest at tempa{0}%
\forest at repeat@n at times{\forest at process@n}{%
- \forest at process@left at bottompop\forest at tempb
+ \forest at process@left at toppop\forest at tempb
\edef\forest at tempa{\ifnum0=\forest at tempa\forest at tempb\space 0\else1\fi}%
}%
\forest at process@left at esetappend{\forest at tempa}%
@@ -5501,11 +5524,10 @@
{\noexpand\forest at forstepwrapper{#1\ifnum\forest at nodewalkstephandler@nargs>0=\fi\forest at util@nargs{####}{\number\numexpr\forest at nodewalkstephandler@nargs}{0}}{####\number\numexpr\forest at nodewalkstephandler@nargs+1}},
}%
\fi\fi
- % Uncomment this to collect a list of for-based spatial propagators
- %\appto\bigbadforlist{[#1]}%
\fi
},
}
+{\csname forest@@doc@@hook at bigbadforlist\endcsname}%
\pgfqkeys{/handlers}{
.nodewalk style/.code={\forest at handlers@savecurrentpath\pgfkeysalso{%
\forest at currentpath/nodewalk/\forest at currentname/.style={#1}%
@@ -7852,8 +7874,8 @@
% \end{macrocode}
% Add the edges of the children.
% \begin{macrocode}
- \get at edges@merge{negative}{#1}%
- \get at edges@merge{positive}{#1}%
+ \forest at get@edges at merge{negative}{#1}%
+ \forest at get@edges at merge{positive}{#1}%
%}%
}
% \end{macrocode}
@@ -7860,7 +7882,7 @@
% Merge the |#1| (=|negative| or |positive|) edge of the node with
% |#1| edges of the children. |#2| = grow angle.
% \begin{macrocode}
-\def\get at edges@merge#1#2{%
+\def\forest at get@edges at merge#1#2{%
\ifnum\forestove{n children}>0
\forestoget{#1 at edge@#2}\forest at node@edge
% \end{macrocode}
@@ -10853,7 +10875,7 @@
}%
}{}%
\setbox0\hbox{%
- \begin{pgfpicture}% this is expensive: so that's why caching
+ \begin{pgfpicture}%
\if\relax\forestOve{#1}{#2}\relax
\pgfpointanchor{\forestOve{#1}{\forest at pa@temp at name}}{center}%
\else
Modified: trunk/Master/texmf-dist/tex/latex/forest/forest-index.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/forest/forest-index.sty 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/tex/latex/forest/forest-index.sty 2016-12-19 22:12:23 UTC (rev 42750)
@@ -73,7 +73,7 @@
\forestset{
declare boolean register=print,
declare boolean register=index,
- declare boolean register=short, short,
+ declare boolean register=short,
declare toks={key}{},
declare toks={argument}{},
declare toks={index key}{},
@@ -100,7 +100,7 @@
every index end/.style={},
declare toks register=stage,
@index/.style n args={3}{
- print, index, index entry type=normal, set'={},
+ print, index, index entry type=normal, set'={}, short,
for nodewalk={
split={#3}{>}{create at main@entry at node, create at subentry@node},
if n=0{
@@ -134,10 +134,17 @@
},
stage={},
if index={
- index at hypertarget/.expanded={.\forestoption{index key}},
+ index at hypertarget/.process={OS_= ? l_ w2}
+ {index key}
+ {}
+ {}{.}
+ {##2##1},
for descendants={
- index at hypertarget/.process= {OOw2}
- {!parent.index at hypertarget} {index key} {##1.##2},
+ index at hypertarget/.process={OO S _l1= ? w2 }
+ {!parent.index at hypertarget}{index key}
+ {}
+ {##1} % empty index key
+ {##1.##2} % otherwise
},
}{},
if index={
@@ -250,8 +257,8 @@
\noexpand\immediate\noexpand\write\noexpand\forestindex at out{%
\noexpand\string\noexpand\indexdefineshortkey\noexpand\unexpanded{{\forestoption{key}}{\forestoption{content}}}%
}%
- }{}%
- }
+ }%
+ }{}
}
}
}
Modified: trunk/Master/texmf-dist/tex/latex/forest/forest.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/forest/forest.sty 2016-12-19 01:05:41 UTC (rev 42749)
+++ trunk/Master/texmf-dist/tex/latex/forest/forest.sty 2016-12-19 22:12:23 UTC (rev 42750)
@@ -44,7 +44,7 @@
%% - LICENCE
%% To use the package, only the files marked with + need to be installed.
%%
-\ProvidesPackage{forest}[2016/12/05 v2.1 Drawing (linguistic) trees]
+\ProvidesPackage{forest}[2016/12/18 v2.1.1 Drawing (linguistic) trees]
\RequirePackage{tikz}[2013/12/13]
\usetikzlibrary{shapes}
@@ -931,11 +931,11 @@
\def\forestmathtype at unitless{P} % <decimal> (a unitless dimension) (P because pgfmath returns such numbers)
\def\forestmathtype at textasc{t} % text (ascending)
\def\forestmathtype at textdesc{T} % text (descending)
-\def\forestmathtype at array{a} % array - internal
\def\forestmathtype at none{} % internal (for requests - means whatever)
\def\forestmathresult{}
\let\forestmathresulttype\forestmathtype at generic
-\def\forest at tryprocess{%
+\def\forest at tryprocess#1{%
+ \def\forest at tryprocess@returnarray{#1}%
\expandafter\forest at tryprocess@a\romannumeral-`0}
\def\forest at tryprocess@a{\futurelet\forest at temp@token\forest at tryprocess@b}
\def\forest at tryprocess@b{%
@@ -947,12 +947,12 @@
}
\def\forest at spacegen{ \forest at spacegen}
\def\forest at tryprocess@yes#1#2\forest at spacegen{%
- \forest at process{false}#2\forest at eov
+ \expandafter\forest at process\expandafter{\forest at tryprocess@returnarray}#2\forest at eov
\@firstoftwo
}
\def\forest at tryprocess@no#1\forest at spacegen{\@secondoftwo}
\def\forestmathsetcount#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
#1=\forest at process@result\relax
}{%
\forestmathsetcount@#1{#2}%
@@ -966,7 +966,7 @@
}%
}
\def\forestmathsetlength#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
#1=\forest at process@result\relax
}{%
\forestmathsetlength@#1{#2}%
@@ -980,7 +980,7 @@
}%
}
\def\forestmathtruncatemacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\forest at temp@count=\forest at process@result\relax
\edef#1{\the\forest at temp@count}%
}{%
@@ -995,7 +995,7 @@
}%
}
\def\forestmathsetlengthmacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\forest at temp@dimen=\forest at process@result\relax
\edef#1{\the\forest at temp@dimen}%
}{%
@@ -1010,12 +1010,12 @@
}%
}
\def\forestmathsetmacro#1#2{%
- \forest at tryprocess#2\forest at spacegen{%
+ \forest at tryprocess{false}#2\forest at spacegen{%
\let#1\forest at process@result
\let\forestmathresulttype\forest at process@result at type
}{%
\forestmathsetmacro@#1{#2}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
\def\forestmathsetmacro@#1#2{%
@@ -1026,12 +1026,12 @@
}%
}
\def\forestmathparse#1{%
- \forest at tryprocess#1\forest at spacegen{%
+ \forest at tryprocess{false}#1\forest at spacegen{%
\let\forestmathresult\forest at process@result
\let\forestmathresulttype\forest at process@result at type
}{%
\forestmathparse@{#1}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
\def\forestmathparse@#1{%
@@ -1041,6 +1041,14 @@
\pgfmathsetmacro\forestmathresult{#1}%
}%
}
+ %\def\forestmathparse at returnarray#1{% same as above, but returns the result as an array (used only internally)
+ % \forest at tryprocess{true}#1\forest at spacegen{}{%
+ % \forestmathparse@{#1}%
+ % \let\forest at process@result at type\forestmathtype at unitless
+ % \forest at process@result at clear
+ % \forest at process@result at letappend\forestmathresult
+ % }%
+ %}
\csdef{forest at bh@0}{0}
\csdef{forest at bh@false}{0}
\csdef{forest at bh@1}{1}
@@ -1082,11 +1090,11 @@
\csdef{forestmath at convert@from at P@to at _}#1{\unexpanded{#1}}
\def\forestmathsettypefrom#1{%
\forest at isnumdim{%
- \let\forestmathresulttype\forest at result@type at numexpr
+ \let\forestmathresulttype\forestmathtype at count
}{%
- \let\forestmathresulttype\forest at result@type at dimexpr
+ \let\forestmathresulttype\forestmathtype at dimen
}{%
- \let\forestmathresulttype\forest at result@type at pgfmath
+ \let\forestmathresulttype\forestmathtype at unitless
}%
}
\def\forestmathadd#1#2{\edef\forestmathresult{%
@@ -2842,12 +2850,12 @@
\forest at process@right at clear
\forest at process@saved at clear
\let\forest at process@savedtype\forestmathtype at generic
- \ExpandIfT{forestdebug}{%
- \edef\forest at process@debug at args{\unexpanded{#2}}%
- \typeout{[forest .process] Start "\unexpanded{#2}"}%
- }%
\csname forest at process@returnarray@#1\endcsname
\def\forest at topextend@next{%
+ \ExpandIfT{forestdebug}{%
+ \edef\forest at process@debug at args{\unexpanded{#2}}%
+ \forest at processor@debuginfo at template{Start "\unexpanded{#2}}%
+ }%
\forest at process@catregime
\endlinechar=-1
\scantokens{#2}%
@@ -2867,10 +2875,10 @@
\def\forest at process@finish{%
\ifforest at process@returnarray@
\forest at process@finish at array
- \global\let\forest at process@result at type\forest at result@type at array
\else
\forest at process@finish at single
\fi
+ \global\let\forest at process@result at type\forestmathresulttype
\ifforestdebugprocess\forest at process@debug at end\fi
\endgroup
}
@@ -2885,7 +2893,6 @@
\else
\forest at process@lengtherror
\fi
- \global\let\forest at process@result at type\forestmathresulttype
}
\csdef{forest at process@finish at single@10}{\forest at process@left at toppop\forest at temp}
\csdef{forest at process@finish at single@01}{\forest at process@right at toppop\forest at temp}
@@ -2915,7 +2922,7 @@
}
\fi
\def\forest at process@debug at end{%
- \typeout{[forest .process] \space\space\space End "\expandonce{\forest at process@debug at args}" -> "\forest at process@left at values\forest at process@right at values"}%
+ \typeout{[forest .process] End "\expandonce{\forest at process@debug at args}" -> "\forest at process@left at values\forest at process@right at values"}%
}
\def\forest at process@lengtherror{%
\PackageError{forest}{%
@@ -2997,7 +3004,7 @@
}
\def\forest at def@processor at debuginfo#1{% #1 = instruction call
\ifforestdebug
- \expandonce{\forest at processor@debuginfo at template{#1}}%
+ \expandonce{\forest at processor@debuginfo at template{\space\space After #1}}%
\fi
}
\def\forest at processor@debuginfo at template#1{%
@@ -3005,7 +3012,7 @@
\edef\forest at temp@left{\forest at process@left at values}%
\edef\forest at temp@right{\forest at process@right at values}%
\edef\forest at temp@saved{\forest at process@saved at values}%
- \typeout{[forest .process]\space\space\space\space After #1: left="\expandonce{\forest at temp@left}", right="\expandonce{\forest at temp@right}", saved="\expandonce{\forest at temp@saved}", type=\forestmathresulttype}%
+ \typeout{[forest .process] #1: left="\expandonce{\forest at temp@left}", right="\expandonce{\forest at temp@right}", saved="\expandonce{\forest at temp@saved}", type=\forestmathresulttype}%
\fi
}
\newcount\forest at process@n
@@ -3040,6 +3047,15 @@
\forest at process@left at letappend\pgfmathresult
\let\forestmathresulttype\forestmathtype at unitless
}
+\forest at def@processor{p}{1}*{}{% process expression
+ \forest at process@right at bottompop\forest at temp@a
+ \def\forest at temp{\forest at process{true}}%
+ \expandafter\forest at temp\forest at temp@a\forest at eov
+ \let\forest at topextend@next\relax
+ \edef\forest at temp{\forest at process@result at values}%
+ \expandafter\forest at process@left at topextend\forest at temp\forest at eov
+ \let\forestmathresulttype\forest at process@result at type
+}
\forest at def@processor{t}{1}*{}{% text
\forest at process@right at bottompop\forest at temp
\forest at process@left at letappend\forest at temp
@@ -3115,7 +3131,7 @@
\forest at loop
\ifnum\forest at temparray@N>0
\forest at temparray@toppop\forest at temp
- \expandafter\forest at process@right at setprepend\expandafter{\expandafter{\forest at temp}}%
+ \expandafter\forest at process@right at setprepend\expandafter{\forest at temp}%
\forest at repeat
}
\def\forest at process@check at mn#1#2#3#4{%
@@ -3211,7 +3227,7 @@
\forest at process@n\forest at process@saved at N\relax
\fi
\expandafter\forest at processor@U@@@\expandafter{%
- \the\numexpr\forest at process@saved at N-\forest at temp@count}%
+ \the\numexpr\forest at process@saved at N-\forest at process@n}%
}
\def\forest at processor@U@@@#1{%
\forest at temp@count#1
@@ -3223,7 +3239,7 @@
\forest at repeat
\let\forestmathresulttype\forest at process@savedtype
\ifforest at temp
- \let\forest at process@savedtype\forest at result@type at any
+ \let\forest at process@savedtype\forestmathtype at none
\forest at process@saved at N#1
\fi
}
@@ -3230,7 +3246,7 @@
\forest at def@processor{&}{2}{}{% and
\def\forest at tempa{1}%
\forest at repeat@n at times{\forest at process@n}{%
- \forest at process@left at bottompop\forest at tempb
+ \forest at process@left at toppop\forest at tempb
\edef\forest at tempa{\ifnum10<\forest at tempa\forest at tempb\space 1\else0\fi}%
}%
\forest at process@left at esetappend{\forest at tempa}%
@@ -3239,7 +3255,7 @@
\forest at def@processor{|}{2}{}{% or
\def\forest at tempa{0}%
\forest at repeat@n at times{\forest at process@n}{%
- \forest at process@left at bottompop\forest at tempb
+ \forest at process@left at toppop\forest at tempb
\edef\forest at tempa{\ifnum0=\forest at tempa\forest at tempb\space 0\else1\fi}%
}%
\forest at process@left at esetappend{\forest at tempa}%
@@ -4738,11 +4754,10 @@
{\noexpand\forest at forstepwrapper{#1\ifnum\forest at nodewalkstephandler@nargs>0=\fi\forest at util@nargs{####}{\number\numexpr\forest at nodewalkstephandler@nargs}{0}}{####\number\numexpr\forest at nodewalkstephandler@nargs+1}},
}%
\fi\fi
- % Uncomment this to collect a list of for-based spatial propagators
- %\appto\bigbadforlist{[#1]}%
\fi
},
}
+{\csname forest@@doc@@hook at bigbadforlist\endcsname}%
\pgfqkeys{/handlers}{
.nodewalk style/.code={\forest at handlers@savecurrentpath\pgfkeysalso{%
\forest at currentpath/nodewalk/\forest at currentname/.style={#1}%
@@ -6898,11 +6913,11 @@
\forest at node@boundary\forest at negative@node at edge\forest at positive@node at edge
\forestolet{negative at edge@#1}\forest at negative@node at edge
\forestolet{positive at edge@#1}\forest at positive@node at edge
- \get at edges@merge{negative}{#1}%
- \get at edges@merge{positive}{#1}%
+ \forest at get@edges at merge{negative}{#1}%
+ \forest at get@edges at merge{positive}{#1}%
%}%
}
-\def\get at edges@merge#1#2{%
+\def\forest at get@edges at merge#1#2{%
\ifnum\forestove{n children}>0
\forestoget{#1 at edge@#2}\forest at node@edge
\forest at pointanchor{parent anchor}%
@@ -9201,7 +9216,7 @@
}%
}{}%
\setbox0\hbox{%
- \begin{pgfpicture}% this is expensive: so that's why caching
+ \begin{pgfpicture}%
\if\relax\forestOve{#1}{#2}\relax
\pgfpointanchor{\forestOve{#1}{\forest at pa@temp at name}}{center}%
\else
More information about the tex-live-commits
mailing list