summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-12-19 22:12:23 +0000
committerKarl Berry <karl@freefriends.org>2016-12-19 22:12:23 +0000
commite1425b370048a49ecbf068c6dae629eac6c6fb10 (patch)
tree52fda7b94044b1f0c6ce6e2a2eb8073962291a83 /Master
parenta7a330379a8d0b08547fe2b5dddacbf1b95152fb (diff)
forest (19dec16)
git-svn-id: svn://tug.org/texlive/trunk@42750 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/forest/README2
-rw-r--r--Master/texmf-dist/doc/latex/forest/forest-doc.pdfbin1183175 -> 1205944 bytes
-rw-r--r--Master/texmf-dist/doc/latex/forest/forest-doc.tex259
-rw-r--r--Master/texmf-dist/doc/latex/forest/forest.pdfbin496572 -> 497040 bytes
-rw-r--r--Master/texmf-dist/source/latex/forest/forest-index.dtx23
-rw-r--r--Master/texmf-dist/source/latex/forest/forest.dtx106
-rw-r--r--Master/texmf-dist/tex/latex/forest/forest-index.sty21
-rw-r--r--Master/texmf-dist/tex/latex/forest/forest.sty85
8 files changed, 348 insertions, 148 deletions
diff --git a/Master/texmf-dist/doc/latex/forest/README b/Master/texmf-dist/doc/latex/forest/README
index 36e0e0f0e76..09a1f7d8ca9 100644
--- a/Master/texmf-dist/doc/latex/forest/README
+++ b/Master/texmf-dist/doc/latex/forest/README
@@ -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})
diff --git a/Master/texmf-dist/doc/latex/forest/forest-doc.pdf b/Master/texmf-dist/doc/latex/forest/forest-doc.pdf
index 28e68d4bcf5..29f139efd2e 100644
--- a/Master/texmf-dist/doc/latex/forest/forest-doc.pdf
+++ b/Master/texmf-dist/doc/latex/forest/forest-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/forest/forest-doc.tex b/Master/texmf-dist/doc/latex/forest/forest-doc.tex
index a7354685334..4fb226a8fb8 100644
--- a/Master/texmf-dist/doc/latex/forest/forest-doc.tex
+++ b/Master/texmf-dist/doc/latex/forest/forest-doc.tex
@@ -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@bigbadforlist{\aftergroup\forest@@doc@@hook@bigbadforlist@}
+\def\forest@@doc@@hook@bigbadforlist@{%
+ \forestset{define long step/.append code={%
+ \ifforest@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 @@ otherwise, \meta{false keylist}.
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 @@ node in the subtree of the current node (including the node itself). In other w
\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 @@ node in the subtree of the current node (including the node itself). In other w
\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 @@ node in the subtree of the current node (including the node itself). In other w
\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 @@ The result is the (single) expansion of the given
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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
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 @@ Before we finally list the available instructions, some notes:
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 @@ Before we finally list the available instructions, some notes:
\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 @@ Before we finally list the available instructions, some notes:
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 @@ Before we finally list the available instructions, some notes:
\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,18 +5748,18 @@ Before we finally list the available instructions, some notes:
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.
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 @@ Before we finally list the available instructions, some notes:
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 @@ Before we finally list the available instructions, some notes:
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 @@ in |-all| styles.
\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):
diff --git a/Master/texmf-dist/doc/latex/forest/forest.pdf b/Master/texmf-dist/doc/latex/forest/forest.pdf
index 11d3d857dd2..a4d072168d1 100644
--- a/Master/texmf-dist/doc/latex/forest/forest.pdf
+++ b/Master/texmf-dist/doc/latex/forest/forest.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/forest/forest-index.dtx b/Master/texmf-dist/source/latex/forest/forest-index.dtx
index 6ffa1d137be..1db075d33df 100644
--- a/Master/texmf-dist/source/latex/forest/forest-index.dtx
+++ b/Master/texmf-dist/source/latex/forest/forest-index.dtx
@@ -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@hypertarget/.expanded={.\forestoption{index key}},
+ index@hypertarget/.process={OS_= ? l_ w2}
+ {index key}
+ {}
+ {}{.}
+ {##2##1},
for descendants={
- index@hypertarget/.process= {OOw2}
- {!parent.index@hypertarget} {index key} {##1.##2},
+ index@hypertarget/.process={OO S _l1= ? w2 }
+ {!parent.index@hypertarget}{index key}
+ {}
+ {##1} % empty index key
+ {##1.##2} % otherwise
},
}{},
% \end{macrocode}
@@ -590,8 +597,8 @@
\noexpand\immediate\noexpand\write\noexpand\forestindex@out{%
\noexpand\string\noexpand\indexdefineshortkey\noexpand\unexpanded{{\forestoption{key}}{\forestoption{content}}}%
}%
- }{}%
- }
+ }%
+ }{}
}
}
}
diff --git a/Master/texmf-dist/source/latex/forest/forest.dtx b/Master/texmf-dist/source/latex/forest/forest.dtx
index 1416caca536..73ad363285f 100644
--- a/Master/texmf-dist/source/latex/forest/forest.dtx
+++ b/Master/texmf-dist/source/latex/forest/forest.dtx
@@ -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@eov| into the array. After that is done, execute |\forest@topextend@next|. This code is difficult and not run often, so it doesn't need specialized control sequences.
+% Puts all items until |\forest@eov| into the array. After that is done, execute |\forest@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@array@currentarray{#1}\forest@array@topextend}%
}
@@ -1151,17 +1151,18 @@
\def\forestmathtype@unitless{P} % <decimal> (a unitless dimension) (P because pgfmath returns such numbers)
\def\forestmathtype@textasc{t} % text (ascending)
\def\forestmathtype@textdesc{T} % text (descending)
-\def\forestmathtype@array{a} % array - internal
\def\forestmathtype@none{} % internal (for requests - means whatever)
\def\forestmathresult{}
\let\forestmathresulttype\forestmathtype@generic
% \end{macrocode}
-% |\forest@tryprocess| takes three ``arguments''. The first is a forestmath expression, delimited
-% by |\forest@spacegen|: if it starts with a |>|, we take it to be a |.process| expression, evaluate
-% it using |\forest@process|, and execute the second argument; it it doesn't, we execute the third
-% argument.
+% |\forest@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@spacegen|: if it starts with a |>|, we take it to be
+% a |.process| expression, evaluate it using |\forest@process|, and execute the third argument; it
+% it doesn't, we execute the fourth argument.
% \begin{macrocode}
-\def\forest@tryprocess{%
+\def\forest@tryprocess#1{%
+ \def\forest@tryprocess@returnarray{#1}%
\expandafter\forest@tryprocess@a\romannumeral-`0}
\def\forest@tryprocess@a{\futurelet\forest@temp@token\forest@tryprocess@b}
\def\forest@tryprocess@b{%
@@ -1173,7 +1174,7 @@
}
\def\forest@spacegen{ \forest@spacegen}
\def\forest@tryprocess@yes#1#2\forest@spacegen{%
- \forest@process{false}#2\forest@eov
+ \expandafter\forest@process\expandafter{\forest@tryprocess@returnarray}#2\forest@eov
\@firstoftwo
}
\def\forest@tryprocess@no#1\forest@spacegen{\@secondoftwo}
@@ -1184,7 +1185,7 @@
% track.)
% \begin{macrocode}
\def\forestmathsetcount#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
#1=\forest@process@result\relax
}{%
\forestmathsetcount@#1{#2}%
@@ -1198,7 +1199,7 @@
}%
}
\def\forestmathsetlength#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
#1=\forest@process@result\relax
}{%
\forestmathsetlength@#1{#2}%
@@ -1212,7 +1213,7 @@
}%
}
\def\forestmathtruncatemacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\forest@temp@count=\forest@process@result\relax
\edef#1{\the\forest@temp@count}%
}{%
@@ -1227,7 +1228,7 @@
}%
}
\def\forestmathsetlengthmacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\forest@temp@dimen=\forest@process@result\relax
\edef#1{\the\forest@temp@dimen}%
}{%
@@ -1242,12 +1243,12 @@
}%
}
\def\forestmathsetmacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\let#1\forest@process@result
\let\forestmathresulttype\forest@process@result@type
}{%
\forestmathsetmacro@#1{#2}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype@unitless
}%
}
\def\forestmathsetmacro@#1#2{%
@@ -1258,12 +1259,12 @@
}%
}
\def\forestmathparse#1{%
- \forest@tryprocess#1\forest@spacegen{%
+ \forest@tryprocess{false}#1\forest@spacegen{%
\let\forestmathresult\forest@process@result
\let\forestmathresulttype\forest@process@result@type
}{%
\forestmathparse@{#1}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype@unitless
}%
}
\def\forestmathparse@#1{%
@@ -1274,6 +1275,20 @@
}%
}
% \end{macrocode}
+% The following macro, which is the only place that sets |\forest@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@returnarray#1{% same as above, but returns the result as an array (used only internally)
+ % \forest@tryprocess{true}#1\forest@spacegen{}{%
+ % \forestmathparse@{#1}%
+ % \let\forest@process@result@type\forestmathtype@unitless
+ % \forest@process@result@clear
+ % \forest@process@result@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@isnumdim{%
- \let\forestmathresulttype\forest@result@type@numexpr
+ \let\forestmathresulttype\forestmathtype@count
}{%
- \let\forestmathresulttype\forest@result@type@dimexpr
+ \let\forestmathresulttype\forestmathtype@dimen
}{%
- \let\forestmathresulttype\forest@result@type@pgfmath
+ \let\forestmathresulttype\forestmathtype@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@process@right@clear
\forest@process@saved@clear
\let\forest@process@savedtype\forestmathtype@generic
- \ExpandIfT{forestdebug}{%
- \edef\forest@process@debug@args{\unexpanded{#2}}%
- \typeout{[forest .process] Start "\unexpanded{#2}"}%
- }%
\csname forest@process@returnarray@#1\endcsname
\def\forest@topextend@next{%
+ \ExpandIfT{forestdebug}{%
+ \edef\forest@process@debug@args{\unexpanded{#2}}%
+ \forest@processor@debuginfo@template{Start "\unexpanded{#2}}%
+ }%
\forest@process@catregime
\endlinechar=-1
\scantokens{#2}%
@@ -3540,10 +3555,10 @@
\def\forest@process@finish{%
\ifforest@process@returnarray@
\forest@process@finish@array
- \global\let\forest@process@result@type\forest@result@type@array
\else
\forest@process@finish@single
\fi
+ \global\let\forest@process@result@type\forestmathresulttype
\ifforestdebugprocess\forest@process@debug@end\fi
\endgroup
}
@@ -3558,7 +3573,6 @@
\else
\forest@process@lengtherror
\fi
- \global\let\forest@process@result@type\forestmathresulttype
}
\csdef{forest@process@finish@single@10}{\forest@process@left@toppop\forest@temp}
\csdef{forest@process@finish@single@01}{\forest@process@right@toppop\forest@temp}
@@ -3591,7 +3605,7 @@
}
\fi
\def\forest@process@debug@end{%
- \typeout{[forest .process] \space\space\space End "\expandonce{\forest@process@debug@args}" -> "\forest@process@left@values\forest@process@right@values"}%
+ \typeout{[forest .process] End "\expandonce{\forest@process@debug@args}" -> "\forest@process@left@values\forest@process@right@values"}%
}
\def\forest@process@lengtherror{%
\PackageError{forest}{%
@@ -3687,7 +3701,7 @@
}
\def\forest@def@processor@debuginfo#1{% #1 = instruction call
\ifforestdebug
- \expandonce{\forest@processor@debuginfo@template{#1}}%
+ \expandonce{\forest@processor@debuginfo@template{\space\space After #1}}%
\fi
}
\def\forest@processor@debuginfo@template#1{%
@@ -3695,7 +3709,7 @@
\edef\forest@temp@left{\forest@process@left@values}%
\edef\forest@temp@right{\forest@process@right@values}%
\edef\forest@temp@saved{\forest@process@saved@values}%
- \typeout{[forest .process]\space\space\space\space After #1: left="\expandonce{\forest@temp@left}", right="\expandonce{\forest@temp@right}", saved="\expandonce{\forest@temp@saved}", type=\forestmathresulttype}%
+ \typeout{[forest .process] #1: left="\expandonce{\forest@temp@left}", right="\expandonce{\forest@temp@right}", saved="\expandonce{\forest@temp@saved}", type=\forestmathresulttype}%
\fi
}
% \end{macrocode}
@@ -3737,6 +3751,15 @@
\forest@process@left@letappend\pgfmathresult
\let\forestmathresulttype\forestmathtype@unitless
}
+\forest@def@processor{p}{1}*{}{% process expression
+ \forest@process@right@bottompop\forest@temp@a
+ \def\forest@temp{\forest@process{true}}%
+ \expandafter\forest@temp\forest@temp@a\forest@eov
+ \let\forest@topextend@next\relax
+ \edef\forest@temp{\forest@process@result@values}%
+ \expandafter\forest@process@left@topextend\forest@temp\forest@eov
+ \let\forestmathresulttype\forest@process@result@type
+}
\forest@def@processor{t}{1}*{}{% text
\forest@process@right@bottompop\forest@temp
\forest@process@left@letappend\forest@temp
@@ -3821,7 +3844,7 @@
\forest@loop
\ifnum\forest@temparray@N>0
\forest@temparray@toppop\forest@temp
- \expandafter\forest@process@right@setprepend\expandafter{\expandafter{\forest@temp}}%
+ \expandafter\forest@process@right@setprepend\expandafter{\forest@temp}%
\forest@repeat
}
\def\forest@process@check@mn#1#2#3#4{%
@@ -3923,7 +3946,7 @@
\forest@process@n\forest@process@saved@N\relax
\fi
\expandafter\forest@processor@U@@@\expandafter{%
- \the\numexpr\forest@process@saved@N-\forest@temp@count}%
+ \the\numexpr\forest@process@saved@N-\forest@process@n}%
}
\def\forest@processor@U@@@#1{%
\forest@temp@count#1
@@ -3935,7 +3958,7 @@
\forest@repeat
\let\forestmathresulttype\forest@process@savedtype
\ifforest@temp
- \let\forest@process@savedtype\forest@result@type@any
+ \let\forest@process@savedtype\forestmathtype@none
\forest@process@saved@N#1
\fi
}
@@ -3945,7 +3968,7 @@
\forest@def@processor{&}{2}{}{% and
\def\forest@tempa{1}%
\forest@repeat@n@times{\forest@process@n}{%
- \forest@process@left@bottompop\forest@tempb
+ \forest@process@left@toppop\forest@tempb
\edef\forest@tempa{\ifnum10<\forest@tempa\forest@tempb\space 1\else0\fi}%
}%
\forest@process@left@esetappend{\forest@tempa}%
@@ -3954,7 +3977,7 @@
\forest@def@processor{|}{2}{}{% or
\def\forest@tempa{0}%
\forest@repeat@n@times{\forest@process@n}{%
- \forest@process@left@bottompop\forest@tempb
+ \forest@process@left@toppop\forest@tempb
\edef\forest@tempa{\ifnum0=\forest@tempa\forest@tempb\space 0\else1\fi}%
}%
\forest@process@left@esetappend{\forest@tempa}%
@@ -5501,11 +5524,10 @@
{\noexpand\forest@forstepwrapper{#1\ifnum\forest@nodewalkstephandler@nargs>0=\fi\forest@util@nargs{####}{\number\numexpr\forest@nodewalkstephandler@nargs}{0}}{####\number\numexpr\forest@nodewalkstephandler@nargs+1}},
}%
\fi\fi
- % Uncomment this to collect a list of for-based spatial propagators
- %\appto\bigbadforlist{[#1]}%
\fi
},
}
+{\csname forest@@doc@@hook@bigbadforlist\endcsname}%
\pgfqkeys{/handlers}{
.nodewalk style/.code={\forest@handlers@savecurrentpath\pgfkeysalso{%
\forest@currentpath/nodewalk/\forest@currentname/.style={#1}%
@@ -7852,15 +7874,15 @@
% \end{macrocode}
% Add the edges of the children.
% \begin{macrocode}
- \get@edges@merge{negative}{#1}%
- \get@edges@merge{positive}{#1}%
+ \forest@get@edges@merge{negative}{#1}%
+ \forest@get@edges@merge{positive}{#1}%
%}%
}
% \end{macrocode}
% Merge the |#1| (=|negative| or |positive|) edge of the node with
% |#1| edges of the children. |#2| = grow angle.
% \begin{macrocode}
-\def\get@edges@merge#1#2{%
+\def\forest@get@edges@merge#1#2{%
\ifnum\forestove{n children}>0
\forestoget{#1@edge@#2}\forest@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@pa@temp@name}}{center}%
\else
diff --git a/Master/texmf-dist/tex/latex/forest/forest-index.sty b/Master/texmf-dist/tex/latex/forest/forest-index.sty
index 6bd6fb774ed..36690d8664f 100644
--- a/Master/texmf-dist/tex/latex/forest/forest-index.sty
+++ b/Master/texmf-dist/tex/latex/forest/forest-index.sty
@@ -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@main@entry@node, create@subentry@node},
if n=0{
@@ -134,10 +134,17 @@
},
stage={},
if index={
- index@hypertarget/.expanded={.\forestoption{index key}},
+ index@hypertarget/.process={OS_= ? l_ w2}
+ {index key}
+ {}
+ {}{.}
+ {##2##1},
for descendants={
- index@hypertarget/.process= {OOw2}
- {!parent.index@hypertarget} {index key} {##1.##2},
+ index@hypertarget/.process={OO S _l1= ? w2 }
+ {!parent.index@hypertarget}{index key}
+ {}
+ {##1} % empty index key
+ {##1.##2} % otherwise
},
}{},
if index={
@@ -250,8 +257,8 @@
\noexpand\immediate\noexpand\write\noexpand\forestindex@out{%
\noexpand\string\noexpand\indexdefineshortkey\noexpand\unexpanded{{\forestoption{key}}{\forestoption{content}}}%
}%
- }{}%
- }
+ }%
+ }{}
}
}
}
diff --git a/Master/texmf-dist/tex/latex/forest/forest.sty b/Master/texmf-dist/tex/latex/forest/forest.sty
index dedd3159561..7443fbdf7ae 100644
--- a/Master/texmf-dist/tex/latex/forest/forest.sty
+++ b/Master/texmf-dist/tex/latex/forest/forest.sty
@@ -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@unitless{P} % <decimal> (a unitless dimension) (P because pgfmath returns such numbers)
\def\forestmathtype@textasc{t} % text (ascending)
\def\forestmathtype@textdesc{T} % text (descending)
-\def\forestmathtype@array{a} % array - internal
\def\forestmathtype@none{} % internal (for requests - means whatever)
\def\forestmathresult{}
\let\forestmathresulttype\forestmathtype@generic
-\def\forest@tryprocess{%
+\def\forest@tryprocess#1{%
+ \def\forest@tryprocess@returnarray{#1}%
\expandafter\forest@tryprocess@a\romannumeral-`0}
\def\forest@tryprocess@a{\futurelet\forest@temp@token\forest@tryprocess@b}
\def\forest@tryprocess@b{%
@@ -947,12 +947,12 @@
}
\def\forest@spacegen{ \forest@spacegen}
\def\forest@tryprocess@yes#1#2\forest@spacegen{%
- \forest@process{false}#2\forest@eov
+ \expandafter\forest@process\expandafter{\forest@tryprocess@returnarray}#2\forest@eov
\@firstoftwo
}
\def\forest@tryprocess@no#1\forest@spacegen{\@secondoftwo}
\def\forestmathsetcount#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
#1=\forest@process@result\relax
}{%
\forestmathsetcount@#1{#2}%
@@ -966,7 +966,7 @@
}%
}
\def\forestmathsetlength#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
#1=\forest@process@result\relax
}{%
\forestmathsetlength@#1{#2}%
@@ -980,7 +980,7 @@
}%
}
\def\forestmathtruncatemacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\forest@temp@count=\forest@process@result\relax
\edef#1{\the\forest@temp@count}%
}{%
@@ -995,7 +995,7 @@
}%
}
\def\forestmathsetlengthmacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\forest@temp@dimen=\forest@process@result\relax
\edef#1{\the\forest@temp@dimen}%
}{%
@@ -1010,12 +1010,12 @@
}%
}
\def\forestmathsetmacro#1#2{%
- \forest@tryprocess#2\forest@spacegen{%
+ \forest@tryprocess{false}#2\forest@spacegen{%
\let#1\forest@process@result
\let\forestmathresulttype\forest@process@result@type
}{%
\forestmathsetmacro@#1{#2}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype@unitless
}%
}
\def\forestmathsetmacro@#1#2{%
@@ -1026,12 +1026,12 @@
}%
}
\def\forestmathparse#1{%
- \forest@tryprocess#1\forest@spacegen{%
+ \forest@tryprocess{false}#1\forest@spacegen{%
\let\forestmathresult\forest@process@result
\let\forestmathresulttype\forest@process@result@type
}{%
\forestmathparse@{#1}%
- \def\forestmathresulttype{P}%
+ \let\forestmathresulttype\forestmathtype@unitless
}%
}
\def\forestmathparse@#1{%
@@ -1041,6 +1041,14 @@
\pgfmathsetmacro\forestmathresult{#1}%
}%
}
+ %\def\forestmathparse@returnarray#1{% same as above, but returns the result as an array (used only internally)
+ % \forest@tryprocess{true}#1\forest@spacegen{}{%
+ % \forestmathparse@{#1}%
+ % \let\forest@process@result@type\forestmathtype@unitless
+ % \forest@process@result@clear
+ % \forest@process@result@letappend\forestmathresult
+ % }%
+ %}
\csdef{forest@bh@0}{0}
\csdef{forest@bh@false}{0}
\csdef{forest@bh@1}{1}
@@ -1082,11 +1090,11 @@
\csdef{forestmath@convert@from@P@to@_}#1{\unexpanded{#1}}
\def\forestmathsettypefrom#1{%
\forest@isnumdim{%
- \let\forestmathresulttype\forest@result@type@numexpr
+ \let\forestmathresulttype\forestmathtype@count
}{%
- \let\forestmathresulttype\forest@result@type@dimexpr
+ \let\forestmathresulttype\forestmathtype@dimen
}{%
- \let\forestmathresulttype\forest@result@type@pgfmath
+ \let\forestmathresulttype\forestmathtype@unitless
}%
}
\def\forestmathadd#1#2{\edef\forestmathresult{%
@@ -2842,12 +2850,12 @@
\forest@process@right@clear
\forest@process@saved@clear
\let\forest@process@savedtype\forestmathtype@generic
- \ExpandIfT{forestdebug}{%
- \edef\forest@process@debug@args{\unexpanded{#2}}%
- \typeout{[forest .process] Start "\unexpanded{#2}"}%
- }%
\csname forest@process@returnarray@#1\endcsname
\def\forest@topextend@next{%
+ \ExpandIfT{forestdebug}{%
+ \edef\forest@process@debug@args{\unexpanded{#2}}%
+ \forest@processor@debuginfo@template{Start "\unexpanded{#2}}%
+ }%
\forest@process@catregime
\endlinechar=-1
\scantokens{#2}%
@@ -2867,10 +2875,10 @@
\def\forest@process@finish{%
\ifforest@process@returnarray@
\forest@process@finish@array
- \global\let\forest@process@result@type\forest@result@type@array
\else
\forest@process@finish@single
\fi
+ \global\let\forest@process@result@type\forestmathresulttype
\ifforestdebugprocess\forest@process@debug@end\fi
\endgroup
}
@@ -2885,7 +2893,6 @@
\else
\forest@process@lengtherror
\fi
- \global\let\forest@process@result@type\forestmathresulttype
}
\csdef{forest@process@finish@single@10}{\forest@process@left@toppop\forest@temp}
\csdef{forest@process@finish@single@01}{\forest@process@right@toppop\forest@temp}
@@ -2915,7 +2922,7 @@
}
\fi
\def\forest@process@debug@end{%
- \typeout{[forest .process] \space\space\space End "\expandonce{\forest@process@debug@args}" -> "\forest@process@left@values\forest@process@right@values"}%
+ \typeout{[forest .process] End "\expandonce{\forest@process@debug@args}" -> "\forest@process@left@values\forest@process@right@values"}%
}
\def\forest@process@lengtherror{%
\PackageError{forest}{%
@@ -2997,7 +3004,7 @@
}
\def\forest@def@processor@debuginfo#1{% #1 = instruction call
\ifforestdebug
- \expandonce{\forest@processor@debuginfo@template{#1}}%
+ \expandonce{\forest@processor@debuginfo@template{\space\space After #1}}%
\fi
}
\def\forest@processor@debuginfo@template#1{%
@@ -3005,7 +3012,7 @@
\edef\forest@temp@left{\forest@process@left@values}%
\edef\forest@temp@right{\forest@process@right@values}%
\edef\forest@temp@saved{\forest@process@saved@values}%
- \typeout{[forest .process]\space\space\space\space After #1: left="\expandonce{\forest@temp@left}", right="\expandonce{\forest@temp@right}", saved="\expandonce{\forest@temp@saved}", type=\forestmathresulttype}%
+ \typeout{[forest .process] #1: left="\expandonce{\forest@temp@left}", right="\expandonce{\forest@temp@right}", saved="\expandonce{\forest@temp@saved}", type=\forestmathresulttype}%
\fi
}
\newcount\forest@process@n
@@ -3040,6 +3047,15 @@
\forest@process@left@letappend\pgfmathresult
\let\forestmathresulttype\forestmathtype@unitless
}
+\forest@def@processor{p}{1}*{}{% process expression
+ \forest@process@right@bottompop\forest@temp@a
+ \def\forest@temp{\forest@process{true}}%
+ \expandafter\forest@temp\forest@temp@a\forest@eov
+ \let\forest@topextend@next\relax
+ \edef\forest@temp{\forest@process@result@values}%
+ \expandafter\forest@process@left@topextend\forest@temp\forest@eov
+ \let\forestmathresulttype\forest@process@result@type
+}
\forest@def@processor{t}{1}*{}{% text
\forest@process@right@bottompop\forest@temp
\forest@process@left@letappend\forest@temp
@@ -3115,7 +3131,7 @@
\forest@loop
\ifnum\forest@temparray@N>0
\forest@temparray@toppop\forest@temp
- \expandafter\forest@process@right@setprepend\expandafter{\expandafter{\forest@temp}}%
+ \expandafter\forest@process@right@setprepend\expandafter{\forest@temp}%
\forest@repeat
}
\def\forest@process@check@mn#1#2#3#4{%
@@ -3211,7 +3227,7 @@
\forest@process@n\forest@process@saved@N\relax
\fi
\expandafter\forest@processor@U@@@\expandafter{%
- \the\numexpr\forest@process@saved@N-\forest@temp@count}%
+ \the\numexpr\forest@process@saved@N-\forest@process@n}%
}
\def\forest@processor@U@@@#1{%
\forest@temp@count#1
@@ -3223,14 +3239,14 @@
\forest@repeat
\let\forestmathresulttype\forest@process@savedtype
\ifforest@temp
- \let\forest@process@savedtype\forest@result@type@any
+ \let\forest@process@savedtype\forestmathtype@none
\forest@process@saved@N#1
\fi
}
\forest@def@processor{&}{2}{}{% and
\def\forest@tempa{1}%
\forest@repeat@n@times{\forest@process@n}{%
- \forest@process@left@bottompop\forest@tempb
+ \forest@process@left@toppop\forest@tempb
\edef\forest@tempa{\ifnum10<\forest@tempa\forest@tempb\space 1\else0\fi}%
}%
\forest@process@left@esetappend{\forest@tempa}%
@@ -3239,7 +3255,7 @@
\forest@def@processor{|}{2}{}{% or
\def\forest@tempa{0}%
\forest@repeat@n@times{\forest@process@n}{%
- \forest@process@left@bottompop\forest@tempb
+ \forest@process@left@toppop\forest@tempb
\edef\forest@tempa{\ifnum0=\forest@tempa\forest@tempb\space 0\else1\fi}%
}%
\forest@process@left@esetappend{\forest@tempa}%
@@ -4738,11 +4754,10 @@
{\noexpand\forest@forstepwrapper{#1\ifnum\forest@nodewalkstephandler@nargs>0=\fi\forest@util@nargs{####}{\number\numexpr\forest@nodewalkstephandler@nargs}{0}}{####\number\numexpr\forest@nodewalkstephandler@nargs+1}},
}%
\fi\fi
- % Uncomment this to collect a list of for-based spatial propagators
- %\appto\bigbadforlist{[#1]}%
\fi
},
}
+{\csname forest@@doc@@hook@bigbadforlist\endcsname}%
\pgfqkeys{/handlers}{
.nodewalk style/.code={\forest@handlers@savecurrentpath\pgfkeysalso{%
\forest@currentpath/nodewalk/\forest@currentname/.style={#1}%
@@ -6898,11 +6913,11 @@
\forest@node@boundary\forest@negative@node@edge\forest@positive@node@edge
\forestolet{negative@edge@#1}\forest@negative@node@edge
\forestolet{positive@edge@#1}\forest@positive@node@edge
- \get@edges@merge{negative}{#1}%
- \get@edges@merge{positive}{#1}%
+ \forest@get@edges@merge{negative}{#1}%
+ \forest@get@edges@merge{positive}{#1}%
%}%
}
-\def\get@edges@merge#1#2{%
+\def\forest@get@edges@merge#1#2{%
\ifnum\forestove{n children}>0
\forestoget{#1@edge@#2}\forest@node@edge
\forest@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@pa@temp@name}}{center}%
\else