-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: 1. Performance: - Substantially enhance the argument processor. - `<forestmath>` expressions: accept an argument processor expression whereever a `<pgfmath>` expression is allowed, simply by prefixing it with `>`. - Internally, avoid using pgfmath whereever possible. - Implement a fast set of macros to determine if a `<pgfmath>` expression is just a count or dimen expression. - Optimize keys `split option` and `split register`. 2. Minor improvements: - Allow <relative node name>s in handler `.option`. - Make aggregate functions nestable and implement their `pgfmath` versions. - Implement `if option/register</>` for dimen and count options and registers. - Implement `if current nodewalk empty`. - Implement nodewalk steps `leaves, `-level` and `-level'`. - Implement nodewalk operation `unique`. - Implement nodewalk key `on invalid` values `error if real` and `last valid`; remove value `step` (no `compat` key, as it was broken and useless). - Implement growth direction based anchors with the `-` prefix: `-parent`, `-parent first` etc. - Implement key `save and restore register`. - Implement handler `.nodewalk style`. - Implement `pgfmath` function `forestloopcount`. - Allow multiple occurrences of package option `compat`. Bugfixes: - Fix a bug in externalization: `\forest@file@copy` set `\endlinechar` to `-1`, which caused problems for several packages, e.g. `biblatex`. - Fix a bug in `delay n`: the number of cycles was reevaluated at each cycle (with `compat=2.0-delayn` key). - Fix a bug in `fixed edge angles`. - Fix `compat=silent`, `compat=1.0-forstep` and `compat=1.0-stages`. - Fix invocations of spatial propagators `for nodewalk`, `for Nodewalk` and `Nodewalk`. - Fix invocations of nodewalk steps `for group`, `for next on tier` and `for previous on tier`. - Fix behaviour of `for next on tier`, `for previous on tier` and `for to tier` on arrival to the invalid node. - Fix problems with interaction between `folder` and `forked edges`.
- Loading branch information
1 parent
3c3952f
commit 5f91c8c
Showing
9 changed files
with
4,706 additions
and
1,295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
% forest-index.dtx | ||
%% `forest-compat' defines a compatibility layer of package `forest'. | ||
%% | ||
%% Copyright (c) 2015 Saso Zivanovic | ||
%% Copyright (c) 2016 Saso Zivanovic | ||
%% (Sa\v{s}o \v{Z}ivanovi\'{c}) | ||
%% [email protected] | ||
%% | ||
|
@@ -23,31 +23,43 @@ | |
%% constituting the package see main source file of the package, | ||
%% `forest.dtx', or the derived `forest.sty'. | ||
|
||
\ProvidesPackage{forest-compat} | ||
\ProvidesPackage{forest-compat}[2016/12/05] | ||
|
||
\def\forest@deprecated#1{% | ||
\PackageWarning{forest}{Compatibility mode for #1}% | ||
} | ||
\forestset{@@deprecated/.code={\forest@deprecated{#1}}} | ||
\def\forestcompat#1{\pgfqkeys{/forest/@compat}{#1}} | ||
\forestcompat{ | ||
silent/.style={\def\forest@deprecated##1{}}, | ||
silent/.code={\def\forest@deprecated##1{}}, | ||
%%% begin listing region: compat_keys | ||
most/.style={1.0-most}, | ||
all/.style={1.0-all}, | ||
none/.style={}, | ||
1.0-most/.style={ | ||
1.0-triangle,1.0-linear,1.0-nodewalk,1.0-ancestors, | ||
1.0-fittotree,1.0-for,1.0-forall | ||
1.0-fittotree,1.0-for,1.0-forall, | ||
2.0.2-most, | ||
}, | ||
1.0-all/.style={ | ||
1.0-most, | ||
1.0-forstep,1.0-rotate,1.0-stages,1.0-name, | ||
2.0.2-all, | ||
}, | ||
2.0.2-most/.style={ | ||
2.0-most, | ||
}, | ||
2.0.2-all/.style={ | ||
2.0.2-delayn,2.0.2-wrapnpgfmathargs, | ||
2.0-all, | ||
}, | ||
2.0-most/.style={}, | ||
2.0-all/.style={ | ||
2.0-most, | ||
2.0-delayn, | ||
2.0-edges, | ||
}, | ||
2.0-edges/.style={2.0-anchors,2.0-forkededge,2.0-folder}, | ||
%%% end listing region: compat_keys | ||
1.0-triangle/.style={ | ||
/forest/triangle/.style={ | ||
|
@@ -106,14 +118,9 @@ | |
}, | ||
1.0-forstep/.code={% | ||
\def\forest@forstepwrapper##1##2{% | ||
\def\forest@nodewalk@config@everystep@method{independent}% | ||
\def\forest@nodewalk@config@history@method{independent}% | ||
\edef\forest@marshal{% | ||
\def\noexpand\forest@nodewalk@config@oninvalid{compatfake}% | ||
\unexpanded{\forest@Nodewalk{##1}{##2}}% | ||
\def\noexpand\forest@cn{\forest@cn}% | ||
\def\noexpand\forest@nodewalk@config@oninvalid{\forest@nodewalk@config@oninvalid}% | ||
}\forest@marshal | ||
\forest@forthis{% | ||
\forest@configured@nodewalk{independent}{independent}{compatfake}{##1}{##2}% | ||
}% | ||
}% | ||
\def\forest@relatednode@option@compat@ignoreinvalidsteps##1{% | ||
\forest@saveandrestoremacro\forest@nodewalk@oninvalid{% | ||
|
@@ -172,11 +179,12 @@ | |
}, | ||
2.0.2-delayn/.style={ | ||
/forest/delay@n/.style 2 args={ | ||
@@deprecated={propagator "delay n" (it introduces two levels of hash doubling)}, | ||
@@deprecated={propagator "delay n" (it introduces two levels of hash doubling reevaluates the first argument (the desired number of cycles) at every cycle)}, | ||
if={##1==1}{delay={##2}}{delay={delay@n/.wrap pgfmath arg={{####1}{##2}}{##1-1}}} | ||
}, | ||
2.0-delayn/.style={}, % this key would patch the same thing! | ||
}, | ||
2.0.2-wrapnpgfmathargs/.code={ | ||
2.0.2-wrapnpgfmathargs/.code={% | ||
\def\forest@wrap@pgfmath@args@@@wrapandpasson{% | ||
\forest@deprecated{handler "wrap n pgfmath args" (it introduces two levels of hash doubling)}% | ||
\expandafter\expandafter\expandafter\def | ||
|
@@ -186,5 +194,58 @@ | |
\expandafter\pgfkeysalso\expandafter{\expandafter\pgfkeyscurrentpath\expandafter=\expandafter{\forest@wrapped}}% | ||
}% | ||
}, | ||
2.0-delayn/.style={ | ||
/forest/delay n/.style 2 args={ | ||
@@deprecated={propagator "delay n" (it reevaluates the first argument (the desired number of cycles) at every cycle)}, | ||
if={##1==0}{##2}{delay@n={##1}{##2}} | ||
}, | ||
/forest/delay@n/.style 2 args={ | ||
if={##1==1}{delay={##2}}{delay={delay@n/.process={P}{##1-1}{##2}}} | ||
}, | ||
}, | ||
2.0-anchors/.code={% | ||
\csdef{forest@anchor@@parent'}{% | ||
\forest@anchor@isbordertrue | ||
\edef\forest@temp@anchor{\number\numexpr\forestove{grow}-\forestove{rotate}+180}% | ||
} | ||
\csdef{forest@anchor@@parent first'}{% | ||
\forest@anchor@isbordertrue | ||
\edef\forest@temp@anchor@parent{\number\numexpr\forestove{grow}-\forestove{rotate}+180}% | ||
\edef\forest@temp@anchor@first{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 -\else+\fi90}% | ||
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@first}\forest@temp@anchor | ||
} | ||
\csdef{forest@anchor@@parent last'}{% | ||
\forest@anchor@isbordertrue | ||
\edef\forest@temp@anchor@parent{\number\numexpr\forestove{grow}-\forestove{rotate}+180}% | ||
\edef\forest@temp@anchor@last{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 +\else-\fi90}% | ||
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@last}\forest@temp@anchor | ||
} | ||
}, | ||
2.0-forkededge/.code={% | ||
\forest@iflibraryloaded{edges}{% | ||
\forestset{ | ||
forked edge/.style={ | ||
edge={rotate/.pgfmath=grow()}, | ||
edge path'={(!u.parent anchor) -- ++(\forestoption{fork sep},0) |- (.child anchor)}, | ||
}, | ||
forked edges/.style={ | ||
for tree={parent anchor=children}, | ||
for descendants={child anchor=parent,forked edge} | ||
}, | ||
}% | ||
}{% | ||
\appto\forest@compat@libraries@edges{\forestcompat{2.0-forkededge}}% | ||
}% | ||
}, | ||
2.0-folder/.code={% | ||
\forest@iflibraryloaded{edges}{% | ||
\expandafter\patchcmd\csname @pgfk@/forest/folder/.@cmd\endcsname | ||
{parent anchor=-children last}{parent anchor=parent last}{}{}% | ||
\expandafter\patchcmd\csname @pgfk@/forest/folder/.@cmd\endcsname | ||
{edge={rotate/.option=!parent.grow},}{edge={rotate/.pgfmath=grow()}}{}{}% | ||
}{% | ||
\appto\forest@compat@libraries@edges{\forestcompat{2.0-folder}}% | ||
}% | ||
}, | ||
} | ||
\expandafter\forestcompat\expandafter{\forest@compat} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
%% forest-doc.sty | ||
%% `forest-doc.sty` is an auxiliary package needed to compile the documentation of package `forest`. | ||
%% | ||
%% Copyright (c) 2015 Saso Zivanovic | ||
%% Copyright (c) 2016 Saso Zivanovic | ||
%% (Sa\v{s}o \v{Z}ivanovi\'{c}) | ||
%% [email protected] | ||
%% | ||
|
@@ -31,7 +31,7 @@ | |
basicstyle=\small\ttfamily,basewidth=0.51em,boxpos=c,pointstyle=\pstyle,moredelim=[is][\pstyle]{~}{~}} | ||
%\lst@InstallKeywords{p}{point}{pointstyle}\relax{keywordstyle}{}ld | ||
\def\pstyle{\color{darkgreen}} | ||
\def\itemnosep{\vspace{-1.4ex}} | ||
\newcommand\itemnosep[1][0pt]{\vspace{\the\dimexpr-1.4ex+#1}} | ||
\lstset{ | ||
rangebeginprefix=\ \ \%\%\%\ begin\ listing\ region:\ , | ||
rangebeginsuffix=, | ||
|
@@ -230,7 +230,9 @@ | |
\@Repeat{#1}{#2}#2% | ||
} | ||
\def\spaces#1{\Repeat{#1}\space} | ||
|
||
|
||
\RequirePackage{dingbat} | ||
|
||
|
||
%%% Local Variables: | ||
%%% mode: latex | ||
|
Oops, something went wrong.