| 1 |
%% |
| 2 |
%% This is file `forest.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% forest.dtx |
| 8 |
%% |
| 9 |
%% `forest' is a `pgf/tikz'-based package for drawing (linguistic) trees. |
| 10 |
%% |
| 11 |
%% Copyright (c) 2012-2017 Saso Zivanovic |
| 12 |
%% (Sa\v{s}o \v{Z}ivanovi\'{c}) |
| 13 |
%% [email protected] |
| 14 |
%% |
| 15 |
%% This work may be distributed and/or modified under the |
| 16 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 17 |
%% of this license or (at your option) any later version. |
| 18 |
%% The latest version of this license is in |
| 19 |
%% |
| 20 |
%% http://www.latex-project.org/lppl.txt |
| 21 |
%% |
| 22 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 23 |
%% version 2005/12/01 or later. |
| 24 |
%% |
| 25 |
%% This work has the LPPL maintenance status `author-maintained'. |
| 26 |
%% |
| 27 |
%% This work consists of the following files: |
| 28 |
%% - forest.dtx: central sources (with rudimentary implementation documentation) |
| 29 |
%% - forest-libs.dtx: sources and documentation for libraries |
| 30 |
%% + forest-compat.sty: sources/runtime for compatibility mode |
| 31 |
%% - forest.ins: produces derived runtime .sty files |
| 32 |
%% + forest.sty: main package |
| 33 |
%% + forest-lib-*.sty: libraries (for the list, see forest.ins) |
| 34 |
%% - forest-doc.tex: central documentation |
| 35 |
%% - forest-doc.sty: private package needed to compile the documentation |
| 36 |
%% - forest-index.dtx: sources of indexing package used in the documentation, |
| 37 |
%% and also part of the documentation itself |
| 38 |
%% - forest-doc.ins: produces derived .sty files needed to compile the documentation |
| 39 |
%% - forest-index.sty |
| 40 |
%% - forest-doc.ist: index style file needed to compile the documentation |
| 41 |
%% - forest.pdf: documentation of core package implementation |
| 42 |
%% - forest-doc.pdf: user's guide |
| 43 |
%% - README |
| 44 |
%% - LICENCE |
| 45 |
%% To use the package, only the files marked with + need to be installed. |
| 46 |
%% |
| 47 |
\ProvidesPackage{forest}[2017/07/14 v2.1.5 Drawing (linguistic) trees] |
| 48 |
|
| 49 |
\RequirePackage{tikz}[2013/12/13] |
| 50 |
\usetikzlibrary{shapes} |
| 51 |
\usetikzlibrary{fit} |
| 52 |
\usetikzlibrary{calc} |
| 53 |
\usepgflibrary{intersections} |
| 54 |
|
| 55 |
\RequirePackage{pgfopts} |
| 56 |
\RequirePackage{etoolbox}[2010/08/21] |
| 57 |
\RequirePackage{elocalloc}% for \locbox |
| 58 |
\RequirePackage{environ} |
| 59 |
\RequirePackage{xparse} |
| 60 |
|
| 61 |
\RequirePackage{inlinedef} |
| 62 |
\newtoks\ID@usercommands{} |
| 63 |
\newcommand\NewInlineCommand[3][0]{% |
| 64 |
\newcommand#2[#1]{#3}% |
| 65 |
\ID@usercommands\xa{% |
| 66 |
\the\ID@usercommands |
| 67 |
\ifx\@foo#2% |
| 68 |
\def\next{\ID@expandunsafe#2}% |
| 69 |
\fi |
| 70 |
}% |
| 71 |
} |
| 72 |
\def\@ExpandIfTF#1{% |
| 73 |
\csname |
| 74 |
% I'm not 100% sure if this plays well in every situation |
| 75 |
\csname if#1\endcsname |
| 76 |
@firstoftwo% |
| 77 |
\else |
| 78 |
@secondoftwo% |
| 79 |
\fi |
| 80 |
\endcsname |
| 81 |
} |
| 82 |
\patchcmd{\ID@switch} |
| 83 |
{\ifcat\noexpand\@foo\space} |
| 84 |
{\the\ID@usercommands\ifcat\noexpand\@foo\space} |
| 85 |
{% |
| 86 |
\NewInlineCommand[2]\ExpandIfT{% |
| 87 |
\MultiExpand{3}{% |
| 88 |
\@ExpandIfTF{#1}{#2}{}% |
| 89 |
}% |
| 90 |
} |
| 91 |
\NewInlineCommand[2]\ExpandIfF{% |
| 92 |
\MultiExpand{3}{% |
| 93 |
\@ExpandIfTF{#1}{}{#2}% |
| 94 |
}% |
| 95 |
} |
| 96 |
\NewInlineCommand[3]\ExpandIfTF{% |
| 97 |
\MultiExpand{3}{% |
| 98 |
\@ExpandIfTF{#1}{#2}{#3}% |
| 99 |
}% |
| 100 |
}% |
| 101 |
\newcommand\InlineNoDef[1]{% |
| 102 |
\begingroup |
| 103 |
% Define a few ``quarks'' |
| 104 |
\def\Expand{\Expand}\def\Super{\Super}% |
| 105 |
\def\UnsafeExpand{\UnsafeExpand}\def\MultiExpand{\MultiExpand}% |
| 106 |
\def\Recurse{\Recurse}\def\NoExpand{\NoExpand}% |
| 107 |
\def\Q@END{\Q@END}% |
| 108 |
% Define a toks register |
| 109 |
\ID@toks{}% |
| 110 |
% Signal that we need to look for a star |
| 111 |
\@testtrue\ID@starfalse\ID@starstarfalse\ID@bangfalse |
| 112 |
% Start scanning for \def or \gdef |
| 113 |
\ID@scan#1\Q@END{}% |
| 114 |
\expandafter\endgroup |
| 115 |
%\expandafter\@firstofone |
| 116 |
\the\ID@toks |
| 117 |
}% |
| 118 |
}% |
| 119 |
{% |
| 120 |
\PackageWarning{forest}{Could not patch inlinedef! Disabling it. Except in some special situations (nested arrays), stuff will probably still work, but there's no guarantee. Please report this situation to the author (but check first if a new version already exists).}{}% |
| 121 |
\let\Inline\relax |
| 122 |
\def\Expand#1{#1}% |
| 123 |
\def\MultiExpand#1#2{#2}% |
| 124 |
\def\InlineNoDef#1{#1}% |
| 125 |
\def\ExpandIfT#1#2{\@ExpandIfTF{#1}{#2}{}}% |
| 126 |
\def\ExpandIfF#1#2{\@ExpandIfTF{#1}{}{#2}}% |
| 127 |
\def\ExpandIfTF#1#2#3{\@ExpandIfTF{#1}{#2}{#3}}% |
| 128 |
} |
| 129 |
\pgfkeys{/forest/.is family} |
| 130 |
\def\forestset#1{\pgfqkeys{/forest}{#1}} |
| 131 |
\newif\ifforest@external@ |
| 132 |
\newif\ifforesttikzcshack |
| 133 |
\newif\ifforest@install@keys@to@tikz@path@ |
| 134 |
\newif\ifforestdebugnodewalks |
| 135 |
\newif\ifforestdebugdynamics |
| 136 |
\newif\ifforestdebugprocess |
| 137 |
\newif\ifforestdebugtemp |
| 138 |
\newif\ifforestdebug |
| 139 |
\def\forest@compat{} |
| 140 |
\forestset{package@options/.cd, |
| 141 |
external/.is if=forest@external@, |
| 142 |
tikzcshack/.is if=foresttikzcshack, |
| 143 |
tikzinstallkeys/.is if=forest@install@keys@to@tikz@path@, |
| 144 |
compat/.code={\appto\forest@compat{,#1}}, |
| 145 |
compat/.default=most, |
| 146 |
.unknown/.code={% load library |
| 147 |
\eappto\forest@loadlibrarieslater{% |
| 148 |
\noexpand\useforestlibrary{\pgfkeyscurrentname}% |
| 149 |
\noexpand\forestapplylibrarydefaults{\pgfkeyscurrentname}% |
| 150 |
}% |
| 151 |
}, |
| 152 |
debug/.code={\forestdebugtrue\pgfqkeys{/forest/package@options/debug}{#1}}, |
| 153 |
debug/.default={nodewalks,dynamics,process}, |
| 154 |
debug/nodewalks/.is if=forestdebugnodewalks, |
| 155 |
debug/dynamics/.is if=forestdebugdynamics, |
| 156 |
debug/process/.is if=forestdebugprocess, |
| 157 |
} |
| 158 |
\forest@install@keys@to@tikz@path@true |
| 159 |
\foresttikzcshacktrue |
| 160 |
\def\forest@loadlibrarieslater{} |
| 161 |
\AtEndOfPackage{\forest@loadlibrarieslater} |
| 162 |
\NewDocumentCommand\useforestlibrary{s O{} m}{% |
| 163 |
\def\useforestlibrary@@##1{\useforestlibrary@{#2}{##1}}% |
| 164 |
\forcsvlist\useforestlibrary@@{#3}% |
| 165 |
\IfBooleanT{#1}{\forestapplylibrarydefaults{#3}}% |
| 166 |
} |
| 167 |
\def\useforestlibrary@#1#2{% |
| 168 |
\RequirePackage[#1]{forest-lib-#2}% |
| 169 |
\csuse{forest@compat@libraries@#2}% |
| 170 |
} |
| 171 |
\def\forestapplylibrarydefaults#1{\forcsvlist\forestapplylibrarydefaults@{#1}} |
| 172 |
\def\forestapplylibrarydefaults@#1{\forestset{libraries/#1/defaults/.try}} |
| 173 |
\NewDocumentCommand\ProvidesForestLibrary{m O{}}{% |
| 174 |
\ProvidesPackage{forest-lib-#1}[#2]% |
| 175 |
\csdef{forest@libraries@loaded@#1}{}% |
| 176 |
} |
| 177 |
\def\forest@iflibraryloaded#1#2#3{\ifcsdef{forest@libraries@loaded@#1}{#2}{#3}} |
| 178 |
\ProcessPgfPackageOptions{/forest/package@options} |
| 179 |
\def\forest@patch#1#2#3#4#5{% |
| 180 |
% #1 = cs to be patched |
| 181 |
% %2 = purpose of the patch |
| 182 |
% #3 = macro arguments |
| 183 |
% #4 = original code |
| 184 |
% #5 = patched code |
| 185 |
\csdef{forest@original@#1}#3{#4}% |
| 186 |
\csdef{forest@patched@#1}#3{#5}% |
| 187 |
\ifcsequal{#1}{forest@original@#1}{% |
| 188 |
\csletcs{#1}{forest@patched@#1}% |
| 189 |
}{% |
| 190 |
\ifcsequal{#1}{forest@patched@#1}{% all is good, the patch is in! |
| 191 |
}{% |
| 192 |
\PackageWarning{forest}{Failed patching '\expandafter\string\csname #1\endcsname'. Purpose of the patch: #2}% |
| 193 |
}% |
| 194 |
}% |
| 195 |
} |
| 196 |
\forest@patch{pgfgettransform}{fix a leaking space}{#1}{% |
| 197 |
\edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}} |
| 198 |
}{% |
| 199 |
\edef#1{{\pgf@pt@aa}{\pgf@pt@ab}{\pgf@pt@ba}{\pgf@pt@bb}{\the\pgf@pt@x}{\the\pgf@pt@y}}% |
| 200 |
} |
| 201 |
\def\forest@empty{} |
| 202 |
\long\def\@escapeif#1#2\fi{\fi#1} |
| 203 |
\long\def\@escapeifif#1#2\fi#3\fi{\fi\fi#1} |
| 204 |
\long\def\@escapeififif#1#2\fi#3\fi#4\fi{\fi\fi\fi#1} |
| 205 |
\def\forest@repeat@n@times#1{% #1=n, #2=code |
| 206 |
\expandafter\forest@repeat@n@times@\expandafter{\the\numexpr#1}} |
| 207 |
\def\forest@repeat@n@times@#1{% |
| 208 |
\ifnum#1>0 |
| 209 |
\@escapeif{% |
| 210 |
\expandafter\forest@repeat@n@times@@\expandafter{\the\numexpr#1-1}% |
| 211 |
}% |
| 212 |
\else |
| 213 |
\expandafter\@gobble |
| 214 |
\fi |
| 215 |
} |
| 216 |
\def\forest@repeat@n@times@@#1#2{% |
| 217 |
#2% |
| 218 |
\forest@repeat@n@times@{#1}{#2}% |
| 219 |
} |
| 220 |
\def\newloop#1{% |
| 221 |
\count@=\escapechar |
| 222 |
\escapechar=-1 |
| 223 |
\expandafter\newloop@parse@loopname\string#1\newloop@end |
| 224 |
\escapechar=\count@ |
| 225 |
}% |
| 226 |
{\lccode`7=`l \lccode`8=`o \lccode`9=`p |
| 227 |
\lowercase{\gdef\newloop@parse@loopname#17889#2\newloop@end{% |
| 228 |
\edef\newloop@marshal{% |
| 229 |
\noexpand\csdef{#1loop#2}####1\expandafter\noexpand\csname #1repeat#2\endcsname{% |
| 230 |
\noexpand\csdef{#1iterate#2}{####1\relax\noexpand\expandafter\expandafter\noexpand\csname#1iterate#2\endcsname\noexpand\fi}% |
| 231 |
\expandafter\noexpand\csname#1iterate#2\endcsname |
| 232 |
\let\expandafter\noexpand\csname#1iterate#2\endcsname\relax |
| 233 |
}% |
| 234 |
}% |
| 235 |
\newloop@marshal |
| 236 |
}% |
| 237 |
}% |
| 238 |
}% |
| 239 |
\def\newsafeloop#1{% |
| 240 |
\csdef{safeloop@#1}##1\saferepeat{% |
| 241 |
\forest@temp@toks{##1}% |
| 242 |
\csedef{safeiterate@#1}{% |
| 243 |
\the\forest@temp@toks\relax |
| 244 |
\noexpand\expandafter |
| 245 |
\expandonce{\csname safeiterate@#1\endcsname}% |
| 246 |
\noexpand\fi |
| 247 |
}% |
| 248 |
\csuse{safeiterate@#1}% |
| 249 |
\advance\noexpand\safeloop@depth-1\relax |
| 250 |
\cslet{safeiterate@#1}\relax |
| 251 |
}% |
| 252 |
\expandafter\newif\csname ifsafebreak@\the\safeloop@depth\endcsname |
| 253 |
}% |
| 254 |
\newcount\safeloop@depth |
| 255 |
\def\safeloop{% |
| 256 |
\advance\safeloop@depth1 |
| 257 |
\ifcsdef{safeloop@\the\safeloop@depth}{}{\expandafter\newsafeloop\expandafter{\the\safeloop@depth}}% |
| 258 |
\csdef{safeloopn@\the\safeloop@depth}{0}% |
| 259 |
\csuse{safeloop@\the\safeloop@depth}% |
| 260 |
\csedef{safeloopn@\the\safeloop@depth}{\number\numexpr\csuse{safeloopn@\the\safeloop@depth}+1}% |
| 261 |
} |
| 262 |
\let\saferepeat\fi |
| 263 |
\def\safeloopn{\csuse{safeloopn@\the\safeloop@depth}}% |
| 264 |
\def\newsafeRKloop#1{% |
| 265 |
\csdef{safeRKloop@#1}##1\safeRKrepeat{% |
| 266 |
\forest@temp@toks{##1}% |
| 267 |
\csedef{safeRKiterate@#1}{% |
| 268 |
\the\forest@temp@toks\relax |
| 269 |
\noexpand\expandafter |
| 270 |
\expandonce{\csname safeRKiterate@#1\endcsname}% |
| 271 |
\noexpand\fi |
| 272 |
}% |
| 273 |
\csuse{safeRKiterate@#1}% |
| 274 |
\advance\noexpand\safeRKloop@depth-1\relax |
| 275 |
\cslet{safeRKiterate@#1}\relax |
| 276 |
}% |
| 277 |
\expandafter\newif\csname ifsafeRKbreak@\the\safeRKloop@depth\endcsname |
| 278 |
}% |
| 279 |
\newcount\safeRKloop@depth |
| 280 |
\def\safeRKloop{% |
| 281 |
\advance\safeRKloop@depth1 |
| 282 |
\ifcsdef{safeRKloop@\the\safeRKloop@depth}{}{\expandafter\newsafeRKloop\expandafter{\the\safeRKloop@depth}}% |
| 283 |
\csdef{safeRKloopn@\the\safeRKloop@depth}{0}% |
| 284 |
\csuse{safeRKbreak@\the\safeRKloop@depth false}% |
| 285 |
\csuse{safeRKloop@\the\safeRKloop@depth}% |
| 286 |
\csedef{safeRKloopn@\the\safeRKloop@depth}{\number\numexpr\csuse{safeRKloopn@\the\safeRKloop@depth}+1}% |
| 287 |
} |
| 288 |
\let\safeRKrepeat\fi |
| 289 |
\def\safeRKloopn{\csuse{safeRKloopn@\the\safeRKloop@depth}}% |
| 290 |
\newloop\forest@loop |
| 291 |
\newdimen\forest@temp@dimen |
| 292 |
\newcount\forest@temp@count |
| 293 |
\newcount\forest@n |
| 294 |
\newif\ifforest@temp |
| 295 |
\newcount\forest@temp@global@count |
| 296 |
\newtoks\forest@temp@toks |
| 297 |
\def\etotoks#1#2{\edef\pot@temp{#2}\expandafter#1\expandafter{\pot@temp}} |
| 298 |
\def\apptotoks#1#2{\expandafter#1\expandafter{\the#1#2}} |
| 299 |
\long\def\lapptotoks#1#2{\expandafter#1\expandafter{\the#1#2}} |
| 300 |
\def\eapptotoks#1#2{\edef\pot@temp{#2}\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter#1\pot@temp}} |
| 301 |
\def\pretotoks#1#2{\toks@={#2}\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks@\the#1}} |
| 302 |
\def\epretotoks#1#2{\edef\pot@temp{#2}\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\pot@temp\the#1}} |
| 303 |
\def\gapptotoks#1#2{\expandafter\global\expandafter#1\expandafter{\the#1#2}} |
| 304 |
\def\xapptotoks#1#2{\edef\pot@temp{#2}\expandafter\expandafter\expandafter\global\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter#1\pot@temp}} |
| 305 |
\def\gpretotoks#1#2{\toks@={#2}\expandafter\expandafter\expandafter\global\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks@\the#1}} |
| 306 |
\def\xpretotoks#1#2{\edef\pot@temp{#2}\expandafter\expandafter\expandafter\global\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\pot@temp\the#1}} |
| 307 |
\def\expandnumberarg#1#2{\expandafter#1\expandafter{\number#2}} |
| 308 |
\def\expandtwonumberargs#1#2#3{% |
| 309 |
\expandafter\expandtwonumberargs@\expandafter#1\expandafter{\number#3}{#2}} |
| 310 |
\def\expandtwonumberargs@#1#2#3{% |
| 311 |
\expandafter#1\expandafter{\number#3}{#2}} |
| 312 |
\def\expandthreenumberargs#1#2#3#4{% |
| 313 |
\expandafter\expandthreenumberargs@\expandafter#1\expandafter{\number#4}{#2}{#3}} |
| 314 |
\def\expandthreenumberargs@#1#2#3#4{% |
| 315 |
\expandafter\expandthreenumberargs@@\expandafter#1\expandafter{\number#4}{#2}{#3}} |
| 316 |
\def\expandthreenumberargs@@#1#2#3#4{% |
| 317 |
\expandafter#1\expandafter{\number#4}{#2}{#3}} |
| 318 |
\def\forest@convert@others@to@underscores#1#2{% |
| 319 |
\def\forest@cotu@result{}% |
| 320 |
\forest@cotu@first#1\forest@end |
| 321 |
\let#2\forest@cotu@result |
| 322 |
} |
| 323 |
\def\forest@cotu{% |
| 324 |
\let\forest@cotu@have@num\forest@cotu@have@alpha |
| 325 |
\futurelet\forest@cotu@nextchar\forest@cotu@checkforspace |
| 326 |
} |
| 327 |
\def\forest@cotu@first{% |
| 328 |
\let\forest@cotu@have@num\forest@cotu@haveother |
| 329 |
\futurelet\forest@cotu@nextchar\forest@cotu@checkforspace |
| 330 |
} |
| 331 |
\def\forest@cotu@checkforspace{% |
| 332 |
\expandafter\ifx\space\forest@cotu@nextchar |
| 333 |
\let\forest@cotu@next\forest@cotu@havespace |
| 334 |
\else |
| 335 |
\let\forest@cotu@next\forest@cotu@nospace |
| 336 |
\fi |
| 337 |
\forest@cotu@next |
| 338 |
} |
| 339 |
\def\forest@cotu@havespace#1{% |
| 340 |
\appto\forest@cotu@result{_}% |
| 341 |
\forest@cotu#1% |
| 342 |
} |
| 343 |
\def\forest@cotu@nospace{% |
| 344 |
\ifx\forest@cotu@nextchar\forest@end |
| 345 |
\@escapeif\@gobble |
| 346 |
\else |
| 347 |
\@escapeif\forest@cotu@nospaceB |
| 348 |
\fi |
| 349 |
} |
| 350 |
\def\forest@cotu@nospaceB#1{% |
| 351 |
\ifcat#1a% |
| 352 |
\let\forest@cotu@next\forest@cotu@have@alpha |
| 353 |
\else |
| 354 |
\if!\ifnum9<1#1!\fi |
| 355 |
\let\forest@cotu@next\forest@cotu@have@num |
| 356 |
\else |
| 357 |
\let\forest@cotu@next\forest@cotu@haveother |
| 358 |
\fi |
| 359 |
\fi |
| 360 |
\forest@cotu@next#1% |
| 361 |
} |
| 362 |
\def\forest@cotu@have@alpha#1{% |
| 363 |
\appto\forest@cotu@result{#1}% |
| 364 |
\forest@cotu |
| 365 |
} |
| 366 |
\def\forest@cotu@haveother#1{% |
| 367 |
\appto\forest@cotu@result{_}% |
| 368 |
\forest@cotu |
| 369 |
} |
| 370 |
\def\forest@listedel#1#2{% #1 = list, #2 = item |
| 371 |
\edef\forest@marshal{\noexpand\forest@listdel\noexpand#1{#2}}% |
| 372 |
\forest@marshal |
| 373 |
} |
| 374 |
\def\forest@listcsdel#1#2{% |
| 375 |
\expandafter\forest@listdel\csname #1\endcsname{#2}% |
| 376 |
} |
| 377 |
\def\forest@listcsedel#1#2{% |
| 378 |
\expandafter\forest@listedel\csname #1\endcsname{#2}% |
| 379 |
} |
| 380 |
\edef\forest@restorelistsepcatcode{\noexpand\catcode`|\the\catcode`|\relax}% |
| 381 |
\catcode`\|=3 |
| 382 |
\gdef\forest@listdel#1#2{% |
| 383 |
\def\forest@listedel@A##1|#2|##2\forest@END{% |
| 384 |
\forest@listedel@B##1|##2\forest@END%| |
| 385 |
}% |
| 386 |
\def\forest@listedel@B|##1\forest@END{%| |
| 387 |
\def#1{##1}% |
| 388 |
}% |
| 389 |
\expandafter\forest@listedel@A\expandafter|#1\forest@END%| |
| 390 |
} |
| 391 |
\forest@restorelistsepcatcode |
| 392 |
\def\forest@strip@braces#1{% |
| 393 |
\forest@strip@braces@A#1\forest@strip@braces@preend\forest@strip@braces@end |
| 394 |
} |
| 395 |
\def\forest@strip@braces@A#1#2\forest@strip@braces@end{% |
| 396 |
#1\ifx\forest@strip@braces@preend#2\else\@escapeif{\forest@strip@braces@A#2\forest@strip@braces@end}\fi |
| 397 |
} |
| 398 |
\def\forest@copycommandkey#1#2{% copies command of #1 into #2 |
| 399 |
\pgfkeysifdefined{#1/.@cmd}{}{% |
| 400 |
\PackageError{forest}{Key #1 is not a command key}{}% |
| 401 |
}% |
| 402 |
\pgfkeysgetvalue{#1/.@cmd}\forest@temp |
| 403 |
\pgfkeyslet{#2/.@cmd}\forest@temp |
| 404 |
\pgfkeysifdefined{#1/.@args}{% |
| 405 |
\pgfkeysgetvalue{#1/.@args}\forest@temp |
| 406 |
\pgfkeyslet{#2/.@args}\forest@temp |
| 407 |
}{}% |
| 408 |
\pgfkeysifdefined{#1/.@body}{% |
| 409 |
\pgfkeysgetvalue{#1/.@body}\forest@temp |
| 410 |
\pgfkeyslet{#2/.@body}\forest@temp |
| 411 |
}{}% |
| 412 |
\pgfkeysifdefined{#1/.@@body}{% |
| 413 |
\pgfkeysgetvalue{#1/.@@body}\forest@temp |
| 414 |
\pgfkeyslet{#2/.@@body}\forest@temp |
| 415 |
}{}% |
| 416 |
\pgfkeysifdefined{#1/.@def}{% |
| 417 |
\pgfkeysgetvalue{#1/.@def}\forest@temp |
| 418 |
\pgfkeyslet{#2/.@def}\forest@temp |
| 419 |
}{}% |
| 420 |
} |
| 421 |
\forestset{ |
| 422 |
copy command key/.code 2 args={\forest@copycommandkey{#1}{#2}}, |
| 423 |
autoforward/.code 2 args={\forest@autoforward{#1}{#2={#1={##1}}}{true}}, |
| 424 |
autoforward'/.code 2 args={\forest@autoforward{#1}{#2-=#1,#2={#1={##1}}}{true}}, |
| 425 |
Autoforward/.code 2 args={\forest@autoforward{#1}{#2}{true}}, |
| 426 |
autoforward register/.code 2 args={\forest@autoforward{#1}{#2={#1={##1}}}{false}}, |
| 427 |
autoforward register'/.code 2 args={\forest@autoforward{#1}{#2-=#1,#2={#1={##1}}}{false}}, |
| 428 |
Autoforward register/.code 2 args={\forest@autoforward{#1}{#2}{false}}, |
| 429 |
copy command key@if it exists/.code 2 args={% |
| 430 |
\pgfkeysifdefined{#1/.@cmd}{% |
| 431 |
\forest@copycommandkey{#1}{#2}% |
| 432 |
}{}% |
| 433 |
}, |
| 434 |
unautoforward/.style={ |
| 435 |
typeout={unautoforwarding #1}, |
| 436 |
copy command key@if it exists={/forest/autoforwarded #1}{/forest/#1}, |
| 437 |
copy command key@if it exists={/forest/autoforwarded #1+}{/forest/#1+}, |
| 438 |
copy command key@if it exists={/forest/autoforwarded #1-}{/forest/#1-}, |
| 439 |
copy command key@if it exists={/forest/autoforwarded #1*}{/forest/#1*}, |
| 440 |
copy command key@if it exists={/forest/autoforwarded #1:}{/forest/#1:}, |
| 441 |
copy command key@if it exists={/forest/autoforwarded #1'}{/forest/#1'}, |
| 442 |
copy command key@if it exists={/forest/autoforwarded #1+'}{/forest/#1+'}, |
| 443 |
copy command key@if it exists={/forest/autoforwarded #1-'}{/forest/#1-'}, |
| 444 |
copy command key@if it exists={/forest/autoforwarded #1*'}{/forest/#1*'}, |
| 445 |
copy command key@if it exists={/forest/autoforwarded #1:'}{/forest/#1:'}, |
| 446 |
copy command key@if it exists={/forest/autoforwarded +#1}{/forest/+#1}, |
| 447 |
}, |
| 448 |
/handlers/.undef/.code={\csundef{pgfk@\pgfkeyscurrentpath}}, |
| 449 |
undef option/.style={ |
| 450 |
/forest/#1/.undef, |
| 451 |
/forest/#1/.@cmd/.undef, |
| 452 |
/forest/#1+/.@cmd/.undef, |
| 453 |
/forest/#1-/.@cmd/.undef, |
| 454 |
/forest/#1*/.@cmd/.undef, |
| 455 |
/forest/#1:/.@cmd/.undef, |
| 456 |
/forest/#1'/.@cmd/.undef, |
| 457 |
/forest/#1+'/.@cmd/.undef, |
| 458 |
/forest/#1-'/.@cmd/.undef, |
| 459 |
/forest/#1*'/.@cmd/.undef, |
| 460 |
/forest/#1:'/.@cmd/.undef, |
| 461 |
/forest/+#1/.@cmd/.undef, |
| 462 |
/forest/TeX={\patchcmd{\forest@node@init}{\forestoinit{#1}}{}{}{}}, |
| 463 |
}, |
| 464 |
undef register/.style={undef option={#1}}, |
| 465 |
} |
| 466 |
\def\forest@autoforward#1#2#3{% |
| 467 |
% #1 = option name |
| 468 |
% #2 = code of a style taking one arg (new option value), |
| 469 |
% which expands to whatever should be done with the new value |
| 470 |
% autoforward(') adds to the keylist (arg#2) |
| 471 |
% #3 = true=option, false=register |
| 472 |
\forest@autoforward@createforwarder{}{#1}{}{#2}{#3}% |
| 473 |
\forest@autoforward@createforwarder{}{#1}{+}{#2}{#3}% |
| 474 |
\forest@autoforward@createforwarder{}{#1}{-}{#2}{#3}% |
| 475 |
\forest@autoforward@createforwarder{}{#1}{*}{#2}{#3}% |
| 476 |
\forest@autoforward@createforwarder{}{#1}{:}{#2}{#3}% |
| 477 |
\forest@autoforward@createforwarder{}{#1}{'}{#2}{#3}% |
| 478 |
\forest@autoforward@createforwarder{}{#1}{+'}{#2}{#3}% |
| 479 |
\forest@autoforward@createforwarder{}{#1}{-'}{#2}{#3}% |
| 480 |
\forest@autoforward@createforwarder{}{#1}{*'}{#2}{#3}% |
| 481 |
\forest@autoforward@createforwarder{}{#1}{:'}{#2}{#3}% |
| 482 |
\forest@autoforward@createforwarder{+}{#1}{}{#2}{#3}% |
| 483 |
} |
| 484 |
\def\forest@autoforward@createforwarder#1#2#3#4#5{% |
| 485 |
% #1=prefix, #2=option name, #3=suffix, #4=macro code (#2 above), #5=option or register |
| 486 |
\pgfkeysifdefined{/forest/#1#2#3/.@cmd}{% |
| 487 |
\forest@copycommandkey{/forest/#1#2#3}{/forest/autoforwarded #1#2#3}% |
| 488 |
\pgfkeyssetvalue{/forest/autoforwarded #1#2#3/option@name}{#2}% |
| 489 |
\pgfkeysdef{/forest/#1#2#3}{% |
| 490 |
\pgfkeysalso{autoforwarded #1#2#3={##1}}% |
| 491 |
\def\forest@temp@macro####1{#4}% |
| 492 |
\csname forest@temp#5\endcsname |
| 493 |
\edef\forest@temp@value{\ifforest@temp\expandafter\forestOv\expandafter{\expandafter\forest@setter@node\expandafter}\else\expandafter\forestrv\fi{#2}}% |
| 494 |
%\expandafter\expandafter\expandafter\pgfkeysalso\expandafter\expandafter\expandafter{\expandafter\forest@temp@macro\expandafter{\forest@temp@value}}% ??? how many expansions are really needed? |
| 495 |
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfkeysalso\expandafter\expandafter\expandafter{\expandafter\forest@temp@macro\expandafter{\forest@temp@value}}% |
| 496 |
}% |
| 497 |
}{}% |
| 498 |
} |
| 499 |
\def\forest@node@removekeysfromkeylist#1#2{% #1 = keys to remove, #2 = option name |
| 500 |
\edef\forest@marshal{% |
| 501 |
\noexpand\forest@removekeysfromkeylist{\unexpanded{#1}}{\forestov{#2}}\noexpand\forest@temp@toks}\forest@marshal |
| 502 |
\forestoeset{#2}{\the\forest@temp@toks}% |
| 503 |
} |
| 504 |
\def\forest@removekeysfromkeylist#1#2#3{% |
| 505 |
% #1 = keys to remove (a keylist: an empty value means remove a key with any value) |
| 506 |
% #2 = keylist |
| 507 |
% #3 = toks cs for result |
| 508 |
\forest@temp@toks{}% |
| 509 |
\def\forestnovalue{\forestnovalue}% |
| 510 |
\pgfqkeys{/forest/remove@key@installer}{#1}% |
| 511 |
\let\forestnovalue\pgfkeysnovaluetext |
| 512 |
\pgfqkeys{/forest/remove@key}{#2}% |
| 513 |
\pgfqkeys{/forest/remove@key@uninstaller}{#1}% |
| 514 |
#3\forest@temp@toks |
| 515 |
} |
| 516 |
\def\forest@remove@key@novalue{\forest@remove@key@novalue}% |
| 517 |
\forestset{ |
| 518 |
remove@key@installer/.unknown/.code={% #1 = (outer) value |
| 519 |
\def\forest@temp{#1}% |
| 520 |
\ifx\forest@temp\pgfkeysnovalue@text |
| 521 |
\pgfkeysdef{/forest/remove@key/\pgfkeyscurrentname}{}% |
| 522 |
\else |
| 523 |
\ifx\forest@temp\forestnovalue |
| 524 |
\expandafter\forest@remove@key@installer@defwithvalue\expandafter{\pgfkeyscurrentname}{\pgfkeysnovalue}% |
| 525 |
\else |
| 526 |
\expandafter\forest@remove@key@installer@defwithvalue\expandafter{\pgfkeyscurrentname}{#1}% |
| 527 |
\fi |
| 528 |
\fi |
| 529 |
}, |
| 530 |
remove@key/.unknown/.code={% #1 = (inner) value |
| 531 |
\expandafter\apptotoks\expandafter\forest@temp@toks\expandafter{\pgfkeyscurrentname={#1},}% |
| 532 |
}, |
| 533 |
remove@key@uninstaller/.unknown/.code={% |
| 534 |
\pgfkeyslet{/forest/remove@key/\pgfkeyscurrentname/.@cmd}\@undefined}, |
| 535 |
} |
| 536 |
\def\forest@remove@key@installer@defwithvalue#1#2{% #1=key name, #2 = outer value |
| 537 |
\pgfkeysdef{/forest/remove@key/#1}{% ##1 = inner value |
| 538 |
\def\forest@temp@outer{#2}% |
| 539 |
\def\forest@temp@inner{##1}% |
| 540 |
\ifx\forest@temp@outer\forest@temp@inner |
| 541 |
\else |
| 542 |
\apptotoks\forest@temp@toks{#1={##1},}% |
| 543 |
\fi |
| 544 |
}% |
| 545 |
} |
| 546 |
\forestset{ |
| 547 |
show register/.code={% |
| 548 |
\forestrget{#1}\foresttemp |
| 549 |
\typeout{Forest register "#1"=\expandafter\detokenize\expandafter{\foresttemp}}% |
| 550 |
}, |
| 551 |
} |
| 552 |
\def\forest@newarray#1{% |
| 553 |
\forest@tempfalse % non-global |
| 554 |
{% |
| 555 |
\escapechar=-1 |
| 556 |
\expandafter\escapechar\expandafter\count@\expandafter |
| 557 |
}% |
| 558 |
\expandafter\forest@newarray@\expandafter{\string#1}% |
| 559 |
} |
| 560 |
\def\forest@newglobalarray#1{% |
| 561 |
\forest@temptrue % global |
| 562 |
{% |
| 563 |
\escapechar=-1 |
| 564 |
\expandafter\escapechar\expandafter\count@\expandafter |
| 565 |
}% |
| 566 |
\expandafter\forest@newarray@\expandafter{\string#1}% |
| 567 |
} |
| 568 |
\def\forest@array@empty@error#1{% |
| 569 |
\PackageError{forest}{Cannot pop from empty array "#1".}{}}% |
| 570 |
\def\forest@array@oub@error#1#2{% |
| 571 |
\PackageError{forest}{#2 is out of bounds of array "#1" |
| 572 |
(\the\csuse{#1M}--\the\csuse{#1N}).}{}}% |
| 573 |
\def\forest@newarray@#1{% |
| 574 |
% array bounds: M <= i < N |
| 575 |
\expandafter\newcount\csname#1M\endcsname |
| 576 |
\expandafter\newcount\csname#1N\endcsname |
| 577 |
\csedef{#1clear}{% |
| 578 |
\ifforest@temp\global\fi\expandonce{\csname#1M\endcsname}0 |
| 579 |
\ifforest@temp\global\fi\expandonce{\csname#1N\endcsname}0 |
| 580 |
}% |
| 581 |
\csedef{#1ifempty}{% |
| 582 |
\noexpand\ifnum\expandonce{\csname#1M\endcsname}<\expandonce{\csname#1N\endcsname}\relax |
| 583 |
\unexpanded{\expandafter\@secondoftwo |
| 584 |
\else |
| 585 |
\expandafter\@firstoftwo |
| 586 |
\fi}% |
| 587 |
}% |
| 588 |
\csedef{#1length}{% a numexpr |
| 589 |
\noexpand\numexpr\expandonce{\csname#1N\endcsname}-\expandonce{\csname#1M\endcsname}\relax |
| 590 |
}% |
| 591 |
\csedef{#1checkrange}##1##2{% args can be \numexprs |
| 592 |
\noexpand\forest@tempfalse |
| 593 |
\noexpand\ifnum\numexpr##1<\expandonce{\csname#1M\endcsname}\relax |
| 594 |
\noexpand\forest@temptrue |
| 595 |
\noexpand\fi |
| 596 |
\noexpand\ifnum\numexpr##2>\expandonce{\csname#1N\endcsname}\relax |
| 597 |
\noexpand\forest@temptrue |
| 598 |
\noexpand\fi |
| 599 |
\noexpand\ifforest@temp |
| 600 |
\noexpand\forest@array@oub@error{#1}{Range "\noexpand\number\noexpand\numexpr##1\relax--\noexpand\number\noexpand\numexpr##2\relax"}% |
| 601 |
\noexpand\fi |
| 602 |
}% |
| 603 |
\csedef{#1checkindex}##1{% arg can be a \numexpr |
| 604 |
\noexpand\forest@tempfalse |
| 605 |
\noexpand\ifnum\numexpr##1<\expandonce{\csname#1M\endcsname}\relax |
| 606 |
\noexpand\forest@temptrue |
| 607 |
\noexpand\fi |
| 608 |
\noexpand\ifnum\numexpr##1<\expandonce{\csname#1N\endcsname}\relax |
| 609 |
\noexpand\else |
| 610 |
\noexpand\forest@temptrue |
| 611 |
\noexpand\fi |
| 612 |
\noexpand\ifforest@temp |
| 613 |
\noexpand\forest@array@oub@error{#1}{Index "\noexpand\number\noexpand\numexpr##1\relax"}% |
| 614 |
\noexpand\fi |
| 615 |
}% |
| 616 |
\csedef{#1get}##1##2{% ##1 = index, ##2 = receiving cs |
| 617 |
\expandonce{\csname#1checkindex\endcsname}{##1}% |
| 618 |
\noexpand\letcs##2{#1##1}% |
| 619 |
}% |
| 620 |
\csedef{#1get@}##1##2{% ##1 = index, ##2 = receiving cs (don't check bounds) |
| 621 |
\noexpand\letcs##2{#1##1}% |
| 622 |
}% |
| 623 |
\csedef{#1toppop}##1{% ##1 = receiving cs |
| 624 |
\expandonce{\csname#1ifempty\endcsname}{% |
| 625 |
\noexpand\forest@array@empty@error{#1}% |
| 626 |
}{% |
| 627 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1N\endcsname}-1 |
| 628 |
\noexpand\letcs\noexpand##1{#1\noexpand\the\expandonce{\csname#1N\endcsname}}% |
| 629 |
}% |
| 630 |
}% |
| 631 |
\InlineNoDef{\csdef{#1bottompop}##1{% ##1 = receiving cs |
| 632 |
\Expand{\csname#1ifempty\endcsname}{% |
| 633 |
\forest@array@empty@error{#1}% |
| 634 |
}{% |
| 635 |
\letcs##1{#1\the\Expand{\csname#1M\endcsname}}% |
| 636 |
\ExpandIfT{forest@temp}\global\advance\Expand{\csname#1M\endcsname 1}% |
| 637 |
}% |
| 638 |
}}% |
| 639 |
% \csdef{#1bottompop}##1{}% we need this as \Inline chokes on \let\macro=\relax |
| 640 |
% \expandafter\Inline\expandafter\def\csname#1bottompop\endcsname##1{% ##1 = receiving cs |
| 641 |
% \Expand{\csname#1ifempty\endcsname}{% |
| 642 |
% \forest@array@empty@error{#1}% |
| 643 |
% }{% |
| 644 |
% \letcs##1{#1\the\Expand{\csname#1M\endcsname}}% |
| 645 |
% \ExpandIfT{forest@temp}\global\advance\Expand{\csname#1M\endcsname 1}% |
| 646 |
% }% |
| 647 |
% }% |
| 648 |
% \csedef{#1bottompop}##1{% ##1 = receiving cs |
| 649 |
% \expandonce{\csname#1ifempty\endcsname}{% |
| 650 |
% \noexpand\forest@array@empty@error{#1}% |
| 651 |
% }{% |
| 652 |
% \noexpand\letcs\noexpand##1{#1\noexpand\the\expandonce{\csname#1M\endcsname}}% |
| 653 |
% \ifforest@temp\global\fi\advance\expandonce{\csname#1M\endcsname}1 |
| 654 |
% }% |
| 655 |
% }% |
| 656 |
\csedef{#1setappend}##1{% ##1 = definition |
| 657 |
\ifforest@temp\noexpand\csxdef\else\noexpand\csedef\fi |
| 658 |
{#1\noexpand\the\expandonce{\csname#1N\endcsname}}% |
| 659 |
{\noexpand\unexpanded{##1}}% |
| 660 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1N\endcsname}1 |
| 661 |
}% |
| 662 |
\csedef{#1setappend@}##1##2{% ##1 = continue by, ##2 = definition |
| 663 |
\ifforest@temp\noexpand\csxdef\else\noexpand\csedef\fi |
| 664 |
{#1\noexpand\the\expandonce{\csname#1N\endcsname}}% |
| 665 |
{\noexpand\unexpanded{##2}}% |
| 666 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1N\endcsname}1 |
| 667 |
##1% |
| 668 |
}% |
| 669 |
\csedef{#1setprepend}##1{% ##1 = definition |
| 670 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1M\endcsname}-1 |
| 671 |
\ifforest@temp\noexpand\csxdef\else\noexpand\csedef\fi |
| 672 |
{#1\noexpand\the\expandonce{\csname#1M\endcsname}}% |
| 673 |
{\noexpand\unexpanded{##1}}% |
| 674 |
}% |
| 675 |
\csedef{#1esetappend}##1{% ##1 = definition |
| 676 |
\ifforest@temp\noexpand\csxdef\else\noexpand\csedef\fi{#1\noexpand\the\expandonce{\csname#1N\endcsname}}{##1}% |
| 677 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1N\endcsname}1 |
| 678 |
}% |
| 679 |
\csedef{#1esetprepend}##1{% ##1 = definition |
| 680 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1M\endcsname}-1 |
| 681 |
\ifforest@temp\noexpand\csxdef\else\noexpand\csedef\fi{#1\noexpand\the\expandonce{\csname#1M\endcsname}}{##1}% |
| 682 |
}% |
| 683 |
\csedef{#1letappend}##1{% ##1 = cs |
| 684 |
\ifforest@temp\noexpand\expandafter\noexpand\global\fi\noexpand\expandafter\noexpand\let |
| 685 |
\noexpand\csname#1\noexpand\the\expandonce{\csname#1N\endcsname}\noexpand\endcsname |
| 686 |
##1% |
| 687 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1N\endcsname}1 |
| 688 |
}% |
| 689 |
\csedef{#1letprepend}##1{% ##1 = cs |
| 690 |
\ifforest@temp\global\fi\advance\expandonce{\csname#1M\endcsname}-1 |
| 691 |
\ifforest@temp\noexpand\expandafter\noexpand\global\fi\noexpand\expandafter\noexpand\let |
| 692 |
\noexpand\csname#1\noexpand\the\expandonce{\csname#1M\endcsname}\noexpand\endcsname |
| 693 |
##1% |
| 694 |
}% |
| 695 |
\csedef{#1values}{% |
| 696 |
\noexpand\expandafter\noexpand\expandafter\noexpand\expandafter\expandonce{\csname#1valuesfromrange\endcsname}% |
| 697 |
\noexpand\expandafter\noexpand\expandafter\noexpand\expandafter{% |
| 698 |
\noexpand\expandafter\noexpand\the |
| 699 |
\noexpand\expandafter\expandonce{\csname#1M\endcsname}% |
| 700 |
\noexpand\expandafter}% |
| 701 |
\noexpand\expandafter{\noexpand\the\expandonce{\csname#1N\endcsname}}% |
| 702 |
}% |
| 703 |
\csedef{#1valuesfromrange}##1##2{% ##1/##2 = lower/upper bounds (we receive them expanded) |
| 704 |
\noexpand\ifnum##1<##2 |
| 705 |
{\noexpand\expandafter\noexpand\expandonce\noexpand\expandafter{\noexpand\csname#1##1\noexpand\endcsname}}% here we add braces (for the general case, we might want an arbitrary prefix&suffix) |
| 706 |
\noexpand\expandafter\noexpand\@escapeif\noexpand\expandafter{\noexpand\expandafter\expandonce{\csname#1valuesfromrange\endcsname}% |
| 707 |
\noexpand\expandafter{\noexpand\number\noexpand\numexpr##1+1}{##2}}% |
| 708 |
\noexpand\fi |
| 709 |
}% |
| 710 |
\csdef{#1topextend}{\def\forest@array@currentarray{#1}\forest@array@topextend}% |
| 711 |
} |
| 712 |
\def\forest@array@topextend{\futurelet\forest@ate@next@token\forest@ate@checkforspace} |
| 713 |
\def\forest@ate@checkforspace{% |
| 714 |
\expandafter\ifx\space\forest@ate@next@token |
| 715 |
\expandafter\forest@ate@havespace |
| 716 |
\else |
| 717 |
\expandafter\forest@ate@checkforgroup |
| 718 |
\fi |
| 719 |
} |
| 720 |
\def\forest@ate@havespace{\expandafter\forest@array@topextend\romannumeral-`0}% |
| 721 |
\def\forest@ate@checkforgroup{% |
| 722 |
\ifx\forest@ate@next@token\bgroup |
| 723 |
\expandafter\forest@ate@appendgroup |
| 724 |
\else |
| 725 |
\expandafter\forest@ate@checkforeov |
| 726 |
\fi |
| 727 |
} |
| 728 |
\def\forest@ate@appendgroup{% |
| 729 |
\expandonce{\csname\forest@array@currentarray setappend@\endcsname}\forest@array@topextend |
| 730 |
} |
| 731 |
\def\forest@ate@checkforeov{% |
| 732 |
\ifx\forest@ate@next@token\forest@eov |
| 733 |
\expandafter\forest@ate@finish |
| 734 |
\else |
| 735 |
\expandafter\forest@ate@appendtoken |
| 736 |
\fi |
| 737 |
} |
| 738 |
\def\forest@ate@appendtoken#1{% |
| 739 |
\expandonce{\csname\forest@array@currentarray setappend\endcsname}{#1}% |
| 740 |
\forest@array@topextend |
| 741 |
} |
| 742 |
\def\forest@ate@finish\forest@eov{\forest@topextend@next} |
| 743 |
\let\forest@topextend@next\relax |
| 744 |
\forest@newarray\forest@temparray@ |
| 745 |
\forest@newglobalarray\forest@global@temparray@ |
| 746 |
\def\forest@eon{ } |
| 747 |
\newif\ifforest@isnum@minus |
| 748 |
\newif\ifforest@isnum |
| 749 |
\def\forest@isnum#1{% |
| 750 |
\forest@isnum@minusfalse |
| 751 |
\let\forest@isnum@next\forest@isnum@finish |
| 752 |
\edef\forest@isnum@temp{#1}% |
| 753 |
\expandafter\forest@isnum@a\forest@isnum@temp\forest@eon\forest@eon\forest@END |
| 754 |
\ifforest@isnum |
| 755 |
\expandafter\@firstoftwo |
| 756 |
\else |
| 757 |
\expandafter\@secondoftwo |
| 758 |
\fi |
| 759 |
} |
| 760 |
\def\forest@isnum@a{\futurelet\forest@isnum@token\forest@isnum@b} |
| 761 |
\def\forest@isnum@minustoggle{% |
| 762 |
\ifforest@isnum@minus\forest@isnum@minusfalse\else\forest@isnum@minustrue\fi |
| 763 |
} |
| 764 |
\def\forest@isnum@b{% |
| 765 |
\let\forest@next\forest@isnum@p |
| 766 |
\ifx-\forest@isnum@token |
| 767 |
\forest@isnum@minustoggle |
| 768 |
\let\forest@next\forest@isnum@c |
| 769 |
\else |
| 770 |
\ifx+\forest@isnum@token |
| 771 |
\let\forest@next\forest@isnum@c |
| 772 |
\else |
| 773 |
\expandafter\ifx\space\forest@isnum@token |
| 774 |
\let\forest@next\forest@isnum@s |
| 775 |
\fi |
| 776 |
\fi |
| 777 |
\fi |
| 778 |
\forest@next |
| 779 |
} |
| 780 |
\def\forest@isnum@c#1{\forest@isnum@a}% |
| 781 |
\def\forest@isnum@s#1{\forest@isnum@a#1}% |
| 782 |
\newcount\forest@isnum@count |
| 783 |
\def\forest@isnum@p{% |
| 784 |
\ifx0\forest@isnum@token |
| 785 |
\let\forest@next\forest@isnum@next |
| 786 |
\else |
| 787 |
\let\forest@next\forest@isnum@nz@ |
| 788 |
\fi |
| 789 |
\forest@isnumtrue |
| 790 |
\afterassignment\forest@isnum@q\forest@isnum@count\ifforest@isnum@minus-\fi0% |
| 791 |
} |
| 792 |
\def\forest@isnum@q{% |
| 793 |
\futurelet\forest@isnum@token\forest@next |
| 794 |
} |
| 795 |
\def\forest@isnum@nz@{% |
| 796 |
\ifnum\forest@isnum@count=0 |
| 797 |
\forest@isnumfalse |
| 798 |
\fi |
| 799 |
\forest@isnum@next |
| 800 |
} |
| 801 |
\def\forest@isnum@finish#1\forest@END{% |
| 802 |
\ifx\forest@isnum@token\forest@eon |
| 803 |
\else |
| 804 |
\forest@isnumfalse |
| 805 |
\fi |
| 806 |
} |
| 807 |
\newcount\forest@isdim@nonintpart |
| 808 |
\newif\ifforest@isdim |
| 809 |
\def\forest@isdim#1{% |
| 810 |
\forest@isdimfalse |
| 811 |
\forest@isnum@minusfalse |
| 812 |
\def\forest@isdim@leadingzeros{}% |
| 813 |
\forest@isdim@nonintpart=0 |
| 814 |
\def\forest@isdim@unit{pt}% |
| 815 |
\let\forest@isnum@next\forest@isdim@checkfordot |
| 816 |
\edef\forest@isnum@temp{#1}% |
| 817 |
\expandafter\forest@isnum@a\forest@isnum@temp\forest@eon\forest@eon\forest@eon\forest@eon\forest@END |
| 818 |
\ifforest@isdim |
| 819 |
\expandafter\@firstoftwo |
| 820 |
\else |
| 821 |
\expandafter\@secondoftwo |
| 822 |
\fi |
| 823 |
} |
| 824 |
\def\forest@isdim@checkfordot{% |
| 825 |
\ifx.\forest@isnum@token |
| 826 |
\expandafter\forest@isdim@dot |
| 827 |
\else |
| 828 |
\ifx,\forest@isnum@token |
| 829 |
\expandafter\expandafter\expandafter\forest@isdim@dot |
| 830 |
\else |
| 831 |
\expandafter\expandafter\expandafter\forest@isdim@nodot |
| 832 |
\fi |
| 833 |
\fi |
| 834 |
} |
| 835 |
\def\forest@isdim@nodot{% |
| 836 |
\ifforest@isnum |
| 837 |
\expandafter\forest@isdim@checkforunit |
| 838 |
\else |
| 839 |
\expandafter\forest@isdim@finish@nodim |
| 840 |
\fi |
| 841 |
} |
| 842 |
\def\forest@isdim@dot#1{% #1=. or , |
| 843 |
\futurelet\forest@isnum@token\forest@isdim@collectzero |
| 844 |
} |
| 845 |
\def\forest@isdim@collectzero{% |
| 846 |
\ifx0\forest@isnum@token |
| 847 |
\expandafter\forest@isdim@collectzero@ |
| 848 |
\else |
| 849 |
\expandafter\forest@isdim@getnonintpart |
| 850 |
\fi |
| 851 |
} |
| 852 |
\def\forest@isdim@collectzero@#1{% #1 = 0 |
| 853 |
\appto\forest@isdim@leadingzeros{0}% |
| 854 |
\futurelet\forest@isnum@token\forest@isdim@collectzero |
| 855 |
} |
| 856 |
\def\forest@isdim@getnonintpart{% |
| 857 |
\afterassignment\forest@isdim@checkforunit\forest@isdim@nonintpart0% |
| 858 |
} |
| 859 |
\def\forest@def@unit#1{\csdef{forest@unit@#1}{#1}} |
| 860 |
\forest@def@unit{em} |
| 861 |
\forest@def@unit{ex} |
| 862 |
\forest@def@unit{pt} |
| 863 |
\forest@def@unit{pc} |
| 864 |
\forest@def@unit{in} |
| 865 |
\forest@def@unit{bp} |
| 866 |
\forest@def@unit{cm} |
| 867 |
\forest@def@unit{mm} |
| 868 |
\forest@def@unit{dd} |
| 869 |
\forest@def@unit{cc} |
| 870 |
\forest@def@unit{sp} |
| 871 |
\def\forest@isdim@checkforunit#1#2{% |
| 872 |
\lowercase{\edef\forest@isnum@temp{\detokenize{#1#2}}}% |
| 873 |
\ifcsname forest@unit@\forest@isnum@temp\endcsname |
| 874 |
\let\forest@isdim@next\forest@isdim@finish@dim |
| 875 |
\edef\forest@isdim@unit{\csname forest@unit@\forest@isnum@temp\endcsname}% |
| 876 |
\else |
| 877 |
\ifx#1\forest@eon |
| 878 |
\let\forest@isdim@next\forest@isdim@finish@dim |
| 879 |
\else |
| 880 |
\let\forest@isdim@next\forest@isdim@finish@nodim |
| 881 |
\fi |
| 882 |
\fi |
| 883 |
\forest@isdim@next |
| 884 |
} |
| 885 |
\def\forest@isdim@finish@dim{% |
| 886 |
\futurelet\forest@isnum@token\forest@isdim@finish@dim@a |
| 887 |
} |
| 888 |
\def\forest@isdim@finish@dim@a{% |
| 889 |
\expandafter\ifx\space\forest@isnum@token |
| 890 |
\expandafter\forest@isdim@finish@dim@b |
| 891 |
\else |
| 892 |
\expandafter\forest@isdim@finish@dim@c |
| 893 |
\fi |
| 894 |
} |
| 895 |
\expandafter\def\expandafter\forest@isdim@finish@dim@b\space{% eat one space |
| 896 |
\futurelet\forest@isnum@token\forest@isdim@finish@dim@c |
| 897 |
} |
| 898 |
\def\forest@isdim@finish@dim@c#1\forest@END{% |
| 899 |
\ifx\forest@isnum@token\forest@eon |
| 900 |
\forest@isdimtrue |
| 901 |
\forest@isdim@dimen\the\forest@isnum@count.\forest@isdim@leadingzeros\the\forest@isdim@nonintpart\forest@isdim@unit\relax |
| 902 |
\else |
| 903 |
\forest@isdimfalse |
| 904 |
\fi |
| 905 |
} |
| 906 |
\def\forest@isdim@finish@nodim#1\forest@END{% |
| 907 |
\forest@isdimfalse |
| 908 |
} |
| 909 |
\newdimen\forest@isdim@dimen |
| 910 |
% \long\def\@firstofthree#1#2#3{#3} % defined by LaTeX |
| 911 |
\long\def\@firstofthree#1#2#3{#1} |
| 912 |
\long\def\@secondofthree#1#2#3{#2} |
| 913 |
\def\forest@isnumdim#1{% |
| 914 |
\forest@isdim{#1}{% |
| 915 |
\forest@isnumdim@ |
| 916 |
}{% |
| 917 |
\@thirdofthree |
| 918 |
}% |
| 919 |
} |
| 920 |
\def\forest@isnumdim@{% |
| 921 |
\ifforest@isnum |
| 922 |
\expandafter\@firstofthree |
| 923 |
\else |
| 924 |
\expandafter\@secondofthree |
| 925 |
\fi |
| 926 |
} |
| 927 |
\def\forestmathtype@generic{_} % generic (token list) |
| 928 |
\def\forestmathtype@count{n} % integer |
| 929 |
\def\forestmathtype@dimen{d} % a dimension: <decimal> pt |
| 930 |
\def\forestmathtype@unitless{P} % <decimal> (a unitless dimension) (P because pgfmath returns such numbers) |
| 931 |
\def\forestmathtype@textasc{t} % text (ascending) |
| 932 |
\def\forestmathtype@textdesc{T} % text (descending) |
| 933 |
\def\forestmathtype@none{} % internal (for requests - means whatever) |
| 934 |
\def\forestmathresult{} |
| 935 |
\let\forestmathresulttype\forestmathtype@generic |
| 936 |
\def\forest@tryprocess#1{% |
| 937 |
\def\forest@tryprocess@returnarray{#1}% |
| 938 |
\expandafter\forest@tryprocess@a\romannumeral-`0} |
| 939 |
\def\forest@tryprocess@a{\futurelet\forest@temp@token\forest@tryprocess@b} |
| 940 |
\def\forest@tryprocess@b{% |
| 941 |
\ifx>\forest@temp@token |
| 942 |
\expandafter\forest@tryprocess@yes |
| 943 |
\else |
| 944 |
\expandafter\forest@tryprocess@no |
| 945 |
\fi |
| 946 |
} |
| 947 |
\def\forest@spacegen{ \forest@spacegen} |
| 948 |
\def\forest@tryprocess@yes#1#2\forest@spacegen{% |
| 949 |
\expandafter\forest@process\expandafter{\forest@tryprocess@returnarray}#2\forest@eov |
| 950 |
\@firstoftwo |
| 951 |
} |
| 952 |
\def\forest@tryprocess@no#1\forest@spacegen{\@secondoftwo} |
| 953 |
\def\forestmathsetcount#1#2{% |
| 954 |
\forest@tryprocess{false}#2\forest@spacegen{% |
| 955 |
#1=\forest@process@result\relax |
| 956 |
}{% |
| 957 |
\forestmathsetcount@#1{#2}% |
| 958 |
}% |
| 959 |
} |
| 960 |
\def\forestmathsetcount@#1#2{% |
| 961 |
\forest@isnum{#2}{% |
| 962 |
#1=\forest@isnum@count |
| 963 |
}{% |
| 964 |
\pgfmathsetcount#1{#2}% |
| 965 |
}% |
| 966 |
} |
| 967 |
\def\forestmathsetlength#1#2{% |
| 968 |
\forest@tryprocess{false}#2\forest@spacegen{% |
| 969 |
#1=\forest@process@result\relax |
| 970 |
}{% |
| 971 |
\forestmathsetlength@#1{#2}% |
| 972 |
}% |
| 973 |
} |
| 974 |
\def\forestmathsetlength@#1#2{% |
| 975 |
\forest@isdim{#2}{% |
| 976 |
#1=\forest@isdim@dimen |
| 977 |
}{% |
| 978 |
\pgfmathsetlength#1{#2}% |
| 979 |
}% |
| 980 |
} |
| 981 |
\def\forestmathtruncatemacro#1#2{% |
| 982 |
\forest@tryprocess{false}#2\forest@spacegen{% |
| 983 |
\forest@temp@count=\forest@process@result\relax |
| 984 |
\edef#1{\the\forest@temp@count}% |
| 985 |
}{% |
| 986 |
\forestmathtruncatemacro@#1{#2}% |
| 987 |
}% |
| 988 |
} |
| 989 |
\def\forestmathtruncatemacro@#1#2{% |
| 990 |
\forest@isnum{#2}{% |
| 991 |
\edef#1{\the\forest@isnum@count}% |
| 992 |
}{% |
| 993 |
\pgfmathtruncatemacro#1{#2}% |
| 994 |
}% |
| 995 |
} |
| 996 |
\def\forestmathsetlengthmacro#1#2{% |
| 997 |
\forest@tryprocess{false}#2\forest@spacegen{% |
| 998 |
\forest@temp@dimen=\forest@process@result\relax |
| 999 |
\edef#1{\the\forest@temp@dimen}% |
| 1000 |
}{% |
| 1001 |
\forestmathsetlengthmacro@#1{#2}% |
| 1002 |
}% |
| 1003 |
} |
| 1004 |
\def\forestmathsetlengthmacro@#1#2{% |
| 1005 |
\forest@isdim{#2}{% |
| 1006 |
\edef#1{\the\forest@isdim@dimen}% |
| 1007 |
}{% |
| 1008 |
\pgfmathsetlengthmacro#1{#2}% |
| 1009 |
}% |
| 1010 |
} |
| 1011 |
\def\forestmathsetmacro#1#2{% |
| 1012 |
\forest@tryprocess{false}#2\forest@spacegen{% |
| 1013 |
\let#1\forest@process@result |
| 1014 |
\let\forestmathresulttype\forest@process@result@type |
| 1015 |
}{% |
| 1016 |
\forestmathsetmacro@#1{#2}% |
| 1017 |
\let\forestmathresulttype\forestmathtype@unitless |
| 1018 |
}% |
| 1019 |
} |
| 1020 |
\def\forestmathsetmacro@#1#2{% |
| 1021 |
\forest@isdim{#2}{% |
| 1022 |
\edef#1{\expandafter\Pgf@geT\the\forest@isdim@dimen}% |
| 1023 |
}{% |
| 1024 |
\pgfmathsetmacro#1{#2}% |
| 1025 |
}% |
| 1026 |
} |
| 1027 |
\def\forestmathparse#1{% |
| 1028 |
\forest@tryprocess{false}#1\forest@spacegen{% |
| 1029 |
\let\forestmathresult\forest@process@result |
| 1030 |
\let\forestmathresulttype\forest@process@result@type |
| 1031 |
}{% |
| 1032 |
\forestmathparse@{#1}% |
| 1033 |
\let\forestmathresulttype\forestmathtype@unitless |
| 1034 |
}% |
| 1035 |
} |
| 1036 |
\def\forestmathparse@#1{% |
| 1037 |
\forest@isdim{#1}{% |
| 1038 |
\edef\forestmathresult{\expandafter\Pgf@geT\the\forest@isdim@dimen}% |
| 1039 |
}{% |
| 1040 |
\pgfmathsetmacro\forestmathresult{#1}% |
| 1041 |
}% |
| 1042 |
} |
| 1043 |
%\def\forestmathparse@returnarray#1{% same as above, but returns the result as an array (used only internally) |
| 1044 |
% \forest@tryprocess{true}#1\forest@spacegen{}{% |
| 1045 |
% \forestmathparse@{#1}% |
| 1046 |
% \let\forest@process@result@type\forestmathtype@unitless |
| 1047 |
% \forest@process@result@clear |
| 1048 |
% \forest@process@result@letappend\forestmathresult |
| 1049 |
% }% |
| 1050 |
%} |
| 1051 |
\csdef{forest@bh@0}{0} |
| 1052 |
\csdef{forest@bh@false}{0} |
| 1053 |
\csdef{forest@bh@1}{1} |
| 1054 |
\csdef{forest@bh@true}{1} |
| 1055 |
\def\forestmath@if#1{% |
| 1056 |
\ifcsdef{forest@bh@\detokenize{#1}}{% |
| 1057 |
\let\forest@next\forestmath@if@fast |
| 1058 |
}{% |
| 1059 |
\let\forest@next\forestmath@if@slow |
| 1060 |
}% |
| 1061 |
\forest@next{#1}% |
| 1062 |
\ifnum\forest@temp=0 |
| 1063 |
\expandafter\@secondoftwo |
| 1064 |
\else |
| 1065 |
\expandafter\@firstoftwo |
| 1066 |
\fi |
| 1067 |
} |
| 1068 |
\def\forestmath@if@fast#1{\letcs\forest@temp{forest@bh@\detokenize{#1}}} |
| 1069 |
\def\forestmath@if@slow#1{\forestmathtruncatemacro\forest@temp{#1}} |
| 1070 |
\def\forestmath@convert@fromto#1#2#3{% |
| 1071 |
\edef\forestmathresult{\csname forestmath@convert@from@#1@to@#2\endcsname{#3}}} |
| 1072 |
\def\forestmath@convert@from#1{\forestmath@convert@fromto{#1}{\forestmathresulttype}} |
| 1073 |
\def\forestmath@convert@to{\forestmath@convert@fromto{\forestmathresulttype}} |
| 1074 |
\def\forestmath@convert@from@n@to@n#1{#1} |
| 1075 |
\def\forestmath@convert@from@n@to@d#1{#1\pgfmath@pt} |
| 1076 |
\def\forestmath@convert@from@n@to@P#1{#1} |
| 1077 |
\def\forestmath@convert@from@d@to@n#1{% |
| 1078 |
\expandafter\forestmath@convert@uptodot\Pgf@geT#1.\forest@eov} |
| 1079 |
\def\forestmath@convert@from@d@to@d#1{#1} |
| 1080 |
\def\forestmath@convert@from@d@to@P#1{\Pgf@geT#1} |
| 1081 |
\def\forestmath@convert@from@P@to@n#1{% |
| 1082 |
\forestmath@convert@uptodot#1.\forest@eov} |
| 1083 |
\def\forestmath@convert@from@P@to@d#1{#1\pgfmath@pt} |
| 1084 |
\def\forestmath@convert@from@P@to@P#1{#1} |
| 1085 |
\def\forestmath@convert@uptodot#1.#2\forest@eov{#1} |
| 1086 |
\def\forestmathzero{\forestmath@convert@from\forestmathtype@count{0}} |
| 1087 |
\csdef{forestmath@convert@from@n@to@_}#1{\unexpanded{#1}} |
| 1088 |
\csdef{forestmath@convert@from@d@to@_}#1{\unexpanded{#1}} |
| 1089 |
\csdef{forestmath@convert@from@P@to@_}#1{\unexpanded{#1}} |
| 1090 |
\def\forestmathsettypefrom#1{% |
| 1091 |
\forest@isnumdim{% |
| 1092 |
\let\forestmathresulttype\forestmathtype@count |
| 1093 |
}{% |
| 1094 |
\let\forestmathresulttype\forestmathtype@dimen |
| 1095 |
}{% |
| 1096 |
\let\forestmathresulttype\forestmathtype@unitless |
| 1097 |
}% |
| 1098 |
} |
| 1099 |
\def\forestmathadd#1#2{\edef\forestmathresult{% |
| 1100 |
\csname forestmathadd@\forestmathresulttype\endcsname{#1}{#2}}} |
| 1101 |
\def\forestmathadd@#1#2#3{\edef\forestmathresult{% |
| 1102 |
\csname forestmathadd@#1\endcsname{#2}{#3}}} |
| 1103 |
\def\forestmathadd@n#1#2{\the\numexpr#1+#2\relax} |
| 1104 |
\def\forestmathadd@d#1#2{\the\dimexpr#1+#2\relax} |
| 1105 |
\def\forestmathadd@P#1#2{\expandafter\Pgf@geT\the\dimexpr#1pt+#2pt\relax} |
| 1106 |
\def\forestmathmultiply#1#2{% |
| 1107 |
\csname forestmathmultiply@\forestmathresulttype\endcsname{#1}{#2}} |
| 1108 |
\def\forestmathmultiply@#1#2#3{% |
| 1109 |
\csname forestmathmultiply@#1\endcsname{#2}{#3}} |
| 1110 |
\def\forestmathmultiply@n#1#2{\edef\forestmathresult{% |
| 1111 |
\the\numexpr#1*#2\relax}} |
| 1112 |
\def\forestmathmultiply@d#1#2{% |
| 1113 |
\edef\forestmath@marshal{\forestmathmultiply@d@{#1}{#2}}\forestmath@marshal |
| 1114 |
} |
| 1115 |
\def\forestmathmultiply@d@#1#2{% |
| 1116 |
\edef\forestmath@marshal{% |
| 1117 |
\noexpand\pgfmathmultiply@{\Pgf@geT#1}{\Pgf@geT#2}% |
| 1118 |
}\forestmath@marshal |
| 1119 |
\edef\forestmathresult{\pgfmathresult\pgfmath@pt}% |
| 1120 |
} |
| 1121 |
\def\forestmathmultiply@P#1#2{% |
| 1122 |
\pgfmathmultiply@{#1}{#2}% |
| 1123 |
\let\forestmathresult\pgfmathresult |
| 1124 |
} |
| 1125 |
\def\forestmathdivide#1#2{% |
| 1126 |
\csname forestmathdivide@\forestmathresulttype\endcsname{#1}{#2}} |
| 1127 |
\def\forestmathdivide@#1#2#3{% |
| 1128 |
\csname forestmathdivide@#1\endcsname{#2}{#3}} |
| 1129 |
\def\forestmathdivide@n#1#2{\edef\forestmathresult{% |
| 1130 |
\the\numexpr#1/#2\relax}} |
| 1131 |
\def\forestmathdivide@d#1#2{\edef\forestmathresult{% |
| 1132 |
\the\dimexpr#1/#2\relax}} |
| 1133 |
\def\forestmathdivide@P#1#2{% |
| 1134 |
\edef\forest@marshal{% |
| 1135 |
\noexpand\pgfmathdivide{+#1}{+#2}% |
| 1136 |
}\forest@marshal |
| 1137 |
\let\forestmathresult\pgfmathresult |
| 1138 |
} |
| 1139 |
\def\forestmathtrue{% |
| 1140 |
\def\forestmathresult{1}% |
| 1141 |
\let\forestmathresulttype\forestmathtype@count} |
| 1142 |
\def\forestmathfalse{% |
| 1143 |
\def\forestmathresult{0}% |
| 1144 |
\let\forestmathresulttype\forestmathtype@count} |
| 1145 |
\def\forestmath@if@lt@n#1#2{\ifnum#1<#2\relax |
| 1146 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1147 |
\def\forestmath@if@lt@d#1#2{\ifdim#1<#2\relax |
| 1148 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1149 |
\def\forestmath@if@lt@P#1#2{\ifdim#1pt<#2pt |
| 1150 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1151 |
\def\forestmath@if@lt@t#1#2{\ifnum\pdfstrcmp{#1}{#2}<0 |
| 1152 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1153 |
\def\forestmath@if@lt@T#1#2{\ifnum\pdfstrcmp{#1}{#2}>0 |
| 1154 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1155 |
\def\forest@cmp@error#1#2{\PackageError{forest}{Comparison |
| 1156 |
("<" or ">") of generic type arguments "#1" and "#2" |
| 1157 |
makes no sense}{Use one of argument processor instructions |
| 1158 |
"n", "d", "P" or "t" to change the type. Use package option |
| 1159 |
"debug=process" to see what's happening here.}} |
| 1160 |
\cslet{forestmath@if@lt@_}\forest@cmp@error |
| 1161 |
\def\forestmath@if@eq@n#1#2{\ifnum#1=#2\relax |
| 1162 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1163 |
\def\forestmath@if@eq@d#1#2{\ifdim#1=#2\relax |
| 1164 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1165 |
\def\forestmath@if@eq@P#1#2{\ifdim#1pt=#2pt |
| 1166 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1167 |
\def\forestmath@if@eq@t#1#2{\ifnum\pdfstrcmp{#1}{#2}=0 |
| 1168 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1169 |
\let\forestmath@if@eq@T\forestmath@if@eq@t |
| 1170 |
\csdef{forestmath@if@eq@_}#1#2{% |
| 1171 |
\def\forestmath@tempa{#1}% |
| 1172 |
\def\forestmath@tempb{#2}% |
| 1173 |
\ifx\forestmath@tempa\forestmath@tempb |
| 1174 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1175 |
\def\forestmathlt#1#2{% |
| 1176 |
\csname forestmath@if@lt@\forestmathresulttype\endcsname{#1}{#2}% |
| 1177 |
\forestmathtrue |
| 1178 |
\forestmathfalse} |
| 1179 |
\def\forestmathlt@#1#2#3{% |
| 1180 |
\csname forestmath@if@lt@#1\endcsname{#2}{#3}% |
| 1181 |
\forestmathtrue |
| 1182 |
\forestmathfalse} |
| 1183 |
\def\forestmathgt#1#2{% |
| 1184 |
\csname forestmath@if@lt@\forestmathresulttype\endcsname{#2}{#1}% |
| 1185 |
\forestmathtrue |
| 1186 |
\forestmathfalse} |
| 1187 |
\def\forestmathgt@#1#2#3{% |
| 1188 |
\csname forestmath@if@lt@#1\endcsname{#3}{#2}% |
| 1189 |
\forestmathtrue |
| 1190 |
\forestmathfalse} |
| 1191 |
\def\forestmatheq#1#2{% |
| 1192 |
\csname forestmath@if@eq@\forestmathresulttype\endcsname{#1}{#2}% |
| 1193 |
\forestmathtrue |
| 1194 |
\forestmathfalse} |
| 1195 |
\def\forestmatheq@#1#2#3{% |
| 1196 |
\csname forestmath@if@eq@#1\endcsname{#2}{#3}% |
| 1197 |
\forestmathtrue |
| 1198 |
\forestmathfalse} |
| 1199 |
\def\forestmathmin{\forestmath@minmax{min}{\forestmathresulttype}} |
| 1200 |
\def\forestmathmax{\forestmath@minmax{max}{\forestmathresulttype}} |
| 1201 |
\def\forestmathmin@{\forestmath@minmax{min}} |
| 1202 |
\def\forestmathmax@{\forestmath@minmax{max}} |
| 1203 |
\def\forestmath@minmax#1#2#3#4{% #1=min/max, #2=type, #3,#4=args |
| 1204 |
\edef\forestmath@tempa{#3}% |
| 1205 |
\edef\forestmath@tempb{#4}% |
| 1206 |
\if\relax\detokenize\expandafter{\forestmath@tempa}\relax |
| 1207 |
\forestmath@minmax@one{#1}{#2}\forestmath@tempb |
| 1208 |
\else |
| 1209 |
\if\relax\detokenize\expandafter{\forestmath@tempb}\relax |
| 1210 |
\forestmath@minmax@one{#1}{#2}\forestmath@tempa |
| 1211 |
\else |
| 1212 |
\csname forestmath@#1\endcsname{#2}% |
| 1213 |
\fi |
| 1214 |
\fi |
| 1215 |
} |
| 1216 |
\def\forestmath@minmax@one#1#2#3{% #1=min/max, #2=type, #3 = the (possibly) non-empty arg |
| 1217 |
\ifcsname forestmath@#1@one@#2\endcsname |
| 1218 |
\csname forestmath@#1@one@#2\endcsname#3% |
| 1219 |
\else |
| 1220 |
\let\forestmathresult#3% |
| 1221 |
\fi |
| 1222 |
} |
| 1223 |
\def\forestmath@min@one@t#1{\let\forestmathresult\forest@empty} |
| 1224 |
\def\forestmath@max@one@t#1{\let\forestmathresult#1} |
| 1225 |
\def\forestmath@min@one@T#1{\let\forestmathresult#1} |
| 1226 |
\def\forestmath@max@one@T#1{\let\forestmathresult\forest@empty} |
| 1227 |
|
| 1228 |
\def\forestmath@min#1{% #1 = type |
| 1229 |
\csname forestmath@if@lt@#1\endcsname\forestmath@tempa\forestmath@tempb |
| 1230 |
{\let\forestmathresult\forestmath@tempa}% |
| 1231 |
{\let\forestmathresult\forestmath@tempb}% |
| 1232 |
} |
| 1233 |
\def\forestmath@max#1{% #1 = type |
| 1234 |
\csname forestmath@if@lt@#1\endcsname\forestmath@tempa\forestmath@tempb |
| 1235 |
{\let\forestmathresult\forestmath@tempb}% |
| 1236 |
{\let\forestmathresult\forestmath@tempa}% |
| 1237 |
} |
| 1238 |
\def\forest@sort#1#2#3#4#5{% |
| 1239 |
\let\forest@sort@cmp#1\relax |
| 1240 |
\let\forest@sort@let#2\relax |
| 1241 |
\let\forest@sort@direction#3\relax |
| 1242 |
\forest@@sort{#4}{#5}% |
| 1243 |
} |
| 1244 |
\def\forest@quicksort@minarraylength{10000} |
| 1245 |
\def\forest@@sort#1#2{% |
| 1246 |
\ifnum#1<#2\relax\@escapeif{% |
| 1247 |
\forest@sort@m=#2 |
| 1248 |
\advance\forest@sort@m -#1 |
| 1249 |
\ifnum\forest@sort@m>\forest@quicksort@minarraylength\relax\@escapeif{% |
| 1250 |
\forest@quicksort{#1}{#2}% |
| 1251 |
}\else\@escapeif{% |
| 1252 |
\forest@insertionsort{#1}{#2}% |
| 1253 |
}\fi |
| 1254 |
}\fi |
| 1255 |
} |
| 1256 |
\newcount\forest@sort@m\newcount\forest@sort@k\newcount\forest@sort@p |
| 1257 |
\def\forest@sort@ascending{>} |
| 1258 |
\def\forest@sort@descending{<} |
| 1259 |
\def\forest@sort@cmp{% |
| 1260 |
\PackageError{sort}{You must define forest@sort@cmp function before calling |
| 1261 |
sort}{The macro must take two arguments, indices of the array |
| 1262 |
elements to be compared, and return '=' if the elements are equal |
| 1263 |
and '>'/'<' if the first is greater /less than the secong element.}% |
| 1264 |
} |
| 1265 |
\def\forest@sort@cmp@gt{\def\forest@sort@cmp@result{>}} |
| 1266 |
\def\forest@sort@cmp@lt{\def\forest@sort@cmp@result{<}} |
| 1267 |
\def\forest@sort@cmp@eq{\def\forest@sort@cmp@result{=}} |
| 1268 |
\def\forest@sort@let{% |
| 1269 |
\PackageError{sort}{You must define forest@sort@let function before calling |
| 1270 |
sort}{The macro must take two arguments, indices of the array: |
| 1271 |
element 2 must be copied onto element 1.}% |
| 1272 |
} |
| 1273 |
\newloop\forest@sort@loop |
| 1274 |
\newloop\forest@sort@loopA |
| 1275 |
\def\forest@quicksort#1#2{% |
| 1276 |
\forest@sort@m=#2 |
| 1277 |
\advance\forest@sort@m -#1 |
| 1278 |
\ifodd\forest@sort@m\relax\advance\forest@sort@m1 \fi |
| 1279 |
\divide\forest@sort@m 2 |
| 1280 |
\advance\forest@sort@m #1 |
| 1281 |
\forest@sort@cmp{#1}{#2}% |
| 1282 |
\if\forest@sort@cmp@result=% |
| 1283 |
\forest@sort@p=#1 |
| 1284 |
\else |
| 1285 |
\if\forest@sort@cmp@result>% |
| 1286 |
\forest@sort@p=#1\relax |
| 1287 |
\else |
| 1288 |
\forest@sort@p=#2\relax |
| 1289 |
\fi |
| 1290 |
\forest@sort@cmp{\the\forest@sort@p}{\the\forest@sort@m}% |
| 1291 |
\if\forest@sort@cmp@result<% |
| 1292 |
\else |
| 1293 |
\forest@sort@p=\the\forest@sort@m |
| 1294 |
\fi |
| 1295 |
\fi |
| 1296 |
\forest@sort@xch{#1}{\the\forest@sort@p}% |
| 1297 |
\forest@sort@m=#1\relax |
| 1298 |
\forest@sort@k=#1\relax |
| 1299 |
\forest@sort@loop |
| 1300 |
\ifnum\forest@sort@k<#2\relax |
| 1301 |
\advance\forest@sort@k 1 |
| 1302 |
\forest@sort@cmp{#1}{\the\forest@sort@k}% |
| 1303 |
\ifx\forest@sort@direction\forest@sort@cmp@result |
| 1304 |
\advance\forest@sort@m 1 |
| 1305 |
\forest@sort@xch{\the\forest@sort@m}{\the\forest@sort@k} |
| 1306 |
\fi |
| 1307 |
\forest@sort@repeat |
| 1308 |
\forest@sort@xch{#1}{\the\forest@sort@m}% |
| 1309 |
\forest@sort@k=\forest@sort@m |
| 1310 |
\advance\forest@sort@k -1 |
| 1311 |
\advance\forest@sort@m 1 |
| 1312 |
\edef\forest@sort@marshal{% |
| 1313 |
\noexpand\forest@@sort{#1}{\the\forest@sort@k}% |
| 1314 |
\noexpand\forest@@sort{\the\forest@sort@m}{#2}% |
| 1315 |
}% |
| 1316 |
\forest@sort@marshal |
| 1317 |
} |
| 1318 |
\def\forest@sort@aux{aux} |
| 1319 |
\def\forest@sort@xch#1#2{% |
| 1320 |
\forest@sort@let{\forest@sort@aux}{#1}% |
| 1321 |
\forest@sort@let{#1}{#2}% |
| 1322 |
\forest@sort@let{#2}{\forest@sort@aux}% |
| 1323 |
} |
| 1324 |
\def\forest@insertionsort#1#2{% |
| 1325 |
\forest@sort@m=#1 |
| 1326 |
\edef\forest@insertionsort@low{#1}% |
| 1327 |
\forest@sort@loopA |
| 1328 |
\ifnum\forest@sort@m<#2 |
| 1329 |
\advance\forest@sort@m 1 |
| 1330 |
\forest@insertionsort@Qbody |
| 1331 |
\forest@sort@repeatA |
| 1332 |
} |
| 1333 |
\newif\ifforest@insertionsort@loop |
| 1334 |
\def\forest@insertionsort@Qbody{% |
| 1335 |
\forest@sort@let{\forest@sort@aux}{\the\forest@sort@m}% |
| 1336 |
\forest@sort@k\forest@sort@m |
| 1337 |
\advance\forest@sort@k -1 |
| 1338 |
\forest@insertionsort@looptrue |
| 1339 |
\forest@sort@loop |
| 1340 |
\ifforest@insertionsort@loop |
| 1341 |
\forest@insertionsort@qbody |
| 1342 |
\forest@sort@repeat |
| 1343 |
\advance\forest@sort@k 1 |
| 1344 |
\forest@sort@let{\the\forest@sort@k}{\forest@sort@aux}% |
| 1345 |
} |
| 1346 |
\def\forest@insertionsort@qbody{% |
| 1347 |
\forest@sort@cmp{\the\forest@sort@k}{\forest@sort@aux}% |
| 1348 |
\ifx\forest@sort@direction\forest@sort@cmp@result\relax |
| 1349 |
\forest@sort@p=\forest@sort@k |
| 1350 |
\advance\forest@sort@p 1 |
| 1351 |
\forest@sort@let{\the\forest@sort@p}{\the\forest@sort@k}% |
| 1352 |
\advance\forest@sort@k -1 |
| 1353 |
\ifnum\forest@sort@k<\forest@insertionsort@low\relax |
| 1354 |
\forest@insertionsort@loopfalse |
| 1355 |
\fi |
| 1356 |
\else |
| 1357 |
\forest@insertionsort@loopfalse |
| 1358 |
\fi |
| 1359 |
} |
| 1360 |
\def\forest@sort@cmpnumcs#1#2{% |
| 1361 |
\ifnum\csname#1\endcsname>\csname#2\endcsname\relax |
| 1362 |
\forest@sort@cmp@gt |
| 1363 |
\else |
| 1364 |
\ifnum\csname#1\endcsname<\csname#2\endcsname\relax |
| 1365 |
\forest@sort@cmp@lt |
| 1366 |
\else |
| 1367 |
\forest@sort@cmp@eq |
| 1368 |
\fi |
| 1369 |
\fi |
| 1370 |
} |
| 1371 |
\def\forest@sort@cmpdimcs#1#2{% |
| 1372 |
\ifdim\csname#1\endcsname>\csname#2\endcsname\relax |
| 1373 |
\forest@sort@cmp@gt |
| 1374 |
\else |
| 1375 |
\ifdim\csname#1\endcsname<\csname#2\endcsname\relax |
| 1376 |
\forest@sort@cmp@lt |
| 1377 |
\else |
| 1378 |
\forest@sort@cmp@eq |
| 1379 |
\fi |
| 1380 |
\fi |
| 1381 |
} |
| 1382 |
\def\forest@sort@cmptwodimcs#1#2#3#4{% |
| 1383 |
\ifdim\csname#1\endcsname>\csname#3\endcsname\relax |
| 1384 |
\forest@sort@cmp@gt |
| 1385 |
\else |
| 1386 |
\ifdim\csname#1\endcsname<\csname#3\endcsname\relax |
| 1387 |
\forest@sort@cmp@lt |
| 1388 |
\else |
| 1389 |
\ifdim\csname#2\endcsname>\csname#4\endcsname\relax |
| 1390 |
\forest@sort@cmp@gt |
| 1391 |
\else |
| 1392 |
\ifdim\csname#2\endcsname<\csname#4\endcsname\relax |
| 1393 |
\forest@sort@cmp@lt |
| 1394 |
\else |
| 1395 |
\forest@sort@cmp@eq |
| 1396 |
\fi |
| 1397 |
\fi |
| 1398 |
\fi |
| 1399 |
\fi |
| 1400 |
} |
| 1401 |
\def\forest@reversearray#1#2#3{% |
| 1402 |
\let\forest@sort@let#1% |
| 1403 |
\c@pgf@countc=#2 |
| 1404 |
\c@pgf@countd=#3 |
| 1405 |
\advance\c@pgf@countd -1 |
| 1406 |
\safeloop |
| 1407 |
\ifnum\c@pgf@countc<\c@pgf@countd\relax |
| 1408 |
\forest@sort@xch{\the\c@pgf@countc}{\the\c@pgf@countd}% |
| 1409 |
\advance\c@pgf@countc 1 |
| 1410 |
\advance\c@pgf@countd -1 |
| 1411 |
\saferepeat |
| 1412 |
} |
| 1413 |
\def\bracketset#1{\pgfqkeys{/bracket}{#1}}% |
| 1414 |
\bracketset{% |
| 1415 |
/bracket/.is family, |
| 1416 |
/handlers/.let/.style={\pgfkeyscurrentpath/.code={\let#1##1}}, |
| 1417 |
opening bracket/.let=\bracket@openingBracket, |
| 1418 |
closing bracket/.let=\bracket@closingBracket, |
| 1419 |
action character/.let=\bracket@actionCharacter, |
| 1420 |
opening bracket=[, |
| 1421 |
closing bracket=], |
| 1422 |
action character, |
| 1423 |
new node/.code n args={3}{% #1=preamble, #2=node spec, #3=cs receiving the id |
| 1424 |
\forest@node@new#3% |
| 1425 |
\forestOeset{#3}{given options}{\forest@contentto=\unexpanded{#2}}% |
| 1426 |
\ifblank{#1}{}{% |
| 1427 |
\forestrset{preamble}{#1}% |
| 1428 |
}% |
| 1429 |
}, |
| 1430 |
set afterthought/.code 2 args={% #1=node id, #2=afterthought |
| 1431 |
\ifblank{#2}{}{\forestOappto{#1}{given options}{,afterthought={#2}}}% |
| 1432 |
} |
| 1433 |
} |
| 1434 |
\newtoks\bracket@content |
| 1435 |
\newtoks\bracket@afterthought |
| 1436 |
\def\bracketParse#1#2={% |
| 1437 |
\def\bracketEndParsingHook{#1}% |
| 1438 |
\def\bracket@saveRootNodeTo{#2}% |
| 1439 |
\bracket@content={}% |
| 1440 |
\bracket@afterthought={}% |
| 1441 |
\let\bracket@state\bracket@state@starting |
| 1442 |
\bracket@ignorespacestrue |
| 1443 |
\bracket@expandtokensfalse |
| 1444 |
\def\bracket@parentNode{0}% |
| 1445 |
\def\bracket@rootNode{0}% |
| 1446 |
\def\bracket@newNode{0}% |
| 1447 |
\def\bracket@afterthoughtNode{0}% |
| 1448 |
\bracket@Parse |
| 1449 |
} |
| 1450 |
\def\bracketResume{\bracket@Parse}% |
| 1451 |
\def\bracket@Parse{% |
| 1452 |
\futurelet\bracket@next@token\bracket@Parse@checkForSpace |
| 1453 |
} |
| 1454 |
\def\bracket@Parse@checkForSpace{% |
| 1455 |
\expandafter\ifx\space\bracket@next@token\@escapeif{% |
| 1456 |
\ifbracket@ignorespaces\else |
| 1457 |
\bracket@haveSpacetrue |
| 1458 |
\fi |
| 1459 |
\expandafter\bracket@Parse\romannumeral-`0% |
| 1460 |
}\else\@escapeif{% |
| 1461 |
\bracket@Parse@maybeexpand |
| 1462 |
}\fi |
| 1463 |
} |
| 1464 |
\newif\ifbracket@expandtokens |
| 1465 |
\def\bracket@Parse@maybeexpand{% |
| 1466 |
\ifbracket@expandtokens\@escapeif{% |
| 1467 |
\expandafter\bracket@Parse@peekAhead\romannumeral-`0% |
| 1468 |
}\else\@escapeif{% |
| 1469 |
\bracket@Parse@peekAhead |
| 1470 |
}\fi |
| 1471 |
} |
| 1472 |
\def\bracket@Parse@peekAhead{% |
| 1473 |
\futurelet\bracket@next@token\bracket@Parse@checkForTeXGroup |
| 1474 |
} |
| 1475 |
\def\bracket@Parse@checkForTeXGroup{% |
| 1476 |
\ifx\bracket@next@token\bgroup% |
| 1477 |
\@escapeif{\bracket@Parse@appendGroup}% |
| 1478 |
\else |
| 1479 |
\@escapeif{\bracket@Parse@token}% |
| 1480 |
\fi |
| 1481 |
} |
| 1482 |
\long\def\bracket@Parse@token#1{% |
| 1483 |
\ifx#1\bracket@openingBracket |
| 1484 |
\@escapeif{\bracket@Parse@openingBracketFound}% |
| 1485 |
\else |
| 1486 |
\@escapeif{% |
| 1487 |
\ifx#1\bracket@closingBracket |
| 1488 |
\@escapeif{\bracket@Parse@closingBracketFound}% |
| 1489 |
\else |
| 1490 |
\@escapeif{% |
| 1491 |
\ifx#1\bracket@actionCharacter |
| 1492 |
\@escapeif{\futurelet\bracket@next@token\bracket@Parse@actionCharacterFound}% |
| 1493 |
\else |
| 1494 |
\@escapeif{\bracket@Parse@appendToken#1}% |
| 1495 |
\fi |
| 1496 |
}% |
| 1497 |
\fi |
| 1498 |
}% |
| 1499 |
\fi |
| 1500 |
} |
| 1501 |
\newif\ifbracket@haveSpace |
| 1502 |
\newif\ifbracket@ignorespaces |
| 1503 |
\def\bracket@Parse@appendSpace{% |
| 1504 |
\ifbracket@haveSpace |
| 1505 |
\ifcase\bracket@state\relax |
| 1506 |
\eapptotoks\bracket@content\space |
| 1507 |
\or |
| 1508 |
\eapptotoks\bracket@afterthought\space |
| 1509 |
\or |
| 1510 |
\eapptotoks\bracket@afterthought\space |
| 1511 |
\fi |
| 1512 |
\bracket@haveSpacefalse |
| 1513 |
\fi |
| 1514 |
} |
| 1515 |
\long\def\bracket@Parse@appendToken#1{% |
| 1516 |
\bracket@Parse@appendSpace |
| 1517 |
\ifcase\bracket@state\relax |
| 1518 |
\lapptotoks\bracket@content{#1}% |
| 1519 |
\or |
| 1520 |
\lapptotoks\bracket@afterthought{#1}% |
| 1521 |
\or |
| 1522 |
\lapptotoks\bracket@afterthought{#1}% |
| 1523 |
\fi |
| 1524 |
\bracket@ignorespacesfalse |
| 1525 |
\bracket@Parse |
| 1526 |
} |
| 1527 |
\def\bracket@Parse@appendGroup#1{% |
| 1528 |
\bracket@Parse@appendSpace |
| 1529 |
\ifcase\bracket@state\relax |
| 1530 |
\apptotoks\bracket@content{{#1}}% |
| 1531 |
\or |
| 1532 |
\apptotoks\bracket@afterthought{{#1}}% |
| 1533 |
\or |
| 1534 |
\apptotoks\bracket@afterthought{{#1}}% |
| 1535 |
\fi |
| 1536 |
\bracket@ignorespacesfalse |
| 1537 |
\bracket@Parse |
| 1538 |
} |
| 1539 |
\def\bracket@state@inContent{0} |
| 1540 |
\def\bracket@state@inAfterthought{1} |
| 1541 |
\def\bracket@state@starting{2} |
| 1542 |
\def\bracket@Parse@openingBracketFound{% |
| 1543 |
\bracket@haveSpacefalse |
| 1544 |
\ifcase\bracket@state\relax% in content [ ... [ |
| 1545 |
\@escapeif{% |
| 1546 |
\bracket@createNode |
| 1547 |
\ifnum\bracket@parentNode=0 \else |
| 1548 |
\forest@node@Append{\bracket@parentNode}{\bracket@newNode}% |
| 1549 |
\fi |
| 1550 |
\let\bracket@parentNode\bracket@newNode |
| 1551 |
\bracket@Parse |
| 1552 |
}% |
| 1553 |
\or % in afterthought ] ... [ |
| 1554 |
\@escapeif{% |
| 1555 |
\bracket@addAfterthought |
| 1556 |
\let\bracket@state\bracket@state@inContent |
| 1557 |
\bracket@Parse |
| 1558 |
}% |
| 1559 |
\else % starting |
| 1560 |
\@escapeif{% |
| 1561 |
\let\bracket@state\bracket@state@inContent |
| 1562 |
\bracket@Parse |
| 1563 |
}% |
| 1564 |
\fi |
| 1565 |
} |
| 1566 |
\def\bracket@Parse@closingBracketFound{% |
| 1567 |
\bracket@haveSpacefalse |
| 1568 |
\ifcase\bracket@state\relax % in content [ ... ] |
| 1569 |
\@escapeif{% |
| 1570 |
\bracket@createNode |
| 1571 |
\ifnum\bracket@parentNode=0 |
| 1572 |
\@escapeif\bracketEndParsingHook |
| 1573 |
\else |
| 1574 |
\@escapeif{% |
| 1575 |
\let\bracket@afterthoughtNode\bracket@newNode |
| 1576 |
\let\bracket@state\bracket@state@inAfterthought |
| 1577 |
\forest@node@Append{\bracket@parentNode}{\bracket@newNode}% |
| 1578 |
\bracket@Parse |
| 1579 |
}% |
| 1580 |
\fi |
| 1581 |
}% |
| 1582 |
\or % in afterthought ] ... ] |
| 1583 |
\@escapeif{% |
| 1584 |
\bracket@addAfterthought |
| 1585 |
\let\bracket@afterthoughtNode\bracket@parentNode |
| 1586 |
\edef\bracket@parentNode{\forestOve{\bracket@parentNode}{@parent}}% |
| 1587 |
\ifnum\bracket@parentNode=0 |
| 1588 |
\expandafter\bracketEndParsingHook |
| 1589 |
\else |
| 1590 |
\expandafter\bracket@Parse |
| 1591 |
\fi |
| 1592 |
}% |
| 1593 |
\else % starting |
| 1594 |
\PackageError{forest}{You're attempting to start a bracket representation |
| 1595 |
with a closing bracket}{}% |
| 1596 |
\fi |
| 1597 |
} |
| 1598 |
\def\bracket@Parse@actionCharacterFound{% |
| 1599 |
\ifx\bracket@next@token\bgroup\@escapeif{% |
| 1600 |
\bracket@Parse@action@expandgroup |
| 1601 |
}\else\@escapeif{% |
| 1602 |
\bracket@Parse@action@notagroup |
| 1603 |
}\fi |
| 1604 |
} |
| 1605 |
\def\bracket@Parse@action@expandgroup#1{% |
| 1606 |
\edef\bracket@Parse@action@expandgroup@macro{#1}% |
| 1607 |
\expandafter\bracket@Parse\bracket@Parse@action@expandgroup@macro |
| 1608 |
} |
| 1609 |
\let\bracket@action@fullyexpandCharacter+ |
| 1610 |
\let\bracket@action@dontexpandCharacter- |
| 1611 |
\let\bracket@action@executeCharacter! |
| 1612 |
\def\bracket@Parse@action@notagroup#1{% |
| 1613 |
\ifx#1\bracket@action@fullyexpandCharacter\@escapeif{% |
| 1614 |
\bracket@expandtokenstrue\bracket@Parse |
| 1615 |
}\else\@escapeif{% |
| 1616 |
\ifx#1\bracket@action@dontexpandCharacter\@escapeif{% |
| 1617 |
\bracket@expandtokensfalse\bracket@Parse |
| 1618 |
}\else\@escapeif{% |
| 1619 |
\ifx#10\@escapeif{% |
| 1620 |
\bracket@Parse@appendToken |
| 1621 |
}\else\@escapeif{% |
| 1622 |
\ifx#1\bracket@actionCharacter |
| 1623 |
\else\@escapeif{% |
| 1624 |
\expandafter\bracket@Parse#1% |
| 1625 |
}\fi |
| 1626 |
}\fi |
| 1627 |
}\fi |
| 1628 |
}\fi |
| 1629 |
} |
| 1630 |
\def\bracket@createNode{% |
| 1631 |
\ifnum\bracket@rootNode=0 |
| 1632 |
% root node |
| 1633 |
\bracketset{new node/.expanded=% |
| 1634 |
{\the\bracket@afterthought}% |
| 1635 |
{\the\bracket@content}% |
| 1636 |
\noexpand\bracket@newNode |
| 1637 |
}% |
| 1638 |
\bracket@afterthought={}% |
| 1639 |
\let\bracket@rootNode\bracket@newNode |
| 1640 |
\expandafter\let\bracket@saveRootNodeTo\bracket@newNode |
| 1641 |
\else |
| 1642 |
% other nodes |
| 1643 |
\bracketset{new node/.expanded=% |
| 1644 |
{}% |
| 1645 |
{\the\bracket@content}% |
| 1646 |
\noexpand\bracket@newNode |
| 1647 |
}% |
| 1648 |
\fi |
| 1649 |
\bracket@content={}% |
| 1650 |
} |
| 1651 |
\def\bracket@addAfterthought{% |
| 1652 |
\bracketset{% |
| 1653 |
set afterthought/.expanded={\bracket@afterthoughtNode}{\the\bracket@afterthought}% |
| 1654 |
}% |
| 1655 |
\bracket@afterthought={}% |
| 1656 |
} |
| 1657 |
% full expansion expands precisely to the value |
| 1658 |
\def\forestov#1{\expandafter\expandonce\csname fRsT\forest@cn/#1\endcsname} |
| 1659 |
% full expansion expands all the way |
| 1660 |
\def\forestove#1{\csname fRsT\forest@cn/#1\endcsname} |
| 1661 |
% full expansion expands to the cs holding the value |
| 1662 |
\def\forestom#1{\expandonce{\csname fRsT\forest@cn/#1\endcsname}} |
| 1663 |
\def\forestoget#1#2{\expandafter\let\expandafter#2\csname fRsT\forest@cn/#1\endcsname} |
| 1664 |
\def\forestolet#1#2{\expandafter\let\csname fRsT\forest@cn/#1\endcsname#2} |
| 1665 |
\def\forestoset#1#2{\expandafter\edef\csname fRsT\forest@cn/#1\endcsname{\unexpanded{#2}}} |
| 1666 |
\def\forestoeset#1%#2 |
| 1667 |
{\expandafter\edef\csname fRsT\forest@cn/#1\endcsname |
| 1668 |
%{#2} |
| 1669 |
} |
| 1670 |
\def\forestoappto#1#2{% |
| 1671 |
\forestoeset{#1}{\forestov{#1}\unexpanded{#2}}% |
| 1672 |
} |
| 1673 |
\def\forestoifdefined#1%#2#3 |
| 1674 |
{% |
| 1675 |
\ifcsdef{fRsT\forest@cn/#1}%{#2}{#3}% |
| 1676 |
} |
| 1677 |
\let\forestoption\forestov |
| 1678 |
\let\foresteoption\forestove |
| 1679 |
\def\forestOv#1#2{\expandafter\expandonce\csname fRsT#1/#2\endcsname} |
| 1680 |
\def\forestOve#1#2{\csname fRsT#1/#2\endcsname} |
| 1681 |
% full expansion expands to the cs holding the value |
| 1682 |
\def\forestOm#1#2{\expandonce{\csname fRsT#1/#2\endcsname}} |
| 1683 |
\def\forestOget#1#2#3{\expandafter\let\expandafter#3\csname fRsT#1/#2\endcsname} |
| 1684 |
\def\forestOlet#1#2#3{\expandafter\let\csname fRsT#1/#2\endcsname#3} |
| 1685 |
\def\forestOset#1#2#3{\expandafter\edef\csname fRsT#1/#2\endcsname{\unexpanded{#3}}} |
| 1686 |
\def\forestOeset#1#2%#3 |
| 1687 |
{\expandafter\edef\csname fRsT#1/#2\endcsname |
| 1688 |
% {#3} |
| 1689 |
} |
| 1690 |
\def\forestOappto#1#2#3{% |
| 1691 |
\forestOeset{#1}{#2}{\forestOv{#1}{#2}\unexpanded{#3}}% |
| 1692 |
} |
| 1693 |
\def\forestOeappto#1#2#3{% |
| 1694 |
\forestOeset{#1}{#2}{\forestOv{#1}{#2}#3}% |
| 1695 |
} |
| 1696 |
\def\forestOpreto#1#2#3{% |
| 1697 |
\forestOeset{#1}{#2}{\unexpanded{#3}\forestOv{#1}{#2}}% |
| 1698 |
} |
| 1699 |
\def\forestOepreto#1#2#3{% |
| 1700 |
\forestOeset{#1}{#2}{#3\forestOv{#1}{#2}}% |
| 1701 |
} |
| 1702 |
\def\forestOifdefined#1#2%#3#4 |
| 1703 |
{% |
| 1704 |
\ifcsdef{fRsT#1/#2}%{#3}{#4}% |
| 1705 |
} |
| 1706 |
\def\forestOletO#1#2#3#4{% option #2 of node #1 <-- option #4 of node #3 |
| 1707 |
\forestOget{#3}{#4}\forestoption@temp |
| 1708 |
\forestOlet{#1}{#2}\forestoption@temp} |
| 1709 |
\def\forestOleto#1#2#3{% |
| 1710 |
\forestoget{#3}\forestoption@temp |
| 1711 |
\forestOlet{#1}{#2}\forestoption@temp} |
| 1712 |
\def\forestoletO#1#2#3{% |
| 1713 |
\forestOget{#2}{#3}\forestoption@temp |
| 1714 |
\forestolet{#1}\forestoption@temp} |
| 1715 |
\def\forestoleto#1#2{% |
| 1716 |
\forestoget{#2}\forestoption@temp |
| 1717 |
\forestolet{#1}\forestoption@temp} |
| 1718 |
\def\forestRNOget#1#2{% #1=rn!option, #2 = receiving cs |
| 1719 |
\pgfutil@in@{.}{#1}% |
| 1720 |
\ifpgfutil@in@ |
| 1721 |
\forestRNOget@rn#2#1\forest@END |
| 1722 |
\else |
| 1723 |
\forestoget{#1}#2% |
| 1724 |
\fi |
| 1725 |
} |
| 1726 |
\def\forestRNOget@rn#1#2.#3\forest@END{% |
| 1727 |
\forest@forthis{% |
| 1728 |
\forest@nameandgo{#2}% |
| 1729 |
\forestoget{#3}#1% |
| 1730 |
}% |
| 1731 |
} |
| 1732 |
\def\forestRNO@getvalueandtype#1#2#3{% #1=rn.option, #2,#3 = receiving css |
| 1733 |
\pgfutil@in@{.}{#1}% |
| 1734 |
\ifpgfutil@in@ |
| 1735 |
\forestRNO@getvalueandtype@rn#2#3#1\forest@END |
| 1736 |
\else |
| 1737 |
\forestoget{#1}#2% |
| 1738 |
\pgfkeysgetvalue{/forest/#1/@type}#3% |
| 1739 |
\fi |
| 1740 |
} |
| 1741 |
\def\forestRNO@getvalueandtype@rn#1#2#3.#4\forest@END{% |
| 1742 |
% #1,#2=receiving css, #3=relative node name, #4=option name |
| 1743 |
\forest@forthis{% |
| 1744 |
\forest@nameandgo{#3}% |
| 1745 |
\forestoget{#4}#1% |
| 1746 |
}% |
| 1747 |
\pgfkeysgetvalue{/forest/#4/@type}#2% |
| 1748 |
} |
| 1749 |
% full expansion expands precisely to the value |
| 1750 |
\def\forestrv#1{\expandafter\expandonce\csname fRsT/#1\endcsname} |
| 1751 |
% full expansion expands all the way |
| 1752 |
\def\forestrve#1{\csname fRsT/#1\endcsname} |
| 1753 |
% full expansion expands to the cs holding the value |
| 1754 |
\def\forestrm#1{\expandonce{\csname fRsT/#1\endcsname}} |
| 1755 |
\def\forestrget#1#2{\expandafter\let\expandafter#2\csname fRsT/#1\endcsname} |
| 1756 |
\def\forestrlet#1#2{\expandafter\let\csname fRsT/#1\endcsname#2} |
| 1757 |
\def\forestrset#1#2{\expandafter\edef\csname fRsT/#1\endcsname{\unexpanded{#2}}} |
| 1758 |
\def\forestreset#1%#2 |
| 1759 |
{\expandafter\edef\csname fRsT/#1\endcsname}%{#2} |
| 1760 |
\def\forestrappto#1#2{% |
| 1761 |
\forestreset{#1}{\forestrv{#1}\unexpanded{#2}}% |
| 1762 |
} |
| 1763 |
\def\forestrpreto#1#2{% |
| 1764 |
\forestreset{#1}{\unexpanded{#2}\forestrv{#1}}% |
| 1765 |
} |
| 1766 |
\def\forestrifdefined#1%#2#3 |
| 1767 |
{% |
| 1768 |
\ifcsdef{fRsT/#1}%{#2}{#3}% |
| 1769 |
} |
| 1770 |
\def\forestregister#1{\forestrv{#1}} |
| 1771 |
\def\foresteregister#1{\forestrve{#1}} |
| 1772 |
\def\forest@node@init{% |
| 1773 |
\forestoset{@parent}{0}% |
| 1774 |
\forestoset{@previous}{0}% previous sibling |
| 1775 |
\forestoset{@next}{0}% next sibling |
| 1776 |
\forestoset{@first}{0}% primary child |
| 1777 |
\forestoset{@last}{0}% last child |
| 1778 |
} |
| 1779 |
\def\forestoinit#1{% |
| 1780 |
\pgfkeysgetvalue{/forest/#1}\forestoinit@temp |
| 1781 |
\forestolet{#1}\forestoinit@temp |
| 1782 |
} |
| 1783 |
\newcount\forest@node@maxid |
| 1784 |
\def\forest@node@new#1{% #1 = cs receiving the new node id |
| 1785 |
\advance\forest@node@maxid1 |
| 1786 |
\forest@fornode{\the\forest@node@maxid}{% |
| 1787 |
\forest@node@init |
| 1788 |
\forestoeset{id}{\forest@cn}% |
| 1789 |
\forest@node@setname{node@\forest@cn}% |
| 1790 |
\forest@initializefromstandardnode |
| 1791 |
\edef#1{\forest@cn}% |
| 1792 |
}% |
| 1793 |
} |
| 1794 |
\let\forestoinit@orig\forestoinit |
| 1795 |
\def\forest@node@copy#1#2{% #1=from node id, cs receiving the new node id |
| 1796 |
\advance\forest@node@maxid1 |
| 1797 |
\def\forestoinit##1{\ifstrequal{##1}{name}{\forestoset{name}{node@\forest@cn}}{\forestoletO{##1}{#1}{##1}}}% |
| 1798 |
\forest@fornode{\the\forest@node@maxid}{% |
| 1799 |
\forest@node@init |
| 1800 |
\forestoeset{id}{\forest@cn}% |
| 1801 |
\forest@node@setname{\forest@copy@name@template{\forestOve{#1}{name}}}% |
| 1802 |
\edef#2{\forest@cn}% |
| 1803 |
}% |
| 1804 |
\let\forestoinit\forestoinit@orig |
| 1805 |
} |
| 1806 |
\forestset{ |
| 1807 |
copy name template/.code={\def\forest@copy@name@template##1{#1}}, |
| 1808 |
copy name template/.default={node@\the\forest@node@maxid}, |
| 1809 |
copy name template |
| 1810 |
} |
| 1811 |
\def\forest@tree@copy#1#2{% #1=from node id, #2=cs receiving the new node id |
| 1812 |
\forest@node@copy{#1}\forest@node@copy@temp@id |
| 1813 |
\forest@fornode{\forest@node@copy@temp@id}{% |
| 1814 |
\expandafter\forest@tree@copy@\expandafter{\forest@node@copy@temp@id}{#1}% |
| 1815 |
\edef#2{\forest@cn}% |
| 1816 |
}% |
| 1817 |
} |
| 1818 |
\def\forest@tree@copy@#1#2{% |
| 1819 |
\forest@node@Foreachchild{#2}{% |
| 1820 |
\expandafter\forest@tree@copy\expandafter{\forest@cn}\forest@node@copy@temp@childid |
| 1821 |
\forest@node@Append{#1}{\forest@node@copy@temp@childid}% |
| 1822 |
}% |
| 1823 |
} |
| 1824 |
\def\forest@cn{0} |
| 1825 |
\forest@node@init |
| 1826 |
\def\forest@node@append#1{\expandtwonumberargs\forest@node@Append{\forest@cn}{#1}} |
| 1827 |
\def\forest@node@prepend#1{\expandtwonumberargs\forest@node@Insertafter{\forest@cn}{#1}{0}} |
| 1828 |
\def\forest@node@insertafter#1#2{% |
| 1829 |
\expandthreenumberargs\forest@node@Insertafter{\forest@cn}{#1}{#2}} |
| 1830 |
\def\forest@node@insertbefore#1#2{% |
| 1831 |
\expandthreenumberargs\forest@node@Insertafter{\forest@cn}{#1}{\forestOve{#2}{@previous}}% |
| 1832 |
} |
| 1833 |
\def\forest@node@remove{\expandnumberarg\forest@node@Remove{\forest@cn}} |
| 1834 |
\def\forest@node@Append#1#2{\expandtwonumberargs\forest@node@Append@{#1}{#2}} |
| 1835 |
\def\forest@node@Prepend#1#2{\expandtwonumberargs\forest@node@Insertafter{#1}{#2}{0}} |
| 1836 |
\def\forest@node@Insertafter#1#2#3{% #2 is inserted after #3 |
| 1837 |
\expandthreenumberargs\forest@node@Insertafter@{#1}{#2}{#3}% |
| 1838 |
} |
| 1839 |
\def\forest@node@Insertbefore#1#2#3{% #2 is inserted before #3 |
| 1840 |
\expandthreenumberargs\forest@node@Insertafter{#1}{#2}{\forestOve{#3}{@previous}}% |
| 1841 |
} |
| 1842 |
\def\forest@node@Remove#1{\expandnumberarg\forest@node@Remove@{#1}} |
| 1843 |
\def\forest@node@Insertafter@#1#2#3{% |
| 1844 |
\ifnum\forestOve{#2}{@parent}=0 |
| 1845 |
\else |
| 1846 |
\PackageError{forest}{Insertafter(#1,#2,#3): |
| 1847 |
node #2 already has a parent (\forestOve{#2}{@parent})}{}% |
| 1848 |
\fi |
| 1849 |
\ifnum#3=0 |
| 1850 |
\else |
| 1851 |
\ifnum#1=\forestOve{#3}{@parent} |
| 1852 |
\else |
| 1853 |
\PackageError{forest}{Insertafter(#1,#2,#3): node #1 is not the parent of the |
| 1854 |
intended sibling #3 (with parent \forestOve{#3}{@parent})}{}% |
| 1855 |
\fi |
| 1856 |
\fi |
| 1857 |
\forestOeset{#2}{@parent}{#1}% |
| 1858 |
\forestOeset{#2}{@previous}{#3}% |
| 1859 |
\ifnum#3=0 |
| 1860 |
\forestOget{#1}{@first}\forest@node@temp |
| 1861 |
\forestOeset{#1}{@first}{#2}% |
| 1862 |
\else |
| 1863 |
\forestOget{#3}{@next}\forest@node@temp |
| 1864 |
\forestOeset{#3}{@next}{#2}% |
| 1865 |
\fi |
| 1866 |
\forestOeset{#2}{@next}{\forest@node@temp}% |
| 1867 |
\ifnum\forest@node@temp=0 |
| 1868 |
\forestOeset{#1}{@last}{#2}% |
| 1869 |
\else |
| 1870 |
\forestOeset{\forest@node@temp}{@previous}{#2}% |
| 1871 |
\fi |
| 1872 |
} |
| 1873 |
\def\forest@node@Append@#1#2{% |
| 1874 |
\ifnum\forestOve{#2}{@parent}=0 |
| 1875 |
\else |
| 1876 |
\PackageError{forest}{Append(#1,#2): |
| 1877 |
node #2 already has a parent (\forestOve{#2}{@parent})}{}% |
| 1878 |
\fi |
| 1879 |
\forestOeset{#2}{@parent}{#1}% |
| 1880 |
\forestOget{#1}{@last}\forest@node@temp |
| 1881 |
\forestOeset{#1}{@last}{#2}% |
| 1882 |
\forestOeset{#2}{@previous}{\forest@node@temp}% |
| 1883 |
\ifnum\forest@node@temp=0 |
| 1884 |
\forestOeset{#1}{@first}{#2}% |
| 1885 |
\else |
| 1886 |
\forestOeset{\forest@node@temp}{@next}{#2}% |
| 1887 |
\fi |
| 1888 |
} |
| 1889 |
\def\forest@node@Remove@#1{% |
| 1890 |
\forestOget{#1}{@parent}\forest@node@temp@parent |
| 1891 |
\ifnum\forest@node@temp@parent=0 |
| 1892 |
\else |
| 1893 |
\forestOget{#1}{@previous}\forest@node@temp@previous |
| 1894 |
\forestOget{#1}{@next}\forest@node@temp@next |
| 1895 |
\ifnum\forest@node@temp@previous=0 |
| 1896 |
\forestOeset{\forest@node@temp@parent}{@first}{\forest@node@temp@next}% |
| 1897 |
\else |
| 1898 |
\forestOeset{\forest@node@temp@previous}{@next}{\forest@node@temp@next}% |
| 1899 |
\fi |
| 1900 |
\ifnum\forest@node@temp@next=0 |
| 1901 |
\forestOeset{\forest@node@temp@parent}{@last}{\forest@node@temp@previous}% |
| 1902 |
\else |
| 1903 |
\forestOeset{\forest@node@temp@next}{@previous}{\forest@node@temp@previous}% |
| 1904 |
\fi |
| 1905 |
\forestOset{#1}{@parent}{0}% |
| 1906 |
\forestOset{#1}{@previous}{0}% |
| 1907 |
\forestOset{#1}{@next}{0}% |
| 1908 |
\fi |
| 1909 |
} |
| 1910 |
\def\forest@forthis#1{% |
| 1911 |
\edef\forest@node@marshal{\unexpanded{#1}\def\noexpand\forest@cn}% |
| 1912 |
\expandafter\forest@node@marshal\expandafter{\forest@cn}% |
| 1913 |
} |
| 1914 |
\def\forest@fornode#1#2{% |
| 1915 |
\edef\forest@node@marshal{\edef\noexpand\forest@cn{#1}\unexpanded{#2}\def\noexpand\forest@cn}% |
| 1916 |
\expandafter\forest@node@marshal\expandafter{\forest@cn}% |
| 1917 |
} |
| 1918 |
\def\forest@node@foreachchild#1{\forest@node@Foreachchild{\forest@cn}{#1}} |
| 1919 |
\def\forest@node@Foreachchild#1#2{% |
| 1920 |
\forest@fornode{\forestOve{#1}{@first}}{\forest@node@@forselfandfollowingsiblings{#2}}% |
| 1921 |
} |
| 1922 |
\def\forest@node@@forselfandfollowingsiblings#1{% |
| 1923 |
\ifnum\forest@cn=0 |
| 1924 |
\else |
| 1925 |
\forest@forthis{#1}% |
| 1926 |
\@escapeif{% |
| 1927 |
\edef\forest@cn{\forestove{@next}}% |
| 1928 |
\forest@node@@forselfandfollowingsiblings{#1}% |
| 1929 |
}% |
| 1930 |
\fi |
| 1931 |
} |
| 1932 |
\def\forest@node@@forselfandfollowingsiblings@reversed#1{% |
| 1933 |
\ifnum\forest@cn=0 |
| 1934 |
\else |
| 1935 |
\@escapeif{% |
| 1936 |
\edef\forest@marshal{% |
| 1937 |
\noexpand\def\noexpand\forest@cn{\forestove{@next}}% |
| 1938 |
\noexpand\forest@node@@forselfandfollowingsiblings@reversed{\unexpanded{#1}}% |
| 1939 |
\noexpand\forest@fornode{\forest@cn}{\unexpanded{#1}}% |
| 1940 |
}\forest@marshal |
| 1941 |
}% |
| 1942 |
\fi |
| 1943 |
} |
| 1944 |
\def\forest@node@foreachchild@reversed#1{\forest@node@Foreachchild@reversed{\forest@cn}{#1}} |
| 1945 |
\def\forest@node@Foreachchild@reversed#1#2{% |
| 1946 |
\forest@fornode{\forestOve{#1}{@last}}{\forest@node@@forselfandprecedingsiblings@reversed{#2}}% |
| 1947 |
} |
| 1948 |
\def\forest@node@@forselfandprecedingsiblings@reversed#1{% |
| 1949 |
\ifnum\forest@cn=0 |
| 1950 |
\else |
| 1951 |
\forest@forthis{#1}% |
| 1952 |
\@escapeif{% |
| 1953 |
\edef\forest@cn{\forestove{@previous}}% |
| 1954 |
\forest@node@@forselfandprecedingsiblings@reversed{#1}% |
| 1955 |
}% |
| 1956 |
\fi |
| 1957 |
} |
| 1958 |
\def\forest@node@@forselfandprecedingsiblings#1{% |
| 1959 |
\ifnum\forest@cn=0 |
| 1960 |
\else |
| 1961 |
\@escapeif{% |
| 1962 |
\edef\forest@marshal{% |
| 1963 |
\noexpand\def\noexpand\forest@cn{\forestove{@previous}}% |
| 1964 |
\noexpand\forest@node@@forselfandprecedingsiblings{\unexpanded{#1}}% |
| 1965 |
\noexpand\forest@fornode{\forest@cn}{\unexpanded{#1}}% |
| 1966 |
}\forest@marshal |
| 1967 |
}% |
| 1968 |
\fi |
| 1969 |
} |
| 1970 |
\def\forest@node@@foreach#1#2#3#4{% |
| 1971 |
% #1 = do what |
| 1972 |
% #2 = do that -1=before,1=after processing children |
| 1973 |
% #3 & #4: normal or reversed order of children? |
| 1974 |
% #3 = @first/@last |
| 1975 |
% #4 = \forest@node@@forselfandfollowingsiblings / \forest@node@@forselfandprecedingsiblings@reversed |
| 1976 |
\ifnum#2<0 \forest@forthis{#1}\fi |
| 1977 |
\ifnum\forestove{#3}=0 |
| 1978 |
\else\@escapeif{% |
| 1979 |
\forest@forthis{% |
| 1980 |
\edef\forest@cn{\forestove{#3}}% |
| 1981 |
#4{\forest@node@@foreach{#1}{#2}{#3}{#4}}% |
| 1982 |
}% |
| 1983 |
}\fi |
| 1984 |
\ifnum#2>0 \forest@forthis{#1}\fi |
| 1985 |
} |
| 1986 |
\def\forest@node@foreach#1{% |
| 1987 |
\forest@node@@foreach{#1}{-1}{@first}{\forest@node@@forselfandfollowingsiblings}} |
| 1988 |
\def\forest@node@Foreach#1#2{% |
| 1989 |
\forest@fornode{#1}{\forest@node@@foreach{#2}{-1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 1990 |
\def\forest@node@foreach@reversed#1{% |
| 1991 |
\forest@node@@foreach{#1}{-1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}} |
| 1992 |
\def\forest@node@Foreach@reversed#1#2{% |
| 1993 |
\forest@fornode{#1}{\forest@node@@foreach{#2}{-1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 1994 |
\def\forest@node@foreach@childrenfirst#1{% |
| 1995 |
\forest@node@@foreach{#1}{1}{@first}{\forest@node@@forselfandfollowingsiblings}} |
| 1996 |
\def\forest@node@Foreach@childrenfirst#1#2{% |
| 1997 |
\forest@fornode{#1}{\forest@node@@foreach{#2}{1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 1998 |
\def\forest@node@foreach@childrenfirst@reversed#1{% |
| 1999 |
\forest@node@@foreach{#1}{1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}} |
| 2000 |
\def\forest@node@Foreach@childrenfirst@reversed#1#2{% |
| 2001 |
\forest@fornode{#1}{\forest@node@@foreach{#2}{1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 2002 |
\def\forest@node@foreachdescendant#1{% |
| 2003 |
\forest@node@foreachchild{\forest@node@@foreach{#1}{-1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 2004 |
\def\forest@node@Foreachdescendant#1#2{% |
| 2005 |
\forest@node@Foreachchild{#1}{\forest@node@@foreach{#2}{-1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 2006 |
\def\forest@node@foreachdescendant@reversed#1{% |
| 2007 |
\forest@node@foreachchild@reversed{\forest@node@@foreach{#1}{-1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 2008 |
\def\forest@node@Foreachdescendant@reversed#1#2{% |
| 2009 |
\forest@node@Foreachchild@reversed{#1}{\forest@node@@foreach{#2}{-1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 2010 |
\def\forest@node@foreachdescendant@childrenfirst#1{% |
| 2011 |
\forest@node@foreachchild{\forest@node@@foreach{#1}{1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 2012 |
\def\forest@node@Foreachdescendant@childrenfirst#1#2{% |
| 2013 |
\forest@node@Foreachchild{#1}{\forest@node@@foreach{#2}{1}{@first}{\forest@node@@forselfandfollowingsiblings}}} |
| 2014 |
\def\forest@node@foreachdescendant@childrenfirst@reversed#1{% |
| 2015 |
\forest@node@foreachchild@reversed{\forest@node@@foreach{#1}{1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 2016 |
\def\forest@node@Foreachdescendant@childrenfirst@reversed#1#2{% |
| 2017 |
\forest@node@Foreachchild@reversed{#1}{\forest@node@@foreach{#2}{1}{@last}{\forest@node@@forselfandprecedingsiblings@reversed}}} |
| 2018 |
\def\forest@node@foreach@breadthfirst#1#2{% #1 = max level, #2 = code |
| 2019 |
\forest@node@Foreach@breadthfirst@{\forest@cn}{@first}{@next}{#1}{#2}} |
| 2020 |
\def\forest@node@foreach@breadthfirst@reversed#1#2{% #1 = max level, #2 = code |
| 2021 |
\forest@node@Foreach@breadthfirst@{\forest@cn}{@last}{@previous}{#1}{#2}} |
| 2022 |
\def\forest@node@Foreach@breadthfirst#1#2#3{% #1 = node id, #2 = max level, #3 = code |
| 2023 |
\forest@node@Foreach@breadthfirst@{#1}{@first}{@next}{#2}{#3}} |
| 2024 |
\def\forest@node@Foreach@breadthfirst@reversed#1#2#3{% #1 = node id, #2 = max level, #3 = code |
| 2025 |
\forest@node@Foreach@breadthfirst@{#1}{@last}{@previous}{#2}{#3}} |
| 2026 |
\def\forest@node@Foreach@breadthfirst@#1#2#3#4#5{% |
| 2027 |
% #1 = root node, |
| 2028 |
% #2 = @first/@last, #3 = @next/@previous (must be in sync with #2), |
| 2029 |
% #4 = max level (< 0 means infinite) |
| 2030 |
% #5 = code to execute at each node |
| 2031 |
\forest@node@Foreach@breadthfirst@processqueue{#1,}{#2}{#3}{#4}{#5}% |
| 2032 |
} |
| 2033 |
\def\forest@node@Foreach@breadthfirst@processqueue#1#2#3#4#5{% |
| 2034 |
% #1 = queue, |
| 2035 |
% #2 = @first/@last, #3 = @next/@previous (must be in sync with #2), |
| 2036 |
% #4 = max level (< 0 means infinite) |
| 2037 |
% #5 = code to execute at each node |
| 2038 |
\ifstrempty{#1}{}{% |
| 2039 |
\forest@node@Foreach@breadthfirst@processqueue@#1\forest@node@Foreach@breadthfirst@processqueue@ |
| 2040 |
{#2}{#3}{#4}{#5}% |
| 2041 |
}% |
| 2042 |
} |
| 2043 |
\def\forest@node@Foreach@breadthfirst@processqueue@#1,#2\forest@node@Foreach@breadthfirst@processqueue@#3#4#5#6{% |
| 2044 |
% #1 = first, |
| 2045 |
% #2 = rest, |
| 2046 |
% #3 = @first/@last, #4 = next/previous (must be in sync with #2), |
| 2047 |
% #5 = max level (< 0 means infinite) |
| 2048 |
% #6 = code to execute at each node |
| 2049 |
\forest@fornode{#1}{% |
| 2050 |
#6% |
| 2051 |
\ifnum#5<0 |
| 2052 |
\forest@node@getlistofchildren\forest@temp{#3}{#4}% |
| 2053 |
\else |
| 2054 |
\ifnum\forestove{level}>#5\relax |
| 2055 |
\def\forest@temp{}% |
| 2056 |
\else |
| 2057 |
\forest@node@getlistofchildren\forest@temp{#3}{#4}% |
| 2058 |
\fi |
| 2059 |
\fi |
| 2060 |
\edef\forest@marshal{% |
| 2061 |
\noexpand\forest@node@Foreach@breadthfirst@processqueue{\unexpanded{#2}\forest@temp}% |
| 2062 |
{#3}{#4}{#5}{\unexpanded{#6}}% |
| 2063 |
}\forest@marshal |
| 2064 |
}% |
| 2065 |
} |
| 2066 |
\def\forest@node@getlistofchildren#1#2#3{% #1 = list cs, #2 = @first/@last, #3 = @next/@previous |
| 2067 |
\forest@node@Getlistofchildren{\forest@cn}{#1}{#2}{#3}% |
| 2068 |
} |
| 2069 |
\def\forest@node@Getlistofchildren#1#2#3#4{% #1 = node, #2 = list cs, #3 = @first/@last, #4 = @next/@previous |
| 2070 |
\def#2{}% |
| 2071 |
\ifnum\forestove{#3}=0 |
| 2072 |
\else |
| 2073 |
\eappto#2{\forestOve{#1}{#3},}% |
| 2074 |
\@escapeif{% |
| 2075 |
\edef\forest@marshal{% |
| 2076 |
\noexpand\forest@node@Getlistofchildren@{\forestOve{#1}{#3}}\noexpand#2{#4}% |
| 2077 |
}\forest@marshal |
| 2078 |
}% |
| 2079 |
\fi |
| 2080 |
} |
| 2081 |
\def\forest@node@Getlistofchildren@#1#2#3{% #1 = node, #2 = list cs, #3 = @next/@previous |
| 2082 |
\ifnum\forestOve{#1}{#3}=0 |
| 2083 |
\else |
| 2084 |
\eappto#2{\forestOve{#1}{#3},}% |
| 2085 |
\@escapeif{% |
| 2086 |
\edef\forest@marshal{% |
| 2087 |
\noexpand\forest@node@Getlistofchildren@{\forestOve{#1}{#3}}\noexpand#2{#3}% |
| 2088 |
}\forest@marshal |
| 2089 |
}% |
| 2090 |
\fi |
| 2091 |
} |
| 2092 |
\def\forest@node@Compute@numeric@ts@info@#1{% |
| 2093 |
\forest@node@Foreach{#1}{\forest@node@@compute@numeric@ts@info}% |
| 2094 |
\ifnum\forestOve{#1}{@parent}=0 |
| 2095 |
\else |
| 2096 |
\forest@fornode{#1}{\forest@node@@compute@numeric@ts@info@nbar}% |
| 2097 |
% hack: the parent of the node we called the update for gets +1 for n_children |
| 2098 |
\edef\forest@node@temp{\forestOve{#1}{@parent}}% |
| 2099 |
\forestOeset{\forest@node@temp}{n children}{% |
| 2100 |
\number\numexpr\forestOve{\forest@node@temp}{n children}-1% |
| 2101 |
}% |
| 2102 |
\fi |
| 2103 |
\forest@node@Foreachdescendant{#1}{\forest@node@@compute@numeric@ts@info@nbar}% |
| 2104 |
} |
| 2105 |
\def\forest@node@@compute@numeric@ts@info{% |
| 2106 |
\forestoset{n children}{0}% |
| 2107 |
% |
| 2108 |
\edef\forest@node@temp{\forestove{@previous}}% |
| 2109 |
\ifnum\forest@node@temp=0 |
| 2110 |
\forestoset{n}{1}% |
| 2111 |
\else |
| 2112 |
\forestoeset{n}{\number\numexpr\forestOve{\forest@node@temp}{n}+1}% |
| 2113 |
\fi |
| 2114 |
% |
| 2115 |
\edef\forest@node@temp{\forestove{@parent}}% |
| 2116 |
\ifnum\forest@node@temp=0 |
| 2117 |
\forestoset{n}{0}% |
| 2118 |
\forestoset{n'}{0}% |
| 2119 |
\forestoset{level}{0}% |
| 2120 |
\else |
| 2121 |
\forestOeset{\forest@node@temp}{n children}{% |
| 2122 |
\number\numexpr\forestOve{\forest@node@temp}{n children}+1% |
| 2123 |
}% |
| 2124 |
\forestoeset{level}{% |
| 2125 |
\number\numexpr\forestOve{\forest@node@temp}{level}+1% |
| 2126 |
}% |
| 2127 |
\fi |
| 2128 |
} |
| 2129 |
\def\forest@node@@compute@numeric@ts@info@nbar{% |
| 2130 |
\forestoeset{n'}{\number\numexpr\forestOve{\forestove{@parent}}{n children}-\forestove{n}+1}% |
| 2131 |
} |
| 2132 |
\def\forest@node@compute@numeric@ts@info#1{% |
| 2133 |
\expandnumberarg\forest@node@Compute@numeric@ts@info@{\forest@cn}% |
| 2134 |
} |
| 2135 |
\def\forest@node@Compute@numeric@ts@info#1{% |
| 2136 |
\expandnumberarg\forest@node@Compute@numeric@ts@info@{#1}% |
| 2137 |
} |
| 2138 |
\def\forest@node@rootid{% |
| 2139 |
\expandnumberarg\forest@node@Rootid{\forest@cn}% |
| 2140 |
} |
| 2141 |
\def\forest@node@Rootid#1{% #1=node |
| 2142 |
\ifnum\forestOve{#1}{@parent}=0 |
| 2143 |
#1% |
| 2144 |
\else |
| 2145 |
\@escapeif{\expandnumberarg\forest@node@Rootid{\forestOve{#1}{@parent}}}% |
| 2146 |
\fi |
| 2147 |
} |
| 2148 |
\def\forest@node@nthchildid#1{% #1=n |
| 2149 |
\ifnum#1<1 |
| 2150 |
0% |
| 2151 |
\else |
| 2152 |
\expandnumberarg\forest@node@nthchildid@{\number\forestove{@first}}{#1}% |
| 2153 |
\fi |
| 2154 |
} |
| 2155 |
\def\forest@node@nthchildid@#1#2{% |
| 2156 |
\ifnum#1=0 |
| 2157 |
0% |
| 2158 |
\else |
| 2159 |
\ifnum#2>1 |
| 2160 |
\@escapeifif{\expandtwonumberargs |
| 2161 |
\forest@node@nthchildid@{\forestOve{#1}{@next}}{\numexpr#2-1}}% |
| 2162 |
\else |
| 2163 |
#1% |
| 2164 |
\fi |
| 2165 |
\fi |
| 2166 |
} |
| 2167 |
\def\forest@node@nbarthchildid#1{% #1=n |
| 2168 |
\expandnumberarg\forest@node@nbarthchildid@{\number\forestove{@last}}{#1}% |
| 2169 |
} |
| 2170 |
\def\forest@node@nbarthchildid@#1#2{% |
| 2171 |
\ifnum#1=0 |
| 2172 |
0% |
| 2173 |
\else |
| 2174 |
\ifnum#2>1 |
| 2175 |
\@escapeifif{\expandtwonumberargs |
| 2176 |
\forest@node@nbarthchildid@{\forestOve{#1}{@previous}}{\numexpr#2-1}}% |
| 2177 |
\else |
| 2178 |
#1% |
| 2179 |
\fi |
| 2180 |
\fi |
| 2181 |
} |
| 2182 |
\def\forest@node@nornbarthchildid#1{% |
| 2183 |
\ifnum#1>0 |
| 2184 |
\forest@node@nthchildid{#1}% |
| 2185 |
\else |
| 2186 |
\ifnum#1<0 |
| 2187 |
\forest@node@nbarthchildid{-#1}% |
| 2188 |
\else |
| 2189 |
\forest@node@nornbarthchildid@error |
| 2190 |
\fi |
| 2191 |
\fi |
| 2192 |
} |
| 2193 |
\def\forest@node@nornbarthchildid@error{% |
| 2194 |
\PackageError{forest}{In \string\forest@node@nornbarthchildid, n should !=0}{}% |
| 2195 |
} |
| 2196 |
\def\forest@node@previousleafid{% |
| 2197 |
\expandnumberarg\forest@node@Previousleafid{\forest@cn}% |
| 2198 |
} |
| 2199 |
\def\forest@node@Previousleafid#1{% |
| 2200 |
\ifnum\forestOve{#1}{@previous}=0 |
| 2201 |
\@escapeif{\expandnumberarg\forest@node@previousleafid@Goup{#1}}% |
| 2202 |
\else |
| 2203 |
\expandnumberarg\forest@node@previousleafid@Godown{\forestOve{#1}{@previous}}% |
| 2204 |
\fi |
| 2205 |
} |
| 2206 |
\def\forest@node@previousleafid@Goup#1{% |
| 2207 |
\ifnum\forestOve{#1}{@parent}=0 |
| 2208 |
\PackageError{forest}{get previous leaf: this is the first leaf}{}% |
| 2209 |
\else |
| 2210 |
\@escapeif{\expandnumberarg\forest@node@Previousleafid{\forestOve{#1}{@parent}}}% |
| 2211 |
\fi |
| 2212 |
} |
| 2213 |
\def\forest@node@previousleafid@Godown#1{% |
| 2214 |
\ifnum\forestOve{#1}{@last}=0 |
| 2215 |
#1% |
| 2216 |
\else |
| 2217 |
\@escapeif{\expandnumberarg\forest@node@previousleafid@Godown{\forestOve{#1}{@last}}}% |
| 2218 |
\fi |
| 2219 |
} |
| 2220 |
\def\forest@node@nextleafid{% |
| 2221 |
\expandnumberarg\forest@node@Nextleafid{\forest@cn}% |
| 2222 |
} |
| 2223 |
\def\forest@node@Nextleafid#1{% |
| 2224 |
\ifnum\forestOve{#1}{@next}=0 |
| 2225 |
\@escapeif{\expandnumberarg\forest@node@nextleafid@Goup{#1}}% |
| 2226 |
\else |
| 2227 |
\expandnumberarg\forest@node@nextleafid@Godown{\forestOve{#1}{@next}}% |
| 2228 |
\fi |
| 2229 |
} |
| 2230 |
\def\forest@node@nextleafid@Goup#1{% |
| 2231 |
\ifnum\forestOve{#1}{@parent}=0 |
| 2232 |
\PackageError{forest}{get next leaf: this is the last leaf}{}% |
| 2233 |
\else |
| 2234 |
\@escapeif{\expandnumberarg\forest@node@Nextleafid{\forestOve{#1}{@parent}}}% |
| 2235 |
\fi |
| 2236 |
} |
| 2237 |
\def\forest@node@nextleafid@Godown#1{% |
| 2238 |
\ifnum\forestOve{#1}{@first}=0 |
| 2239 |
#1% |
| 2240 |
\else |
| 2241 |
\@escapeif{\expandnumberarg\forest@node@nextleafid@Godown{\forestOve{#1}{@first}}}% |
| 2242 |
\fi |
| 2243 |
} |
| 2244 |
|
| 2245 |
\def\forest@node@linearnextid{% |
| 2246 |
\ifnum\forestove{@first}=0 |
| 2247 |
\expandafter\forest@node@linearnextnotdescendantid |
| 2248 |
\else |
| 2249 |
\forestove{@first}% |
| 2250 |
\fi |
| 2251 |
} |
| 2252 |
\def\forest@node@linearnextnotdescendantid{% |
| 2253 |
\expandnumberarg\forest@node@Linearnextnotdescendantid{\forest@cn}% |
| 2254 |
} |
| 2255 |
\def\forest@node@Linearnextnotdescendantid#1{% |
| 2256 |
\ifnum\forestOve{#1}{@next}=0 |
| 2257 |
\ifnum\forestOve{#1}{@parent}=0 |
| 2258 |
0% |
| 2259 |
\else |
| 2260 |
\@escapeifif{\expandnumberarg\forest@node@Linearnextnotdescendantid{\forestOve{#1}{@parent}}}% |
| 2261 |
\fi |
| 2262 |
\else |
| 2263 |
\forestOve{#1}{@next}% |
| 2264 |
\fi |
| 2265 |
} |
| 2266 |
\def\forest@node@linearpreviousid{% |
| 2267 |
\ifnum\forestove{@previous}=0 |
| 2268 |
\forestove{@parent}% |
| 2269 |
\else |
| 2270 |
\forest@node@previousleafid |
| 2271 |
\fi |
| 2272 |
} |
| 2273 |
|
| 2274 |
\def\forest@ifancestorof#1{% is the current node an ancestor of #1? Yes: #2, no: #3 |
| 2275 |
\begingroup |
| 2276 |
\expandnumberarg\forest@ifancestorof@{\forestOve{#1}{@parent}}% |
| 2277 |
} |
| 2278 |
\def\forest@ifancestorof@#1{% |
| 2279 |
\ifnum#1=0 |
| 2280 |
\def\forest@ifancestorof@next{\expandafter\endgroup\@secondoftwo}% |
| 2281 |
\else |
| 2282 |
\ifnum\forest@cn=#1 |
| 2283 |
\def\forest@ifancestorof@next{\expandafter\endgroup\@firstoftwo}% |
| 2284 |
\else |
| 2285 |
\ifcsdef{forest@circularity@used#1}{% |
| 2286 |
\def\forest@ifancestorof@next{\expandafter\endgroup\@secondoftwo}% |
| 2287 |
}{% |
| 2288 |
\csdef{forest@circularity@used#1}{}% |
| 2289 |
\def\forest@ifancestorof@next{\expandnumberarg\forest@ifancestorof@{\forestOve{#1}{@parent}}}% |
| 2290 |
}% |
| 2291 |
\fi |
| 2292 |
\fi |
| 2293 |
\forest@ifancestorof@next |
| 2294 |
} |
| 2295 |
\NewDocumentCommand\forestdebugtypeouttrees{o}{% |
| 2296 |
\forestdebug@typeouttrees\forest@temp |
| 2297 |
\typeout{% |
| 2298 |
\forestdebugtypeouttreesprefix |
| 2299 |
\IfValueTF{#1}{#1: }{}% |
| 2300 |
\detokenize\expandafter{\forest@temp}% |
| 2301 |
\forestdebugtypeouttreessuffix |
| 2302 |
}% |
| 2303 |
} |
| 2304 |
\def\forestdebug@typeouttrees#1{% #1 = cs to store the result |
| 2305 |
\begingroup |
| 2306 |
\edef\forest@temp@message{}% |
| 2307 |
\def\forestdebug@typeouttrees@n{0}% |
| 2308 |
\loop |
| 2309 |
\ifnum\forestdebug@typeouttrees@n<\forest@node@maxid |
| 2310 |
\edef\forestdebug@typeouttrees@n{\number\numexpr\forestdebug@typeouttrees@n+1}% |
| 2311 |
\ifcsdef{forestdebug@typeouttree@used@\forestdebug@typeouttrees@n}{}{% |
| 2312 |
\forest@fornode{\forestdebug@typeouttrees@n}{% |
| 2313 |
\begingroup |
| 2314 |
\forestdebug@typeouttrees@findroot |
| 2315 |
\expandafter\endgroup |
| 2316 |
\expandafter\edef\expandafter\forest@cn\expandafter{\forest@cn}% |
| 2317 |
\forestdebug@typeouttree@build |
| 2318 |
\appto\forest@temp@message{ }% |
| 2319 |
}% |
| 2320 |
}% |
| 2321 |
\repeat |
| 2322 |
\expandafter\endgroup |
| 2323 |
\expandafter\def\expandafter#1\expandafter{\forest@temp@message}% |
| 2324 |
} |
| 2325 |
\def\forestdebug@typeouttrees@findroot{% |
| 2326 |
\let\forestdebug@typeouttrees@next\relax |
| 2327 |
\edef\forestdebug@typeouttrees@parent{\forestOve{\forest@cn}{@parent}}% |
| 2328 |
\ifnum\forestdebug@typeouttrees@parent=0 |
| 2329 |
\else |
| 2330 |
\ifcsdef{forestdebug@typeouttree@used@\forest@cn}{}{% |
| 2331 |
\csdef{forestdebug@typeouttree@used@\forest@cn}{}% |
| 2332 |
\edef\forest@cn{\forestdebug@typeouttrees@parent}% |
| 2333 |
\let\forestdebug@typeouttrees@next\forestdebug@typeouttrees@findroot |
| 2334 |
}% |
| 2335 |
\fi |
| 2336 |
\forestdebug@typeouttrees@next |
| 2337 |
} |
| 2338 |
\def\forestdebug@typeouttree#1#2{% #1=root id, #2=cs to receive result |
| 2339 |
\begingroup |
| 2340 |
\edef\forest@temp@message{}% |
| 2341 |
\forest@fornode{#1}{\forestdebug@typeouttree@build}% |
| 2342 |
\expandafter\endgroup |
| 2343 |
\expandafter\edef\expandafter#2\expandafter{\forest@temp@message}% |
| 2344 |
} |
| 2345 |
\NewDocumentCommand\forestdebugtypeouttree{d() O{\forest@cn}}{% |
| 2346 |
\forestdebug@typeouttree{#2}\forest@temp |
| 2347 |
\typeout{\IfValueTF{#1}{#1: }{}\forest@temp}% |
| 2348 |
} |
| 2349 |
\def\forestdebug@typeouttree@build{% |
| 2350 |
\eappto\forest@temp@message{[\forestdebugtypeouttreenodeinfo%] |
| 2351 |
\ifcsdef{forestdebug@typeouttree@used@\forest@cn}{*}{}% |
| 2352 |
}% |
| 2353 |
\ifcsdef{forestdebug@typeouttree@used@\forest@cn}{}{% |
| 2354 |
\csdef{forestdebug@typeouttree@used@\forest@cn}{}% |
| 2355 |
\forest@node@foreachchild{\forestdebug@typeouttree@build}% |
| 2356 |
}% |
| 2357 |
\eappto\forest@temp@message{%[ |
| 2358 |
]}% |
| 2359 |
} |
| 2360 |
\def\forestdebugtypeouttreenodeinfo{\forest@cn} |
| 2361 |
\def\forestdebugtypeouttreesprefix{} |
| 2362 |
\def\forestdebugtypeouttreessuffix{} |
| 2363 |
\def\forest@declarehandler#1#2#3{%#1=handler for specific type,#2=option name,#3=default value |
| 2364 |
\pgfkeyssetvalue{/forest/#2}{#3}% |
| 2365 |
\appto\forest@node@init{\forestoinit{#2}}% |
| 2366 |
\pgfkeyssetvalue{/forest/#2/node@or@reg}{\forest@cn}% |
| 2367 |
\forest@convert@others@to@underscores{#2}\forest@pgfmathoptionname |
| 2368 |
\edef\forest@marshal{% |
| 2369 |
\noexpand#1{/forest/#2}{/forest}{#2}{\forest@pgfmathoptionname}% |
| 2370 |
}\forest@marshal |
| 2371 |
} |
| 2372 |
\def\forest@def@with@pgfeov#1#2{% \pgfeov mustn't occur in the arg of the .code handler!!! |
| 2373 |
\long\def#1##1\pgfeov{#2}% |
| 2374 |
} |
| 2375 |
\def\forest@declaretoks@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2376 |
\forest@declaretoks@handler@A{#1}{#2}{#3}{#4}{}% |
| 2377 |
} |
| 2378 |
\def\forest@declarekeylist@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2379 |
\forest@declaretoks@handler@A{#1}{#2}{#3}{#4}{,}% |
| 2380 |
\forest@copycommandkey{#1}{#1'}% |
| 2381 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 2382 |
\forest@copycommandkey{#1+}{#1}% |
| 2383 |
\pgfkeysalso{#1-/.code={% |
| 2384 |
\forest@fornode{\forest@setter@node}{% |
| 2385 |
\forest@node@removekeysfromkeylist{##1}{#3}% |
| 2386 |
}}}% |
| 2387 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 2388 |
} |
| 2389 |
\def\forest@declaretoks@handler@A#1#2#3#4#5{% #1=key,#2=path,#3=name,#4=pgfmathname,#5=infix |
| 2390 |
\pgfkeysalso{% |
| 2391 |
#1/.code={\forestOset{\forest@setter@node}{#3}{##1}}, |
| 2392 |
#2/if #3/.code n args={3}{% |
| 2393 |
\forestoget{#3}\forest@temp@option@value |
| 2394 |
\edef\forest@temp@compared@value{\unexpanded{##1}}% |
| 2395 |
\ifx\forest@temp@option@value\forest@temp@compared@value |
| 2396 |
\pgfkeysalso{##2}% |
| 2397 |
\else |
| 2398 |
\pgfkeysalso{##3}% |
| 2399 |
\fi |
| 2400 |
}, |
| 2401 |
#2/if in #3/.code n args={3}{% |
| 2402 |
\forestoget{#3}\forest@temp@option@value |
| 2403 |
\edef\forest@temp@compared@value{\unexpanded{##1}}% |
| 2404 |
\expandafter\expandafter\expandafter\pgfutil@in@\expandafter\expandafter\expandafter{\expandafter\forest@temp@compared@value\expandafter}\expandafter{\forest@temp@option@value}% |
| 2405 |
\ifpgfutil@in@ |
| 2406 |
\pgfkeysalso{##2}% |
| 2407 |
\else |
| 2408 |
\pgfkeysalso{##3}% |
| 2409 |
\fi |
| 2410 |
}, |
| 2411 |
#2/where #3/.style n args={3}{for tree={#2/if #3={##1}{##2}{##3}}}, |
| 2412 |
#2/where in #3/.style n args={3}{for tree={#2/if in #3={##1}{##2}{##3}}} |
| 2413 |
}% |
| 2414 |
\ifstrempty{#5}{% |
| 2415 |
\pgfkeysalso{% |
| 2416 |
#1+/.code={\forestOappto{\forest@setter@node}{#3}{#5##1}}, |
| 2417 |
#2/+#3/.code={\forestOpreto{\forest@setter@node}{#3}{##1#5}}, |
| 2418 |
}% |
| 2419 |
}{% |
| 2420 |
\pgfkeysalso{% |
| 2421 |
#1+/.code={% |
| 2422 |
\forestOget{\forest@setter@node}{#3}\forest@temp |
| 2423 |
\ifdefempty{\forest@temp}{% |
| 2424 |
\forestOset{\forest@setter@node}{#3}{##1}% |
| 2425 |
}{% |
| 2426 |
\forestOappto{\forest@setter@node}{#3}{#5##1}% |
| 2427 |
}% |
| 2428 |
}, |
| 2429 |
#2/+#3/.code={% |
| 2430 |
\forestOget{\forest@setter@node}{#3}\forest@temp |
| 2431 |
\ifdefempty{\forest@temp}{% |
| 2432 |
\forestOset{\forest@setter@node}{#3}{##1}% |
| 2433 |
}{% |
| 2434 |
\forestOpreto{\forest@setter@node}{#3}{##1#5}% |
| 2435 |
}% |
| 2436 |
}% |
| 2437 |
}% |
| 2438 |
}% |
| 2439 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 2440 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 2441 |
\pgfkeyssetvalue{#2/+#3/option@name}{#3}% |
| 2442 |
\pgfkeyslet{#1/@type}\forestmathtype@generic % for .process & co |
| 2443 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@attribute@toks{##1}{#3}}% |
| 2444 |
} |
| 2445 |
\def\forest@declareautowrappedtoks@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname,#5=infix |
| 2446 |
\forest@declaretoks@handler{#1}{#2}{#3}{#4}% |
| 2447 |
\forest@copycommandkey{#1}{#1'}% |
| 2448 |
\pgfkeysalso{#1/.style={#1'/.wrap value={##1}}}% |
| 2449 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 2450 |
\forest@copycommandkey{#1+}{#1+'}% |
| 2451 |
\pgfkeysalso{#1+/.style={#1+'/.wrap value={##1}}}% |
| 2452 |
\pgfkeyssetvalue{#1+'/option@name}{#3}% |
| 2453 |
\forest@copycommandkey{#2/+#3}{#2/+#3'}% |
| 2454 |
\pgfkeysalso{#2/+#3/.style={#2/+#3'/.wrap value={##1}}}% |
| 2455 |
\pgfkeyssetvalue{#2/+#3'/option@name}{#3}% |
| 2456 |
} |
| 2457 |
\def\forest@declarereadonlydimen@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2458 |
% this is to have `pt` with the correct category code |
| 2459 |
\pgfutil@tempdima=\pgfkeysvalueof{/forest/#3}\relax |
| 2460 |
\edef\forest@marshal{% |
| 2461 |
\noexpand\pgfkeyssetvalue{/forest/#3}{\the\pgfutil@tempdima}% |
| 2462 |
}\forest@marshal |
| 2463 |
\pgfkeysalso{% |
| 2464 |
#2/if #3/.code n args={3}{% |
| 2465 |
\forestoget{#3}\forest@temp@option@value |
| 2466 |
\ifdim\forest@temp@option@value=##1\relax |
| 2467 |
\pgfkeysalso{##2}% |
| 2468 |
\else |
| 2469 |
\pgfkeysalso{##3}% |
| 2470 |
\fi |
| 2471 |
}, |
| 2472 |
#2/if #3</.code n args={3}{% |
| 2473 |
\forestoget{#3}\forest@temp@option@value |
| 2474 |
\ifdim\forest@temp@option@value>##1\relax |
| 2475 |
\pgfkeysalso{##3}% |
| 2476 |
\else |
| 2477 |
\pgfkeysalso{##2}% |
| 2478 |
\fi |
| 2479 |
}, |
| 2480 |
#2/if #3>/.code n args={3}{% |
| 2481 |
\forestoget{#3}\forest@temp@option@value |
| 2482 |
\ifdim\forest@temp@option@value<##1\relax |
| 2483 |
\pgfkeysalso{##3}% |
| 2484 |
\else |
| 2485 |
\pgfkeysalso{##2}% |
| 2486 |
\fi |
| 2487 |
}, |
| 2488 |
#2/where #3/.style n args={3}{for tree={#2/if #3={##1}{##2}{##3}}}, |
| 2489 |
#2/where #3</.style n args={3}{for tree={#2/if #3<={##1}{##2}{##3}}}, |
| 2490 |
#2/where #3>/.style n args={3}{for tree={#2/if #3>={##1}{##2}{##3}}}, |
| 2491 |
}% |
| 2492 |
\pgfkeyslet{#1/@type}\forestmathtype@dimen % for .process & co |
| 2493 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@attribute@dimen{##1}{#3}}% |
| 2494 |
} |
| 2495 |
\def\forest@declaredimen@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2496 |
\forest@declarereadonlydimen@handler{#1}{#2}{#3}{#4}% |
| 2497 |
\pgfkeysalso{% |
| 2498 |
#1/.code={% |
| 2499 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 2500 |
\forestOlet{\forest@setter@node}{#3}\forest@temp |
| 2501 |
}, |
| 2502 |
#1+/.code={% |
| 2503 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 2504 |
\pgfutil@tempdima=\forestove{#3} |
| 2505 |
\advance\pgfutil@tempdima\forest@temp\relax |
| 2506 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2507 |
}, |
| 2508 |
#1-/.code={% |
| 2509 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 2510 |
\pgfutil@tempdima=\forestove{#3} |
| 2511 |
\advance\pgfutil@tempdima-\forest@temp\relax |
| 2512 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2513 |
}, |
| 2514 |
#1*/.style={% |
| 2515 |
#1={#4()*(##1)}% |
| 2516 |
}, |
| 2517 |
#1:/.style={% |
| 2518 |
#1={#4()/(##1)}% |
| 2519 |
}, |
| 2520 |
#1'/.code={% |
| 2521 |
\pgfutil@tempdima=##1\relax |
| 2522 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2523 |
}, |
| 2524 |
#1'+/.code={% |
| 2525 |
\pgfutil@tempdima=\forestove{#3}\relax |
| 2526 |
\advance\pgfutil@tempdima##1\relax |
| 2527 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2528 |
}, |
| 2529 |
#1'-/.code={% |
| 2530 |
\pgfutil@tempdima=\forestove{#3}\relax |
| 2531 |
\advance\pgfutil@tempdima-##1\relax |
| 2532 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2533 |
}, |
| 2534 |
#1'*/.style={% |
| 2535 |
\pgfutil@tempdima=\forestove{#3}\relax |
| 2536 |
\multiply\pgfutil@tempdima##1\relax |
| 2537 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2538 |
}, |
| 2539 |
#1':/.style={% |
| 2540 |
\pgfutil@tempdima=\forestove{#3}\relax |
| 2541 |
\divide\pgfutil@tempdima##1\relax |
| 2542 |
\forestOeset{\forest@setter@node}{#3}{\the\pgfutil@tempdima}% |
| 2543 |
}, |
| 2544 |
}% |
| 2545 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 2546 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 2547 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 2548 |
\pgfkeyssetvalue{#1*/option@name}{#3}% |
| 2549 |
\pgfkeyssetvalue{#1:/option@name}{#3}% |
| 2550 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 2551 |
\pgfkeyssetvalue{#1'+/option@name}{#3}% |
| 2552 |
\pgfkeyssetvalue{#1'-/option@name}{#3}% |
| 2553 |
\pgfkeyssetvalue{#1'*/option@name}{#3}% |
| 2554 |
\pgfkeyssetvalue{#1':/option@name}{#3}% |
| 2555 |
} |
| 2556 |
\def\forest@declarereadonlycount@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2557 |
\pgfkeysalso{ |
| 2558 |
#2/if #3/.code n args={3}{% |
| 2559 |
\forestoget{#3}\forest@temp@option@value |
| 2560 |
\ifnum\forest@temp@option@value=##1\relax |
| 2561 |
\pgfkeysalso{##2}% |
| 2562 |
\else |
| 2563 |
\pgfkeysalso{##3}% |
| 2564 |
\fi |
| 2565 |
}, |
| 2566 |
#2/if #3</.code n args={3}{% |
| 2567 |
\forestoget{#3}\forest@temp@option@value |
| 2568 |
\ifnum\forest@temp@option@value>##1\relax |
| 2569 |
\pgfkeysalso{##3}% |
| 2570 |
\else |
| 2571 |
\pgfkeysalso{##2}% |
| 2572 |
\fi |
| 2573 |
}, |
| 2574 |
#2/if #3>/.code n args={3}{% |
| 2575 |
\forestoget{#3}\forest@temp@option@value |
| 2576 |
\ifnum\forest@temp@option@value<##1\relax |
| 2577 |
\pgfkeysalso{##3}% |
| 2578 |
\else |
| 2579 |
\pgfkeysalso{##2}% |
| 2580 |
\fi |
| 2581 |
}, |
| 2582 |
#2/where #3/.style n args={3}{for tree={#2/if #3={##1}{##2}{##3}}}, |
| 2583 |
#2/where #3</.style n args={3}{for tree={#2/if #3<={##1}{##2}{##3}}}, |
| 2584 |
#2/where #3>/.style n args={3}{for tree={#2/if #3>={##1}{##2}{##3}}}, |
| 2585 |
}% |
| 2586 |
\pgfkeyslet{#1/@type}\forestmathtype@count % for .process & co |
| 2587 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@attribute@count{##1}{#3}}% |
| 2588 |
} |
| 2589 |
\def\forest@declarecount@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2590 |
\forest@declarereadonlycount@handler{#1}{#2}{#3}{#4}% |
| 2591 |
\pgfkeysalso{ |
| 2592 |
#1/.code={% |
| 2593 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 2594 |
\forestOlet{\forest@setter@node}{#3}\forest@temp |
| 2595 |
}, |
| 2596 |
#1+/.code={% |
| 2597 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 2598 |
\c@pgf@counta=\forestove{#3}\relax |
| 2599 |
\advance\c@pgf@counta\forest@temp\relax |
| 2600 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2601 |
}, |
| 2602 |
#1-/.code={% |
| 2603 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 2604 |
\c@pgf@counta=\forestove{#3}\relax |
| 2605 |
\advance\c@pgf@counta-\forest@temp\relax |
| 2606 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2607 |
}, |
| 2608 |
#1*/.code={% |
| 2609 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 2610 |
\c@pgf@counta=\forestove{#3}\relax |
| 2611 |
\multiply\c@pgf@counta\forest@temp\relax |
| 2612 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2613 |
}, |
| 2614 |
#1:/.code={% |
| 2615 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 2616 |
\c@pgf@counta=\forestove{#3}\relax |
| 2617 |
\divide\c@pgf@counta\forest@temp\relax |
| 2618 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2619 |
}, |
| 2620 |
#1'/.code={% |
| 2621 |
\c@pgf@counta=##1\relax |
| 2622 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2623 |
}, |
| 2624 |
#1'+/.code={% |
| 2625 |
\c@pgf@counta=\forestove{#3}\relax |
| 2626 |
\advance\c@pgf@counta##1\relax |
| 2627 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2628 |
}, |
| 2629 |
#1'-/.code={% |
| 2630 |
\c@pgf@counta=\forestove{#3}\relax |
| 2631 |
\advance\c@pgf@counta-##1\relax |
| 2632 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2633 |
}, |
| 2634 |
#1'*/.style={% |
| 2635 |
\c@pgf@counta=\forestove{#3}\relax |
| 2636 |
\multiply\c@pgf@counta##1\relax |
| 2637 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2638 |
}, |
| 2639 |
#1':/.style={% |
| 2640 |
\c@pgf@counta=\forestove{#3}\relax |
| 2641 |
\divide\c@pgf@counta##1\relax |
| 2642 |
\forestOeset{\forest@setter@node}{#3}{\the\c@pgf@counta}% |
| 2643 |
}, |
| 2644 |
}% |
| 2645 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 2646 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 2647 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 2648 |
\pgfkeyssetvalue{#1*/option@name}{#3}% |
| 2649 |
\pgfkeyssetvalue{#1:/option@name}{#3}% |
| 2650 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 2651 |
\pgfkeyssetvalue{#1'+/option@name}{#3}% |
| 2652 |
\pgfkeyssetvalue{#1'-/option@name}{#3}% |
| 2653 |
\pgfkeyssetvalue{#1'*/option@name}{#3}% |
| 2654 |
\pgfkeyssetvalue{#1':/option@name}{#3}% |
| 2655 |
} |
| 2656 |
\def\forest@declareboolean@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 2657 |
\pgfkeysalso{% |
| 2658 |
#1/.code={% |
| 2659 |
\forestmath@if{##1}{% |
| 2660 |
\def\forest@temp{1}% |
| 2661 |
}{% |
| 2662 |
\def\forest@temp{0}% |
| 2663 |
}% |
| 2664 |
\forestOlet{\forest@setter@node}{#3}\forest@temp |
| 2665 |
}, |
| 2666 |
#1/.default=1, |
| 2667 |
#2/not #3/.code={\forestOset{\forest@setter@node}{#3}{0}}, |
| 2668 |
#2/if #3/.code 2 args={% |
| 2669 |
\forestoget{#3}\forest@temp@option@value |
| 2670 |
\ifnum\forest@temp@option@value=0 |
| 2671 |
\pgfkeysalso{##2}% |
| 2672 |
\else |
| 2673 |
\pgfkeysalso{##1}% |
| 2674 |
\fi |
| 2675 |
}, |
| 2676 |
#2/where #3/.style 2 args={for tree={#2/if #3={##1}{##2}}} |
| 2677 |
}% |
| 2678 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 2679 |
\pgfkeyslet{#1/@type}\forestmathtype@count % for .process & co |
| 2680 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@attribute@count{##1}{#3}}% |
| 2681 |
} |
| 2682 |
\forestset{ |
| 2683 |
declare toks/.code 2 args={% |
| 2684 |
\forest@declarehandler\forest@declaretoks@handler{#1}{#2}% |
| 2685 |
}, |
| 2686 |
declare autowrapped toks/.code 2 args={% |
| 2687 |
\forest@declarehandler\forest@declareautowrappedtoks@handler{#1}{#2}% |
| 2688 |
}, |
| 2689 |
declare keylist/.code 2 args={% |
| 2690 |
\forest@declarehandler\forest@declarekeylist@handler{#1}{#2}% |
| 2691 |
}, |
| 2692 |
declare readonly dimen/.code 2 args={% |
| 2693 |
\forestmathsetlengthmacro\forest@temp{#2}% |
| 2694 |
\edef\forest@marshal{% |
| 2695 |
\unexpanded{\forest@declarehandler\forest@declarereadonlydimen@handler{#1}}{\forest@temp}% |
| 2696 |
}\forest@marshal |
| 2697 |
}, |
| 2698 |
declare dimen/.code 2 args={% |
| 2699 |
\forestmathsetlengthmacro\forest@temp{#2}% |
| 2700 |
\edef\forest@marshal{% |
| 2701 |
\unexpanded{\forest@declarehandler\forest@declaredimen@handler{#1}}{\forest@temp}% |
| 2702 |
}\forest@marshal |
| 2703 |
}, |
| 2704 |
declare readonly count/.code 2 args={% |
| 2705 |
\forestmathtruncatemacro\forest@temp{#2}% |
| 2706 |
\edef\forest@marshal{% |
| 2707 |
\unexpanded{\forest@declarehandler\forest@declarereadonlycount@handler{#1}}{\forest@temp}% |
| 2708 |
}\forest@marshal |
| 2709 |
}, |
| 2710 |
declare count/.code 2 args={% |
| 2711 |
\forestmathtruncatemacro\forest@temp{#2}% |
| 2712 |
\edef\forest@marshal{% |
| 2713 |
\unexpanded{\forest@declarehandler\forest@declarecount@handler{#1}}{\forest@temp}% |
| 2714 |
}\forest@marshal |
| 2715 |
}, |
| 2716 |
declare boolean/.code 2 args={% |
| 2717 |
\forestmath@if{#2}{% |
| 2718 |
\def\forest@temp{1}% |
| 2719 |
}{% |
| 2720 |
\def\forest@temp{0}% |
| 2721 |
}% |
| 2722 |
\edef\forest@marshal{% |
| 2723 |
\unexpanded{\forest@declarehandler\forest@declareboolean@handler{#1}}{\forest@temp}% |
| 2724 |
}\forest@marshal |
| 2725 |
}, |
| 2726 |
/handlers/.restore default value/.code={% |
| 2727 |
\edef\forest@handlers@currentpath{\pgfkeyscurrentpath}% |
| 2728 |
\pgfkeysgetvalue{\pgfkeyscurrentpath/option@name}\forest@currentoptionname |
| 2729 |
\pgfkeysgetvalue{/forest/\forest@currentoptionname}\forest@temp |
| 2730 |
\expandafter\pgfkeysalso\expandafter{\forest@handlers@currentpath/.expand once=\forest@temp}% |
| 2731 |
}, |
| 2732 |
/handlers/.pgfmath/.code={% |
| 2733 |
\pgfmathparse{#1}% |
| 2734 |
\pgfkeysalso{\pgfkeyscurrentpath/.expand once=\pgfmathresult}% |
| 2735 |
}, |
| 2736 |
/handlers/.wrap value/.code={% |
| 2737 |
\edef\forest@handlers@wrap@currentpath{\pgfkeyscurrentpath}% |
| 2738 |
\pgfkeysgetvalue{\forest@handlers@wrap@currentpath/option@name}\forest@currentoptionname |
| 2739 |
\forestOget{\pgfkeysvalueof{/forest/\forest@currentoptionname/node@or@reg}}{\forest@currentoptionname}\forest@option@value |
| 2740 |
\forest@def@with@pgfeov\forest@wrap@code{#1}% |
| 2741 |
\expandafter\edef\expandafter\forest@wrapped@value\expandafter{\expandafter\expandonce\expandafter{\expandafter\forest@wrap@code\forest@option@value\pgfeov}}% |
| 2742 |
\pgfkeysalso{\forest@handlers@wrap@currentpath/.expand once=\forest@wrapped@value}% |
| 2743 |
}, |
| 2744 |
/handlers/.option/.code={% |
| 2745 |
\edef\forest@temp{\pgfkeyscurrentpath}% |
| 2746 |
\expandafter\forest@handlers@option\expandafter{\forest@temp}{#1}% |
| 2747 |
}, |
| 2748 |
} |
| 2749 |
\def\forest@handlers@option#1#2{%#1=pgfkeyscurrentpath,#2=relative node name |
| 2750 |
\forestRNOget{#2}\forest@temp |
| 2751 |
\pgfkeysalso{#1/.expand once={\forest@temp}}% |
| 2752 |
}% |
| 2753 |
\forestset{ |
| 2754 |
/handlers/.register/.code={% |
| 2755 |
\edef\forest@marshal{% |
| 2756 |
\noexpand\pgfkeysalso{\pgfkeyscurrentpath={\forestregister{#1}}}% |
| 2757 |
}\forest@marshal |
| 2758 |
}, |
| 2759 |
/handlers/.wrap pgfmath arg/.code 2 args={% |
| 2760 |
\forestmathparse{#2}\let\forest@wrap@arg@i\forestmathresult |
| 2761 |
\edef\forest@wrap@args{{\expandonce\forest@wrap@arg@i}}% |
| 2762 |
\def\forest@wrap@code##1{#1}% |
| 2763 |
% here we don't call \forest@wrap@pgfmath@args@@@wrapandpasson, as compat-2.0.2-wrappgfmathargs changes that to achieve the old, confusing state of affairs, which *didn't* apply at *1*-arg pgfmath wrapping |
| 2764 |
\expandafter\expandafter\expandafter\forest@temp@toks\expandafter\expandafter\expandafter{\expandafter\forest@wrap@code\forest@wrap@args}% |
| 2765 |
\expandafter\pgfkeysalso\expandafter{\expandafter\pgfkeyscurrentpath\expandafter=\expandafter{\the\forest@temp@toks}}% |
| 2766 |
}, |
| 2767 |
/handlers/.wrap 2 pgfmath args/.code n args={3}{% |
| 2768 |
\forestmathparse{#2}\let\forest@wrap@arg@i\forestmathresult |
| 2769 |
\forestmathparse{#3}\let\forest@wrap@arg@ii\forestmathresult |
| 2770 |
\edef\forest@wrap@args{{\expandonce\forest@wrap@arg@i}{\expandonce\forest@wrap@arg@ii}}% |
| 2771 |
\def\forest@wrap@code##1##2{#1}% |
| 2772 |
\forest@wrap@pgfmath@args@@@wrapandpasson |
| 2773 |
}, |
| 2774 |
/handlers/.wrap 3 pgfmath args/.code n args={4}{% |
| 2775 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{}{}{}{}{}{3}% |
| 2776 |
\forest@wrap@n@pgfmath@do{#1}{3}}, |
| 2777 |
/handlers/.wrap 4 pgfmath args/.code n args={5}{% |
| 2778 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{#5}{}{}{}{}{4}% |
| 2779 |
\forest@wrap@n@pgfmath@do{#1}{4}}, |
| 2780 |
/handlers/.wrap 5 pgfmath args/.code n args={6}{% |
| 2781 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{#5}{#6}{}{}{}{5}% |
| 2782 |
\forest@wrap@n@pgfmath@do{#1}{5}}, |
| 2783 |
/handlers/.wrap 6 pgfmath args/.code n args={7}{% |
| 2784 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{#5}{#6}{#7}{}{}{6}% |
| 2785 |
\forest@wrap@n@pgfmath@do{#1}{6}}, |
| 2786 |
/handlers/.wrap 7 pgfmath args/.code n args={8}{% |
| 2787 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{#5}{#6}{#7}{#8}{}{7}% |
| 2788 |
\forest@wrap@n@pgfmath@do{#1}{7}}, |
| 2789 |
/handlers/.wrap 8 pgfmath args/.code n args={9}{% |
| 2790 |
\forest@wrap@n@pgfmath@args{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}{8}% |
| 2791 |
\forest@wrap@n@pgfmath@do{#1}{8}}, |
| 2792 |
} |
| 2793 |
\def\forest@wrap@n@pgfmath@args#1#2#3#4#5#6#7#8#9{% |
| 2794 |
\forestmathparse{#1}\let\forest@wrap@arg@i\forestmathresult |
| 2795 |
\ifnum#9>1 \forestmathparse{#2}\let\forest@wrap@arg@ii\forestmathresult\fi |
| 2796 |
\ifnum#9>2 \forestmathparse{#3}\let\forest@wrap@arg@iii\forestmathresult\fi |
| 2797 |
\ifnum#9>3 \forestmathparse{#4}\let\forest@wrap@arg@iv\forestmathresult\fi |
| 2798 |
\ifnum#9>4 \forestmathparse{#5}\let\forest@wrap@arg@v\forestmathresult\fi |
| 2799 |
\ifnum#9>5 \forestmathparse{#6}\let\forest@wrap@arg@vi\forestmathresult\fi |
| 2800 |
\ifnum#9>6 \forestmathparse{#7}\let\forest@wrap@arg@vii\forestmathresult\fi |
| 2801 |
\ifnum#9>7 \forestmathparse{#8}\let\forest@wrap@arg@viii\forestmathresult\fi |
| 2802 |
\edef\forest@wrap@args{% |
| 2803 |
{\expandonce\forest@wrap@arg@i} |
| 2804 |
\ifnum#9>1 {\expandonce\forest@wrap@arg@ii}\fi |
| 2805 |
\ifnum#9>2 {\expandonce\forest@wrap@arg@iii}\fi |
| 2806 |
\ifnum#9>3 {\expandonce\forest@wrap@arg@iv}\fi |
| 2807 |
\ifnum#9>4 {\expandonce\forest@wrap@arg@v}\fi |
| 2808 |
\ifnum#9>5 {\expandonce\forest@wrap@arg@vi}\fi |
| 2809 |
\ifnum#9>6 {\expandonce\forest@wrap@arg@vii}\fi |
| 2810 |
\ifnum#9>7 {\expandonce\forest@wrap@arg@viii}\fi |
| 2811 |
}% |
| 2812 |
} |
| 2813 |
\def\forest@wrap@n@pgfmath@do#1#2{% |
| 2814 |
\ifcase#2\relax |
| 2815 |
\or\def\forest@wrap@code##1{#1}% |
| 2816 |
\or\def\forest@wrap@code##1##2{#1}% |
| 2817 |
\or\def\forest@wrap@code##1##2##3{#1}% |
| 2818 |
\or\def\forest@wrap@code##1##2##3##4{#1}% |
| 2819 |
\or\def\forest@wrap@code##1##2##3##4##5{#1}% |
| 2820 |
\or\def\forest@wrap@code##1##2##3##4##5##6{#1}% |
| 2821 |
\or\def\forest@wrap@code##1##2##3##4##5##6##7{#1}% |
| 2822 |
\or\def\forest@wrap@code##1##2##3##4##5##6##7##8{#1}% |
| 2823 |
\fi |
| 2824 |
\forest@wrap@pgfmath@args@@@wrapandpasson |
| 2825 |
} |
| 2826 |
\def\forest@wrap@pgfmath@args@@@wrapandpasson{% |
| 2827 |
\expandafter\expandafter\expandafter\forest@temp@toks |
| 2828 |
\expandafter\expandafter\expandafter{% |
| 2829 |
\expandafter\forest@wrap@code\forest@wrap@args}% |
| 2830 |
\expandafter\pgfkeysalso\expandafter{% |
| 2831 |
\expandafter\pgfkeyscurrentpath\expandafter=\expandafter{% |
| 2832 |
\the\forest@temp@toks}}% |
| 2833 |
} |
| 2834 |
\def\forest@process@catregime{} % filled by processor defs |
| 2835 |
\forest@newarray\forest@process@left@ % processed args |
| 2836 |
\forest@newarray\forest@process@right@ % unprocessed args |
| 2837 |
\forest@newarray\forest@process@saved@ % used by instructions |S| and |U| |
| 2838 |
\let\forest@process@savedtype\forestmathtype@none |
| 2839 |
\forest@newglobalarray\forest@process@result@ |
| 2840 |
\newif\ifforest@process@returnarray@ |
| 2841 |
\def\forest@process#1#2#{% #1 = true/false (should we return an array?) |
| 2842 |
% #2 = processing instructions (if non-empty), |
| 2843 |
% (initial) args follow |
| 2844 |
\ifblank{#2}{\forest@process@a{#1}}{\forest@process@a{#1}{#2}}% |
| 2845 |
} |
| 2846 |
\Inline\def\forest@process@a#1#2{% |
| 2847 |
\begingroup |
| 2848 |
\forest@process@left@clear |
| 2849 |
\forest@process@right@clear |
| 2850 |
\forest@process@saved@clear |
| 2851 |
\let\forest@process@savedtype\forestmathtype@generic |
| 2852 |
\csname forest@process@returnarray@#1\endcsname |
| 2853 |
\def\forest@topextend@next{% |
| 2854 |
\ExpandIfT{forestdebug}{% |
| 2855 |
\edef\forest@process@debug@args{\unexpanded{#2}}% |
| 2856 |
\forest@processor@debuginfo@template{Start "\unexpanded{#2}}% |
| 2857 |
}% |
| 2858 |
\forest@process@catregime |
| 2859 |
\endlinechar=-1 |
| 2860 |
\scantokens{#2}% |
| 2861 |
\forest@process@finish |
| 2862 |
}% |
| 2863 |
\forest@process@right@topextend |
| 2864 |
} |
| 2865 |
\pgfkeys{% |
| 2866 |
/handlers/.process/.code={% |
| 2867 |
\forest@process{true}#1\forest@eov |
| 2868 |
\edef\forest@marshal{% |
| 2869 |
\noexpand\pgfkeysalso{\noexpand\pgfkeyscurrentpath=\forest@process@result@values}% |
| 2870 |
}\forest@marshal |
| 2871 |
}, |
| 2872 |
/forest/copy command key={/handlers/.process}{/handlers/.process args}, |
| 2873 |
} |
| 2874 |
\def\forest@process@finish{% |
| 2875 |
\ifforest@process@returnarray@ |
| 2876 |
\forest@process@finish@array |
| 2877 |
\else |
| 2878 |
\forest@process@finish@single |
| 2879 |
\fi |
| 2880 |
\global\let\forest@process@result@type\forestmathresulttype |
| 2881 |
\ifforestdebugprocess\forest@process@debug@end\fi |
| 2882 |
\endgroup |
| 2883 |
} |
| 2884 |
\def\forest@process@finish@single{% |
| 2885 |
\edef\forest@temp{forest@process@finish@single@% |
| 2886 |
\the\numexpr\forest@process@left@N-\forest@process@left@M\relax |
| 2887 |
\the\numexpr\forest@process@right@N-\forest@process@right@M\relax |
| 2888 |
}% |
| 2889 |
\ifcsname\forest@temp\endcsname |
| 2890 |
\csname\forest@temp\endcsname |
| 2891 |
\global\let\forest@process@result\forest@temp |
| 2892 |
\else |
| 2893 |
\forest@process@lengtherror |
| 2894 |
\fi |
| 2895 |
} |
| 2896 |
\csdef{forest@process@finish@single@10}{\forest@process@left@toppop\forest@temp} |
| 2897 |
\csdef{forest@process@finish@single@01}{\forest@process@right@toppop\forest@temp} |
| 2898 |
\def\forest@process@finish@array{% |
| 2899 |
\forest@process@result@clear |
| 2900 |
\forest@temp@count\forest@process@left@M\relax |
| 2901 |
\forest@loop |
| 2902 |
\ifnum\forest@temp@count<\forest@process@left@N\relax |
| 2903 |
\forest@process@left@get@{\the\forest@temp@count}\forest@temp |
| 2904 |
\forest@process@result@letappend\forest@temp |
| 2905 |
\advance\forest@temp@count1 |
| 2906 |
\forest@repeat |
| 2907 |
\forest@temp@count\forest@process@right@M\relax |
| 2908 |
\forest@loop |
| 2909 |
\ifnum\forest@temp@count<\forest@process@right@N\relax |
| 2910 |
\forest@process@right@get@{\the\forest@temp@count}\forest@temp |
| 2911 |
\forest@process@result@letappend\forest@temp |
| 2912 |
\advance\forest@temp@count1 |
| 2913 |
\forest@repeat |
| 2914 |
} |
| 2915 |
\ifforestdebug |
| 2916 |
\let\forest@process@d\forest@process@b |
| 2917 |
\def\forest@process@b#1\forest@eov{% save and print initial arguments |
| 2918 |
\edef\forest@process@debug@args{\unexpanded{#1}}% |
| 2919 |
\typeout{[forest .process] Start "\unexpanded{#1}"}% |
| 2920 |
\forest@process@d#1\forest@eov |
| 2921 |
} |
| 2922 |
\fi |
| 2923 |
\def\forest@process@debug@end{% |
| 2924 |
\typeout{[forest .process] End "\expandonce{\forest@process@debug@args}" -> "\forest@process@left@values\forest@process@right@values"}% |
| 2925 |
} |
| 2926 |
\def\forest@process@lengtherror{% |
| 2927 |
\PackageError{forest}{% |
| 2928 |
The ".process" expression was expected to evaluate to a single argument, |
| 2929 |
but the result is \the\forest@process@result@N |
| 2930 |
\space items long.}{}% |
| 2931 |
} |
| 2932 |
\def\forest@def@processor#1{% |
| 2933 |
{% |
| 2934 |
\def\forest@dp@double##1{% |
| 2935 |
\gdef\forest@global@temp{\forest@def@processor@{#1}{##1}}% |
| 2936 |
}% |
| 2937 |
\let\\\forest@dp@double |
| 2938 |
\catcode`#1=13 |
| 2939 |
\scantokens{\\#1}% |
| 2940 |
}% |
| 2941 |
\forest@global@temp |
| 2942 |
} |
| 2943 |
\def\forest@def@processor@#1#2{% |
| 2944 |
% #1 = instruction char (normal catcode), #2 = instruction char (active) |
| 2945 |
% #3 = default n (optional numeric arg, which precedes any other args; |
| 2946 |
% if the default is empty, this means no optional n) |
| 2947 |
% #4 = args spec, |
| 2948 |
% #5 = code |
| 2949 |
\eappto\forest@process@catregime{% |
| 2950 |
\unexpanded{\let#2}\expandonce{\csname forest@processor@#1\endcsname}% |
| 2951 |
\unexpanded{\catcode`#1=13 }% |
| 2952 |
}% |
| 2953 |
\def\forest@def@processor@inschar{#1}% |
| 2954 |
\forest@def@processor@@ |
| 2955 |
} |
| 2956 |
\def\forest@def@processor@@#1{% |
| 2957 |
\ifstrempty{#1}{% |
| 2958 |
\forest@def@processor@@non |
| 2959 |
}{% |
| 2960 |
\def\forest@def@processor@@default@n{#1}% |
| 2961 |
\forest@def@processor@@n |
| 2962 |
}% |
| 2963 |
} |
| 2964 |
\def\forest@def@processor@@non#1#2{% #1=args spec, #2=code |
| 2965 |
\csedef{forest@processor@\forest@def@processor@inschar}#1{% |
| 2966 |
\relax %% we need this (see above) |
| 2967 |
\unexpanded{#2}% |
| 2968 |
\expandafter\forest@def@processor@debuginfo\expandafter{% |
| 2969 |
\expandafter"\forest@def@processor@inschar"\ifstrempty{#1}{}{(#1)}}% |
| 2970 |
\ignorespaces |
| 2971 |
}% |
| 2972 |
} |
| 2973 |
\def\forest@def@processor@@n{% |
| 2974 |
\@ifnextchar*% |
| 2975 |
{\forest@temptrue\forest@def@processor@@n@}% |
| 2976 |
{\forest@tempfalse\forest@def@processor@@n@@}% |
| 2977 |
} |
| 2978 |
\def\forest@def@processor@@n@*{\forest@def@processor@@n@@} |
| 2979 |
\def\forest@def@processor@@n@@#1#2{% #1=args spec, #2=code |
| 2980 |
\csedef{forest@processor@\forest@def@processor@inschar}{% |
| 2981 |
\relax %% we need this (see above) |
| 2982 |
\noexpand\forestprocess@get@n |
| 2983 |
{\forest@def@processor@@default@n}% |
| 2984 |
\expandonce{\csname forest@processor@\forest@def@processor@inschar @\endcsname}% |
| 2985 |
}% |
| 2986 |
\ifforest@temp |
| 2987 |
\csedef{forest@processor@\forest@def@processor@inschar @}{% |
| 2988 |
\noexpand\forest@repeat@n@times{\forest@process@n}{% |
| 2989 |
\expandonce{\csname forest@processor@\forest@def@processor@inschar @rep\endcsname}% |
| 2990 |
}% |
| 2991 |
}% |
| 2992 |
\fi |
| 2993 |
\edef\forest@temp{% |
| 2994 |
\forest@def@processor@inschar |
| 2995 |
\ifforest@temp\else\noexpand\the\forest@process@n\fi |
| 2996 |
"}% |
| 2997 |
\csedef{forest@processor@\forest@def@processor@inschar @\ifforest@temp rep\fi}#1{% |
| 2998 |
\unexpanded{#2}% |
| 2999 |
\expandafter\forest@def@processor@debuginfo\expandafter{% |
| 3000 |
\forest@temp |
| 3001 |
\ifstrempty{#1}{}{(#1)}}% |
| 3002 |
}% |
| 3003 |
} |
| 3004 |
\def\forest@def@processor@debuginfo#1{% #1 = instruction call |
| 3005 |
\ifforestdebug |
| 3006 |
\expandonce{\forest@processor@debuginfo@template{\space\space After #1}}% |
| 3007 |
\fi |
| 3008 |
} |
| 3009 |
\def\forest@processor@debuginfo@template#1{% |
| 3010 |
\ifforestdebugprocess |
| 3011 |
\edef\forest@temp@left{\forest@process@left@values}% |
| 3012 |
\edef\forest@temp@right{\forest@process@right@values}% |
| 3013 |
\edef\forest@temp@saved{\forest@process@saved@values}% |
| 3014 |
\typeout{[forest .process] #1: left="\expandonce{\forest@temp@left}", right="\expandonce{\forest@temp@right}", saved="\expandonce{\forest@temp@saved}", type=\forestmathresulttype}% |
| 3015 |
\fi |
| 3016 |
} |
| 3017 |
\newcount\forest@process@n |
| 3018 |
\def\forestprocess@get@n#1#2{% |
| 3019 |
\def\forestprocess@default@n{#1}% |
| 3020 |
\let\forestprocess@after@get@n@#2% |
| 3021 |
\afterassignment\forestprocess@get@n@\forest@process@n=0% |
| 3022 |
} |
| 3023 |
\def\forestprocess@get@n@{% |
| 3024 |
\ifnum\forest@process@n=0 |
| 3025 |
\forest@process@n\forestprocess@default@n\relax |
| 3026 |
\fi |
| 3027 |
\forestprocess@after@get@n@ |
| 3028 |
} |
| 3029 |
\forest@def@processor{_}{1}*{}{% no processing, no type |
| 3030 |
\forest@process@right@bottompop\forest@temp |
| 3031 |
\forest@process@left@letappend\forest@temp |
| 3032 |
} |
| 3033 |
\forest@def@processor{n}{1}*{}{% numexpr |
| 3034 |
\forest@process@right@bottompop\forest@temp |
| 3035 |
\forest@process@left@esetappend{\number\numexpr\forest@temp}% |
| 3036 |
\let\forestmathresulttype\forestmathtype@count |
| 3037 |
} |
| 3038 |
\forest@def@processor{d}{1}*{}{% dimexpr |
| 3039 |
\forest@process@right@bottompop\forest@temp |
| 3040 |
\forest@process@left@esetappend{\the\dimexpr\forest@temp}% |
| 3041 |
\let\forestmathresulttype\forestmathtype@dimen |
| 3042 |
} |
| 3043 |
\forest@def@processor{P}{1}*{}{% pgfmath expression |
| 3044 |
\forest@process@right@bottompop\forest@temp |
| 3045 |
\pgfmathparse{\forest@temp}% |
| 3046 |
\forest@process@left@letappend\pgfmathresult |
| 3047 |
\let\forestmathresulttype\forestmathtype@unitless |
| 3048 |
} |
| 3049 |
\forest@def@processor{p}{1}*{}{% process expression |
| 3050 |
\forest@process@right@bottompop\forest@temp@a |
| 3051 |
\def\forest@temp{\forest@process{true}}% |
| 3052 |
\expandafter\forest@temp\forest@temp@a\forest@eov |
| 3053 |
\let\forest@topextend@next\relax |
| 3054 |
\edef\forest@temp{\forest@process@result@values}% |
| 3055 |
\expandafter\forest@process@left@topextend\forest@temp\forest@eov |
| 3056 |
\let\forestmathresulttype\forest@process@result@type |
| 3057 |
} |
| 3058 |
\forest@def@processor{t}{1}*{}{% text |
| 3059 |
\forest@process@right@bottompop\forest@temp |
| 3060 |
\forest@process@left@letappend\forest@temp |
| 3061 |
\let\forestmathresulttype\forestmathtype@textasc |
| 3062 |
} |
| 3063 |
\forest@def@processor{-}{}{}{% toggle ascending/descending |
| 3064 |
\forest@process@left@toppop\forestmathresult |
| 3065 |
\csname forest@processor@-@\forestmathresulttype\endcsname |
| 3066 |
\forest@process@left@letappend\forestmathresult |
| 3067 |
} |
| 3068 |
\cslet{forest@processor@-@\forestmathtype@generic}\relax |
| 3069 |
\csdef{forest@processor@-@\forestmathtype@count}{% |
| 3070 |
\forestmathadd{\forestmathzero}{-\forestmathresult}} |
| 3071 |
\csletcs{forest@processor@-@\forestmathtype@dimen} |
| 3072 |
{forest@processor@-@\forestmathtype@count} |
| 3073 |
\csletcs{forest@processor@-@\forestmathtype@unitless} |
| 3074 |
{forest@processor@-@\forestmathtype@count} |
| 3075 |
\csdef{forest@processor@-@\forestmathtype@textasc}{% |
| 3076 |
\let\forestmathresulttype\forestmathtype@textdesc} |
| 3077 |
\csdef{forest@processor@-@\forestmathtype@textdesc}{% |
| 3078 |
\let\forestmathresulttype\forestmathtype@textasc} |
| 3079 |
|
| 3080 |
\forest@def@processor{c}{}{}{% to lowercase |
| 3081 |
\forest@process@right@bottompop\forest@temp |
| 3082 |
\expandafter\lowercase\expandafter{\expandafter\def\expandafter\forest@temp\expandafter{\forest@temp}}% |
| 3083 |
\forest@process@left@letappend\forest@temp |
| 3084 |
} |
| 3085 |
\forest@def@processor{C}{}{}{% to uppercase |
| 3086 |
\forest@process@right@bottompop\forest@temp |
| 3087 |
\expandafter\uppercase\expandafter{\expandafter\def\expandafter\forest@temp\expandafter{\forest@temp}}% |
| 3088 |
\forest@process@left@letappend\forest@temp |
| 3089 |
} |
| 3090 |
\forest@def@processor{x}{}{}{% expand |
| 3091 |
\forest@process@right@bottompop\forest@temp |
| 3092 |
\forest@process@left@esetappend{\forest@temp}% |
| 3093 |
\let\forestmathresulttype\forestmathtype@generic |
| 3094 |
} |
| 3095 |
\forest@def@processor{o}{1}{}{% expand once (actually, \forest@count@n times) |
| 3096 |
\forest@process@right@bottompop\forest@temp |
| 3097 |
\forest@repeat@n@times{\forest@process@n}{% |
| 3098 |
\expandafter\expandafter\expandafter\def |
| 3099 |
\expandafter\expandafter\expandafter\forest@temp |
| 3100 |
\expandafter\expandafter\expandafter{\forest@temp}% |
| 3101 |
}% |
| 3102 |
\expandafter\forest@process@left@setappend\expandafter{\forest@temp}% |
| 3103 |
\let\forestmathresulttype\forestmathtype@generic |
| 3104 |
} |
| 3105 |
\forest@def@processor{O}{1}*{}{% option |
| 3106 |
\forest@process@right@bottompop\forest@temp |
| 3107 |
\expandafter\forestRNO@getvalueandtype\expandafter{\forest@temp}\forest@tempvalue\forest@temp@type |
| 3108 |
\let\forestmathresulttype\forest@temp@type |
| 3109 |
\forest@process@left@letappend\forest@tempvalue |
| 3110 |
} |
| 3111 |
\forest@def@processor{R}{1}*{}{% register |
| 3112 |
\forest@process@right@bottompop\forest@temp |
| 3113 |
\forestrget{\forest@temp}\forest@tempvalue |
| 3114 |
\forest@process@left@letappend\forest@tempvalue |
| 3115 |
\pgfkeysgetvalue{/forest/\forest@temp/@type}\forest@temp@type |
| 3116 |
\let\forestmathresulttype\forest@temp@type |
| 3117 |
} |
| 3118 |
\forest@def@processor{+}{1}*{}{% join processors = pop one from result |
| 3119 |
\forest@process@left@toppop\forest@temp |
| 3120 |
\forest@process@right@letprepend\forest@temp |
| 3121 |
} |
| 3122 |
\forest@def@processor{u}{}{}{% ungroup: remove braces and leave in the argument list |
| 3123 |
\forest@process@right@bottompop\forest@temp |
| 3124 |
\forest@temparray@clear |
| 3125 |
\let\forestmathresulttype\forestmathtype@generic |
| 3126 |
\let\forest@topextend@next\forest@processor@u@ |
| 3127 |
\expandafter\forest@temparray@topextend\forest@temp\forest@eov |
| 3128 |
} |
| 3129 |
\def\forest@processor@u@{% |
| 3130 |
\forest@loop |
| 3131 |
\ifnum\forest@temparray@N>0 |
| 3132 |
\forest@temparray@toppop\forest@temp |
| 3133 |
\expandafter\forest@process@right@setprepend\expandafter{\forest@temp}% |
| 3134 |
\forest@repeat |
| 3135 |
} |
| 3136 |
\def\forest@process@check@mn#1#2#3#4{% |
| 3137 |
% #1 = processor, #2 = given n, #3/#4 = lower/upper bound (inclusive) |
| 3138 |
\ifnum#3>#2\relax |
| 3139 |
\forest@process@check@n@error{#1}{#2}{#3<=}{<=#4}% |
| 3140 |
\else |
| 3141 |
\ifnum#4<#2\relax |
| 3142 |
\forest@process@check@n@error{#1}{#2}{#3<=}{<=#4}% |
| 3143 |
\fi |
| 3144 |
\fi |
| 3145 |
} |
| 3146 |
\def\forest@process@check@m#1#2#3{% |
| 3147 |
% #1 = processor, #2 = given n, #3 = lower bound (inclusive) |
| 3148 |
\ifnum#2<#3\relax |
| 3149 |
\forest@process@check@n@error{#1}{#2}{#3<=}{}% |
| 3150 |
\fi |
| 3151 |
} |
| 3152 |
\def\forest@process@check@n@error#1#2#3#4{% |
| 3153 |
\PackageError{forest}{'.process' instruction '#1' requires a numeric modifier #3n#4, but n="#2" was given.}{}% |
| 3154 |
} |
| 3155 |
\newif\ifforest@process@W |
| 3156 |
\forest@def@processor{w}{1}{}{% consuming wrap: first test 1<=#1<=9 |
| 3157 |
\forest@process@Wtrue |
| 3158 |
\forest@process@check@mn{w}{0\the\forest@process@n}{1}{9}% |
| 3159 |
\expandafter\forest@processor@wW@\expandafter{\the\forest@process@n}% |
| 3160 |
} |
| 3161 |
\forest@def@processor{W}{1}{}{% nonconsuming wrap: first test 1<=#1<=9 |
| 3162 |
\forest@process@Wfalse |
| 3163 |
\forest@process@check@mn{W}{0\the\forest@process@n}{1}{9}% |
| 3164 |
\expandafter\forest@processor@wW@\expandafter{\the\forest@process@n}% |
| 3165 |
} |
| 3166 |
\def\forest@processor@wW@#1{% |
| 3167 |
\forest@process@left@checkindex{\forest@process@left@N-#1}% |
| 3168 |
\edef\forest@marshal{% |
| 3169 |
\edef\noexpand\forest@temp@args{% |
| 3170 |
\noexpand\forest@process@left@valuesfromrange |
| 3171 |
{\number\numexpr\forest@process@left@N-#1}% |
| 3172 |
{\the\forest@process@left@N}% |
| 3173 |
}% |
| 3174 |
}\forest@marshal |
| 3175 |
\ifforest@process@W |
| 3176 |
\advance\forest@process@left@N-#1\relax |
| 3177 |
\fi |
| 3178 |
\forest@process@right@bottompop\forest@temp@macrobody |
| 3179 |
\expandafter\forest@def@n\expandafter\forest@process@temp@macro\expandafter{\expandafter#1\expandafter}\expandafter{\forest@temp@macrobody}% |
| 3180 |
\expandafter\expandafter\expandafter\forest@process@left@setappend\expandafter\expandafter\expandafter{\expandafter\forest@process@temp@macro\forest@temp@args}% |
| 3181 |
\let\forestmathresulttype\forestmathtype@generic |
| 3182 |
} |
| 3183 |
\def\forest@def@n#1#2{\csname forest@def@n@#2\endcsname#1} |
| 3184 |
\csdef{forest@def@n@1}#1{\def#1##1} |
| 3185 |
\csdef{forest@def@n@2}#1{\def#1##1##2} |
| 3186 |
\csdef{forest@def@n@3}#1{\def#1##1##2##3} |
| 3187 |
\csdef{forest@def@n@4}#1{\def#1##1##2##3##4} |
| 3188 |
\csdef{forest@def@n@5}#1{\def#1##1##2##3##4##5} |
| 3189 |
\csdef{forest@def@n@6}#1{\def#1##1##2##3##4##5##6} |
| 3190 |
\csdef{forest@def@n@7}#1{\def#1##1##2##3##4##5##6##7} |
| 3191 |
\csdef{forest@def@n@8}#1{\def#1##1##2##3##4##5##6##7##8} |
| 3192 |
\csdef{forest@def@n@9}#1{\def#1##1##2##3##4##5##6##7##8##9} |
| 3193 |
\forest@def@processor{s}{1}{}{% |
| 3194 |
\forest@temptrue % delete the originals |
| 3195 |
\expandafter\forest@processor@save\expandafter{% |
| 3196 |
\the\numexpr\forest@process@left@N-\forest@process@n}} |
| 3197 |
\forest@def@processor{S}{1}{}{% |
| 3198 |
\forest@tempfalse % keep the originals |
| 3199 |
\expandafter\forest@processor@save\expandafter{% |
| 3200 |
\the\numexpr\forest@process@left@N-\forest@process@n}} |
| 3201 |
\def\forest@processor@save#1{% |
| 3202 |
\forest@process@left@checkindex{#1}% |
| 3203 |
\forest@temp@count#1 |
| 3204 |
\forest@loop |
| 3205 |
\ifnum\forest@temp@count<\forest@process@left@N\relax |
| 3206 |
\forest@process@left@get@{\the\forest@temp@count}\forest@temp |
| 3207 |
\forest@process@saved@letappend\forest@temp |
| 3208 |
\advance\forest@temp@count+1 |
| 3209 |
\forest@repeat |
| 3210 |
\let\forest@process@savedtype\forestmathresulttype |
| 3211 |
\ifforest@temp |
| 3212 |
\forest@process@left@N=#1 |
| 3213 |
\fi |
| 3214 |
} |
| 3215 |
\forest@def@processor{l}{0}{}{% |
| 3216 |
\forest@temptrue |
| 3217 |
\forest@processor@U@@ |
| 3218 |
} |
| 3219 |
\forest@def@processor{L}{0}{}{% |
| 3220 |
\forest@tempfalse |
| 3221 |
\forest@processor@U@@ |
| 3222 |
} |
| 3223 |
|
| 3224 |
\def\forest@processor@U@@{% |
| 3225 |
\ifnum\forest@process@n=0 |
| 3226 |
\forest@process@n\forest@process@saved@N\relax |
| 3227 |
\fi |
| 3228 |
\expandafter\forest@processor@U@@@\expandafter{% |
| 3229 |
\the\numexpr\forest@process@saved@N-\forest@process@n}% |
| 3230 |
} |
| 3231 |
\def\forest@processor@U@@@#1{% |
| 3232 |
\forest@temp@count#1 |
| 3233 |
\forest@loop |
| 3234 |
\ifnum\forest@temp@count<\forest@process@saved@N\relax |
| 3235 |
\forest@process@saved@get@{\the\forest@temp@count}\forest@temp |
| 3236 |
\forest@process@left@letappend\forest@temp |
| 3237 |
\advance\forest@temp@count1 |
| 3238 |
\forest@repeat |
| 3239 |
\let\forestmathresulttype\forest@process@savedtype |
| 3240 |
\ifforest@temp |
| 3241 |
\let\forest@process@savedtype\forestmathtype@none |
| 3242 |
\forest@process@saved@N#1 |
| 3243 |
\fi |
| 3244 |
} |
| 3245 |
\forest@def@processor{&}{2}{}{% and |
| 3246 |
\def\forest@tempa{1}% |
| 3247 |
\forest@repeat@n@times{\forest@process@n}{% |
| 3248 |
\forest@process@left@toppop\forest@tempb |
| 3249 |
\edef\forest@tempa{\ifnum10<\forest@tempa\forest@tempb\space 1\else0\fi}% |
| 3250 |
}% |
| 3251 |
\forest@process@left@esetappend{\forest@tempa}% |
| 3252 |
\let\forestmathresulttype\forestmathtype@count |
| 3253 |
} |
| 3254 |
\forest@def@processor{|}{2}{}{% or |
| 3255 |
\def\forest@tempa{0}% |
| 3256 |
\forest@repeat@n@times{\forest@process@n}{% |
| 3257 |
\forest@process@left@toppop\forest@tempb |
| 3258 |
\edef\forest@tempa{\ifnum0=\forest@tempa\forest@tempb\space 0\else1\fi}% |
| 3259 |
}% |
| 3260 |
\forest@process@left@esetappend{\forest@tempa}% |
| 3261 |
\let\forestmathresulttype\forestmathtype@count |
| 3262 |
} |
| 3263 |
\forest@def@processor{!}{}{}{% not |
| 3264 |
\forest@process@left@toppop\forest@temp |
| 3265 |
\forest@process@left@esetappend{\ifnum0=\forest@temp\space 1\else0\fi}% |
| 3266 |
\let\forestmathresulttype\forestmathtype@count |
| 3267 |
} |
| 3268 |
\forest@def@processor{?}{}{}{% |
| 3269 |
\forest@process@left@toppop\forest@temp |
| 3270 |
\forest@process@right@bottompop\forest@tempa |
| 3271 |
\forest@process@right@bottompop\forest@tempb |
| 3272 |
\ifnum\forest@temp=0 |
| 3273 |
\forest@process@right@letprepend\forest@tempb |
| 3274 |
\else |
| 3275 |
\forest@process@right@letprepend\forest@tempa |
| 3276 |
\fi |
| 3277 |
\let\forestmathresulttype\forestmathtype@generic |
| 3278 |
} |
| 3279 |
\forest@def@processor{=}{}{}{% |
| 3280 |
\forest@process@left@toppop\forest@tempa |
| 3281 |
\forest@process@left@toppop\forest@tempb |
| 3282 |
\forest@process@left@esetappend{\ifx\forest@tempa\forest@tempb 1\else0\fi}% |
| 3283 |
\let\forestmathresulttype\forestmathtype@count |
| 3284 |
} |
| 3285 |
\forest@def@processor{<}{}{}{% |
| 3286 |
\forest@process@left@toppop\forest@tempb |
| 3287 |
\forest@process@left@toppop\forest@tempa |
| 3288 |
\ifx\forestmathresulttype\forestmathtype@generic |
| 3289 |
\forest@cmp@error\forest@tempa\forest@tempb |
| 3290 |
\else |
| 3291 |
\forestmathlt{\forest@tempa}{\forest@tempb}% |
| 3292 |
\forest@process@left@esetappend{\forestmathresult}% |
| 3293 |
\fi |
| 3294 |
} |
| 3295 |
\forest@def@processor{>}{}{}{% |
| 3296 |
\forest@process@left@toppop\forest@tempb |
| 3297 |
\forest@process@left@toppop\forest@tempa |
| 3298 |
\ifx\forestmathresulttype\forestmathtype@generic |
| 3299 |
\forest@cmp@error\forest@tempa\forest@tempb |
| 3300 |
\else |
| 3301 |
\forestmathgt{\forest@tempa}{\forest@tempb}% |
| 3302 |
\forest@process@left@esetappend{\forestmathresult}% |
| 3303 |
\fi |
| 3304 |
} |
| 3305 |
\forest@def@processor{r}{}{}{% reverse keylist |
| 3306 |
\forest@process@right@bottompop\forest@temp |
| 3307 |
\expandafter\forest@processor@r@\expandafter{\forest@temp}% |
| 3308 |
} |
| 3309 |
\def\forest@processor@r@#1{% |
| 3310 |
\forest@process@left@esetappend{}% |
| 3311 |
\def\forest@tempcomma{}% |
| 3312 |
\pgfqkeys{/forest}{split={#1}{,}{process@rk}}% |
| 3313 |
\let\forestmathresulttype\forestmathtype@generic |
| 3314 |
} |
| 3315 |
\forestset{% |
| 3316 |
process@rk/.code={% |
| 3317 |
\forest@process@left@toppop\forest@temp |
| 3318 |
\forest@temp@toks{#1}% |
| 3319 |
\forest@process@left@esetappend{\the\forest@temp@toks\forest@tempcomma\expandonce{\forest@temp}}% |
| 3320 |
\def\forest@tempcomma{,}% |
| 3321 |
}% |
| 3322 |
} |
| 3323 |
\def\forest@pgfmathhelper@register@toks#1#2{% #1 is discarded: it is present only for analogy with options |
| 3324 |
\forestrget{#2}\pgfmathresult |
| 3325 |
} |
| 3326 |
\def\forest@pgfmathhelper@register@dimen#1#2{% |
| 3327 |
\forestrget{#2}\forest@temp |
| 3328 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 3329 |
} |
| 3330 |
\def\forest@pgfmathhelper@register@count#1#2{% |
| 3331 |
\forestrget{#2}\pgfmathresult |
| 3332 |
} |
| 3333 |
\def\forest@declareregisterhandler#1#2{%#1=handler for specific type,#2=option name |
| 3334 |
\pgfkeyssetvalue{/forest/#2/node@or@reg}{}% empty = register (node id=node) |
| 3335 |
\forest@convert@others@to@underscores{#2}\forest@pgfmathoptionname |
| 3336 |
\edef\forest@marshal{% |
| 3337 |
\noexpand#1{/forest/#2}{/forest}{#2}{\forest@pgfmathoptionname}% |
| 3338 |
}\forest@marshal |
| 3339 |
} |
| 3340 |
\def\forest@declaretoksregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3341 |
\forest@declaretoksregister@handler@A{#1}{#2}{#3}{#4}{}% |
| 3342 |
} |
| 3343 |
\def\forest@declarekeylistregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3344 |
\forest@declaretoksregister@handler@A{#1}{#2}{#3}{#4}{,}% |
| 3345 |
\forest@copycommandkey{#1}{#1'}% |
| 3346 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 3347 |
\forest@copycommandkey{#1+}{#1}% |
| 3348 |
\pgfkeysalso{#1-/.code={% |
| 3349 |
\forest@fornode{}{% |
| 3350 |
\forest@node@removekeysfromkeylist{##1}{#3}% |
| 3351 |
}}}% |
| 3352 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 3353 |
} |
| 3354 |
\def\forest@declaretoksregister@handler@A#1#2#3#4#5{% #1=key,#2=path,#3=name,#4=pgfmathname,#5=infix |
| 3355 |
\pgfkeysalso{% |
| 3356 |
#1/.code={\forestrset{#3}{##1}}, |
| 3357 |
#2/if #3/.code n args={3}{% |
| 3358 |
\forestrget{#3}\forest@temp@option@value |
| 3359 |
\edef\forest@temp@compared@value{\unexpanded{##1}}% |
| 3360 |
\ifx\forest@temp@option@value\forest@temp@compared@value |
| 3361 |
\pgfkeysalso{##2}% |
| 3362 |
\else |
| 3363 |
\pgfkeysalso{##3}% |
| 3364 |
\fi |
| 3365 |
}, |
| 3366 |
#2/if in #3/.code n args={3}{% |
| 3367 |
\forestrget{#3}\forest@temp@option@value |
| 3368 |
\edef\forest@temp@compared@value{\unexpanded{##1}}% |
| 3369 |
\expandafter\expandafter\expandafter\pgfutil@in@\expandafter\expandafter\expandafter{\expandafter\forest@temp@compared@value\expandafter}\expandafter{\forest@temp@option@value}% |
| 3370 |
\ifpgfutil@in@ |
| 3371 |
\pgfkeysalso{##2}% |
| 3372 |
\else |
| 3373 |
\pgfkeysalso{##3}% |
| 3374 |
\fi |
| 3375 |
}, |
| 3376 |
}% |
| 3377 |
\ifstrempty{#5}{% |
| 3378 |
\pgfkeysalso{% |
| 3379 |
#1+/.code={\forestrappto{#3}{#5##1}}, |
| 3380 |
#2/+#3/.code={\forestrpreto{#3}{##1#5}}, |
| 3381 |
}% |
| 3382 |
}{% |
| 3383 |
\pgfkeysalso{% |
| 3384 |
#1+/.code={% |
| 3385 |
\forestrget{#3}\forest@temp |
| 3386 |
\ifdefempty{\forest@temp}{% |
| 3387 |
\forestrset{#3}{##1}% |
| 3388 |
}{% |
| 3389 |
\forestrappto{#3}{#5##1}% |
| 3390 |
}% |
| 3391 |
}, |
| 3392 |
#2/+#3/.code={% |
| 3393 |
\forestrget{#3}\forest@temp |
| 3394 |
\ifdefempty{\forest@temp}{% |
| 3395 |
\forestrset{#3}{##1}% |
| 3396 |
}{% |
| 3397 |
\forestrpreto{#3}{##1#5}% |
| 3398 |
}% |
| 3399 |
}% |
| 3400 |
}% |
| 3401 |
}% |
| 3402 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 3403 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 3404 |
\pgfkeyssetvalue{#2/+#3/option@name}{#3}% |
| 3405 |
\pgfkeyslet{#1/@type}\forestmathtype@generic % for .process & co |
| 3406 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@register@toks{##1}{#3}}% |
| 3407 |
} |
| 3408 |
\def\forest@declareautowrappedtoksregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname,#5=infix |
| 3409 |
\forest@declaretoksregister@handler{#1}{#2}{#3}{#4}% |
| 3410 |
\forest@copycommandkey{#1}{#1'}% |
| 3411 |
\pgfkeysalso{#1/.style={#1'/.wrap value={##1}}}% |
| 3412 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 3413 |
\forest@copycommandkey{#1+}{#1+'}% |
| 3414 |
\pgfkeysalso{#1+/.style={#1+'/.wrap value={##1}}}% |
| 3415 |
\pgfkeyssetvalue{#1+'/option@name}{#3}% |
| 3416 |
\forest@copycommandkey{#2/+#3}{#2/+#3'}% |
| 3417 |
\pgfkeysalso{#2/+#3/.style={#2/+#3'/.wrap value={##1}}}% |
| 3418 |
\pgfkeyssetvalue{#2/+#3'/option@name}{#3}% |
| 3419 |
} |
| 3420 |
\def\forest@declarereadonlydimenregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3421 |
\pgfkeysalso{% |
| 3422 |
#2/if #3/.code n args={3}{% |
| 3423 |
\forestrget{#3}\forest@temp@option@value |
| 3424 |
\ifdim\forest@temp@option@value=##1\relax |
| 3425 |
\pgfkeysalso{##2}% |
| 3426 |
\else |
| 3427 |
\pgfkeysalso{##3}% |
| 3428 |
\fi |
| 3429 |
}, |
| 3430 |
#2/if #3</.code n args={3}{% |
| 3431 |
\forestrget{#3}\forest@temp@option@value |
| 3432 |
\ifdim\forest@temp@option@value>##1\relax |
| 3433 |
\pgfkeysalso{##3}% |
| 3434 |
\else |
| 3435 |
\pgfkeysalso{##2}% |
| 3436 |
\fi |
| 3437 |
}, |
| 3438 |
#2/if #3>/.code n args={3}{% |
| 3439 |
\forestrget{#3}\forest@temp@option@value |
| 3440 |
\ifdim\forest@temp@option@value<##1\relax |
| 3441 |
\pgfkeysalso{##3}% |
| 3442 |
\else |
| 3443 |
\pgfkeysalso{##2}% |
| 3444 |
\fi |
| 3445 |
}, |
| 3446 |
}% |
| 3447 |
\pgfkeyslet{#1/@type}\forestmathtype@dimen % for .process & co |
| 3448 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@register@dimen{##1}{#3}}% |
| 3449 |
} |
| 3450 |
\def\forest@declaredimenregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3451 |
\forest@declarereadonlydimenregister@handler{#1}{#2}{#3}{#4}% |
| 3452 |
\pgfkeysalso{% |
| 3453 |
#1/.code={% |
| 3454 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 3455 |
\forestrlet{#3}\forest@temp |
| 3456 |
}, |
| 3457 |
#1+/.code={% |
| 3458 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 3459 |
\pgfutil@tempdima=\forestrve{#3} |
| 3460 |
\advance\pgfutil@tempdima\forest@temp\relax |
| 3461 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3462 |
}, |
| 3463 |
#1-/.code={% |
| 3464 |
\forestmathsetlengthmacro\forest@temp{##1}% |
| 3465 |
\pgfutil@tempdima=\forestrve{#3} |
| 3466 |
\advance\pgfutil@tempdima-\forest@temp\relax |
| 3467 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3468 |
}, |
| 3469 |
#1*/.style={% |
| 3470 |
#1={#4()*(##1)}% |
| 3471 |
}, |
| 3472 |
#1:/.style={% |
| 3473 |
#1={#4()/(##1)}% |
| 3474 |
}, |
| 3475 |
#1'/.code={% |
| 3476 |
\pgfutil@tempdima=##1\relax |
| 3477 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3478 |
}, |
| 3479 |
#1'+/.code={% |
| 3480 |
\pgfutil@tempdima=\forestrve{#3}\relax |
| 3481 |
\advance\pgfutil@tempdima##1\relax |
| 3482 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3483 |
}, |
| 3484 |
#1'-/.code={% |
| 3485 |
\pgfutil@tempdima=\forestrve{#3}\relax |
| 3486 |
\advance\pgfutil@tempdima-##1\relax |
| 3487 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3488 |
}, |
| 3489 |
#1'*/.style={% |
| 3490 |
\pgfutil@tempdima=\forestrve{#3}\relax |
| 3491 |
\multiply\pgfutil@tempdima##1\relax |
| 3492 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3493 |
}, |
| 3494 |
#1':/.style={% |
| 3495 |
\pgfutil@tempdima=\forestrve{#3}\relax |
| 3496 |
\divide\pgfutil@tempdima##1\relax |
| 3497 |
\forestreset{#3}{\the\pgfutil@tempdima}% |
| 3498 |
}, |
| 3499 |
}% |
| 3500 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 3501 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 3502 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 3503 |
\pgfkeyssetvalue{#1*/option@name}{#3}% |
| 3504 |
\pgfkeyssetvalue{#1:/option@name}{#3}% |
| 3505 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 3506 |
\pgfkeyssetvalue{#1'+/option@name}{#3}% |
| 3507 |
\pgfkeyssetvalue{#1'-/option@name}{#3}% |
| 3508 |
\pgfkeyssetvalue{#1'*/option@name}{#3}% |
| 3509 |
\pgfkeyssetvalue{#1':/option@name}{#3}% |
| 3510 |
} |
| 3511 |
\def\forest@declarereadonlycountregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3512 |
\pgfkeysalso{ |
| 3513 |
#2/if #3/.code n args={3}{% |
| 3514 |
\forestrget{#3}\forest@temp@option@value |
| 3515 |
\ifnum\forest@temp@option@value=##1\relax |
| 3516 |
\pgfkeysalso{##2}% |
| 3517 |
\else |
| 3518 |
\pgfkeysalso{##3}% |
| 3519 |
\fi |
| 3520 |
}, |
| 3521 |
#2/if #3</.code n args={3}{% |
| 3522 |
\forestrget{#3}\forest@temp@option@value |
| 3523 |
\ifnum\forest@temp@option@value>##1\relax |
| 3524 |
\pgfkeysalso{##3}% |
| 3525 |
\else |
| 3526 |
\pgfkeysalso{##2}% |
| 3527 |
\fi |
| 3528 |
}, |
| 3529 |
#2/if #3>/.code n args={3}{% |
| 3530 |
\forestrget{#3}\forest@temp@option@value |
| 3531 |
\ifnum\forest@temp@option@value<##1\relax |
| 3532 |
\pgfkeysalso{##3}% |
| 3533 |
\else |
| 3534 |
\pgfkeysalso{##2}% |
| 3535 |
\fi |
| 3536 |
}, |
| 3537 |
}% |
| 3538 |
\pgfkeyslet{#1/@type}\forestmathtype@count % for .process & co |
| 3539 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@register@count{##1}{#3}}% |
| 3540 |
} |
| 3541 |
\def\forest@declarecountregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3542 |
\forest@declarereadonlycountregister@handler{#1}{#2}{#3}{#4}% |
| 3543 |
\pgfkeysalso{ |
| 3544 |
#1/.code={% |
| 3545 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3546 |
\forestrlet{#3}\forest@temp |
| 3547 |
}, |
| 3548 |
#1+/.code={% |
| 3549 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3550 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3551 |
\advance\c@pgf@counta\forest@temp\relax |
| 3552 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3553 |
}, |
| 3554 |
#1-/.code={% |
| 3555 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3556 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3557 |
\advance\c@pgf@counta-\forest@temp\relax |
| 3558 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3559 |
}, |
| 3560 |
#1*/.code={% |
| 3561 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3562 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3563 |
\multiply\c@pgf@counta\forest@temp\relax |
| 3564 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3565 |
}, |
| 3566 |
#1:/.code={% |
| 3567 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3568 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3569 |
\divide\c@pgf@counta\forest@temp\relax |
| 3570 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3571 |
}, |
| 3572 |
#1'/.code={% |
| 3573 |
\c@pgf@counta=##1\relax |
| 3574 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3575 |
}, |
| 3576 |
#1'+/.code={% |
| 3577 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3578 |
\advance\c@pgf@counta##1\relax |
| 3579 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3580 |
}, |
| 3581 |
#1'-/.code={% |
| 3582 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3583 |
\advance\c@pgf@counta-##1\relax |
| 3584 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3585 |
}, |
| 3586 |
#1'*/.style={% |
| 3587 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3588 |
\multiply\c@pgf@counta##1\relax |
| 3589 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3590 |
}, |
| 3591 |
#1':/.style={% |
| 3592 |
\c@pgf@counta=\forestrve{#3}\relax |
| 3593 |
\divide\c@pgf@counta##1\relax |
| 3594 |
\forestreset{#3}{\the\c@pgf@counta}% |
| 3595 |
}, |
| 3596 |
}% |
| 3597 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 3598 |
\pgfkeyssetvalue{#1+/option@name}{#3}% |
| 3599 |
\pgfkeyssetvalue{#1-/option@name}{#3}% |
| 3600 |
\pgfkeyssetvalue{#1*/option@name}{#3}% |
| 3601 |
\pgfkeyssetvalue{#1:/option@name}{#3}% |
| 3602 |
\pgfkeyssetvalue{#1'/option@name}{#3}% |
| 3603 |
\pgfkeyssetvalue{#1'+/option@name}{#3}% |
| 3604 |
\pgfkeyssetvalue{#1'-/option@name}{#3}% |
| 3605 |
\pgfkeyssetvalue{#1'*/option@name}{#3}% |
| 3606 |
\pgfkeyssetvalue{#1':/option@name}{#3}% |
| 3607 |
} |
| 3608 |
\def\forest@declarebooleanregister@handler#1#2#3#4{% #1=key,#2=path,#3=name,#4=pgfmathname |
| 3609 |
\pgfkeysalso{% |
| 3610 |
#1/.code={% |
| 3611 |
\ifcsdef{forest@bh@\detokenize{##1}}{% |
| 3612 |
\letcs\forest@temp{forest@bh@\detokenize{##1}}% |
| 3613 |
}{% |
| 3614 |
\forestmathtruncatemacro\forest@temp{##1}% |
| 3615 |
\ifx\forest@temp0\else\def\forest@temp{1}\fi |
| 3616 |
}% |
| 3617 |
\forestrlet{#3}\forest@temp |
| 3618 |
}, |
| 3619 |
#1/.default=1, |
| 3620 |
#2/not #3/.code={\forestrset{#3}{0}}, |
| 3621 |
#2/if #3/.code 2 args={% |
| 3622 |
\forestrget{#3}\forest@temp@option@value |
| 3623 |
\ifnum\forest@temp@option@value=1 |
| 3624 |
\pgfkeysalso{##1}% |
| 3625 |
\else |
| 3626 |
\pgfkeysalso{##2}% |
| 3627 |
\fi |
| 3628 |
}, |
| 3629 |
}% |
| 3630 |
\pgfkeyssetvalue{#1/option@name}{#3}% |
| 3631 |
\pgfkeyslet{#1/@type}\forestmathtype@count % for .process & co |
| 3632 |
\pgfmathdeclarefunction{#4}{1}{\forest@pgfmathhelper@register@count{##1}{#3}}% |
| 3633 |
} |
| 3634 |
\forestset{ |
| 3635 |
declare toks register/.code={% |
| 3636 |
\forest@declareregisterhandler\forest@declaretoksregister@handler{#1}% |
| 3637 |
\forestset{#1={}}% |
| 3638 |
}, |
| 3639 |
declare autowrapped toks register/.code={% |
| 3640 |
\forest@declareregisterhandler\forest@declareautowrappedtoksregister@handler{#1}% |
| 3641 |
\forestset{#1={}}% |
| 3642 |
}, |
| 3643 |
declare keylist register/.code={% |
| 3644 |
\forest@declareregisterhandler\forest@declarekeylistregister@handler{#1}% |
| 3645 |
\forestset{#1'={}}% |
| 3646 |
}, |
| 3647 |
declare dimen register/.code={% |
| 3648 |
\forest@declareregisterhandler\forest@declaredimenregister@handler{#1}% |
| 3649 |
\forestset{#1'=0pt}% |
| 3650 |
}, |
| 3651 |
declare count register/.code={% |
| 3652 |
\forest@declareregisterhandler\forest@declarecountregister@handler{#1}% |
| 3653 |
\forestset{#1'=0}% |
| 3654 |
}, |
| 3655 |
declare boolean register/.code={% |
| 3656 |
\forest@declareregisterhandler\forest@declarebooleanregister@handler{#1}% |
| 3657 |
\forestset{#1=0}% |
| 3658 |
}, |
| 3659 |
} |
| 3660 |
\forestset{ |
| 3661 |
declare toks register=temptoksa,temptoksa={}, |
| 3662 |
declare toks register=temptoksb,temptoksb={}, |
| 3663 |
declare toks register=temptoksc,temptoksc={}, |
| 3664 |
declare toks register=temptoksd,temptoksd={}, |
| 3665 |
declare keylist register=tempkeylista,tempkeylista'={}, |
| 3666 |
declare keylist register=tempkeylistb,tempkeylistb'={}, |
| 3667 |
declare keylist register=tempkeylistc,tempkeylistc'={}, |
| 3668 |
declare keylist register=tempkeylistd,tempkeylistd'={}, |
| 3669 |
declare dimen register=tempdima,tempdima'={0pt}, |
| 3670 |
declare dimen register=tempdimb,tempdimb'={0pt}, |
| 3671 |
declare dimen register=tempdimc,tempdimc'={0pt}, |
| 3672 |
declare dimen register=tempdimd,tempdimd'={0pt}, |
| 3673 |
declare dimen register=tempdimx,tempdimx'={0pt}, |
| 3674 |
declare dimen register=tempdimxa,tempdimxa'={0pt}, |
| 3675 |
declare dimen register=tempdimxb,tempdimxb'={0pt}, |
| 3676 |
declare dimen register=tempdimy,tempdimy'={0pt}, |
| 3677 |
declare dimen register=tempdimya,tempdimya'={0pt}, |
| 3678 |
declare dimen register=tempdimyb,tempdimyb'={0pt}, |
| 3679 |
declare dimen register=tempdiml,tempdiml'={0pt}, |
| 3680 |
declare dimen register=tempdimla,tempdimla'={0pt}, |
| 3681 |
declare dimen register=tempdimlb,tempdimlb'={0pt}, |
| 3682 |
declare dimen register=tempdims,tempdims'={0pt}, |
| 3683 |
declare dimen register=tempdimsa,tempdimsa'={0pt}, |
| 3684 |
declare dimen register=tempdimsb,tempdimsb'={0pt}, |
| 3685 |
declare count register=tempcounta,tempcounta'={0}, |
| 3686 |
declare count register=tempcountb,tempcountb'={0}, |
| 3687 |
declare count register=tempcountc,tempcountc'={0}, |
| 3688 |
declare count register=tempcountd,tempcountd'={0}, |
| 3689 |
declare boolean register=tempboola,tempboola={0}, |
| 3690 |
declare boolean register=tempboolb,tempboolb={0}, |
| 3691 |
declare boolean register=tempboolc,tempboolc={0}, |
| 3692 |
declare boolean register=tempboold,tempboold={0}, |
| 3693 |
} |
| 3694 |
\def\forest@node@Nametoid#1{% #1 = name |
| 3695 |
\csname forest@id@of@#1\endcsname |
| 3696 |
} |
| 3697 |
\def\forest@node@Ifnamedefined#1#2#3{% #1 = name, #2=true,#3=false |
| 3698 |
\ifcsvoid{forest@id@of@#1}{#3}{#2}% |
| 3699 |
} |
| 3700 |
\def\forest@node@setname#1{% |
| 3701 |
\def\forest@temp@setname{y}% |
| 3702 |
\def\forest@temp@silent{n}% |
| 3703 |
\def\forest@temp@propagating{n}% |
| 3704 |
\forest@node@setnameoralias{#1}% |
| 3705 |
} |
| 3706 |
\def\forest@node@setname@silent#1{% |
| 3707 |
\def\forest@temp@setname{y}% |
| 3708 |
\def\forest@temp@silent{y}% |
| 3709 |
\def\forest@temp@propagating{n}% |
| 3710 |
\forest@node@setnameoralias{#1}% |
| 3711 |
} |
| 3712 |
\def\forest@node@setalias#1{% |
| 3713 |
\def\forest@temp@setname{n}% |
| 3714 |
\def\forest@temp@silent{n}% |
| 3715 |
\def\forest@temp@propagating{n}% |
| 3716 |
\forest@node@setnameoralias{#1}% |
| 3717 |
} |
| 3718 |
\def\forest@node@setalias@silent#1{% |
| 3719 |
\def\forest@temp@setname{n}% |
| 3720 |
\def\forest@temp@silent{y}% |
| 3721 |
\def\forest@temp@propagating{n}% |
| 3722 |
\forest@node@setnameoralias{#1}% |
| 3723 |
} |
| 3724 |
\def\forest@node@setnameoralias#1{% |
| 3725 |
\ifstrempty{#1}{% |
| 3726 |
\forest@node@setnameoralias{node@\forest@cn}% |
| 3727 |
}{% |
| 3728 |
\forest@node@Ifnamedefined{#1}{% |
| 3729 |
\if y\forest@temp@propagating |
| 3730 |
% this will find a unique name, eventually: |
| 3731 |
\@escapeif{\forest@node@setnameoralias{#1@\forest@cn}}% |
| 3732 |
\else\@escapeif{% |
| 3733 |
\if y\forest@temp@setname |
| 3734 |
\edef\forest@marshal{% |
| 3735 |
\ifstrequal{\forestove{name}}{#1}% |
| 3736 |
}\forest@marshal{% |
| 3737 |
% same name, no problem |
| 3738 |
}{% |
| 3739 |
\@escapeif{\forest@node@setnameoralias@nameclash{#1}}% |
| 3740 |
}% |
| 3741 |
\else\@escapeif{% setting an alias: clashing with alias is not a problem |
| 3742 |
\forestOget{\forest@node@Nametoid{#1}}{name}\forest@temp |
| 3743 |
\expandafter\ifstrequal\expandafter{\forest@temp}{#1}{% |
| 3744 |
\forest@node@setnameoralias@nameclash{#1}% |
| 3745 |
}{% |
| 3746 |
\forest@node@setnameoralias@do{#1}% |
| 3747 |
}% |
| 3748 |
}\fi |
| 3749 |
}\fi |
| 3750 |
}{% |
| 3751 |
\forest@node@setnameoralias@do{#1}% |
| 3752 |
}% |
| 3753 |
}% |
| 3754 |
} |
| 3755 |
\def\forest@node@setnameoralias@nameclash#1{% |
| 3756 |
\if y\forest@temp@silent |
| 3757 |
\forest@fornode{\forest@node@Nametoid{#1}}{% |
| 3758 |
\def\forest@temp@propagating{y}% |
| 3759 |
\forest@node@setnameoralias{}% |
| 3760 |
}% |
| 3761 |
\forest@node@setnameoralias@do{#1}% |
| 3762 |
\else |
| 3763 |
\PackageError{forest}{Node name "#1" is already used}{}% |
| 3764 |
\fi |
| 3765 |
} |
| 3766 |
\def\forest@node@setnameoralias@do#1{% |
| 3767 |
\if y\forest@temp@setname |
| 3768 |
\csdef{forest@id@of@\forestove{name}}{}% |
| 3769 |
\forestoeset{name}{#1}% |
| 3770 |
\fi |
| 3771 |
\csedef{forest@id@of@#1}{\forest@cn}% |
| 3772 |
} |
| 3773 |
\forestset{ |
| 3774 |
TeX/.code={#1}, |
| 3775 |
TeX'/.code={\appto\forest@externalize@loadimages{#1}#1}, |
| 3776 |
TeX''/.code={\appto\forest@externalize@loadimages{#1}}, |
| 3777 |
options/.code={\forestset{#1}}, |
| 3778 |
also/.code={\pgfkeysalso{#1}}, |
| 3779 |
typeout/.style={TeX={\typeout{#1}}}, |
| 3780 |
declare toks={name}{}, |
| 3781 |
name/.code={% override the default setter |
| 3782 |
\forest@fornode{\forest@setter@node}{\forest@node@setname{#1}}% |
| 3783 |
}, |
| 3784 |
name/.default={}, |
| 3785 |
name'/.code={% override the default setter |
| 3786 |
\forest@fornode{\forest@setter@node}{\forest@node@setname@silent{#1}}% |
| 3787 |
}, |
| 3788 |
name'/.default={}, |
| 3789 |
alias/.code={\forest@fornode{\forest@setter@node}{\forest@node@setalias{#1}}}, |
| 3790 |
alias'/.code={\forest@fornode{\forest@setter@node}{\forest@node@setalias@silent{#1}}}, |
| 3791 |
begin draw/.code={\begin{tikzpicture}}, |
| 3792 |
end draw/.code={\end{tikzpicture}}, |
| 3793 |
declare keylist register=default preamble, |
| 3794 |
default preamble'={}, |
| 3795 |
declare keylist register=preamble, |
| 3796 |
preamble'={}, |
| 3797 |
declare autowrapped toks={content}{}, |
| 3798 |
% #1 = which option to split, #2 = separator (one char!), #3 = receiving options |
| 3799 |
split option/.code n args=3{% |
| 3800 |
\forestRNOget{#1}\forest@temp |
| 3801 |
\edef\forest@marshal{% |
| 3802 |
\noexpand\pgfkeysalso{split={\expandonce{\forest@temp}}\unexpanded{{#2}{#3}}}% |
| 3803 |
}\forest@marshal |
| 3804 |
}, |
| 3805 |
split register/.code n args=3{% #1 = which register to split, #2 = separator (one char!), #3 = receiving options |
| 3806 |
\forestrget{#1}\forest@temp |
| 3807 |
\edef\forest@marshal{% |
| 3808 |
\noexpand\pgfkeysalso{split={\expandonce{\forest@temp}}\unexpanded{{#2}{#3}}}% |
| 3809 |
}\forest@marshal |
| 3810 |
}, |
| 3811 |
TeX={% |
| 3812 |
\def\forest@split@sourcevalues{}% |
| 3813 |
\def\forest@split@sourcevalue{}% |
| 3814 |
\def\forest@split@receivingoptions{}% |
| 3815 |
\def\forest@split@receivingoption{}% |
| 3816 |
}, |
| 3817 |
split/.code n args=3{% #1 = string to split, #2 = separator (one char!), #3 = receiving options |
| 3818 |
\forest@saveandrestoremacro\forest@split@sourcevalues{% |
| 3819 |
\forest@saveandrestoremacro\forest@split@sourcevalue{% |
| 3820 |
\forest@saveandrestoremacro\forest@split@receivingoptions{% |
| 3821 |
\forest@saveandrestoremacro\forest@split@receivingoption{% |
| 3822 |
\def\forest@split@sourcevalues{#1#2}% |
| 3823 |
\edef\forest@split@receivingoptions{#3,}% |
| 3824 |
\def\forest@split@receivingoption{}% |
| 3825 |
\safeloop |
| 3826 |
\expandafter\forest@split\expandafter{\forest@split@sourcevalues}{#2}\forest@split@sourcevalue\forest@split@sourcevalues |
| 3827 |
\ifdefempty\forest@split@receivingoptions{}{% |
| 3828 |
\expandafter\forest@split\expandafter{\forest@split@receivingoptions}{,}\forest@temp\forest@split@receivingoptions |
| 3829 |
\ifdefempty\forest@temp{}{\let\forest@split@receivingoption\forest@temp\def\forest@temp{}}% |
| 3830 |
}% |
| 3831 |
\edef\forest@marshal{% |
| 3832 |
\noexpand\pgfkeysalso{\forest@split@receivingoption={\expandonce{\forest@split@sourcevalue}}}% |
| 3833 |
}\forest@marshal |
| 3834 |
\ifdefempty\forest@split@sourcevalues{\forest@tempfalse}{\forest@temptrue}% |
| 3835 |
\ifforest@temp |
| 3836 |
\saferepeat |
| 3837 |
}}}}% |
| 3838 |
}, |
| 3839 |
declare count={grow}{270}, |
| 3840 |
TeX={% a hack for grow-reversed connection, and compass-based grow specification |
| 3841 |
\forest@copycommandkey{/forest/grow}{/forest/grow@@}% |
| 3842 |
%\pgfkeysgetvalue{/forest/grow/.@cmd}\forest@temp |
| 3843 |
%\pgfkeyslet{/forest/grow@@/.@cmd}\forest@temp |
| 3844 |
}, |
| 3845 |
grow/.style={grow@={#1},reversed=0}, |
| 3846 |
grow'/.style={grow@={#1},reversed=1}, |
| 3847 |
grow''/.style={grow@={#1}}, |
| 3848 |
grow@/.is choice, |
| 3849 |
grow@/east/.style={/forest/grow@@=0}, |
| 3850 |
grow@/north east/.style={/forest/grow@@=45}, |
| 3851 |
grow@/north/.style={/forest/grow@@=90}, |
| 3852 |
grow@/north west/.style={/forest/grow@@=135}, |
| 3853 |
grow@/west/.style={/forest/grow@@=180}, |
| 3854 |
grow@/south west/.style={/forest/grow@@=225}, |
| 3855 |
grow@/south/.style={/forest/grow@@=270}, |
| 3856 |
grow@/south east/.style={/forest/grow@@=315}, |
| 3857 |
grow@/.unknown/.code={\let\forest@temp@grow\pgfkeyscurrentname |
| 3858 |
\pgfkeysalso{/forest/grow@@/.expand once=\forest@temp@grow}}, |
| 3859 |
declare boolean={reversed}{0}, |
| 3860 |
declare toks={parent anchor}{}, |
| 3861 |
declare toks={child anchor}{}, |
| 3862 |
declare toks={anchor}{base}, |
| 3863 |
Autoforward={anchor}{ |
| 3864 |
node options-=anchor, |
| 3865 |
node options+={anchor={##1}} |
| 3866 |
}, |
| 3867 |
anchor'/.style={anchor@no@compass=true,anchor=#1}, |
| 3868 |
anchor+'/.style={anchor@no@compass=true,anchor+=#1}, |
| 3869 |
anchor-'/.style={anchor@no@compass=true,anchor-=#1}, |
| 3870 |
anchor*'/.style={anchor@no@compass=true,anchor*=#1}, |
| 3871 |
anchor:'/.style={anchor@no@compass=true,anchor:=#1}, |
| 3872 |
anchor'+'/.style={anchor@no@compass=true,anchor'+=#1}, |
| 3873 |
anchor'-'/.style={anchor@no@compass=true,anchor'-=#1}, |
| 3874 |
anchor'*'/.style={anchor@no@compass=true,anchor'*=#1}, |
| 3875 |
anchor':'/.style={anchor@no@compass=true,anchor':=#1}, |
| 3876 |
% /tikz/forest anchor/.style={ |
| 3877 |
% /forest/TeX={\forestanchortotikzanchor{#1}\forest@temp@anchor}, |
| 3878 |
% anchor/.expand once=\forest@temp@anchor |
| 3879 |
% }, |
| 3880 |
declare toks={calign}{midpoint}, |
| 3881 |
TeX={% |
| 3882 |
\forest@copycommandkey{/forest/calign}{/forest/calign'}% |
| 3883 |
}, |
| 3884 |
calign/.is choice, |
| 3885 |
calign/child/.style={calign'=child}, |
| 3886 |
calign/first/.style={calign'=child,calign primary child=1}, |
| 3887 |
calign/last/.style={calign'=child,calign primary child=-1}, |
| 3888 |
calign with current/.style={for parent/.wrap pgfmath arg={calign=child,calign primary child=##1}{n}}, |
| 3889 |
calign with current edge/.style={for parent/.wrap pgfmath arg={calign=child edge,calign primary child=##1}{n}}, |
| 3890 |
calign/child edge/.style={calign'=child edge}, |
| 3891 |
calign/midpoint/.style={calign'=midpoint}, |
| 3892 |
calign/center/.style={calign'=midpoint,calign primary child=1,calign secondary child=-1}, |
| 3893 |
calign/edge midpoint/.style={calign'=edge midpoint}, |
| 3894 |
calign/fixed angles/.style={calign'=fixed angles}, |
| 3895 |
calign/fixed edge angles/.style={calign'=fixed edge angles}, |
| 3896 |
calign/.unknown/.code={\PackageError{forest}{unknown calign '\pgfkeyscurrentname'}{}}, |
| 3897 |
declare count={calign primary child}{1}, |
| 3898 |
declare count={calign secondary child}{-1}, |
| 3899 |
declare count={calign primary angle}{-35}, |
| 3900 |
declare count={calign secondary angle}{35}, |
| 3901 |
calign child/.style={calign primary child={#1}}, |
| 3902 |
calign angle/.style={calign primary angle={-#1},calign secondary angle={#1}}, |
| 3903 |
declare toks={tier}{}, |
| 3904 |
declare toks={fit}{tight}, |
| 3905 |
declare boolean={ignore}{0}, |
| 3906 |
declare boolean={ignore edge}{0}, |
| 3907 |
no edge/.style={edge'={},ignore edge}, |
| 3908 |
declare keylist={edge}{draw}, |
| 3909 |
declare toks={edge path}{% |
| 3910 |
\noexpand\path[\forestoption{edge}]% |
| 3911 |
(\forestOve{\forestove{@parent}}{name}.parent anchor)--(\forestove{name}.child anchor) |
| 3912 |
% = |
| 3913 |
% (!u.parent anchor)--(.child anchor)\forestoption{edge label}; |
| 3914 |
\forestoption{edge label};% |
| 3915 |
}, |
| 3916 |
edge path'/.style={ |
| 3917 |
edge path={% |
| 3918 |
\noexpand\path[\forestoption{edge}]% |
| 3919 |
#1% |
| 3920 |
\forestoption{edge label}; |
| 3921 |
} |
| 3922 |
}, |
| 3923 |
declare toks={edge label}{}, |
| 3924 |
declare boolean={phantom}{0}, |
| 3925 |
baseline/.style={alias={forest@baseline@node}}, |
| 3926 |
declare readonly count={id}{0}, |
| 3927 |
declare readonly count={n}{0}, |
| 3928 |
declare readonly count={n'}{0}, |
| 3929 |
declare readonly count={n children}{-1}, |
| 3930 |
declare readonly count={level}{-1}, |
| 3931 |
declare dimen=x{0pt}, |
| 3932 |
declare dimen=y{0pt}, |
| 3933 |
declare dimen={s}{0pt}, |
| 3934 |
declare dimen={l}{6ex}, % just in case: should be set by the calibration |
| 3935 |
declare dimen={s sep}{0.6666em}, |
| 3936 |
declare dimen={l sep}{1ex}, % just in case: calibration! |
| 3937 |
declare keylist={node options}{anchor=base}, |
| 3938 |
declare toks={tikz}{}, |
| 3939 |
afterthought/.style={tikz+={#1}}, |
| 3940 |
label/.style={tikz+={\path[late options={% |
| 3941 |
name=\forestoption{name},label={#1}}];}}, |
| 3942 |
pin/.style={tikz+={\path[late options={% |
| 3943 |
name=\forestoption{name},pin={#1}}];}}, |
| 3944 |
declare toks={content format}{\forestoption{content}}, |
| 3945 |
plain content/.style={content format={\forestoption{content}}}, |
| 3946 |
math content/.style={content format={\noexpand\ensuremath{\forestoption{content}}}}, |
| 3947 |
declare toks={node format}{% |
| 3948 |
\noexpand\node |
| 3949 |
(\forestoption{name})% |
| 3950 |
[\forestoption{node options}]% |
| 3951 |
{\foresteoption{content format}};% |
| 3952 |
}, |
| 3953 |
node format'/.style={ |
| 3954 |
node format={\noexpand\node(\forestoption{name})#1;} |
| 3955 |
}, |
| 3956 |
tabular@environment/.style={content format={% |
| 3957 |
\noexpand\begin{tabular}[\forestoption{base}]{\forestoption{align}}% |
| 3958 |
\forestoption{content}% |
| 3959 |
\noexpand\end{tabular}% |
| 3960 |
}}, |
| 3961 |
declare toks={align}{}, |
| 3962 |
TeX={% |
| 3963 |
\forest@copycommandkey{/forest/align}{/forest/align'}% |
| 3964 |
%\pgfkeysgetvalue{/forest/align/.@cmd}\forest@temp |
| 3965 |
%\pgfkeyslet{/forest/align'/.@cmd}\forest@temp |
| 3966 |
}, |
| 3967 |
align/.is choice, |
| 3968 |
align/.unknown/.code={% |
| 3969 |
\edef\forest@marshal{% |
| 3970 |
\noexpand\pgfkeysalso{% |
| 3971 |
align'={\pgfkeyscurrentname},% |
| 3972 |
tabular@environment |
| 3973 |
}% |
| 3974 |
}\forest@marshal |
| 3975 |
}, |
| 3976 |
align/center/.style={align'={@{}c@{}},tabular@environment}, |
| 3977 |
align/left/.style={align'={@{}l@{}},tabular@environment}, |
| 3978 |
align/right/.style={align'={@{}r@{}},tabular@environment}, |
| 3979 |
declare toks={base}{t}, |
| 3980 |
TeX={% |
| 3981 |
\forest@copycommandkey{/forest/base}{/forest/base'}% |
| 3982 |
%\pgfkeysgetvalue{/forest/base/.@cmd}\forest@temp |
| 3983 |
%\pgfkeyslet{/forest/base'/.@cmd}\forest@temp |
| 3984 |
}, |
| 3985 |
base/.is choice, |
| 3986 |
base/top/.style={base'=t}, |
| 3987 |
base/bottom/.style={base'=b}, |
| 3988 |
base/.unknown/.style={base'/.expand once=\pgfkeyscurrentname}, |
| 3989 |
unknown to/.store in=\forest@unknownto, |
| 3990 |
unknown to=node options, |
| 3991 |
unknown key error/.code={\PackageError{forest}{Unknown keyval: \detokenize{#1}}{}}, |
| 3992 |
content to/.store in=\forest@contentto, |
| 3993 |
content to=content, |
| 3994 |
.unknown/.code={% |
| 3995 |
\expandafter\pgfutil@in@\expandafter.\expandafter{\pgfkeyscurrentname}% |
| 3996 |
\ifpgfutil@in@ |
| 3997 |
\expandafter\forest@relatednode@option@setter\pgfkeyscurrentname=#1\forest@END |
| 3998 |
\else |
| 3999 |
\edef\forest@marshal{% |
| 4000 |
\noexpand\pgfkeysalso{\forest@unknownto={\pgfkeyscurrentname=\unexpanded{#1}}}% |
| 4001 |
}\forest@marshal |
| 4002 |
\fi |
| 4003 |
}, |
| 4004 |
get node boundary/.code={% |
| 4005 |
\forestoget{@boundary}\forest@node@boundary |
| 4006 |
\def#1{}% |
| 4007 |
\forest@extendpath#1\forest@node@boundary{\pgfqpoint{\forestove{x}}{\forestove{y}}}% |
| 4008 |
}, |
| 4009 |
% get min l tree boundary/.code={% |
| 4010 |
% \forest@get@tree@boundary{negative}{\the\numexpr\forestove{grow}-90\relax}#1}, |
| 4011 |
% get max l tree boundary/.code={% |
| 4012 |
% \forest@get@tree@boundary{positive}{\the\numexpr\forestove{grow}-90\relax}#1}, |
| 4013 |
get min s tree boundary/.code={% |
| 4014 |
\forest@get@tree@boundary{negative}{\forestove{grow}}#1}, |
| 4015 |
get max s tree boundary/.code={% |
| 4016 |
\forest@get@tree@boundary{positive}{\forestove{grow}}#1}, |
| 4017 |
use as bounding box/.style={% |
| 4018 |
before drawing tree={ |
| 4019 |
tikz+/.expanded={% |
| 4020 |
\noexpand\pgfresetboundingbox |
| 4021 |
\noexpand\useasboundingbox |
| 4022 |
($(.anchor)+(\forestoption{min x},\forestoption{min y})$) |
| 4023 |
rectangle |
| 4024 |
($(.anchor)+(\forestoption{max x},\forestoption{max y})$) |
| 4025 |
; |
| 4026 |
} |
| 4027 |
} |
| 4028 |
}, |
| 4029 |
use as bounding box'/.style={% |
| 4030 |
before drawing tree={ |
| 4031 |
tikz+/.expanded={% |
| 4032 |
\noexpand\pgfresetboundingbox |
| 4033 |
\noexpand\useasboundingbox |
| 4034 |
($(.anchor)+(\forestoption{min x}+\pgfkeysvalueof{/pgf/outer xsep}/2+\pgfkeysvalueof{/pgf/inner xsep},\forestoption{min y}+\pgfkeysvalueof{/pgf/outer ysep}/2+\pgfkeysvalueof{/pgf/inner ysep})$) |
| 4035 |
rectangle |
| 4036 |
($(.anchor)+(\forestoption{max x}-\pgfkeysvalueof{/pgf/outer xsep}/2-\pgfkeysvalueof{/pgf/inner xsep},\forestoption{max y}-\pgfkeysvalueof{/pgf/outer ysep}/2-\pgfkeysvalueof{/pgf/inner ysep})$) |
| 4037 |
; |
| 4038 |
} |
| 4039 |
} |
| 4040 |
}, |
| 4041 |
}% |
| 4042 |
\def\forest@iftikzkey#1#2#3{% #1 = key name, #2 = true code, #3 = false code |
| 4043 |
\forest@temptrue |
| 4044 |
\pgfkeysifdefined{/tikz/\pgfkeyscurrentname}{}{% |
| 4045 |
\pgfkeysifdefined{/tikz/\pgfkeyscurrentname/.@cmd}{}{% |
| 4046 |
\pgfkeysifdefined{/pgf/\pgfkeyscurrentname}{}{% |
| 4047 |
\pgfkeysifdefined{/pgf/\pgfkeyscurrentname/.@cmd}{}{% |
| 4048 |
\forest@tempfalse |
| 4049 |
}}}}% |
| 4050 |
\ifforest@temp\@escapeif{#2}\else\@escapeif{#3}\fi |
| 4051 |
} |
| 4052 |
\def\forest@ifoptionortikzkey#1#2#3{% #1 = key name, #2 = true code, #3 = false code |
| 4053 |
\forest@temptrue |
| 4054 |
\pgfkeysifdefined{/forest/\pgfkeyscurrentname}{}{% |
| 4055 |
\pgfkeysifdefined{/forest/\pgfkeyscurrentname/.@cmd}{}{% |
| 4056 |
\forest@iftikzkey{#1}{}{}% |
| 4057 |
}}% |
| 4058 |
\ifforest@temp\@escapeif{#2}\else\@escapeif{#3}\fi |
| 4059 |
} |
| 4060 |
\def\forest@get@tree@boundary#1#2#3{%#1=pos/neg,#2=grow,#3=receiving cs |
| 4061 |
\def#3{}% |
| 4062 |
\forest@node@getedge{#1}{#2}\forest@temp@boundary |
| 4063 |
\forest@extendpath#3\forest@temp@boundary{\pgfqpoint{\forestove{x}}{\forestove{y}}}% |
| 4064 |
} |
| 4065 |
\def\forest@setter@node{\forest@cn}% |
| 4066 |
\def\forest@relatednode@option@compat@ignoreinvalidsteps#1{#1} |
| 4067 |
\def\forest@relatednode@option@setter#1.#2=#3\forest@END{% |
| 4068 |
\forest@forthis{% |
| 4069 |
\forest@relatednode@option@compat@ignoreinvalidsteps{% |
| 4070 |
\forest@nameandgo{#1}% |
| 4071 |
\let\forest@setter@node\forest@cn |
| 4072 |
}% |
| 4073 |
}% |
| 4074 |
\ifnum\forest@setter@node=0 |
| 4075 |
\else |
| 4076 |
\forestset{#2={#3}}% |
| 4077 |
\fi |
| 4078 |
\def\forest@setter@node{\forest@cn}% |
| 4079 |
}% |
| 4080 |
\def\forest@split#1#2#3#4{% #1=list (assuming that the list is nonempty and finishes with the separator), #2 = sep, #3 = cs receiving first, #4 = cs receiving last |
| 4081 |
\def\forest@split@@##1#2##2\forest@split@@##3##4{\def##3{##1}\def##4{##2}}% |
| 4082 |
\forest@split@@#1\forest@split@@{#3}{#4}} |
| 4083 |
\forestset{ |
| 4084 |
for tree'/.style 2 args={#1,for children={for tree'={#1}{#2}},#2}, |
| 4085 |
if/.code n args={3}{% |
| 4086 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 4087 |
\ifnum\forest@temp=0 |
| 4088 |
\@escapeif{\pgfkeysalso{#3}}% |
| 4089 |
\else |
| 4090 |
\@escapeif{\pgfkeysalso{#2}}% |
| 4091 |
\fi |
| 4092 |
}, |
| 4093 |
%LaTeX if/.code n args={3}{#1{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}}, |
| 4094 |
if nodewalk valid/.code n args={3}{% |
| 4095 |
\forest@forthis{% |
| 4096 |
\forest@configured@nodewalk{independent}{inherited}{fake}{% |
| 4097 |
#1, |
| 4098 |
TeX={\global\let\forest@global@temp\forest@cn} |
| 4099 |
}{}% |
| 4100 |
}% |
| 4101 |
\ifnum\forest@global@temp=0 |
| 4102 |
\@escapeif{\pgfkeysalso{#3}}% |
| 4103 |
\else |
| 4104 |
\@escapeif{\pgfkeysalso{#2}}% |
| 4105 |
\fi |
| 4106 |
}, |
| 4107 |
if nodewalk empty/.code n args={3}{% |
| 4108 |
\forest@forthis{% |
| 4109 |
\forest@configured@nodewalk{independent}{independent}{fake}{% |
| 4110 |
#1, |
| 4111 |
TeX={\global\let\forest@global@temp\forest@nodewalk@n}, |
| 4112 |
}{}% |
| 4113 |
}% |
| 4114 |
\ifnum\forest@global@temp=0 |
| 4115 |
\@escapeif{\pgfkeysalso{#2}}% |
| 4116 |
\else |
| 4117 |
\@escapeif{\pgfkeysalso{#3}}% |
| 4118 |
\fi |
| 4119 |
}, |
| 4120 |
if current nodewalk empty/.code 2 args={% |
| 4121 |
\ifnum\forest@nodewalk@n=0 |
| 4122 |
\@escapeif{\pgfkeysalso{#1}}% |
| 4123 |
\else |
| 4124 |
\@escapeif{\pgfkeysalso{#2}}% |
| 4125 |
\fi |
| 4126 |
}, |
| 4127 |
where/.style n args={3}{for tree={if={#1}{#2}{#3}}}, |
| 4128 |
where nodewalk valid/.style n args={3}{for tree={if nodewalk valid={#1}{#2}{#3}}}, |
| 4129 |
where nodewalk empty/.style n args={3}{for tree={if nodewalk empty={#1}{#2}{#3}}}, |
| 4130 |
repeat/.code 2 args={% |
| 4131 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 4132 |
\expandafter\forest@repeatkey\expandafter{\forest@temp}{#2}% |
| 4133 |
}, |
| 4134 |
until/.code 2 args={% |
| 4135 |
\ifstrempty{#1}{% |
| 4136 |
\forest@untilkey{\ifnum\forest@cn=0\else\relax\forestloopbreak\fi}{on invalid={fake}{#2}}% |
| 4137 |
}{% |
| 4138 |
\forest@untilkey{\forestmath@if{#1}{\forestloopbreak}{}}{#2}% |
| 4139 |
}% |
| 4140 |
}, |
| 4141 |
while/.code 2 args={% |
| 4142 |
\ifstrempty{#1}{% |
| 4143 |
\forest@untilkey{\ifnum\forest@cn=0\relax\forestloopbreak\fi}{on invalid={fake}{#2}}% |
| 4144 |
}{% |
| 4145 |
\forest@untilkey{\forestmath@if{#1}{}{\forestloopbreak}}{#2}% |
| 4146 |
}% |
| 4147 |
}, |
| 4148 |
do until/.code 2 args={% |
| 4149 |
\ifstrempty{#1}{% |
| 4150 |
\forest@dountilkey{\ifnum\forest@cn=0\else\relax\forestloopbreak\fi}{on invalid={fake}{#2}}% |
| 4151 |
}{% |
| 4152 |
\forest@dountilkey{\forestmath@if{#1}{\forestloopbreak}{}}{#2}% |
| 4153 |
}% |
| 4154 |
}, |
| 4155 |
do while/.code 2 args={% |
| 4156 |
\ifstrempty{#1}{% |
| 4157 |
\forest@dountilkey{\ifnum\forest@cn=0\relax\forestloopbreak\fi}{on invalid={fake}{#2}}% |
| 4158 |
}{% |
| 4159 |
\forest@dountilkey{\forestmath@if{#1}{}{\forestloopbreak}}{#2}% |
| 4160 |
}% |
| 4161 |
}, |
| 4162 |
until nodewalk valid/.code 2 args={% |
| 4163 |
\forest@untilkey{\forest@forthis{% |
| 4164 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@cn=0\relax\else\forestloopbreak\fi}}{}}}{#2}% |
| 4165 |
}, |
| 4166 |
while nodewalk valid/.code 2 args={% |
| 4167 |
\forest@untilkey{\forest@forthis{% |
| 4168 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@cn=0\relax\forestloopbreak\fi}}{}}}{#2}% |
| 4169 |
}, |
| 4170 |
do until nodewalk valid/.code 2 args={% |
| 4171 |
\forest@dountilkey{\forest@forthis{% |
| 4172 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@cn=0\relax\else\forestloopbreak\fi}}{}}}{#2}% |
| 4173 |
}, |
| 4174 |
do while nodewalk valid/.code 2 args={% |
| 4175 |
\forest@dountilkey{\forest@forthis{% |
| 4176 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@cn=0\relax\forestloopbreak\fi}}{}}}{#2}% |
| 4177 |
}, |
| 4178 |
until nodewalk empty/.code 2 args={% |
| 4179 |
\forest@untilkey{\forest@forthis{% |
| 4180 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@nodewalk@n=0\relax\forestloopbreak\fi}}{}}}{#2}% |
| 4181 |
}, |
| 4182 |
while nodewalk empty/.code 2 args={% |
| 4183 |
\forest@untilkey{\forest@forthis{% |
| 4184 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@nodewalk@n=0\relax\else\forestloopbreak\fi}}{}}}{#2}% |
| 4185 |
}, |
| 4186 |
do until nodewalk empty/.code 2 args={% |
| 4187 |
\forest@dountilkey{\forest@forthis{% |
| 4188 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@nodewalk@n=0\relax\forestloopbreak\fi}}{}}}{#2}% |
| 4189 |
}, |
| 4190 |
do while nodewalk empty/.code 2 args={% |
| 4191 |
\forest@dountilkey{\forest@forthis{% |
| 4192 |
\forest@nodewalk{on invalid={fake}{#1},TeX={\ifnum\forest@nodewalk@n=0\relax\else\forestloopbreak\fi}}{}}}{#2}% |
| 4193 |
}, |
| 4194 |
break/.code={\forestloopBreak{#1}}, |
| 4195 |
break/.default=0, |
| 4196 |
} |
| 4197 |
\def\forest@repeatkey#1#2{% |
| 4198 |
\safeRKloop |
| 4199 |
\ifnum\safeRKloopn>#1\relax |
| 4200 |
\csuse{safeRKbreak@\the\safeRKloop@depth true}% |
| 4201 |
\fi |
| 4202 |
\expandafter\unless\csname ifsafeRKbreak@\the\safeRKloop@depth\endcsname |
| 4203 |
\pgfkeysalso{#2}% |
| 4204 |
\safeRKrepeat |
| 4205 |
} |
| 4206 |
\def\forest@untilkey#1#2{% #1 = condition, #2 = keys |
| 4207 |
\safeRKloop |
| 4208 |
#1% |
| 4209 |
\expandafter\unless\csname ifsafeRKbreak@\the\safeRKloop@depth\endcsname |
| 4210 |
\pgfkeysalso{#2}% |
| 4211 |
\safeRKrepeat |
| 4212 |
} |
| 4213 |
\def\forest@dountilkey#1#2{% #1 = condition, #2 = keys |
| 4214 |
\safeRKloop |
| 4215 |
\pgfkeysalso{#2}% |
| 4216 |
#1% |
| 4217 |
\expandafter\unless\csname ifsafeRKbreak@\the\safeRKloop@depth\endcsname |
| 4218 |
\safeRKrepeat |
| 4219 |
} |
| 4220 |
\def\forestloopbreak{% |
| 4221 |
\csname safeRKbreak@\the\safeRKloop@depth true\endcsname |
| 4222 |
} |
| 4223 |
\def\forestloopBreak#1{% |
| 4224 |
\csname safeRKbreak@\number\numexpr\the\safeRKloop@depth-#1\relax true\endcsname |
| 4225 |
} |
| 4226 |
\def\forestloopcount{% |
| 4227 |
\csname safeRKloopn@\number\numexpr\the\safeRKloop@depth\endcsname |
| 4228 |
} |
| 4229 |
\def\forestloopCount#1{% |
| 4230 |
\csname safeRKloopn@\number\numexpr\the\safeRKloop@depth-#1\endcsname |
| 4231 |
} |
| 4232 |
\pgfmathdeclarefunction{forestloopcount}{1}{% |
| 4233 |
\edef\pgfmathresult{\forestloopCount{\ifstrempty{#1}{0}{#1}}}% |
| 4234 |
} |
| 4235 |
\forest@copycommandkey{/forest/repeat}{/forest/nodewalk/repeat} |
| 4236 |
\forest@copycommandkey{/forest/while}{/forest/nodewalk/while} |
| 4237 |
\forest@copycommandkey{/forest/do while}{/forest/nodewalk/do while} |
| 4238 |
\forest@copycommandkey{/forest/until}{/forest/nodewalk/until} |
| 4239 |
\forest@copycommandkey{/forest/do until}{/forest/nodewalk/do until} |
| 4240 |
\forest@copycommandkey{/forest/if}{/forest/nodewalk/if} |
| 4241 |
\forest@copycommandkey{/forest/if nodewalk valid}{/forest/nodewalk/if nodewalk valid} |
| 4242 |
\forestset{ |
| 4243 |
aggregate postparse/.is choice, |
| 4244 |
aggregate postparse/int/.code={% |
| 4245 |
\let\forest@aggregate@pgfmathpostparse\forest@aggregate@pgfmathpostparse@toint}, |
| 4246 |
aggregate postparse/none/.code={% |
| 4247 |
\let\forest@aggregate@pgfmathpostparse\relax}, |
| 4248 |
aggregate postparse/print/.code={% |
| 4249 |
\let\forest@aggregate@pgfmathpostparse\forest@aggregate@pgfmathpostparse@print}, |
| 4250 |
aggregate postparse/macro/.code={% |
| 4251 |
\let\forest@aggregate@pgfmathpostparse\forest@aggregate@pgfmathpostparse@usemacro}, |
| 4252 |
aggregate postparse macro/.store in=\forest@aggregate@pgfmathpostparse@macro, |
| 4253 |
} |
| 4254 |
\def\forest@aggregate@pgfmathpostparse@print{% |
| 4255 |
\pgfmathprintnumberto{\pgfmathresult}{\pgfmathresult}% |
| 4256 |
} |
| 4257 |
\def\forest@aggregate@pgfmathpostparse@toint{% |
| 4258 |
\expandafter\forest@split\expandafter{\pgfmathresult.}{.}\pgfmathresult\forest@temp |
| 4259 |
} |
| 4260 |
\def\forest@aggregate@pgfmathpostparse@usemacro{% |
| 4261 |
\forest@aggregate@pgfmathpostparse@macro |
| 4262 |
} |
| 4263 |
\let\forest@aggregate@pgfmathpostparse\relax |
| 4264 |
\forestset{ |
| 4265 |
/handlers/.aggregate/.code n args=4{% |
| 4266 |
% #1 = start value (forestmath) |
| 4267 |
% #2 = forestmath expression that calculates "aggregate result" at each step |
| 4268 |
% #3 = forestmath expression that calculates "aggregate result" at the end of the nodewalk |
| 4269 |
% #4 = nodewalk |
| 4270 |
\forest@aggregate@handler{\forest@aggregate@generic{#1}{#2}{#3}{#4}}% |
| 4271 |
}, |
| 4272 |
/handlers/.sum/.code 2 args={% #1=forestmath, #2=nodewalk |
| 4273 |
\forest@aggregate@handler{\forest@aggregate@sum{#1}{#2}}% |
| 4274 |
}, |
| 4275 |
/handlers/.count/.code={% #1=nodewalk |
| 4276 |
\forest@aggregate@handler{\forest@aggregate@count{#1}}% |
| 4277 |
}, |
| 4278 |
/handlers/.average/.code 2 args={% #1=forestmath, #2=nodewalk |
| 4279 |
\forest@aggregate@handler{\forest@aggregate@average{#1}{#2}}% |
| 4280 |
}, |
| 4281 |
/handlers/.product/.code 2 args={% #1=forestmath, #2=nodewalk |
| 4282 |
\forest@aggregate@handler{\forest@aggregate@product{#1}{#2}}% |
| 4283 |
}, |
| 4284 |
/handlers/.min/.code 2 args={% #1=forestmath, #2=nodewalk |
| 4285 |
\forest@aggregate@handler{\forest@aggregate@min{#1}{#2}}% |
| 4286 |
}, |
| 4287 |
/handlers/.max/.code 2 args={% #1=forestmath, #2=nodewalk |
| 4288 |
\forest@aggregate@handler{\forest@aggregate@max{#1}{#2}}% |
| 4289 |
}, |
| 4290 |
declare count register={aggregate n}, |
| 4291 |
declare toks register={aggregate value}, |
| 4292 |
declare toks register={aggregate result}, |
| 4293 |
aggregate result={}, |
| 4294 |
} |
| 4295 |
\def\forest@aggregate@handler#1{% |
| 4296 |
\edef\forest@marshal{% |
| 4297 |
\unexpanded{% |
| 4298 |
#1% |
| 4299 |
}{% |
| 4300 |
\noexpand\pgfkeysalso{\pgfkeyscurrentpath/.register=aggregate result}% |
| 4301 |
}% |
| 4302 |
}\forest@marshal |
| 4303 |
} |
| 4304 |
\def\forest@aggregate@pgfmathfunction@finish{% |
| 4305 |
\forestrget{aggregate result}\pgfmathresult |
| 4306 |
} |
| 4307 |
\pgfmathdeclarefunction{aggregate}{4}{% |
| 4308 |
\forest@aggregate@generic{#1}{#2}{#3}{#4}% |
| 4309 |
\forest@aggregate@pgfmathfunction@finish |
| 4310 |
} |
| 4311 |
\pgfmathdeclarefunction{aggregate_count}{1}{% |
| 4312 |
\forest@aggregate@sum{#1}% |
| 4313 |
\forest@aggregate@pgfmathfunction@finish |
| 4314 |
} |
| 4315 |
\pgfmathdeclarefunction{aggregate_sum}{2}{% |
| 4316 |
\forest@aggregate@sum{#1}{#2}% |
| 4317 |
\forest@aggregate@pgfmathfunction@finish |
| 4318 |
} |
| 4319 |
\pgfmathdeclarefunction{aggregate_product}{2}{% |
| 4320 |
\forest@aggregate@product{#1}{#2}% |
| 4321 |
\forest@aggregate@pgfmathfunction@finish |
| 4322 |
} |
| 4323 |
\pgfmathdeclarefunction{aggregate_average}{2}{% |
| 4324 |
\forest@aggregate@average{#1}{#2}% |
| 4325 |
\forest@aggregate@pgfmathfunction@finish |
| 4326 |
} |
| 4327 |
\pgfmathdeclarefunction{aggregate_min}{2}{% |
| 4328 |
\forest@aggregate@min{#1}{#2}% |
| 4329 |
\forest@aggregate@pgfmathfunction@finish |
| 4330 |
} |
| 4331 |
\pgfmathdeclarefunction{aggregate_max}{2}{% |
| 4332 |
\forest@aggregate@max{#1}{#2}% |
| 4333 |
\forest@aggregate@pgfmathfunction@finish |
| 4334 |
} |
| 4335 |
\def\forest@aggregate#1#2#3#4#5#6{% #1...#5=real args, |
| 4336 |
% #6=what to do with |aggregate result| register |
| 4337 |
% #1 = start value (forestmath) |
| 4338 |
% #2 = forestmath expression that calculates "aggregate current" at each step |
| 4339 |
% #3 = forestmath expression that calculates "aggregate result" at each step |
| 4340 |
% #4 = forestmath expression that calculates "aggregate result" at the end of the nodewalk |
| 4341 |
% #5 = nodewalk |
| 4342 |
\forest@saveandrestoreregister{aggregate result}{% |
| 4343 |
\forest@saveandrestoreregister{aggregate n}{% |
| 4344 |
\forest@aggregate@{#1}{#2}{#3}{#4}{#5}% |
| 4345 |
#6% |
| 4346 |
}% |
| 4347 |
}% |
| 4348 |
} |
| 4349 |
\def\forest@aggregate@generic#1#2#3#4{\forest@aggregate |
| 4350 |
{\forestmathparse{#1}}% |
| 4351 |
{}% |
| 4352 |
{\forestmathparse{#2}}% |
| 4353 |
{\forestmathparse{#3}}% |
| 4354 |
{#4}% |
| 4355 |
} |
| 4356 |
\def\forest@aggregate@sum#1#2{\forest@aggregate |
| 4357 |
{\forestmath@convert@fromto\forestmathtype@count\forestmathtype@generic{0}}% |
| 4358 |
{\forestmathparse{#1}}% |
| 4359 |
{\forestmathadd{\forestregister{aggregate value}}{\forestregister{aggregate result}}}% |
| 4360 |
{\forestrget{aggregate result}\forestmathresult}% |
| 4361 |
{#2}% |
| 4362 |
} |
| 4363 |
\def\forest@aggregate@count#1{\forest@aggregate |
| 4364 |
{\def\forestmathresult{0}\let\forestmathresulttype\forestmathtype@count}% |
| 4365 |
{\def\forestmathresult{1}\let\forestmathresulttype\forestmathtype@count}% |
| 4366 |
{\edef\forestmathresult{\the\numexpr\forestregister{aggregate result}+1}\let\forestmathresulttype\forestmathtype@count}% |
| 4367 |
{\forestrget{aggregate result}\forestmathresult\let\forestmathresulttype\forestmathtype@count}% |
| 4368 |
{#1}% |
| 4369 |
} |
| 4370 |
\def\forest@aggregate@average#1#2{\forest@aggregate |
| 4371 |
{\forestmath@convert@fromto\forestmathtype@count\forestmathtype@generic{0}}% |
| 4372 |
{\forestmathparse{#1}}% |
| 4373 |
{\forestmathadd{\forestregister{aggregate value}}{\forestregister{aggregate result}}}% |
| 4374 |
{\forestmathdivide@P{\forestregister{aggregate result}}{\forestregister{aggregate n}}}% |
| 4375 |
{#2}% |
| 4376 |
} |
| 4377 |
\def\forest@aggregate@product#1#2{\forest@aggregate |
| 4378 |
{\forestmath@convert@fromto\forestmathtype@count\forestmathtype@generic{1}}% |
| 4379 |
{\forestmathparse{#1}}% |
| 4380 |
{\forestmathmultiply{\forestregister{aggregate value}}{\forestregister{aggregate result}}}% |
| 4381 |
{\forestrget{aggregate result}\forestmathresult}% |
| 4382 |
{#2}% |
| 4383 |
} |
| 4384 |
\def\forest@aggregate@min#1#2{\forest@aggregate |
| 4385 |
{\def\forestmathresult{}}% |
| 4386 |
{\forestmathparse{#1}}% |
| 4387 |
{\forestmathmin{\forestregister{aggregate value}}{\forestregister{aggregate result}}}% |
| 4388 |
{\forestrget{aggregate result}\forestmathresult}% |
| 4389 |
{#2}% |
| 4390 |
} |
| 4391 |
\def\forest@aggregate@max#1#2{\forest@aggregate |
| 4392 |
{\def\forestmathresult{}}% |
| 4393 |
{\forestmathparse{#1}}% |
| 4394 |
{\forestmathmax{\forestregister{aggregate value}}{\forestregister{aggregate result}}}% |
| 4395 |
{\forestrget{aggregate result}\forestmathresult}% |
| 4396 |
{#2}% |
| 4397 |
} |
| 4398 |
\def\forest@aggregate@#1#2#3#4#5{% |
| 4399 |
% #1 = start value (forestmath) |
| 4400 |
% #2 = forestmath expression that calculates "aggregate current" at each step |
| 4401 |
% #3 = forestmath expression that calculates "aggregate result" at each step |
| 4402 |
% #4 = forestmath expression that calculates "aggregate result" at the end of the nodewalk |
| 4403 |
% #5 = nodewalk |
| 4404 |
#1% |
| 4405 |
\forestrlet{aggregate result}\forestmathresult |
| 4406 |
\forestrset{aggregate value}{}% |
| 4407 |
\forestrset{aggregate n}{0}% |
| 4408 |
\forest@forthis{% |
| 4409 |
\forest@nodewalk{#5}{% |
| 4410 |
TeX={% |
| 4411 |
\forestreset{aggregate n}{\number\numexpr\forestrv{aggregate n}+1}% |
| 4412 |
#2% |
| 4413 |
\forestrlet{aggregate value}\forestmathresult |
| 4414 |
#3% |
| 4415 |
\forestrlet{aggregate result}\forestmathresult |
| 4416 |
}% |
| 4417 |
}{}% |
| 4418 |
}% |
| 4419 |
#4% |
| 4420 |
\let\forest@temp@pgfmathpostparse\pgfmathpostparse |
| 4421 |
\let\pgfmathpostparse\forest@aggregate@pgfmathpostparse |
| 4422 |
\forestmath@convert@to\forestmathtype@dimen{\forestmathresult}% |
| 4423 |
\pgfmathqparse{\forestmathresult}% |
| 4424 |
\let\pgfmathpostparse\forest@temp@pgfmathpostparse |
| 4425 |
\forestrlet{aggregate result}\pgfmathresult |
| 4426 |
} |
| 4427 |
\pgfmathdeclarefunction{strequal}{2}{% |
| 4428 |
\ifstrequal{#1}{#2}{\def\pgfmathresult{1}}{\def\pgfmathresult{0}}% |
| 4429 |
} |
| 4430 |
\pgfmathdeclarefunction{instr}{2}{% |
| 4431 |
\pgfutil@in@{#1}{#2}% |
| 4432 |
\ifpgfutil@in@\def\pgfmathresult{1}\else\def\pgfmathresult{0}\fi |
| 4433 |
} |
| 4434 |
\pgfmathdeclarefunction{strcat}{...}{% |
| 4435 |
\edef\pgfmathresult{\forest@strip@braces{#1}}% |
| 4436 |
} |
| 4437 |
\pgfmathdeclarefunction{min_s}{2}{% #1 = node, #2 = context node (for growth rotation) |
| 4438 |
\forest@forthis{% |
| 4439 |
\forest@nameandgo{#1}% |
| 4440 |
\forest@compute@minmax@ls{#2}% |
| 4441 |
\edef\forest@temp{\forestove{min@s}}% |
| 4442 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 4443 |
}% |
| 4444 |
} |
| 4445 |
\pgfmathdeclarefunction{min_l}{2}{% #1 = node, #2 = context node (for growth rotation) |
| 4446 |
\forest@forthis{% |
| 4447 |
\forest@nameandgo{#1}% |
| 4448 |
\forest@compute@minmax@ls{#2}% |
| 4449 |
\edef\forest@temp{\forestove{min@l}}% |
| 4450 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 4451 |
}% |
| 4452 |
} |
| 4453 |
\pgfmathdeclarefunction{max_s}{2}{% #1 = node, #2 = context node (for growth rotation) |
| 4454 |
\forest@forthis{% |
| 4455 |
\forest@nameandgo{#1}% |
| 4456 |
\forest@compute@minmax@ls{#2}% |
| 4457 |
\edef\forest@temp{\forestove{max@s}}% |
| 4458 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 4459 |
}% |
| 4460 |
} |
| 4461 |
\pgfmathdeclarefunction{max_l}{2}{% #1 = node, #2 = context node (for growth rotation) |
| 4462 |
\forest@forthis{% |
| 4463 |
\forest@nameandgo{#1}% |
| 4464 |
\forest@compute@minmax@ls{#2}% |
| 4465 |
\edef\forest@temp{\forestove{max@l}}% |
| 4466 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 4467 |
}% |
| 4468 |
} |
| 4469 |
\def\forest@compute@minmax@ls#1{% #1 = nodewalk; in the context of which node? |
| 4470 |
{% |
| 4471 |
\pgftransformreset |
| 4472 |
\forest@forthis{% |
| 4473 |
\forest@nameandgo{#1}% |
| 4474 |
\forest@pgfqtransformrotate{-\forestove{grow}}% |
| 4475 |
}% |
| 4476 |
\forestoget{min x}\forest@temp@minx |
| 4477 |
\forestoget{min y}\forest@temp@miny |
| 4478 |
\forestoget{max x}\forest@temp@maxx |
| 4479 |
\forestoget{max y}\forest@temp@maxy |
| 4480 |
\pgfpointtransformed{\pgfqpoint{\forest@temp@minx}{\forest@temp@miny}}% |
| 4481 |
\forestoeset{min@l}{\the\pgf@x}% |
| 4482 |
\forestoeset{min@s}{\the\pgf@y}% |
| 4483 |
\forestoeset{max@l}{\the\pgf@x}% |
| 4484 |
\forestoeset{max@s}{\the\pgf@y}% |
| 4485 |
\pgfpointtransformed{\pgfqpoint{\forest@temp@minx}{\forest@temp@maxy}}% |
| 4486 |
\ifdim\pgf@x<\forestove{min@l}\relax\forestoeset{min@l}{\the\pgf@x}\fi |
| 4487 |
\ifdim\pgf@y<\forestove{min@s}\relax\forestoeset{min@s}{\the\pgf@y}\fi |
| 4488 |
\ifdim\pgf@x>\forestove{max@l}\relax\forestoeset{max@l}{\the\pgf@x}\fi |
| 4489 |
\ifdim\pgf@y>\forestove{max@s}\relax\forestoeset{max@s}{\the\pgf@y}\fi |
| 4490 |
\pgfpointtransformed{\pgfqpoint{\forest@temp@maxx}{\forest@temp@miny}}% |
| 4491 |
\ifdim\pgf@x<\forestove{min@l}\relax\forestoeset{min@l}{\the\pgf@x}\fi |
| 4492 |
\ifdim\pgf@y<\forestove{min@s}\relax\forestoeset{min@s}{\the\pgf@y}\fi |
| 4493 |
\ifdim\pgf@x>\forestove{max@l}\relax\forestoeset{max@l}{\the\pgf@x}\fi |
| 4494 |
\ifdim\pgf@y>\forestove{max@s}\relax\forestoeset{max@s}{\the\pgf@y}\fi |
| 4495 |
\pgfpointtransformed{\pgfqpoint{\forest@temp@maxx}{\forest@temp@maxy}}% |
| 4496 |
\ifdim\pgf@x<\forestove{min@l}\relax\forestoeset{min@l}{\the\pgf@x}\fi |
| 4497 |
\ifdim\pgf@y<\forestove{min@s}\relax\forestoeset{min@s}{\the\pgf@y}\fi |
| 4498 |
\ifdim\pgf@x>\forestove{max@l}\relax\forestoeset{max@l}{\the\pgf@x}\fi |
| 4499 |
\ifdim\pgf@y>\forestove{max@s}\relax\forestoeset{max@s}{\the\pgf@y}\fi |
| 4500 |
% smuggle out |
| 4501 |
\edef\forest@marshal{% |
| 4502 |
\noexpand\forestoeset{min@l}{\forestove{min@l}}% |
| 4503 |
\noexpand\forestoeset{min@s}{\forestove{min@s}}% |
| 4504 |
\noexpand\forestoeset{max@l}{\forestove{max@l}}% |
| 4505 |
\noexpand\forestoeset{max@s}{\forestove{max@s}}% |
| 4506 |
}\expandafter |
| 4507 |
}\forest@marshal |
| 4508 |
} |
| 4509 |
\def\forest@pgfmathhelper@attribute@toks#1#2{% |
| 4510 |
\forest@forthis{% |
| 4511 |
\forest@nameandgo{#1}% |
| 4512 |
\ifnum\forest@cn=0 |
| 4513 |
\def\pgfmathresult{}% |
| 4514 |
\else |
| 4515 |
\forestoget{#2}\pgfmathresult |
| 4516 |
\fi |
| 4517 |
}% |
| 4518 |
} |
| 4519 |
\def\forest@pgfmathhelper@attribute@dimen#1#2{% |
| 4520 |
\forest@forthis{% |
| 4521 |
\forest@nameandgo{#1}% |
| 4522 |
\ifnum\forest@cn=0 |
| 4523 |
\def\pgfmathresult{0}% |
| 4524 |
\else |
| 4525 |
\forestoget{#2}\forest@temp |
| 4526 |
\edef\pgfmathresult{\expandafter\Pgf@geT\forest@temp}% |
| 4527 |
\fi |
| 4528 |
}% |
| 4529 |
} |
| 4530 |
\def\forest@pgfmathhelper@attribute@count#1#2{% |
| 4531 |
\forest@forthis{% |
| 4532 |
\forest@nameandgo{#1}% |
| 4533 |
\ifnum\forest@cn=0 |
| 4534 |
\def\pgfmathresult{0}% |
| 4535 |
\else |
| 4536 |
\forestoget{#2}\pgfmathresult |
| 4537 |
\fi |
| 4538 |
}% |
| 4539 |
} |
| 4540 |
\pgfmathdeclarefunction*{id}{1}{% |
| 4541 |
\forest@forthis{% |
| 4542 |
\forest@nameandgo{#1}% |
| 4543 |
\let\pgfmathresult\forest@cn |
| 4544 |
}% |
| 4545 |
} |
| 4546 |
\def\forest@nodewalk@n{0} |
| 4547 |
\def\forest@nodewalk@historyback{0,} |
| 4548 |
\def\forest@nodewalk@historyforward{0,} |
| 4549 |
\def\forest@nodewalk@origin{0} |
| 4550 |
\def\forest@nodewalk@config@everystep@independent@before#1{% #1 = every step keylist |
| 4551 |
\forestrset{every step}{#1}% |
| 4552 |
} |
| 4553 |
\def\forest@nodewalk@config@everystep@independent@after{% |
| 4554 |
\noexpand\forestrset{every step}{\forestrv{every step}}% |
| 4555 |
} |
| 4556 |
\def\forest@nodewalk@config@history@independent@before{% |
| 4557 |
\def\forest@nodewalk@n{0}% |
| 4558 |
\edef\forest@nodewalk@origin{\forest@cn}% |
| 4559 |
\def\forest@nodewalk@historyback{0,}% |
| 4560 |
\def\forest@nodewalk@historyforward{0,}% |
| 4561 |
} |
| 4562 |
\def\forest@nodewalk@config@history@independent@after{% |
| 4563 |
\edef\noexpand\forest@nodewalk@n{\expandonce{\forest@nodewalk@n}}% |
| 4564 |
\edef\noexpand\forest@nodewalk@origin{\expandonce{\forest@nodewalk@origin}}% |
| 4565 |
\edef\noexpand\forest@nodewalk@historyback{\expandonce{\forest@nodewalk@historyback}}% |
| 4566 |
\edef\noexpand\forest@nodewalk@historyforward{\expandonce{\forest@nodewalk@historyforward}}% |
| 4567 |
} |
| 4568 |
\def\forest@nodewalk@config@everystep@shared@before#1{}% #1 = every step keylist |
| 4569 |
\def\forest@nodewalk@config@everystep@shared@after{} |
| 4570 |
\def\forest@nodewalk@config@history@shared@before{} |
| 4571 |
\def\forest@nodewalk@config@history@shared@after{} |
| 4572 |
\def\forest@nodewalk@config@everystep@inherited@before#1{}% #1 = every step keylist |
| 4573 |
\let\forest@nodewalk@config@everystep@inherited@after\forest@nodewalk@config@everystep@independent@after |
| 4574 |
\def\forest@nodewalk@config@history@inherited@before{} |
| 4575 |
\let\forest@nodewalk@config@history@inherited@after\forest@nodewalk@config@history@independent@after |
| 4576 |
\def\forest@nodewalk#1#2{% #1 = nodewalk, #2 = every step keylist |
| 4577 |
\forest@configured@nodewalk{independent}{independent}{inherited}{#1}{#2}% |
| 4578 |
} |
| 4579 |
\def\forest@configured@nodewalk#1#2#3#4#5{% |
| 4580 |
% #1 = every step method, #2 = history method, #3 = on invalid |
| 4581 |
% #4 = nodewalk, #5 = every step keylist |
| 4582 |
\def\forest@nodewalk@config@everystep@method{#1}% |
| 4583 |
\def\forest@nodewalk@config@history@method{#2}% |
| 4584 |
\def\forest@nodewalk@config@oninvalid{#3}% |
| 4585 |
\forest@Nodewalk{#4}{#5}% |
| 4586 |
} |
| 4587 |
\def\forest@nodewalk@oninvalid@inherited@text{inherited} |
| 4588 |
\def\forest@Nodewalk#1#2{% #1 = nodewalk, #2 = every step keylist |
| 4589 |
\ifx\forest@nodewalk@config@oninvalid\forest@nodewalk@oninvalid@inherited@text |
| 4590 |
\edef\forest@nodewalk@config@oninvalid{\forest@nodewalk@oninvalid}% |
| 4591 |
\fi |
| 4592 |
\edef\forest@nw@marshal{% |
| 4593 |
\noexpand\pgfqkeys{/forest/nodewalk}{\unexpanded{#1}}% |
| 4594 |
\csname forest@nodewalk@config@everystep@\forest@nodewalk@config@everystep@method @after\endcsname |
| 4595 |
\csname forest@nodewalk@config@history@\forest@nodewalk@config@history@method @after\endcsname |
| 4596 |
\edef\noexpand\forest@nodewalk@oninvalid{\forest@nodewalk@oninvalid}% |
| 4597 |
}% |
| 4598 |
\csname forest@nodewalk@config@everystep@\forest@nodewalk@config@everystep@method @before\endcsname{#2}% |
| 4599 |
\csname forest@nodewalk@config@history@\forest@nodewalk@config@history@method @before\endcsname |
| 4600 |
\edef\forest@nodewalk@oninvalid{\forest@nodewalk@config@oninvalid}% |
| 4601 |
\forest@saveandrestoreifcs{forest@nodewalk@fake}{% |
| 4602 |
\forest@nodewalk@fakefalse |
| 4603 |
\forest@nw@marshal |
| 4604 |
}% |
| 4605 |
} |
| 4606 |
\pgfmathdeclarefunction{valid}{1}{% |
| 4607 |
\forest@forthis{% |
| 4608 |
\forest@nameandgo{#1}% |
| 4609 |
\edef\pgfmathresult{\ifnum\forest@cn=0 0\else 1\fi}% |
| 4610 |
}% |
| 4611 |
} |
| 4612 |
\pgfmathdeclarefunction{invalid}{1}{% |
| 4613 |
\forest@forthis{% |
| 4614 |
\forest@nameandgo{#1}% |
| 4615 |
\edef\pgfmathresult{\ifnum\forest@cn=0 1\else 0\fi}% |
| 4616 |
}% |
| 4617 |
} |
| 4618 |
\newif\ifforest@nodewalk@fake |
| 4619 |
\def\forest@nodewalk@oninvalid{error} |
| 4620 |
\def\forest@nodewalk@makestep{% |
| 4621 |
\ifnum\forest@cn=0 |
| 4622 |
\csname forest@nodewalk@makestep@oninvalid@\forest@nodewalk@oninvalid\endcsname |
| 4623 |
\else |
| 4624 |
\forest@nodewalk@makestep@ |
| 4625 |
\fi |
| 4626 |
} |
| 4627 |
\csdef{forest@nodewalk@makestep@oninvalid@error if real}{\ifforest@nodewalk@fake\expandafter\forest@nodewalk@makestep@\else\expandafter\forest@nodewalk@makestep@oninvalid@error\fi} |
| 4628 |
\csdef{forest@nodewalk@makestep@oninvalid@last valid}{% |
| 4629 |
\forest@nodewalk@tolastvalid |
| 4630 |
\ifforestdebugnodewalks\forest@nodewalk@makestep@invalidtolastvalid@debug\fi}% |
| 4631 |
\def\forest@nodewalk@makestep@oninvalid@error{\PackageError{forest}{nodewalk stepped to the invalid node\MessageBreak nodewalk stack: "\forest@nodewalk@currentstepname"}{}}% |
| 4632 |
\let\forest@nodewalk@makestep@oninvalid@fake\relax |
| 4633 |
\def\forest@nodewalk@makestep@oninvalid@compatfake{% |
| 4634 |
\forest@deprecated{last step in stack "\forest@nodewalk@currentstepname", which stepped on an invalid node; enabled by "compat=1.0-forstep". Use "on invalid={fake}{...}" or "for Nodewalk={on invalid=fake}{...}{...}" instead.}% |
| 4635 |
}% |
| 4636 |
\def\forest@nodewalk@makestep@{% |
| 4637 |
\ifforestdebugnodewalks\forest@nodewalk@makestep@debug\fi |
| 4638 |
\ifforest@nodewalk@fake |
| 4639 |
\else |
| 4640 |
\edef\forest@nodewalk@n{\number\numexpr\forest@nodewalk@n+1}% |
| 4641 |
\epreto\forest@nodewalk@historyback{\forest@cn,}% |
| 4642 |
\def\forest@nodewalk@historyforward{0,}% |
| 4643 |
\forest@process@keylist@register{every step}% |
| 4644 |
\fi |
| 4645 |
} |
| 4646 |
\def\forest@nodewalk@makestep@debug{% |
| 4647 |
\edef\forest@marshal{% |
| 4648 |
\noexpand\typeout{\ifforest@nodewalk@fake fake \fi "\forest@nodewalk@currentstepname" step to node id=\forest@cn, content=\forestoption{content}}% |
| 4649 |
}\forest@marshal |
| 4650 |
}% |
| 4651 |
\def\forest@nodewalk@makestep@invalidtolastvalid@debug{% |
| 4652 |
\edef\forest@marshal{% |
| 4653 |
\noexpand\typeout{\ifforest@nodewalk@fake fake \fi "\forest@nodewalk@currentstepname" step to invalid node, (fake) return to last valid id=\forest@cn, content=\forestoption{content}}% |
| 4654 |
}\forest@marshal |
| 4655 |
}% |
| 4656 |
\def\forest@handlers@savecurrentpath{% |
| 4657 |
\edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% |
| 4658 |
\let\forest@currentkey\pgfkeyscurrentkey |
| 4659 |
\pgfkeys@split@path |
| 4660 |
\edef\forest@currentpath{\pgfkeyscurrentpath}% |
| 4661 |
\let\forest@currentname\pgfkeyscurrentname |
| 4662 |
} |
| 4663 |
\pgfkeys{/handlers/save current path/.code={\forest@handlers@savecurrentpath}} |
| 4664 |
\newif\ifforest@nodewalkstephandler@style |
| 4665 |
\newif\ifforest@nodewalkstephandler@autostep |
| 4666 |
\newif\ifforest@nodewalkstephandler@stripfakesteps |
| 4667 |
\newif\ifforest@nodewalkstephandler@muststartatvalidnode |
| 4668 |
\newif\ifforest@nodewalkstephandler@makefor |
| 4669 |
\let\forest@nodewalkstephandler@styletrueorfalse\forest@nodewalkstephandler@stylefalse |
| 4670 |
\def\forest@nodewalk@currentstepname{} |
| 4671 |
\forestset{ |
| 4672 |
/forest/define@step/style/.is if=forest@nodewalkstephandler@style, |
| 4673 |
/forest/define@step/autostep/.is if=forest@nodewalkstephandler@autostep, |
| 4674 |
% the following is useful because some macros use grouping (by \forest@forthis or similar) and therefore, after making the last step, revert \forest@cn to the original value, essentially making a fake step |
| 4675 |
/forest/define@step/strip fake steps/.is if=forest@nodewalkstephandler@stripfakesteps, |
| 4676 |
% this can never happen with autosteps ... |
| 4677 |
/forest/define@step/autostep/.append code={% |
| 4678 |
\ifforest@nodewalkstephandler@autostep |
| 4679 |
\forest@nodewalkstephandler@stripfakestepsfalse |
| 4680 |
\fi |
| 4681 |
}, |
| 4682 |
/forest/define@step/must start at valid node/.is if=forest@nodewalkstephandler@muststartatvalidnode, |
| 4683 |
/forest/define@step/n args/.store in=\forest@nodewalkstephandler@nargs, |
| 4684 |
/forest/define@step/make for/.is if=forest@nodewalkstephandler@makefor, |
| 4685 |
/forest/define@step/@bare/.style={strip fake steps=false,must start at valid node=false,make for=false}, |
| 4686 |
define long step/.code n args=3{% |
| 4687 |
\forest@nodewalkstephandler@styletrueorfalse % true for end users; but in the package, most of steps are defined by .code |
| 4688 |
\forest@nodewalkstephandler@autostepfalse |
| 4689 |
\forest@nodewalkstephandler@stripfakestepstrue |
| 4690 |
\forest@nodewalkstephandler@muststartatvalidnodetrue % most steps can only start at a valid node |
| 4691 |
\forest@nodewalkstephandler@makefortrue % make for prefix? |
| 4692 |
\def\forest@nodewalkstephandler@nargs{0}% |
| 4693 |
\pgfqkeys{/forest/define@step}{#2}% |
| 4694 |
\forest@temp@toks{#3}% handler code |
| 4695 |
\ifforest@nodewalkstephandler@style |
| 4696 |
\expandafter\forest@temp@toks\expandafter{% |
| 4697 |
\expandafter\pgfkeysalso\expandafter{\the\forest@temp@toks}% |
| 4698 |
}% |
| 4699 |
\fi |
| 4700 |
\ifforest@nodewalkstephandler@autostep |
| 4701 |
\apptotoks\forest@temp@toks{\forest@nodewalk@makestep}% |
| 4702 |
\fi |
| 4703 |
\ifforest@nodewalkstephandler@stripfakesteps |
| 4704 |
\expandafter\forest@temp@toks\expandafter{\expandafter\forest@nodewalk@stripfakesteps\expandafter{\the\forest@temp@toks}}% |
| 4705 |
\fi |
| 4706 |
\ifforest@nodewalkstephandler@muststartatvalidnode |
| 4707 |
\edef\forest@marshal{% |
| 4708 |
\noexpand\forest@temp@toks{% |
| 4709 |
\unexpanded{% |
| 4710 |
\ifnum\forest@cn=0 |
| 4711 |
\csname forest@nodewalk@start@oninvalid@\forest@nodewalk@oninvalid\endcsname{#1}% |
| 4712 |
\else |
| 4713 |
}% |
| 4714 |
\noexpand\@escapeif{\the\forest@temp@toks}% |
| 4715 |
\noexpand\fi |
| 4716 |
}% |
| 4717 |
}\forest@marshal |
| 4718 |
\fi |
| 4719 |
\pretotoks\forest@temp@toks{\appto\forest@nodewalk@currentstepname{,#1}}% |
| 4720 |
\expandafter\forest@temp@toks\expandafter{\expandafter\forest@saveandrestoremacro\expandafter\forest@nodewalk@currentstepname\expandafter{\the\forest@temp@toks}}% |
| 4721 |
\ifforestdebugnodewalks |
| 4722 |
\epretotoks\forest@temp@toks{\noexpand\typeout{Starting step "#1" from id=\noexpand\forest@cn |
| 4723 |
\ifnum\forest@nodewalkstephandler@nargs>0 \space with args \noexpand\unexpanded{####1}\fi |
| 4724 |
\ifnum\forest@nodewalkstephandler@nargs>1 ,\noexpand\unexpanded{####2}\fi |
| 4725 |
\ifnum\forest@nodewalkstephandler@nargs>2 ,\noexpand\unexpanded{####3}\fi |
| 4726 |
\ifnum\forest@nodewalkstephandler@nargs>3 ,\noexpand\unexpanded{####4}\fi |
| 4727 |
\ifnum\forest@nodewalkstephandler@nargs>4 ,\noexpand\unexpanded{####5}\fi |
| 4728 |
\ifnum\forest@nodewalkstephandler@nargs>5 ,\noexpand\unexpanded{####6}\fi |
| 4729 |
\ifnum\forest@nodewalkstephandler@nargs>6 ,\noexpand\unexpanded{####7}\fi |
| 4730 |
\ifnum\forest@nodewalkstephandler@nargs>7 ,\noexpand\unexpanded{####8}\fi |
| 4731 |
\ifnum\forest@nodewalkstephandler@nargs>8 ,\noexpand\unexpanded{####9}\fi |
| 4732 |
}}% |
| 4733 |
\fi |
| 4734 |
\def\forest@temp{/forest/nodewalk/#1/.code}% |
| 4735 |
\ifnum\forest@nodewalkstephandler@nargs<2 |
| 4736 |
\eappto\forest@temp{=}% |
| 4737 |
\else\ifnum\forest@nodewalkstephandler@nargs=2 |
| 4738 |
\eappto\forest@temp{ 2 args=}% |
| 4739 |
\else |
| 4740 |
\eappto\forest@temp{ n args={\forest@nodewalkstephandler@nargs}}% |
| 4741 |
\fi\fi |
| 4742 |
\eappto\forest@temp{{\the\forest@temp@toks}}% |
| 4743 |
\expandafter\pgfkeysalso\expandafter{\forest@temp}% |
| 4744 |
\ifforest@nodewalkstephandler@makefor |
| 4745 |
\ifnum\forest@nodewalkstephandler@nargs=0 |
| 4746 |
\forestset{% |
| 4747 |
for #1/.code={\forest@forstepwrapper{#1}{##1}}, |
| 4748 |
}% |
| 4749 |
\else\ifnum\forest@nodewalkstephandler@nargs=1 |
| 4750 |
\forestset{% |
| 4751 |
for #1/.code 2 args={\forest@forstepwrapper{#1={##1}}{##2}}, |
| 4752 |
}% |
| 4753 |
\else |
| 4754 |
\forestset{% |
| 4755 |
for #1/.code n args/.expanded=% |
| 4756 |
{\number\numexpr\forest@nodewalkstephandler@nargs+1}% |
| 4757 |
{\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}}, |
| 4758 |
}% |
| 4759 |
\fi\fi |
| 4760 |
\fi |
| 4761 |
}, |
| 4762 |
} |
| 4763 |
{\csname forest@@doc@@hook@bigbadforlist\endcsname}% |
| 4764 |
\pgfqkeys{/handlers}{ |
| 4765 |
.nodewalk style/.code={\forest@handlers@savecurrentpath\pgfkeysalso{% |
| 4766 |
\forest@currentpath/nodewalk/\forest@currentname/.style={#1}% |
| 4767 |
}}, |
| 4768 |
} |
| 4769 |
\def\forest@forstepwrapper#1#2{\forest@forthis{\forest@nodewalk{#1}{#2}}} |
| 4770 |
\def\forest@util@nargs#1#2#3{% #1 = prefix (#, ##, ...), #2 = n args, #3=start; returns {#start+1}...{#start+n} |
| 4771 |
\ifnum#2>0 {#1\number\numexpr#3+1}\fi |
| 4772 |
\ifnum#2>1 {#1\number\numexpr#3+2}\fi |
| 4773 |
\ifnum#2>2 {#1\number\numexpr#3+3}\fi |
| 4774 |
\ifnum#2>3 {#1\number\numexpr#3+4}\fi |
| 4775 |
\ifnum#2>4 {#1\number\numexpr#3+5}\fi |
| 4776 |
\ifnum#2>5 {#1\number\numexpr#3+6}\fi |
| 4777 |
\ifnum#2>6 {#1\number\numexpr#3+7}\fi |
| 4778 |
\ifnum#2>7 {#1\number\numexpr#3+8}\fi |
| 4779 |
\ifnum#2>8 {#1\number\numexpr#3+9}\fi |
| 4780 |
} |
| 4781 |
\def\forest@nodewalk@start@oninvalid@fake#1{} |
| 4782 |
\def\forest@nodewalk@start@oninvalid@compatfake#1{% |
| 4783 |
\forest@deprecated{last step in stack "\forest@nodewalk@currentstepname", which started from an invalid node; enabled by "compat=1.0-forstep". Use "on invalid={fake}{...}" or "for Nodewalk={on invalid=fake}{...}{...}" instead.}% |
| 4784 |
}% |
| 4785 |
\let\forest@nodewalk@start@oninvalid@errorifreal\forest@nodewalk@start@oninvalid@fake % the step will be to an invalid node anyway |
| 4786 |
\let\forest@nodewalk@start@oninvalid@lastvalid\forest@nodewalk@start@oninvalid@fake |
| 4787 |
\def\forest@nodewalk@start@oninvalid@error#1{\PackageError{forest}{nodewalk step "#1" cannot start at the invalid node}{}} |
| 4788 |
\forestset{ |
| 4789 |
define long step={current}{autostep}{}, |
| 4790 |
define long step={next}{autostep}{\edef\forest@cn{\forestove{@next}}}, |
| 4791 |
define long step={previous}{autostep}{\edef\forest@cn{\forestove{@previous}}}, |
| 4792 |
define long step={parent}{autostep}{\edef\forest@cn{\forestove{@parent}}}, |
| 4793 |
define long step={first}{autostep}{\edef\forest@cn{\forestove{@first}}}, |
| 4794 |
define long step={last}{autostep}{\edef\forest@cn{\forestove{@last}}}, |
| 4795 |
define long step={sibling}{autostep}{% |
| 4796 |
\edef\forest@cn{% |
| 4797 |
\ifnum\forestove{@previous}=0 |
| 4798 |
\forestove{@next}% |
| 4799 |
\else |
| 4800 |
\forestove{@previous}% |
| 4801 |
\fi |
| 4802 |
}% |
| 4803 |
}, |
| 4804 |
define long step={next node}{autostep}{\edef\forest@cn{\forest@node@linearnextid}}, |
| 4805 |
define long step={previous node}{autostep}{\edef\forest@cn{\forest@node@linearpreviousid}}, |
| 4806 |
define long step={first leaf}{autostep}{% |
| 4807 |
\safeloop |
| 4808 |
\edef\forest@cn{\forestove{@first}}% |
| 4809 |
\unless\ifnum\forestove{@first}=0 |
| 4810 |
\saferepeat |
| 4811 |
}, |
| 4812 |
define long step={first leaf'}{autostep}{% |
| 4813 |
\safeloop |
| 4814 |
\unless\ifnum\forestove{@first}=0 |
| 4815 |
\edef\forest@cn{\forestove{@first}}% |
| 4816 |
\saferepeat |
| 4817 |
}, |
| 4818 |
define long step={last leaf}{autostep}{% |
| 4819 |
\safeloop |
| 4820 |
\edef\forest@cn{\forestove{@last}}% |
| 4821 |
\unless\ifnum\forestove{@last}=0 |
| 4822 |
\saferepeat |
| 4823 |
}, |
| 4824 |
define long step={last leaf'}{autostep}{% |
| 4825 |
\safeloop |
| 4826 |
\unless\ifnum\forestove{@last}=0 |
| 4827 |
\edef\forest@cn{\forestove{@last}}% |
| 4828 |
\saferepeat |
| 4829 |
}, |
| 4830 |
define long step={next leaf}{style,strip fake steps=false}{group={do until={n_children()==0}{next node}}}, |
| 4831 |
define long step={previous leaf}{style,strip fake steps=false}{group={do until={n_children()==0}{previous node}}}, |
| 4832 |
define long step={next on tier}{autostep,n args=1}{% |
| 4833 |
\def\forest@temp{#1}% |
| 4834 |
\ifx\forest@temp\pgfkeysnovalue@text |
| 4835 |
\forestoget{tier}\forest@nodewalk@giventier |
| 4836 |
\else |
| 4837 |
\def\forest@nodewalk@giventier{#1}% |
| 4838 |
\fi |
| 4839 |
\edef\forest@cn{\forest@node@linearnextid}% |
| 4840 |
\safeloop |
| 4841 |
\forest@nodewalk@gettier |
| 4842 |
\ifforest@temp |
| 4843 |
\edef\forest@cn{\forest@node@linearnextid}% |
| 4844 |
\saferepeat |
| 4845 |
}, |
| 4846 |
define long step={previous on tier}{autostep,n args=1}{% |
| 4847 |
\def\forest@temp{#1}% |
| 4848 |
\ifx\forest@temp\pgfkeysnovalue@text |
| 4849 |
\forestoget{tier}\forest@nodewalk@giventier |
| 4850 |
\else |
| 4851 |
\def\forest@nodewalk@giventier{#1}% |
| 4852 |
\fi |
| 4853 |
\safeloop |
| 4854 |
\edef\forest@cn{\forest@node@linearpreviousid}% |
| 4855 |
\forest@nodewalk@gettier |
| 4856 |
\ifforest@temp |
| 4857 |
\saferepeat |
| 4858 |
}, |
| 4859 |
TeX={% |
| 4860 |
\def\forest@nodewalk@gettier{% |
| 4861 |
\ifnum\forest@cn=0 |
| 4862 |
\forest@tempfalse |
| 4863 |
\else |
| 4864 |
\forestoget{tier}\forest@temp |
| 4865 |
\ifx\forest@temp\forest@nodewalk@giventier |
| 4866 |
\forest@tempfalse |
| 4867 |
\else |
| 4868 |
\forest@temptrue |
| 4869 |
\fi |
| 4870 |
\fi |
| 4871 |
}% |
| 4872 |
}, |
| 4873 |
% |
| 4874 |
define long step={root}{autostep,must start at valid node=false}{% |
| 4875 |
\edef\forest@cn{\forest@node@rootid}}, |
| 4876 |
define long step={root'}{autostep,must start at valid node=false}{% |
| 4877 |
\forestOifdefined{\forest@root}{@parent}{\edef\forest@cn{\forest@root}}{\edef\forest@cn{0}}% |
| 4878 |
}, |
| 4879 |
define long step={origin}{autostep,must start at valid node=false}{\edef\forest@cn{\forest@nodewalk@origin}}, |
| 4880 |
% |
| 4881 |
define long step={n}{autostep,n args=1}{% |
| 4882 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 4883 |
\edef\forest@cn{\forest@node@nthchildid{\forest@temp@n}}% |
| 4884 |
}, |
| 4885 |
define long step={n}{autostep,make for=false,n args=1}{% |
| 4886 |
% Yes, twice. ;-) |
| 4887 |
% n=1 and n(ext) |
| 4888 |
\def\forest@nodewalk@temp{#1}% |
| 4889 |
\ifx\forest@nodewalk@temp\pgfkeysnovalue@text |
| 4890 |
\edef\forest@cn{\forestove{@next}}% |
| 4891 |
\else |
| 4892 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 4893 |
\edef\forest@cn{\forest@node@nthchildid{\forest@temp@n}}% |
| 4894 |
\fi |
| 4895 |
}, |
| 4896 |
define long step={n'}{autostep,n args=1}{% |
| 4897 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 4898 |
\edef\forest@cn{\forest@node@nbarthchildid{\forest@temp@n}}% |
| 4899 |
}, |
| 4900 |
define long step={to tier}{autostep,n args=1}{% |
| 4901 |
\def\forest@nodewalk@giventier{#1}% |
| 4902 |
\safeloop |
| 4903 |
\forest@nodewalk@gettier |
| 4904 |
\ifforest@temp |
| 4905 |
\forestoget{@parent}\forest@cn |
| 4906 |
\saferepeat |
| 4907 |
}, |
| 4908 |
% |
| 4909 |
define long step={name}{autostep,n args=1,must start at valid node=false}{% |
| 4910 |
\edef\forest@cn{% |
| 4911 |
\forest@node@Ifnamedefined{#1}{\forest@node@Nametoid{#1}}{0}% |
| 4912 |
}% |
| 4913 |
}, |
| 4914 |
define long step={id}{autostep,n args=1,must start at valid node=false}{% |
| 4915 |
\forestOifdefined{#1}{@parent}{\edef\forest@cn{#1}}{\edef\forest@cn{0}}% |
| 4916 |
}, |
| 4917 |
define long step={Nodewalk}{n args=3,@bare}{% #1 = config, #2 = nodewalk |
| 4918 |
\def\forest@nodewalk@config@everystep@method{independent}% |
| 4919 |
\def\forest@nodewalk@config@history@method{shared}% |
| 4920 |
\def\forest@nodewalk@config@oninvalid{inherited}% |
| 4921 |
\pgfqkeys{/forest/nodewalk@config}{#1}% |
| 4922 |
\forest@Nodewalk{#2}{#3}% |
| 4923 |
}, |
| 4924 |
define long step={nodewalk}{n args=2,@bare}{% #1 = nodewalk, #2 = every step |
| 4925 |
\forest@nodewalk{#1}{#2}% |
| 4926 |
}, |
| 4927 |
define long step={nodewalk'}{n args=1,@bare}{% #1 = nodewalk |
| 4928 |
\forest@configured@nodewalk{inherited}{independent}{inherited}{#1}{}% |
| 4929 |
}, |
| 4930 |
% these "for ..." keys must be defined explicitely |
| 4931 |
% (and copied into node keyspace manually), |
| 4932 |
% as prefix "for" normally introduces the every-step keylist |
| 4933 |
define long step={for nodewalk}{n args=2,@bare}{% #1 = nodewalk, #2 = every step |
| 4934 |
\forest@forthis{\forest@nodewalk{#1}{#2}}}, |
| 4935 |
define long step={for nodewalk'}{n args=1,@bare}{% #1 = nodewalk |
| 4936 |
\forest@forthis{% |
| 4937 |
\forest@configured@nodewalk{inherited}{independent}{inherited}{#1}{}% |
| 4938 |
}% |
| 4939 |
}, |
| 4940 |
define long step={for Nodewalk}{n args=3,@bare}{% #1 = config, #2 = nodewalk, #3 = every-step |
| 4941 |
\def\forest@nodewalk@config@everystep@method{independent}% |
| 4942 |
\def\forest@nodewalk@config@history@method{shared}% |
| 4943 |
\def\forest@nodewalk@config@oninvalid{inherited}% |
| 4944 |
\pgfqkeys{/forest/nodewalk@config}{#1}% |
| 4945 |
\forest@forthis{\forest@Nodewalk{#2}{#3}}% |
| 4946 |
}, |
| 4947 |
copy command key={/forest/nodewalk/Nodewalk}{/forest/Nodewalk}, |
| 4948 |
copy command key={/forest/nodewalk/for nodewalk}{/forest/for nodewalk}, |
| 4949 |
copy command key={/forest/nodewalk/for Nodewalk}{/forest/for Nodewalk}, |
| 4950 |
declare keylist register=every step, |
| 4951 |
every step'={}, |
| 4952 |
%%% begin nodewalk config |
| 4953 |
nodewalk@config/.cd, |
| 4954 |
every@step/.is choice, |
| 4955 |
every@step/independent/.code={}, |
| 4956 |
every@step/inherited/.code={}, |
| 4957 |
every@step/shared/.code={}, |
| 4958 |
every step/.store in=\forest@nodewalk@config@everystep@method, |
| 4959 |
every step/.prefix style={every@step=#1}, |
| 4960 |
@history/.is choice, |
| 4961 |
@history/independent/.code={}, |
| 4962 |
@history/inherited/.code={}, |
| 4963 |
@history/shared/.code={}, |
| 4964 |
history/.store in=\forest@nodewalk@config@history@method, |
| 4965 |
history/.prefix style={@history=#1}, |
| 4966 |
on@invalid/.is choice, |
| 4967 |
on@invalid/error/.code={}, |
| 4968 |
on@invalid/fake/.code={}, |
| 4969 |
on@invalid/error if real/.code={}, |
| 4970 |
on@invalid/last valid/.code={}, |
| 4971 |
on@invalid/inherited/.code={}, |
| 4972 |
on invalid/.store in=\forest@nodewalk@config@oninvalid, |
| 4973 |
on invalid/.prefix style={on@invalid=#1}, |
| 4974 |
%%% end nodewalk config |
| 4975 |
} |
| 4976 |
\newtoks\forest@nodewalk@branch@toks |
| 4977 |
\forestset{ |
| 4978 |
declare toks register=branch@temp@toks, |
| 4979 |
branch@temp@toks={}, |
| 4980 |
declare keylist register=branched@nodewalk, |
| 4981 |
branched@nodewalk={}, |
| 4982 |
define long step={branch}{n args=1,@bare,make for,style}{@branch={#1}{branch@build@realstep,branch@build@fakestep}}, |
| 4983 |
define long step={branch'}{n args=1,@bare,make for,style}{@branch={#1}{branch@build@realstep}}, |
| 4984 |
@branch/.style 2 args={% |
| 4985 |
save and restore register={branched@nodewalk}{ |
| 4986 |
branch@temp@toks={}, |
| 4987 |
split/.process={r}{#1}{,}{#2}, |
| 4988 |
also/.register=branch@temp@toks, |
| 4989 |
also/.register=branched@nodewalk, |
| 4990 |
} |
| 4991 |
}, |
| 4992 |
nodewalk/branch@build@realstep/.style={% #1 = nodewalk for this branch |
| 4993 |
branch@temp@toks/.expanded={for nodewalk={\unexpanded{#1}}{ |
| 4994 |
branched@nodewalk+/.expanded={id=\noexpand\forestoption{id}}, |
| 4995 |
\forestregister{branch@temp@toks}}}, |
| 4996 |
}, |
| 4997 |
nodewalk/branch@build@fakestep/.style={% #1 = nodewalk for this branch |
| 4998 |
branch@temp@toks/.expanded={for nodewalk={\unexpanded{#1}}{ |
| 4999 |
\forestregister{branch@temp@toks}}}, |
| 5000 |
}, |
| 5001 |
define long step={group}{autostep,n args=1}{\forest@go{#1}}, |
| 5002 |
nodewalk/fake/.code={% |
| 5003 |
\forest@saveandrestoreifcs{forest@nodewalk@fake}{% |
| 5004 |
\forest@nodewalk@faketrue |
| 5005 |
\pgfkeysalso{#1}% |
| 5006 |
}% |
| 5007 |
}, |
| 5008 |
nodewalk/real/.code={% |
| 5009 |
\forest@saveandrestoreifcs{forest@nodewalk@fake}{% |
| 5010 |
\forest@nodewalk@fakefalse |
| 5011 |
\pgfkeysalso{#1}% |
| 5012 |
}% |
| 5013 |
}, |
| 5014 |
declare keylist register=filtered@nodewalk, |
| 5015 |
filtered@nodewalk={}, |
| 5016 |
define long step={filter}{n args=2,@bare,make for,style}{% #1 = nodewalk, #2 = condition |
| 5017 |
save and restore register={filtered@nodewalk}{ |
| 5018 |
filtered@nodewalk'={}, |
| 5019 |
Nodewalk=% |
| 5020 |
{history=inherited}% |
| 5021 |
{#1}% |
| 5022 |
{if={#2}{filtered@nodewalk+/.expanded={id=\forestoption{id}}}{}}, |
| 5023 |
filtered@nodewalk@style/.style/.register=filtered@nodewalk, |
| 5024 |
filtered@nodewalk@style |
| 5025 |
}, |
| 5026 |
}, |
| 5027 |
on@invalid/.is choice, |
| 5028 |
on@invalid/error/.code={}, |
| 5029 |
on@invalid/fake/.code={}, |
| 5030 |
on@invalid/error if real/.code={}, |
| 5031 |
on@invalid/last valid/.code={}, |
| 5032 |
on invalid/.code 2 args={% |
| 5033 |
\pgfkeysalso{/forest/on@invalid={#1}}% |
| 5034 |
\forest@saveandrestoremacro\forest@nodewalk@oninvalid{% |
| 5035 |
\def\forest@nodewalk@oninvalid{#1}% |
| 5036 |
\pgfkeysalso{#2}% |
| 5037 |
}% |
| 5038 |
}, |
| 5039 |
define long step={strip fake steps}{n args=1,@bare}{% |
| 5040 |
\forest@nodewalk@stripfakesteps{\pgfkeysalso{#1}}}, |
| 5041 |
define long step={unique}{n args=1}{% |
| 5042 |
\begingroup |
| 5043 |
\def\forest@nodewalk@unique@temp{}% |
| 5044 |
\forest@nodewalk{#1}{% |
| 5045 |
TeX={% |
| 5046 |
\forestoget{unique@visited}\forest@temp |
| 5047 |
\ifx\forest@temp\relax |
| 5048 |
\forestoset{unique@visited}{1}% |
| 5049 |
\eappto\forest@nodewalk@unique@temp{,id=\forest@cn}% |
| 5050 |
\fi |
| 5051 |
}% |
| 5052 |
}% |
| 5053 |
\global\let\forest@global@temp\forest@nodewalk@unique@temp |
| 5054 |
\endgroup |
| 5055 |
\pgfkeysalsofrom{\forest@global@temp}% |
| 5056 |
}, |
| 5057 |
define long step={walk back}{n args=1,@bare}{% |
| 5058 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 5059 |
\forest@nodewalk@walklist{\forest@nodewalk@historyforward}{\forest@nodewalk@historyback}{\ifnum\forest@cn=0 0\else1\fi}{\forest@temp@n+\ifnum\forest@cn=0 0\else1\fi}{\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep}% |
| 5060 |
\forest@nodewalk@back@updatehistory |
| 5061 |
}, |
| 5062 |
nodewalk/walk back/.default=1, |
| 5063 |
define long step={jump back}{n args=1,@bare}{% |
| 5064 |
\forestmathtruncatemacro\forest@temp@n{(#1)+\ifnum\forest@cn=0 0\else1\fi}% |
| 5065 |
\forest@nodewalk@walklist{\forest@nodewalk@historyforward}{\forest@nodewalk@historyback}{\forest@temp@n-1}{\forest@temp@n}{\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep}% |
| 5066 |
\forest@nodewalk@back@updatehistory |
| 5067 |
}, |
| 5068 |
nodewalk/jump back/.default=1, |
| 5069 |
define long step={back}{n args=1,@bare}{% |
| 5070 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 5071 |
\forest@nodewalk@walklist{\forest@nodewalk@historyforward}{\forest@nodewalk@historyback}{\ifnum\forest@cn=0 0\else1\fi}{\forest@temp@n+\ifnum\forest@cn=0 0\else1\fi}{\let\forest@cn\forest@nodewalk@cn\forest@saveandrestoreifcs{forest@nodewalk@fake}{\forest@nodewalk@faketrue\forest@nodewalk@makestep}}% |
| 5072 |
\forest@nodewalk@back@updatehistory |
| 5073 |
}, |
| 5074 |
nodewalk/back/.default=1, |
| 5075 |
define long step={walk forward}{n args=1,@bare}{% |
| 5076 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 5077 |
\forest@nodewalk@walklist{\forest@nodewalk@historyback}{\forest@nodewalk@historyforward}{0}{\forest@temp@n}{\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep}% |
| 5078 |
\forest@nodewalk@forward@updatehistory |
| 5079 |
}, |
| 5080 |
nodewalk/walk forward/.default=1, |
| 5081 |
define long step={jump forward}{n args=1,@bare}{% |
| 5082 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 5083 |
\forest@nodewalk@walklist{\forest@nodewalk@historyback}{\forest@nodewalk@historyforward}{\forest@temp@n-1}{\forest@temp@n}{\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep}% |
| 5084 |
\forest@nodewalk@forward@updatehistory |
| 5085 |
}, |
| 5086 |
nodewalk/jump forward/.default=1, |
| 5087 |
define long step={forward}{n args=1,@bare}{% |
| 5088 |
\forestmathtruncatemacro\forest@temp@n{#1}% |
| 5089 |
\forest@nodewalk@walklist{\forest@nodewalk@historyback}{\forest@nodewalk@historyforward}{0}{\forest@temp@n}{\let\forest@cn\forest@nodewalk@cn\forest@saveandrestoreifcs{forest@nodewalk@fake}{\forest@nodewalk@faketrue\forest@nodewalk@makestep}}% |
| 5090 |
\forest@nodewalk@forward@updatehistory |
| 5091 |
}, |
| 5092 |
nodewalk/forward/.default=1, |
| 5093 |
define long step={last valid'}{@bare}{% |
| 5094 |
\ifnum\forest@cn=0 |
| 5095 |
\forest@nodewalk@tolastvalid |
| 5096 |
\forest@nodewalk@makestep |
| 5097 |
\fi |
| 5098 |
}, |
| 5099 |
define long step={last valid}{@bare}{% |
| 5100 |
\forest@nodewalk@tolastvalid |
| 5101 |
}, |
| 5102 |
define long step={reverse}{n args=1,@bare,make for}{% |
| 5103 |
\forest@nodewalk{#1,TeX={% |
| 5104 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5105 |
\global\let\forest@global@tempn\forest@nodewalk@n |
| 5106 |
}}{}% |
| 5107 |
\forest@nodewalk@walklist{}{\forest@global@temp}{0}{\forest@global@tempn}{\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep}% |
| 5108 |
}, |
| 5109 |
define long step={walk and reverse}{n args=1,@bare,make for}{% |
| 5110 |
\edef\forest@marshal{% |
| 5111 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5112 |
\noexpand\forest@nodewalk@walklist{}{\noexpand\forest@nodewalk@historyback}{0}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}{\let\noexpand\forest@cn\noexpand\forest@nodewalk@cn\noexpand\forest@nodewalk@makestep}% |
| 5113 |
}\forest@marshal |
| 5114 |
}, |
| 5115 |
define long step={sort}{n args=1,@bare,make for}{% |
| 5116 |
\forest@nodewalk{#1,TeX={% |
| 5117 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5118 |
\global\let\forest@global@tempn\forest@nodewalk@n |
| 5119 |
}}{}% |
| 5120 |
\forest@nodewalk@sortlist{\forest@global@temp}{\forest@global@tempn}\forest@sort@ascending |
| 5121 |
}, |
| 5122 |
define long step={sort'}{n args=1,@bare,make for}{% |
| 5123 |
\forest@nodewalk{#1,TeX={% |
| 5124 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5125 |
\global\let\forest@global@tempn\forest@nodewalk@n |
| 5126 |
}}{}% |
| 5127 |
\forest@nodewalk@sortlist{\forest@global@temp}{\forest@global@tempn}\forest@sort@descending |
| 5128 |
}, |
| 5129 |
define long step={walk and sort}{n args=1,@bare,make for}{% walk as given, then walk sorted |
| 5130 |
\edef\forest@marshal{% |
| 5131 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5132 |
\noexpand\forest@nodewalk@sortlist{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}\noexpand\forest@sort@ascending |
| 5133 |
}\forest@marshal |
| 5134 |
}, |
| 5135 |
define long step={walk and sort'}{n args=1,@bare,make for}{% |
| 5136 |
\edef\forest@marshal{% |
| 5137 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5138 |
\noexpand\forest@nodewalk@sortlist{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}\noexpand\forest@sort@descending |
| 5139 |
}\forest@marshal |
| 5140 |
}, |
| 5141 |
declare keylist register=sort by, |
| 5142 |
copy command key={/forest/sort by'}{/forest/sort by}, |
| 5143 |
sort by={}, |
| 5144 |
define long step={save}{n args=2,@bare,make for}{% #1 = name, #2 = nodewalk |
| 5145 |
\forest@forthis{% |
| 5146 |
\forest@nodewalk{#2,TeX={% |
| 5147 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5148 |
\global\let\forest@global@tempn\forest@nodewalk@n |
| 5149 |
}}{}% |
| 5150 |
}% |
| 5151 |
\forest@nodewalk@walklist{}{\forest@global@temp}{0}{\forest@global@tempn}\relax |
| 5152 |
\csedef{forest@nodewalk@saved@#1}{\forest@nodewalk@walklist@walked}% |
| 5153 |
}, |
| 5154 |
define long step={walk and save}{n args=2,@bare,make for}{% #1 = name, #2 = nodewalk |
| 5155 |
\edef\forest@marshal{% |
| 5156 |
\noexpand\pgfkeysalso{\unexpanded{#2}}% |
| 5157 |
\noexpand\forest@nodewalk@walklist{}{\noexpand\forest@nodewalk@historyback}{0}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}\relax |
| 5158 |
}\forest@marshal |
| 5159 |
\csedef{forest@nodewalk@saved@#1}{\forest@nodewalk@walklist@walked}% |
| 5160 |
}, |
| 5161 |
define long step={save append}{style,n args=2,@bare,make for}{% #1 = nodewalk name, #2 = nodewalk |
| 5162 |
save@append@prepend={#1}{#2}{save}{\cseappto}}, |
| 5163 |
define long step={save prepend}{style,n args=2,@bare,make for}{% #1 = nodewalk name, #2 = nodewalk |
| 5164 |
save@append@prepend={#1}{#2}{save}{\csepreto}}, |
| 5165 |
define long step={walk and save append}{style,n args=2,@bare,make for}{% #1 = nodewalk name, #2 = nodewalk |
| 5166 |
save@append@prepend={#1}{#2}{walk and save}{\cseappto}}, |
| 5167 |
define long step={walk and save prepend}{style,n args=2,@bare,make for}{% #1 = nodewalk name, #2 = nodewalk |
| 5168 |
save@append@prepend={#1}{#2}{walk and save}{\csepreto}}, |
| 5169 |
nodewalk/save@append@prepend/.code n args=4{% |
| 5170 |
% #1 = nodewalk name, #2 = nodewalk |
| 5171 |
% #3 = "(walk and) save" #4 = \cseappto/\csepreto |
| 5172 |
\pgfkeysalso{#3={@temp}{#2}}% |
| 5173 |
\letcs\forest@temp{forest@nodewalk@saved@@temp}% |
| 5174 |
#4{forest@nodewalk@saved@#1}{\expandonce{\forest@temp}}% |
| 5175 |
}, |
| 5176 |
nodewalk/save history/.code 2 args={% #1 = back, forward |
| 5177 |
\csedef{forest@nodewalk@saved@#1}{\forest@nodewalk@historyback}% |
| 5178 |
\csedef{forest@nodewalk@saved@#2}{\forest@nodewalk@historyforward}% |
| 5179 |
}, |
| 5180 |
define long step={load}{n args=1,@bare,make for}{% |
| 5181 |
\forest@nodewalk@walklist{}{\csuse{forest@nodewalk@saved@#1}0,}{0}{-1}{\ifnum\forest@nodewalk@cn=0 \else\let\forest@cn\forest@nodewalk@cn\forest@nodewalk@makestep\fi}% |
| 5182 |
}, |
| 5183 |
if in saved nodewalk/.code n args=4{% is node #1 in nodewalk #2; yes: #3, no: #4 |
| 5184 |
\forest@forthis{% |
| 5185 |
\forest@go{#1}% |
| 5186 |
\edef\forest@marshal{% |
| 5187 |
\noexpand\pgfutil@in@{,\forest@cn,}{,\csuse{forest@nodewalk@saved@#2},}% |
| 5188 |
}\forest@marshal |
| 5189 |
}% |
| 5190 |
\ifpgfutil@in@ |
| 5191 |
\@escapeif{\pgfkeysalso{#3}}% |
| 5192 |
\else |
| 5193 |
\@escapeif{\pgfkeysalso{#4}}% |
| 5194 |
\fi |
| 5195 |
}, |
| 5196 |
where in saved nodewalk/.style n args=4{ |
| 5197 |
for tree={if in saved nodewalk={#1}{#2}{#3}{#4}} |
| 5198 |
}, |
| 5199 |
nodewalk/options/.code={\forestset{#1}}, |
| 5200 |
nodewalk/TeX/.code={#1}, |
| 5201 |
nodewalk/TeX'/.code={\appto\forest@externalize@loadimages{#1}#1}, |
| 5202 |
nodewalk/TeX''/.code={\appto\forest@externalize@loadimages{#1}}, |
| 5203 |
nodewalk/typeout/.style={TeX={\typeout{#1}}}, |
| 5204 |
% repeat is taken later from /forest/repeat |
| 5205 |
} |
| 5206 |
\def\forest@nodewalk@walklist#1#2#3#4#5{% |
| 5207 |
% #1 = list of preceding, #2 = list to walk |
| 5208 |
% #3 = from, #4 = to |
| 5209 |
% #5 = every step code |
| 5210 |
\let\forest@nodewalk@cn\forest@cn |
| 5211 |
\edef\forest@marshal{% |
| 5212 |
\noexpand\forest@nodewalk@walklist@{#1}{#2}{\number\numexpr#3}{\number\numexpr#4}{1}{0}{\unexpanded{#5}}% |
| 5213 |
}\forest@marshal |
| 5214 |
} |
| 5215 |
\def\forest@nodewalk@walklist@#1#2#3#4#5#6#7{% |
| 5216 |
% #1 = list of walked, #2 = list to walk |
| 5217 |
% #3 = from, #4 = to |
| 5218 |
% #5 = current step n, #6 = steps made |
| 5219 |
% #7 = every step code |
| 5220 |
\def\forest@nodewalk@walklist@walked{#1}% |
| 5221 |
\def\forest@nodewalk@walklist@rest{#2}% |
| 5222 |
\edef\forest@nodewalk@walklist@stepsmade{#6}% |
| 5223 |
\ifnum#4<0 |
| 5224 |
\forest@temptrue |
| 5225 |
\else |
| 5226 |
\ifnum#5>#4\relax |
| 5227 |
\forest@tempfalse |
| 5228 |
\else |
| 5229 |
\forest@temptrue |
| 5230 |
\fi |
| 5231 |
\fi |
| 5232 |
\ifforest@temp |
| 5233 |
\edef\forest@nodewalk@cn{\forest@csvlist@getfirst@{#2}}% |
| 5234 |
\ifnum\forest@nodewalk@cn=0 |
| 5235 |
#7% |
| 5236 |
\else |
| 5237 |
\ifnum#5>#3\relax |
| 5238 |
#7% |
| 5239 |
\edef\forest@nodewalk@walklist@stepsmade{\number\numexpr#6+1}% |
| 5240 |
\fi |
| 5241 |
\forest@csvlist@getfirstrest@{#2}\forest@nodewalk@cn\forest@nodewalk@walklist@rest |
| 5242 |
\@escapeifif{% |
| 5243 |
\edef\forest@marshal{% |
| 5244 |
\noexpand\forest@nodewalk@walklist@ |
| 5245 |
{\forest@nodewalk@cn,#1}{\forest@nodewalk@walklist@rest}{#3}{#4}{\number\numexpr#5+1}{\forest@nodewalk@walklist@stepsmade}{\unexpanded{#7}}% |
| 5246 |
}\forest@marshal |
| 5247 |
}% |
| 5248 |
\fi |
| 5249 |
\fi |
| 5250 |
} |
| 5251 |
|
| 5252 |
\def\forest@nodewalk@back@updatehistory{% |
| 5253 |
\ifnum\forest@cn=0 |
| 5254 |
\let\forest@nodewalk@historyback\forest@nodewalk@walklist@rest |
| 5255 |
\let\forest@nodewalk@historyforward\forest@nodewalk@walklist@walked |
| 5256 |
\else |
| 5257 |
\expandafter\forest@csvlist@getfirstrest@\expandafter{\forest@nodewalk@walklist@walked}\forest@temp\forest@nodewalk@historyforward |
| 5258 |
\edef\forest@nodewalk@historyback{\forest@temp,\forest@nodewalk@walklist@rest}% |
| 5259 |
\fi |
| 5260 |
} |
| 5261 |
\def\forest@nodewalk@forward@updatehistory{% |
| 5262 |
\let\forest@nodewalk@historyforward\forest@nodewalk@walklist@rest |
| 5263 |
\let\forest@nodewalk@historyback\forest@nodewalk@walklist@walked |
| 5264 |
} |
| 5265 |
\def\forest@go#1{% |
| 5266 |
\forest@configured@nodewalk{independent}{inherited}{inherited}{#1}{}% |
| 5267 |
} |
| 5268 |
\def\forest@csvlist@getfirst@#1{% assuming that the list is nonempty and finishes with a comma |
| 5269 |
\forest@csvlist@getfirst@@#1\forest@csvlist@getfirst@@} |
| 5270 |
\def\forest@csvlist@getfirst@@#1,#2\forest@csvlist@getfirst@@{#1} |
| 5271 |
\def\forest@csvlist@getrest@#1{% assuming that the list is nonempty and finishes with a comma |
| 5272 |
\forest@csvlist@getrest@@#1\forest@csvlist@getrest@@} |
| 5273 |
\def\forest@csvlist@getrest@@#1,#2\forest@csvlist@getrest@@{#2} |
| 5274 |
\def\forest@csvlist@getfirstrest@#1#2#3{% assuming that the list is nonempty and finishes with a comma |
| 5275 |
% #1 = list, #2 = cs receiving first, #3 = cs receiving rest |
| 5276 |
\forest@csvlist@getfirstrest@@#1\forest@csvlist@getfirstrest@@{#2}{#3}} |
| 5277 |
\def\forest@csvlist@getfirstrest@@#1,#2\forest@csvlist@getfirstrest@@#3#4{% |
| 5278 |
\def#3{#1}% |
| 5279 |
\def#4{#2}% |
| 5280 |
} |
| 5281 |
\def\forest@nodewalk@stripfakesteps#1{% |
| 5282 |
% go to the last valid node if the walk contained any nodes, otherwise restore the current node |
| 5283 |
\edef\forest@marshal{% |
| 5284 |
\unexpanded{#1}% |
| 5285 |
\noexpand\ifnum\noexpand\forest@nodewalk@n=\forest@nodewalk@n\relax |
| 5286 |
\def\noexpand\forest@cn{\forest@cn}% |
| 5287 |
\noexpand\else |
| 5288 |
\unexpanded{% |
| 5289 |
\edef\forest@cn{% |
| 5290 |
\expandafter\forest@csvlist@getfirst@\expandafter{\forest@nodewalk@historyback}% |
| 5291 |
}% |
| 5292 |
}% |
| 5293 |
\noexpand\fi |
| 5294 |
}\forest@marshal |
| 5295 |
} |
| 5296 |
\def\forest@nodewalk@tolastvalid{% |
| 5297 |
\ifnum\forest@cn=0 |
| 5298 |
\edef\forest@cn{\expandafter\forest@csvlist@getfirst@\expandafter{\forest@nodewalk@historyback}}% |
| 5299 |
\ifnum\forest@cn=0 |
| 5300 |
\let\forest@cn\forest@nodewalk@origin |
| 5301 |
\fi |
| 5302 |
\fi |
| 5303 |
} |
| 5304 |
\def\forest@nodewalk@sortlist#1#2#3{%#1=list,#2=to,#3=asc/desc |
| 5305 |
\edef\forest@nodewalksort@list{#1}% |
| 5306 |
\expandafter\forest@nodewalk@sortlist@\expandafter{\number\numexpr#2}{#3}% |
| 5307 |
} |
| 5308 |
\def\forest@nodewalk@sortlist@#1#2{%#1=to,#2=asc/desc |
| 5309 |
\safeloop |
| 5310 |
\unless\ifnum\safeloopn>#1\relax |
| 5311 |
\expandafter\forest@csvlist@getfirstrest@\expandafter{\forest@nodewalksort@list}\forest@nodewalksort@cn\forest@nodewalksort@list |
| 5312 |
\csedef{forest@nodesort@\safeloopn}{\forest@nodewalksort@cn}% |
| 5313 |
\saferepeat |
| 5314 |
\forestrget{sort by}\forest@nodesort@sortkey |
| 5315 |
\forest@sort\forest@nodesort@cmpnodes\forest@nodesort@let#2{1}{#1}% |
| 5316 |
\def\forest@nodewalksort@sorted{}% |
| 5317 |
\safeloop |
| 5318 |
\unless\ifnum\safeloopn>#1\relax |
| 5319 |
\edef\forest@cn{\csname forest@nodesort@\safeloopn\endcsname}% |
| 5320 |
\forest@nodewalk@makestep |
| 5321 |
\saferepeat |
| 5322 |
} |
| 5323 |
\forestset{ |
| 5324 |
define long step={min}{n args=1,@bare,make for}{% the first min in the argument nodewalk |
| 5325 |
\forest@nodewalk{#1,TeX={% |
| 5326 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5327 |
}}{}% |
| 5328 |
\forest@nodewalk@minmax{\forest@global@temp}{-1}{<}{\forest@nodewalk@minmax@node,}% |
| 5329 |
}, |
| 5330 |
define long step={mins}{n args=1,@bare,make for}{% all mins in the argument nodewalk |
| 5331 |
\forest@nodewalk{#1,TeX={% |
| 5332 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5333 |
}}{}% |
| 5334 |
\forest@nodewalk@minmax{\forest@global@temp}{-1}{<}{\forest@nodewalk@minmax@nodes}% |
| 5335 |
}, |
| 5336 |
define long step={walk and min}{n args=1,@bare}{% |
| 5337 |
\edef\forest@marshal{% |
| 5338 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5339 |
\noexpand\forest@nodewalk@minmax{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}{<}{\noexpand\forest@nodewalk@minmax@node,}%% |
| 5340 |
}\forest@marshal |
| 5341 |
}, |
| 5342 |
define long step={walk and mins}{n args=1,@bare}{% |
| 5343 |
\edef\forest@marshal{% |
| 5344 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5345 |
\noexpand\forest@nodewalk@minmax{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}{<}{\noexpand\forest@nodewalk@minmax@nodes}%% |
| 5346 |
}\forest@marshal |
| 5347 |
}, |
| 5348 |
define long step={min in nodewalk}{@bare}{% find the first min in the preceding nodewalk, step to it |
| 5349 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{<}{\forest@nodewalk@minmax@node,}% |
| 5350 |
}, |
| 5351 |
define long step={mins in nodewalk}{@bare}{% find mins in the preceding nodewalk, step to mins |
| 5352 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{<}{\forest@nodewalk@minmax@nodes}% |
| 5353 |
}, |
| 5354 |
define long step={min in nodewalk'}{@bare}{% find the first min in the preceding nodewalk, step to min in history |
| 5355 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{<}{}% |
| 5356 |
}, |
| 5357 |
% |
| 5358 |
define long step={max}{n args=1,@bare,make for}{% the first max in the argument nodewalk |
| 5359 |
\forest@nodewalk{#1,TeX={% |
| 5360 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5361 |
}}{}% |
| 5362 |
\forest@nodewalk@minmax{\forest@global@temp}{-1}{>}{\forest@nodewalk@minmax@node,}% |
| 5363 |
}, |
| 5364 |
define long step={maxs}{n args=1,@bare,make for}{% all maxs in the argument nodewalk |
| 5365 |
\forest@nodewalk{#1,TeX={% |
| 5366 |
\global\let\forest@global@temp\forest@nodewalk@historyback |
| 5367 |
}}{}% |
| 5368 |
\forest@nodewalk@minmax{\forest@global@temp}{-1}{>}{\forest@nodewalk@minmax@nodes}% |
| 5369 |
}, |
| 5370 |
define long step={walk and max}{n args=1,@bare}{% |
| 5371 |
\edef\forest@marshal{% |
| 5372 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5373 |
\noexpand\forest@nodewalk@minmax{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}{>}{\noexpand\forest@nodewalk@minmax@node,}%% |
| 5374 |
}\forest@marshal |
| 5375 |
}, |
| 5376 |
define long step={walk and maxs}{n args=1,@bare}{% |
| 5377 |
\edef\forest@marshal{% |
| 5378 |
\noexpand\pgfkeysalso{\unexpanded{#1}}% |
| 5379 |
\noexpand\forest@nodewalk@minmax{\noexpand\forest@nodewalk@historyback}{\noexpand\forest@nodewalk@n-\forest@nodewalk@n}{>}{\noexpand\forest@nodewalk@minmax@nodes}%% |
| 5380 |
}\forest@marshal |
| 5381 |
}, |
| 5382 |
define long step={max in nodewalk}{@bare}{% find the first max in the preceding nodewalk, step to it |
| 5383 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{>}{\forest@nodewalk@minmax@node,}% |
| 5384 |
}, |
| 5385 |
define long step={maxs in nodewalk}{@bare}{% find maxs in the preceding nodewalk, step to maxs |
| 5386 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{>}{\forest@nodewalk@minmax@nodes}% |
| 5387 |
}, |
| 5388 |
define long step={max in nodewalk'}{@bare}{% find the first max in the preceding nodewalk, step to max in history |
| 5389 |
\forest@nodewalk@minmax{\forest@nodewalk@historyback}{-1}{>}{}% |
| 5390 |
}, |
| 5391 |
} |
| 5392 |
|
| 5393 |
\def\forest@nodewalk@minmax#1#2#3#4{% |
| 5394 |
% #1 = list of nodes |
| 5395 |
% #2 = max index in list (start with 1) |
| 5396 |
% #3 = min/max = ascending/descending = </> |
| 5397 |
% #4 = how many results? 1 = {\forest@nodewalk@minmax@node,}, all={\forest@nodewalk@minmax@nodes}, walk in history={} |
| 5398 |
\forestrget{sort by}\forest@nodesort@sortkey |
| 5399 |
\edef\forest@nodewalk@minmax@N{\number\numexpr#2}% |
| 5400 |
\edef\forest@nodewalk@minmax@n{}% |
| 5401 |
\edef\forest@nodewalk@minmax@list{#1}% |
| 5402 |
\def\forest@nodewalk@minmax@nodes{}% |
| 5403 |
\def\forest@nodewalk@minmax@node{}% |
| 5404 |
\ifdefempty{\forest@nodewalk@minmax@list}{% |
| 5405 |
}{% |
| 5406 |
\safeloop |
| 5407 |
\expandafter\forest@csvlist@getfirstrest@\expandafter{\forest@nodewalk@minmax@list}\forest@nodewalk@minmax@cn\forest@nodewalk@minmax@list |
| 5408 |
\ifnum\forest@nodewalk@minmax@cn=0 \else |
| 5409 |
\ifdefempty{\forest@nodewalk@minmax@node}{% |
| 5410 |
\edef\forest@nodewalk@minmax@node{\forest@nodewalk@minmax@cn}% |
| 5411 |
\edef\forest@nodewalk@minmax@nodes{\forest@nodewalk@minmax@cn,}% |
| 5412 |
\edef\forest@nodewalk@minmax@n{\safeloopn}% |
| 5413 |
}{% |
| 5414 |
\csedef{forest@nodesort@1}{\forest@nodewalk@minmax@node}% |
| 5415 |
\csedef{forest@nodesort@2}{\forest@nodewalk@minmax@cn}% |
| 5416 |
\forest@nodesort@cmpnodes{2}{1}% |
| 5417 |
\if=\forest@sort@cmp@result |
| 5418 |
\edef\forest@nodewalk@minmax@node{\forest@nodewalk@minmax@cn}% |
| 5419 |
\epreto\forest@nodewalk@minmax@nodes{\forest@nodewalk@minmax@cn,}% |
| 5420 |
\edef\forest@nodewalk@minmax@n{\safeloopn}% |
| 5421 |
\else |
| 5422 |
\if#3\forest@sort@cmp@result |
| 5423 |
\edef\forest@nodewalk@minmax@node{\forest@nodewalk@minmax@cn}% |
| 5424 |
\edef\forest@nodewalk@minmax@nodes{\forest@nodewalk@minmax@cn,}% |
| 5425 |
\edef\forest@nodewalk@minmax@n{\safeloopn}% |
| 5426 |
\fi |
| 5427 |
\fi |
| 5428 |
}% |
| 5429 |
\fi |
| 5430 |
\ifdefempty{\forest@nodewalk@minmax@list}{\forest@tempfalse}{\forest@temptrue}% |
| 5431 |
\ifnum\safeloopn=\forest@nodewalk@minmax@N\relax\forest@temptrue\fi |
| 5432 |
\ifforest@temp |
| 5433 |
\saferepeat |
| 5434 |
\edef\forest@nodewalk@minmax@list{#4}% |
| 5435 |
\ifdefempty\forest@nodewalk@minmax@list{% |
| 5436 |
\forestset{nodewalk/jump back=\forest@nodewalk@minmax@n-1}% CHECK |
| 5437 |
}{% |
| 5438 |
\safeloop |
| 5439 |
\expandafter\forest@csvlist@getfirstrest@\expandafter{\forest@nodewalk@minmax@list}\forest@cn\forest@nodewalk@minmax@list |
| 5440 |
\forest@nodewalk@makestep |
| 5441 |
\ifdefempty{\forest@nodewalk@minmax@list}{\forest@tempfalse}{\forest@temptrue}% |
| 5442 |
\ifforest@temp |
| 5443 |
\saferepeat |
| 5444 |
}% |
| 5445 |
}% |
| 5446 |
} |
| 5447 |
\newtoks\forest@nodewalk@shortsteps@resolution |
| 5448 |
\newif\ifforest@nodewalk@areshortsteps |
| 5449 |
\pgfqkeys{/forest/nodewalk}{ |
| 5450 |
.unknown/.code={% |
| 5451 |
\forest@nodewalk@areshortstepsfalse |
| 5452 |
\ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text % no value, so possibly short steps |
| 5453 |
\forest@nodewalk@shortsteps@resolution{}% |
| 5454 |
\forest@nodewalk@areshortstepstrue |
| 5455 |
\expandafter\forest@nodewalk@shortsteps\pgfkeyscurrentname==========,% "=" and "," cannot be short steps, so they are good as delimiters |
| 5456 |
\fi |
| 5457 |
\ifforest@nodewalk@areshortsteps |
| 5458 |
\@escapeif{\expandafter\pgfkeysalso\expandafter{\the\forest@nodewalk@shortsteps@resolution}}% |
| 5459 |
\else |
| 5460 |
\@escapeif{\pgfkeysalso{/forest/\pgfkeyscurrentname={#1}}}% |
| 5461 |
\fi |
| 5462 |
}, |
| 5463 |
} |
| 5464 |
\def\forest@nodewalk@shortsteps{% |
| 5465 |
\futurelet\forest@nodewalk@nexttoken\forest@nodewalk@shortsteps@ |
| 5466 |
} |
| 5467 |
\def\forest@nodewalk@shortsteps@{% |
| 5468 |
\ifx\forest@nodewalk@nexttoken=% |
| 5469 |
\let\forest@nodewalk@nextop\forest@nodewalk@shortsteps@end |
| 5470 |
\else |
| 5471 |
\ifx\forest@nodewalk@nexttoken\bgroup |
| 5472 |
\letcs\forest@nodewalk@nextop{forest@shortstep@group}% |
| 5473 |
\else |
| 5474 |
\let\forest@nodewalk@nextop\forest@nodewalk@shortsteps@@ |
| 5475 |
\fi |
| 5476 |
\fi |
| 5477 |
\forest@nodewalk@nextop |
| 5478 |
} |
| 5479 |
\def\forest@nodewalk@shortsteps@@#1{% |
| 5480 |
\ifcsdef{forest@shortstep@#1}{% |
| 5481 |
\csname forest@shortstep@#1\endcsname |
| 5482 |
}{% |
| 5483 |
\forest@nodewalk@areshortstepsfalse |
| 5484 |
\forest@nodewalk@shortsteps@end |
| 5485 |
}% |
| 5486 |
} |
| 5487 |
\csdef{forest@nodewalk@defshortstep@0@args}#1#2{% |
| 5488 |
\csdef{forest@shortstep@#1}{% |
| 5489 |
\apptotoks\forest@nodewalk@shortsteps@resolution{,#2}% |
| 5490 |
\forest@nodewalk@shortsteps}} |
| 5491 |
\csdef{forest@nodewalk@defshortstep@1@args}#1#2{% |
| 5492 |
\csdef{forest@shortstep@#1}##1{% |
| 5493 |
\edef\forest@marshal####1{#2}% |
| 5494 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}}% |
| 5495 |
\forest@nodewalk@shortsteps}} |
| 5496 |
\csdef{forest@nodewalk@defshortstep@2@args}#1#2{% |
| 5497 |
\csdef{forest@shortstep@#1}##1##2{% |
| 5498 |
\edef\forest@marshal####1####2{#2}% |
| 5499 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}}% |
| 5500 |
\forest@nodewalk@shortsteps}} |
| 5501 |
\csdef{forest@nodewalk@defshortstep@3@args}#1#2{% |
| 5502 |
\csdef{forest@shortstep@#1}##1##2##3{% |
| 5503 |
\edef\forest@marshal####1####2####3{#2}% |
| 5504 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}}% |
| 5505 |
\forest@nodewalk@shortsteps}} |
| 5506 |
\csdef{forest@nodewalk@defshortstep@4@args}#1#2{% |
| 5507 |
\csdef{forest@shortstep@#1}##1##2##3##4{% |
| 5508 |
\edef\forest@marshal####1####2####3####4{#2}% |
| 5509 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}}% |
| 5510 |
\forest@nodewalk@shortsteps}} |
| 5511 |
\csdef{forest@nodewalk@defshortstep@5@args}#1#2{% |
| 5512 |
\csdef{forest@shortstep@#1}##1##2##3##4##5{% |
| 5513 |
\edef\forest@marshal####1####2####3####4####5{#2}% |
| 5514 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}{##5}}% |
| 5515 |
\forest@nodewalk@shortsteps}} |
| 5516 |
\csdef{forest@nodewalk@defshortstep@6@args}#1#2{% |
| 5517 |
\csdef{forest@shortstep@#1}##1##2##3##4##5##6{% |
| 5518 |
\edef\forest@marshal####1####2####3####4####5####6{#2}% |
| 5519 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}{##5}{##6}}% |
| 5520 |
\forest@nodewalk@shortsteps}} |
| 5521 |
\csdef{forest@nodewalk@defshortstep@7@args}#1#2{% |
| 5522 |
\csdef{forest@shortstep@#1}##1##2##3##4##5##6##7{% |
| 5523 |
\edef\forest@marshal####1####2####3####4####5####6####7{#2}% |
| 5524 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% |
| 5525 |
\forest@nodewalk@shortsteps}} |
| 5526 |
\csdef{forest@nodewalk@defshortstep@8@args}#1#2{% |
| 5527 |
\csdef{forest@shortstep@#1}##1##2##3##4##5##6##7##8{% |
| 5528 |
\edef\forest@marshal####1####2####3####4####5####6####7####8{#2}% |
| 5529 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}% |
| 5530 |
\forest@nodewalk@shortsteps}} |
| 5531 |
\csdef{forest@nodewalk@defshortstep@9@args}#1#2{% |
| 5532 |
\csdef{forest@shortstep@#1}##1##2##3##4##5##6##7##8##9{% |
| 5533 |
\edef\forest@marshal####1####2####3####4####5####6####7####8####9{#2}% |
| 5534 |
\eapptotoks\forest@nodewalk@shortsteps@resolution{,\forest@marshal{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}% |
| 5535 |
\forest@nodewalk@shortsteps}} |
| 5536 |
\forestset{ |
| 5537 |
define short step/.code n args=3{% #1 = short step, #2 = n args, #3 = long step |
| 5538 |
\csname forest@nodewalk@defshortstep@#2@args\endcsname{#1}{#3}% |
| 5539 |
}, |
| 5540 |
} |
| 5541 |
\def\forest@nodewalk@shortsteps@end#1,{} |
| 5542 |
\forestset{ |
| 5543 |
define short step={group}{1}{group={#1}}, % {braces} are special |
| 5544 |
define short step={p}{0}{previous}, |
| 5545 |
define short step={n}{0}{next}, |
| 5546 |
define short step={u}{0}{parent}, |
| 5547 |
define short step={s}{0}{sibling}, |
| 5548 |
define short step={c}{0}{current}, |
| 5549 |
define short step={o}{0}{origin}, |
| 5550 |
define short step={r}{0}{root}, |
| 5551 |
define short step={R}{0}{root'}, |
| 5552 |
define short step={P}{0}{previous leaf}, |
| 5553 |
define short step={N}{0}{next leaf}, |
| 5554 |
define short step={F}{0}{first leaf}, |
| 5555 |
define short step={L}{0}{last leaf}, |
| 5556 |
define short step={>}{0}{next on tier}, |
| 5557 |
define short step={<}{0}{previous on tier}, |
| 5558 |
define short step={1}{0}{n=1}, |
| 5559 |
define short step={2}{0}{n=2}, |
| 5560 |
define short step={3}{0}{n=3}, |
| 5561 |
define short step={4}{0}{n=4}, |
| 5562 |
define short step={5}{0}{n=5}, |
| 5563 |
define short step={6}{0}{n=6}, |
| 5564 |
define short step={7}{0}{n=7}, |
| 5565 |
define short step={8}{0}{n=8}, |
| 5566 |
define short step={9}{0}{n=9}, |
| 5567 |
define short step={l}{0}{last}, |
| 5568 |
define short step={b}{0}{back}, |
| 5569 |
define short step={f}{0}{forward}, |
| 5570 |
define short step={v}{0}{last valid}, |
| 5571 |
define short step={*}{2}{repeat={#1}{#2}}, |
| 5572 |
for 1/.style={for nodewalk={n=1}{#1}}, |
| 5573 |
for 2/.style={for nodewalk={n=2}{#1}}, |
| 5574 |
for 3/.style={for nodewalk={n=3}{#1}}, |
| 5575 |
for 4/.style={for nodewalk={n=4}{#1}}, |
| 5576 |
for 5/.style={for nodewalk={n=5}{#1}}, |
| 5577 |
for 6/.style={for nodewalk={n=6}{#1}}, |
| 5578 |
for 7/.style={for nodewalk={n=7}{#1}}, |
| 5579 |
for 8/.style={for nodewalk={n=8}{#1}}, |
| 5580 |
for 9/.style={for nodewalk={n=9}{#1}}, |
| 5581 |
for -1/.style={for nodewalk={n'=1}{#1}}, |
| 5582 |
for -2/.style={for nodewalk={n'=2}{#1}}, |
| 5583 |
for -3/.style={for nodewalk={n'=3}{#1}}, |
| 5584 |
for -4/.style={for nodewalk={n'=4}{#1}}, |
| 5585 |
for -5/.style={for nodewalk={n'=5}{#1}}, |
| 5586 |
for -6/.style={for nodewalk={n'=6}{#1}}, |
| 5587 |
for -7/.style={for nodewalk={n'=7}{#1}}, |
| 5588 |
for -8/.style={for nodewalk={n'=8}{#1}}, |
| 5589 |
for -9/.style={for nodewalk={n'=9}{#1}}, |
| 5590 |
} |
| 5591 |
\forestset{ |
| 5592 |
define long step={tree}{}{\forest@node@foreach{\forest@nodewalk@makestep}}, |
| 5593 |
define long step={tree reversed}{}{\forest@node@foreach@reversed{\forest@nodewalk@makestep}}, |
| 5594 |
define long step={tree children-first}{}{\forest@node@foreach@childrenfirst{\forest@nodewalk@makestep}}, |
| 5595 |
define long step={tree children-first reversed}{}{\forest@node@foreach@childrenfirst@reversed{\forest@nodewalk@makestep}}, |
| 5596 |
define long step={tree breadth-first}{}{\forest@node@foreach@breadthfirst{-1}{\forest@nodewalk@makestep}}, |
| 5597 |
define long step={tree breadth-first reversed}{}{\forest@node@foreach@breadthfirst@reversed{-1}{\forest@nodewalk@makestep}}, |
| 5598 |
define long step={descendants}{}{\forest@node@foreachdescendant{\forest@nodewalk@makestep}}, |
| 5599 |
define long step={descendants reversed}{}{\forest@node@foreachdescendant@reversed{\forest@nodewalk@makestep}}, |
| 5600 |
define long step={descendants children-first}{}{\forest@node@foreachdescendant@childrenfirst{\forest@nodewalk@makestep}}, |
| 5601 |
define long step={descendants children-first reversed}{}{\forest@node@foreachdescendant@childrenfirst@reversed{\forest@nodewalk@makestep}}, |
| 5602 |
define long step={descendants breadth-first}{}{\forest@node@foreach@breadthfirst{0}{\forest@nodewalk@makestep}}, |
| 5603 |
define long step={descendants breadth-first reversed}{}{\forest@node@foreach@breadthfirst@reversed{0}{\forest@nodewalk@makestep}}, |
| 5604 |
define long step={level}{n args=1}{% |
| 5605 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 5606 |
\edef\forest@marshal{% |
| 5607 |
\noexpand\forest@node@foreach@breadthfirst |
| 5608 |
{\forest@temp}% |
| 5609 |
{\noexpand\ifnum\noexpand\forestove{level}=\forest@temp\relax\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5610 |
}\forest@marshal |
| 5611 |
}, |
| 5612 |
define long step={level>}{n args=1}{% |
| 5613 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 5614 |
\edef\forest@marshal{% |
| 5615 |
\noexpand\forest@node@foreach@breadthfirst |
| 5616 |
{-1}% |
| 5617 |
{\noexpand\ifnum\noexpand\forestove{level}<\forest@temp\relax\noexpand\else\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5618 |
}\forest@marshal |
| 5619 |
}, |
| 5620 |
define long step={level<}{n args=1}{% |
| 5621 |
\forestmathtruncatemacro\forest@temp{(#1)-1}% |
| 5622 |
\ifnum\forest@temp=-1 |
| 5623 |
% special case, as \forest@node@foreach@breadthfirst uses level<0 as a signal for unlimited max level |
| 5624 |
\ifnum\forestove{level}=0 |
| 5625 |
\forest@nodewalk@makestep |
| 5626 |
\fi |
| 5627 |
\else |
| 5628 |
\edef\forest@marshal{% |
| 5629 |
\noexpand\forest@node@foreach@breadthfirst |
| 5630 |
{\forest@temp}% |
| 5631 |
{\noexpand\forest@nodewalk@makestep}% |
| 5632 |
}\forest@marshal |
| 5633 |
\fi |
| 5634 |
}, |
| 5635 |
define long step={level reversed}{n args=1}{% |
| 5636 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 5637 |
\edef\forest@marshal{% |
| 5638 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5639 |
{\forest@temp}% |
| 5640 |
{\noexpand\ifnum\noexpand\forestove{level}=\forest@temp\relax\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5641 |
}\forest@marshal |
| 5642 |
}, |
| 5643 |
define long step={level reversed>}{n args=1}{% |
| 5644 |
\forestmathtruncatemacro\forest@temp{#1}% |
| 5645 |
\edef\forest@marshal{% |
| 5646 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5647 |
{-1}% |
| 5648 |
{\noexpand\ifnum\noexpand\forestove{level}<\forest@temp\relax\noexpand\else\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5649 |
}\forest@marshal |
| 5650 |
}, |
| 5651 |
define long step={level reversed<}{n args=1}{% |
| 5652 |
\forestmathtruncatemacro\forest@temp{(#1)-1}% |
| 5653 |
\edef\forest@marshal{% |
| 5654 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5655 |
{\forest@temp}% |
| 5656 |
{\noexpand\forest@nodewalk@makestep}% |
| 5657 |
}\forest@marshal |
| 5658 |
}, |
| 5659 |
% |
| 5660 |
define long step={relative level}{n args=1}{% |
| 5661 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}}% |
| 5662 |
\edef\forest@marshal{% |
| 5663 |
\noexpand\forest@node@foreach@breadthfirst |
| 5664 |
{\forest@temp}% |
| 5665 |
{\noexpand\ifnum\noexpand\forestove{level}=\forest@temp\relax\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5666 |
}\forest@marshal |
| 5667 |
}, |
| 5668 |
define long step={relative level>}{n args=1}{% |
| 5669 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}}% |
| 5670 |
\edef\forest@marshal{% |
| 5671 |
\noexpand\forest@node@foreach@breadthfirst |
| 5672 |
{-1}% |
| 5673 |
{\noexpand\ifnum\noexpand\forestove{level}<\forest@temp\relax\noexpand\else\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5674 |
}\forest@marshal |
| 5675 |
}, |
| 5676 |
define long step={relative level<}{n args=1}{% |
| 5677 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}-1}% |
| 5678 |
\edef\forest@marshal{% |
| 5679 |
\noexpand\forest@node@foreach@breadthfirst |
| 5680 |
{\forest@temp}% |
| 5681 |
{\noexpand\forest@nodewalk@makestep}% |
| 5682 |
}\forest@marshal |
| 5683 |
}, |
| 5684 |
define long step={relative level reversed}{n args=1}{% |
| 5685 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}}% |
| 5686 |
\edef\forest@marshal{% |
| 5687 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5688 |
{\forest@temp}% |
| 5689 |
{\noexpand\ifnum\noexpand\forestove{level}=\forest@temp\relax\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5690 |
}\forest@marshal |
| 5691 |
}, |
| 5692 |
define long step={relative level reversed>}{n args=1}{% |
| 5693 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}}% |
| 5694 |
\edef\forest@marshal{% |
| 5695 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5696 |
{-1}% |
| 5697 |
{\noexpand\ifnum\noexpand\forestove{level}<\forest@temp\relax\noexpand\else\noexpand\forest@nodewalk@makestep\noexpand\fi}% |
| 5698 |
}\forest@marshal |
| 5699 |
}, |
| 5700 |
define long step={relative level reversed<}{n args=1}{% |
| 5701 |
\forestmathtruncatemacro\forest@temp{(#1)+\forestove{level}-1}% |
| 5702 |
\edef\forest@marshal{% |
| 5703 |
\noexpand\forest@node@foreach@breadthfirst@reversed |
| 5704 |
{\forest@temp}% |
| 5705 |
{\noexpand\forest@nodewalk@makestep}% |
| 5706 |
}\forest@marshal |
| 5707 |
}, |
| 5708 |
define long step={leaves}{}{% |
| 5709 |
\forest@node@foreach{% |
| 5710 |
\ifnum\forestove{n children}=0 |
| 5711 |
\forest@nodewalk@makestep |
| 5712 |
\fi |
| 5713 |
}% |
| 5714 |
}, |
| 5715 |
define long step={-level}{n args=1,style}{% |
| 5716 |
unique={branch={leaves,{group={repeat={#1}{parent}}}}} |
| 5717 |
}, |
| 5718 |
define long step={-level'}{n args=1,style}{% |
| 5719 |
unique={on invalid={fake}{branch={leaves,{group={repeat={#1}{parent}}}}}} |
| 5720 |
}, |
| 5721 |
define long step={children}{}{\forest@node@foreachchild{\forest@nodewalk@makestep}}, |
| 5722 |
define long step={children reversed}{}{\forest@node@foreachchild@reversed{\forest@nodewalk@makestep}}, |
| 5723 |
define long step={current and following siblings}{}{\forest@node@@forselfandfollowingsiblings{\forest@nodewalk@makestep}}, |
| 5724 |
define long step={following siblings}{style}{if nodewalk valid={next}{fake=next,current and following siblings}{}}, |
| 5725 |
define long step={current and preceding siblings}{}{\forest@node@@forselfandprecedingsiblings{\forest@nodewalk@makestep}}, |
| 5726 |
define long step={preceding siblings}{style}{if nodewalk valid={previous}{fake=previous,current and preceding siblings}{}}, |
| 5727 |
define long step={current and following siblings reversed}{}{\forest@node@@forselfandfollowingsiblings@reversed{\forest@nodewalk@makestep}}, |
| 5728 |
define long step={following siblings reversed}{style}{fake=next,current and following siblings reversed}, |
| 5729 |
define long step={current and preceding siblings reversed}{}{\forest@node@@forselfandprecedingsiblings@reversed{\forest@nodewalk@makestep}}, |
| 5730 |
define long step={preceding siblings reversed}{style}{fake=previous,current and preceding siblings reversed}, |
| 5731 |
define long step={siblings}{style}{for nodewalk'={preceding siblings},following siblings}, |
| 5732 |
define long step={siblings reversed}{style}{for nodewalk'={following siblings reversed},preceding siblings reversed}, |
| 5733 |
define long step={current and siblings}{style}{for nodewalk'={preceding siblings},current and following siblings}, |
| 5734 |
define long step={current and siblings reversed}{style}{for nodewalk'={current and following siblings reversed},preceding siblings reversed}, |
| 5735 |
define long step={ancestors}{style}{while={}{parent},last valid}, |
| 5736 |
define long step={current and ancestors}{style}{current,ancestors}, |
| 5737 |
define long step={following nodes}{style}{while={}{next node},last valid}, |
| 5738 |
define long step={preceding nodes}{style}{while={}{previous node},last valid}, |
| 5739 |
define long step={current and following nodes}{style}{current,following nodes}, |
| 5740 |
define long step={current and preceding nodes}{style}{current,preceding nodes}, |
| 5741 |
} |
| 5742 |
\let\forest@nodewalkstephandler@styletrueorfalse\forest@nodewalkstephandler@styletrue |
| 5743 |
\def\forest@last@node{0} |
| 5744 |
\csdef{forest@nodewalk@saved@dynamic nodes}{} |
| 5745 |
\def\forest@nodehandleby@name@nodewalk@or@bracket#1{% |
| 5746 |
\ifx\pgfkeysnovalue#1% |
| 5747 |
\edef\forest@last@node{\forest@node@Nametoid{forest@last@node}}% |
| 5748 |
\else |
| 5749 |
\forest@nodehandleby@nnb@checkfirst#1\forest@END |
| 5750 |
\fi |
| 5751 |
} |
| 5752 |
\def\forest@nodehandleby@nnb@checkfirst#1#2\forest@END{% |
| 5753 |
\ifx[#1%] |
| 5754 |
\forest@create@node{#1#2}% |
| 5755 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@last@node,}% |
| 5756 |
\else |
| 5757 |
\forest@forthis{% |
| 5758 |
\forest@nameandgo{#1#2}% |
| 5759 |
\ifnum\forest@cn=0 |
| 5760 |
\PackageError{forest}{Cannot use a dynamic key on the invalid node}{}% |
| 5761 |
\fi |
| 5762 |
\let\forest@last@node\forest@cn |
| 5763 |
}% |
| 5764 |
\fi |
| 5765 |
} |
| 5766 |
\def\forest@create@node#1{% #1=bracket representation |
| 5767 |
\bracketParse{\forest@create@collectafterthought}% |
| 5768 |
\forest@last@node=#1\forest@end@create@node |
| 5769 |
} |
| 5770 |
\def\forest@create@collectafterthought#1\forest@end@create@node{% |
| 5771 |
\forest@node@Foreach{\forest@last@node}{% |
| 5772 |
\forestoleto{delay}{given options}% |
| 5773 |
\forestoset{given options}{}% |
| 5774 |
}% |
| 5775 |
\forestOeappto{\forest@last@node}{delay}{,\unexpanded{#1}}% |
| 5776 |
\forestOset{\forest@last@node}{given options}{delay={}}% |
| 5777 |
} |
| 5778 |
\def\forest@create@node@and@process@given@options#1{% #1=bracket representation |
| 5779 |
\bracketParse{\forest@createandprocess@collectafterthought}% |
| 5780 |
\forest@last@node=#1\forest@end@create@node |
| 5781 |
} |
| 5782 |
\def\forest@createandprocess@collectafterthought#1\forest@end@create@node{% |
| 5783 |
\forest@node@Compute@numeric@ts@info{\forest@last@node}% |
| 5784 |
\forest@saveandrestoremacro\forest@root{% |
| 5785 |
\let\forest@root\forest@last@node |
| 5786 |
\forestset{process keylist=given options}% |
| 5787 |
}% |
| 5788 |
} |
| 5789 |
\def\forest@saveandrestoremacro#1#2{% #1 = the (zero-arg) macro to save before and restore after processing code in #2 |
| 5790 |
\edef\forest@marshal{% |
| 5791 |
\unexpanded{#2}% |
| 5792 |
\noexpand\def\noexpand#1{\expandonce{#1}}% |
| 5793 |
}\forest@marshal |
| 5794 |
} |
| 5795 |
\def\forest@saveandrestoreifcs#1#2{% #1 = the if cs to save before and restore after processing code in #2 |
| 5796 |
\edef\forest@marshal{% |
| 5797 |
\unexpanded{#2}% |
| 5798 |
\ifbool{#1}{\noexpand\setbool{#1}{true}}{\noexpand\setbool{#1}{false}}% |
| 5799 |
}\forest@marshal |
| 5800 |
} |
| 5801 |
\def\forest@globalsaveandrestoreifcs#1#2{% #1 = the if cs to save before and restore after processing code in #2 |
| 5802 |
\edef\forest@marshal{% |
| 5803 |
\unexpanded{#2}% |
| 5804 |
\ifbool{#1}{\global\noexpand\setbool{#1}{true}}{\global\noexpand\setbool{#1}{false}}% |
| 5805 |
}\forest@marshal |
| 5806 |
} |
| 5807 |
\def\forest@saveandrestoretoks#1#2{% #1 = the toks to save before and restore after processing code in #2 |
| 5808 |
\edef\forest@marshal{% |
| 5809 |
\unexpanded{#2}% |
| 5810 |
\noexpand#1{\the#1}% |
| 5811 |
}\forest@marshal |
| 5812 |
} |
| 5813 |
\def\forest@saveandrestoreregister#1#2{% #1 = the register to save before and restore after processing code in #2 |
| 5814 |
\edef\forest@marshal{% |
| 5815 |
\unexpanded{#2}% |
| 5816 |
\noexpand\forestrset{#1}{\forestregister{#1}}% |
| 5817 |
}\forest@marshal |
| 5818 |
} |
| 5819 |
\forestset{ |
| 5820 |
save and restore register/.code 2 args={% |
| 5821 |
\forest@saveandrestoreregister{#1}{% |
| 5822 |
\pgfkeysalso{#2}% |
| 5823 |
}% |
| 5824 |
}, |
| 5825 |
} |
| 5826 |
\def\forest@remove@node#1{% |
| 5827 |
\ifforestdebugdynamics\forestdebug@dynamics{before removing #1}\fi |
| 5828 |
\forest@node@Remove{#1}% |
| 5829 |
} |
| 5830 |
\def\forest@append@node#1#2{% |
| 5831 |
\ifforestdebugdynamics\forestdebug@dynamics{before appending #2 to #1}\fi |
| 5832 |
\forest@dynamic@circularitytest{#2}{#1}{append}% |
| 5833 |
\forest@node@Remove{#2}% |
| 5834 |
\forest@node@Append{#1}{#2}% |
| 5835 |
} |
| 5836 |
\def\forest@prepend@node#1#2{% |
| 5837 |
\ifforestdebugdynamics\forestdebug@dynamics{before prepending #2 to #1}\fi |
| 5838 |
\forest@dynamic@circularitytest{#2}{#1}{prepend}% |
| 5839 |
\forest@node@Remove{#2}% |
| 5840 |
\forest@node@Prepend{#1}{#2}% |
| 5841 |
} |
| 5842 |
\def\forest@insertafter@node#1#2{% |
| 5843 |
\ifforestdebugdynamics\forestdebug@dynamics{before inserting #2 after #1}\fi |
| 5844 |
\forest@node@Remove{#2}% |
| 5845 |
\forest@node@Insertafter{\forestOve{#1}{@parent}}{#2}{#1}% |
| 5846 |
} |
| 5847 |
\def\forest@insertbefore@node#1#2{% |
| 5848 |
\ifforestdebugdynamics\forestdebug@dynamics{before inserting #2 before #1}\fi |
| 5849 |
\forest@node@Remove{#2}% |
| 5850 |
\forest@node@Insertbefore{\forestOve{#1}{@parent}}{#2}{#1}% |
| 5851 |
} |
| 5852 |
\def\forest@set@root#1#2{% |
| 5853 |
\ifforestdebugdynamics\forestdebug@dynamics{before setting #1 as root}\fi |
| 5854 |
\def\forest@root{#2}% |
| 5855 |
} |
| 5856 |
\def\forest@dynamic@circularitytest#1#2#3{% |
| 5857 |
% #1=potenitial ancestor,#2=potential descendant, #3=message prefix |
| 5858 |
\ifnum#1=#2 |
| 5859 |
\forest@circularityerror{#1}{#2}{#3}% |
| 5860 |
\else |
| 5861 |
\forest@fornode{#1}{% |
| 5862 |
\forest@ifancestorof{#2}{\forest@circularityerror{#1}{#2}{#3}}{}% |
| 5863 |
}% |
| 5864 |
\fi |
| 5865 |
} |
| 5866 |
\def\forest@circularityerror#1#2#3{% |
| 5867 |
\forestdebug@typeouttrees{\forest@temp}% |
| 5868 |
\PackageError{forest}{#3ing node id=#1 to id=#2 would result in a circular tree\MessageBreak forest of ids: \forest@temp}{}% |
| 5869 |
}% |
| 5870 |
\def\forestdebug@dynamics#1{% |
| 5871 |
\forestdebug@typeouttrees\forest@temp |
| 5872 |
\typeout{#1: \forest@temp}% |
| 5873 |
} |
| 5874 |
\def\forest@appto@do@dynamics#1#2{% |
| 5875 |
\forest@nodehandleby@name@nodewalk@or@bracket{#2}% |
| 5876 |
\ifcase\forest@dynamics@copyhow\relax\or |
| 5877 |
\forest@tree@copy{\forest@last@node}\forest@last@node |
| 5878 |
\or |
| 5879 |
\forest@node@copy{\forest@last@node}\forest@last@node |
| 5880 |
\fi |
| 5881 |
\forest@node@Ifnamedefined{forest@last@node}{% |
| 5882 |
\forestOepreto{\forest@last@node}{delay} |
| 5883 |
{for id={\forest@node@Nametoid{forest@last@node}}{alias=forest@last@node},}% |
| 5884 |
}{}% |
| 5885 |
\edef\forest@marshal{% |
| 5886 |
\noexpand\apptotoks\noexpand\forest@do@dynamics{% |
| 5887 |
\noexpand#1{\forest@cn}{\forest@last@node}}% |
| 5888 |
}\forest@marshal |
| 5889 |
} |
| 5890 |
\forestset{% |
| 5891 |
create/.code={% |
| 5892 |
\forest@create@node{#1}% |
| 5893 |
\forest@fornode{\forest@last@node}{% |
| 5894 |
\forest@node@setalias{forest@last@node}% |
| 5895 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@last@node,}% |
| 5896 |
}% |
| 5897 |
}, |
| 5898 |
create'/.code={% |
| 5899 |
\forest@create@node@and@process@given@options{#1}% |
| 5900 |
\forest@fornode{\forest@last@node}{% |
| 5901 |
\forest@node@setalias{forest@last@node}% |
| 5902 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@last@node,}% |
| 5903 |
}% |
| 5904 |
}, |
| 5905 |
append/.code={\def\forest@dynamics@copyhow{0}\forest@appto@do@dynamics\forest@append@node{#1}}, |
| 5906 |
prepend/.code={\def\forest@dynamics@copyhow{0}\forest@appto@do@dynamics\forest@prepend@node{#1}}, |
| 5907 |
insert after/.code={\def\forest@dynamics@copyhow{0}\forest@appto@do@dynamics\forest@insertafter@node{#1}}, |
| 5908 |
insert before/.code={\def\forest@dynamics@copyhow{0}\forest@appto@do@dynamics\forest@insertbefore@node{#1}}, |
| 5909 |
append'/.code={\def\forest@dynamics@copyhow{1}\forest@appto@do@dynamics\forest@append@node{#1}}, |
| 5910 |
prepend'/.code={\def\forest@dynamics@copyhow{1}\forest@appto@do@dynamics\forest@prepend@node{#1}}, |
| 5911 |
insert after'/.code={\def\forest@dynamics@copyhow{1}\forest@appto@do@dynamics\forest@insertafter@node{#1}}, |
| 5912 |
insert before'/.code={\def\forest@dynamics@copyhow{1}\forest@appto@do@dynamics\forest@insertbefore@node{#1}}, |
| 5913 |
append''/.code={\def\forest@dynamics@copyhow{2}\forest@appto@do@dynamics\forest@append@node{#1}}, |
| 5914 |
prepend''/.code={\def\forest@dynamics@copyhow{2}\forest@appto@do@dynamics\forest@prepend@node{#1}}, |
| 5915 |
insert after''/.code={\def\forest@dynamics@copyhow{2}\forest@appto@do@dynamics\forest@insertafter@node{#1}}, |
| 5916 |
insert before''/.code={\def\forest@dynamics@copyhow{2}\forest@appto@do@dynamics\forest@insertbefore@node{#1}}, |
| 5917 |
remove/.code={% |
| 5918 |
\pgfkeysalso{alias=forest@last@node}% |
| 5919 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@cn,}% |
| 5920 |
\expandafter\apptotoks\expandafter\forest@do@dynamics\expandafter{% |
| 5921 |
\expandafter\forest@remove@node\expandafter{\forest@cn}}% |
| 5922 |
}, |
| 5923 |
set root/.code={% |
| 5924 |
\def\forest@dynamics@copyhow{0}% |
| 5925 |
\forest@appto@do@dynamics\forest@set@root{#1}% |
| 5926 |
}, |
| 5927 |
replace by/.code={\forest@replaceby@code{#1}{insert after}}, |
| 5928 |
replace by'/.code={\forest@replaceby@code{#1}{insert after'}}, |
| 5929 |
replace by''/.code={\forest@replaceby@code{#1}{insert after''}}, |
| 5930 |
sort/.code={% |
| 5931 |
\eapptotoks\forest@do@dynamics{% |
| 5932 |
\def\noexpand\forest@nodesort@sortkey{\forestrv{sort by}}% |
| 5933 |
\noexpand\forest@nodesort\noexpand\forest@sort@ascending{\forest@cn} |
| 5934 |
}% |
| 5935 |
}, |
| 5936 |
sort'/.code={% |
| 5937 |
\eapptotoks\forest@do@dynamics{% |
| 5938 |
\def\noexpand\forest@nodesort@sortkey{\forestrv{sort by}}% |
| 5939 |
\noexpand\forest@nodesort\noexpand\forest@sort@descending{\forest@cn} |
| 5940 |
}% |
| 5941 |
}, |
| 5942 |
} |
| 5943 |
\def\forest@replaceby@code#1#2{%#1=node spec,#2=insert after[']['] |
| 5944 |
\ifnum\forestove{@parent}=0 |
| 5945 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@cn,}% |
| 5946 |
\pgfkeysalso{alias=forest@last@node,set root={#1}}% |
| 5947 |
\else |
| 5948 |
\cseappto{forest@nodewalk@saved@dynamic nodes}{\forest@cn,}% |
| 5949 |
\pgfkeysalso{alias=forest@last@node,#2={#1}}% |
| 5950 |
\eapptotoks\forest@do@dynamics{% |
| 5951 |
\noexpand\ifnum\noexpand\forestOve{\forest@cn}{@parent}=\forestove{@parent} |
| 5952 |
\noexpand\forest@remove@node{\forest@cn}% |
| 5953 |
\noexpand\fi |
| 5954 |
}% |
| 5955 |
\fi |
| 5956 |
} |
| 5957 |
\def\forest@nodesort#1#2{% #1 = direction, #2 = parent node |
| 5958 |
\ifforestdebugdynamics\forestdebug@dynamics{before sorting children of #2}\fi |
| 5959 |
\forest@fornode{#2}{\forest@nodesort@#1}% |
| 5960 |
\ifforestdebugdynamics\forestdebug@dynamics{after sorting children of #2}\fi |
| 5961 |
} |
| 5962 |
\def\forest@nodesort@#1{% |
| 5963 |
% prepare the array of child ids |
| 5964 |
\c@pgf@counta=0 |
| 5965 |
\forestoget{@first}\forest@nodesort@id |
| 5966 |
\forest@loop |
| 5967 |
\ifnum\forest@nodesort@id>0 |
| 5968 |
\advance\c@pgf@counta 1 |
| 5969 |
\csedef{forest@nodesort@\the\c@pgf@counta}{\forest@nodesort@id}% |
| 5970 |
\forestOget{\forest@nodesort@id}{@next}\forest@nodesort@id |
| 5971 |
\forest@repeat |
| 5972 |
% sort |
| 5973 |
\forestoget{n children}\forest@nodesort@n |
| 5974 |
\forest@sort\forest@nodesort@cmpnodes\forest@nodesort@let#1{1}{\forest@nodesort@n}% |
| 5975 |
% remove all children |
| 5976 |
\forestoget{@first}\forest@nodesort@id |
| 5977 |
\forest@loop |
| 5978 |
\ifnum\forest@nodesort@id>0 |
| 5979 |
\forest@node@Remove{\forest@nodesort@id}% |
| 5980 |
\forestoget{@first}\forest@nodesort@id |
| 5981 |
\forest@repeat |
| 5982 |
% insert the children in new order |
| 5983 |
\c@pgf@counta=0 |
| 5984 |
\forest@loop |
| 5985 |
\ifnum\c@pgf@counta<\forest@nodesort@n\relax |
| 5986 |
\advance\c@pgf@counta 1 |
| 5987 |
\forest@node@append{\csname forest@nodesort@\the\c@pgf@counta\endcsname}% |
| 5988 |
\forest@repeat |
| 5989 |
} |
| 5990 |
\def\forest@nodesort@cmpnodes#1#2{% |
| 5991 |
\expandafter\forest@nodesort@cmpnodes@\forest@nodesort@sortkey,\forest@END{#1}{#2}% |
| 5992 |
} |
| 5993 |
\def\forest@nodesort@cmpnodes@#1,#2\forest@END#3#4{% |
| 5994 |
% #1=process ins+arg for this dimension, #2=for next dimensions |
| 5995 |
% #3, #4 = node ids |
| 5996 |
{% |
| 5997 |
\forest@fornode{\csname forest@nodesort@#3\endcsname}{% |
| 5998 |
\forestmathsetmacro\forest@nodesort@resulta{#1}% |
| 5999 |
}% |
| 6000 |
\forest@fornode{\csname forest@nodesort@#4\endcsname}{% |
| 6001 |
\forestmathsetmacro\forest@nodesort@resultb{#1}% |
| 6002 |
}% |
| 6003 |
\ifx\forestmathresulttype\forestmathtype@generic |
| 6004 |
\forest@cmp@error{\forest@nodesort@resulta}{\forest@nodesort@resultb}% |
| 6005 |
\fi |
| 6006 |
\edef\forest@temp{% |
| 6007 |
\noexpand\forest@nodesort@cmp |
| 6008 |
{\expandonce{\forest@nodesort@resulta}}% |
| 6009 |
{\expandonce{\forest@nodesort@resultb}}% |
| 6010 |
}% |
| 6011 |
\xdef\forest@global@temp{\forest@temp}% |
| 6012 |
}% |
| 6013 |
\if=\forest@global@temp |
| 6014 |
\let\forest@next\forest@nodesort@cmpnodes@ |
| 6015 |
\else |
| 6016 |
\let\forest@next\forest@nodesort@cmpnodes@finish |
| 6017 |
\fi |
| 6018 |
\ifstrempty{#2}{\let\forest@next\forest@nodesort@cmpnodes@finish}{}% |
| 6019 |
\forest@next#2\forest@END{#3}{#4}% |
| 6020 |
} |
| 6021 |
\def\forest@nodesort@cmpnodes@finish#1\forest@END#2#3{% |
| 6022 |
\let\forest@sort@cmp@result\forest@global@temp |
| 6023 |
} |
| 6024 |
\def\forest@nodesort@cmp{\csname fRsT@nsc@\forestmathresulttype\endcsname} |
| 6025 |
\def\fRsT@nsc@#1{\csname fRsT@nsc@#1\endcsname} |
| 6026 |
\def\fRsT@nsc@n#1#2{\ifnum#1<#2 <\else\ifnum#1=#2 =\else>\fi\fi} |
| 6027 |
\def\fRsT@nsc@d#1#2{\ifdim#1<#2 <\else\ifdim#1=#2 =\else>\fi\fi} |
| 6028 |
\def\fRsT@nsc@P#1#2{\ifdim#1pt<#2pt <\else\ifdim#1pt=#2pt =\else>\fi\fi} |
| 6029 |
\def\fRsT@nsc@t#1#2{\csname fRsT@nsc@\pdfstrcmp{#1}{#2}\endcsname} |
| 6030 |
\def\fRsT@nsc@T#1#2{\csname fRsT@nsc@\pdfstrcmp{#2}{#1}\endcsname} |
| 6031 |
\csdef{fRsT@nsc@-1}{<} |
| 6032 |
\csdef{fRsT@nsc@0}{=} |
| 6033 |
\csdef{fRsT@nsc@1}{>} |
| 6034 |
\def\forest@nodesort@let#1#2{% |
| 6035 |
\csletcs{forest@nodesort@#1}{forest@nodesort@#2}% |
| 6036 |
} |
| 6037 |
\forestset{ |
| 6038 |
define long step={last dynamic node}{style,must start at valid node=false}{% |
| 6039 |
name=forest@last@node |
| 6040 |
} |
| 6041 |
} |
| 6042 |
\def\forest@root{0} |
| 6043 |
%%% begin listing region: stages |
| 6044 |
\forestset{ |
| 6045 |
stages/.style={ |
| 6046 |
for root'={ |
| 6047 |
process keylist register=default preamble, |
| 6048 |
process keylist register=preamble |
| 6049 |
}, |
| 6050 |
process keylist=given options, |
| 6051 |
process keylist=before typesetting nodes, |
| 6052 |
typeset nodes stage, |
| 6053 |
process keylist=before packing, |
| 6054 |
pack stage, |
| 6055 |
process keylist=before computing xy, |
| 6056 |
compute xy stage, |
| 6057 |
process keylist=before drawing tree, |
| 6058 |
draw tree stage |
| 6059 |
}, |
| 6060 |
typeset nodes stage/.style={for root'=typeset nodes}, |
| 6061 |
pack stage/.style={for root'=pack}, |
| 6062 |
compute xy stage/.style={for root'=compute xy}, |
| 6063 |
draw tree stage/.style={for root'=draw tree}, |
| 6064 |
} |
| 6065 |
%%% end listing region: stages |
| 6066 |
\forestset{ |
| 6067 |
process keylist/.code={% |
| 6068 |
\forest@process@hook@keylist{#1}{#1 processing order/.try,processing order/.lastretry}}, |
| 6069 |
process keylist'/.code 2 args={\forest@process@hook@keylist@nodynamics{#1}{#2}}, |
| 6070 |
process keylist''/.code 2 args={\forest@process@hook@keylist@{#1}{#2}}, |
| 6071 |
process keylist register/.code={\forest@process@keylist@register{#1}}, |
| 6072 |
process delayed/.code={% |
| 6073 |
\forest@havedelayedoptions{@delay}{#1}% |
| 6074 |
\ifforest@havedelayedoptions |
| 6075 |
\forest@process@hook@keylist@nodynamics{@delay}{#1}% |
| 6076 |
\fi |
| 6077 |
}, |
| 6078 |
do dynamics/.code={% |
| 6079 |
\the\forest@do@dynamics |
| 6080 |
\forest@do@dynamics{}% |
| 6081 |
\forest@node@Compute@numeric@ts@info{\forest@root}% |
| 6082 |
}, |
| 6083 |
declare keylist={given options}{}, |
| 6084 |
declare keylist={before typesetting nodes}{}, |
| 6085 |
declare keylist={before packing}{}, |
| 6086 |
declare keylist={before packing node}{}, |
| 6087 |
declare keylist={after packing node}{}, |
| 6088 |
declare keylist={before computing xy}{}, |
| 6089 |
declare keylist={before drawing tree}{}, |
| 6090 |
declare keylist={delay}{}, |
| 6091 |
delay n/.code 2 args={% |
| 6092 |
\forestmathsetcount\forest@temp@count{#1}% |
| 6093 |
\pgfkeysalso{delay n'={\forest@temp@count}{#2}}% |
| 6094 |
}, |
| 6095 |
delay n'/.code 2 args={ |
| 6096 |
\ifnum#1=0 |
| 6097 |
\pgfkeysalso{#2}% |
| 6098 |
\else |
| 6099 |
\pgfkeysalso{delay={delay n'/.expand once=\expandafter{\number\numexpr#1-1\relax}{#2}}}% |
| 6100 |
\fi |
| 6101 |
}, |
| 6102 |
if have delayed/.style 2 args={if have delayed'={processing order}{#1}{#2}}, |
| 6103 |
if have delayed'/.code n args=3{% |
| 6104 |
\forest@havedelayedoptionsfalse |
| 6105 |
\forest@forthis{% |
| 6106 |
\forest@nodewalk{#1}{% |
| 6107 |
TeX={% |
| 6108 |
\forestoget{delay}\forest@temp@delayed |
| 6109 |
\ifdefempty\forest@temp@delayed{}{\forest@havedelayedoptionstrue}% |
| 6110 |
}% |
| 6111 |
}% |
| 6112 |
}% |
| 6113 |
\ifforest@havedelayedoptions\pgfkeysalso{#2}\else\pgfkeysalso{#3}\fi |
| 6114 |
}, |
| 6115 |
typeset nodes/.code={% |
| 6116 |
\forest@drawtree@preservenodeboxes@false |
| 6117 |
\forest@nodewalk |
| 6118 |
{typeset nodes processing order/.try,processing order/.lastretry}% |
| 6119 |
{TeX={\forest@node@typeset}}% |
| 6120 |
}, |
| 6121 |
typeset nodes'/.code={% |
| 6122 |
\forest@drawtree@preservenodeboxes@true |
| 6123 |
\forest@nodewalk |
| 6124 |
{typeset nodes processing order/.try,processing order/.lastretry}% |
| 6125 |
{TeX={\forest@node@typeset}}% |
| 6126 |
}, |
| 6127 |
typeset node/.code={% |
| 6128 |
\forest@drawtree@preservenodeboxes@false |
| 6129 |
\forest@node@typeset |
| 6130 |
}, |
| 6131 |
pack/.code={\forest@pack}, |
| 6132 |
pack'/.code={\forest@pack@onlythisnode}, |
| 6133 |
compute xy/.code={\forest@node@computeabsolutepositions}, |
| 6134 |
draw tree box/.store in=\forest@drawtreebox, |
| 6135 |
draw tree box, |
| 6136 |
draw tree/.code={% |
| 6137 |
\forest@drawtree@preservenodeboxes@false |
| 6138 |
\forest@node@drawtree |
| 6139 |
}, |
| 6140 |
draw tree'/.code={% |
| 6141 |
\forest@drawtree@preservenodeboxes@true |
| 6142 |
\forest@node@drawtree |
| 6143 |
}, |
| 6144 |
%%% begin listing region: draw_tree_method |
| 6145 |
draw tree method/.style={ |
| 6146 |
for nodewalk={ |
| 6147 |
draw tree nodes processing order/.try, |
| 6148 |
draw tree processing order/.retry, |
| 6149 |
processing order/.lastretry |
| 6150 |
}{draw tree node}, |
| 6151 |
for nodewalk={ |
| 6152 |
draw tree edges processing order/.try, |
| 6153 |
draw tree processing order/.retry, |
| 6154 |
processing order/.lastretry |
| 6155 |
}{draw tree edge}, |
| 6156 |
for nodewalk={ |
| 6157 |
draw tree tikz processing order/.try, |
| 6158 |
draw tree processing order/.retry, |
| 6159 |
processing order/.lastretry |
| 6160 |
}{draw tree tikz} |
| 6161 |
}, |
| 6162 |
%%% end listing region: draw_tree_method |
| 6163 |
draw tree node/.code={\forest@draw@node}, |
| 6164 |
draw tree node'/.code={\forest@draw@node@}, |
| 6165 |
if node drawn/.code n args={3}{% |
| 6166 |
\forest@forthis{% |
| 6167 |
\forest@configured@nodewalk{independent}{inherited}{fake}{#1}{}% |
| 6168 |
\ifnum\forest@cn=0 |
| 6169 |
\forest@tempfalse |
| 6170 |
\else |
| 6171 |
\ifcsdef{forest@drawn@\forest@cn}{\forest@temptrue}{\forest@tempfalse}% |
| 6172 |
\fi |
| 6173 |
}% |
| 6174 |
\ifforest@temp\pgfkeysalso{#2}\else\pgfkeysalso{#3}\fi |
| 6175 |
}, |
| 6176 |
draw tree edge/.code={\forest@draw@edge}, |
| 6177 |
draw tree edge'/.code={\forest@draw@edge@}, |
| 6178 |
draw tree tikz/.code={\forest@draw@tikz@}, % always! |
| 6179 |
draw tree tikz'/.code={\forest@draw@tikz@}, |
| 6180 |
processing order/.nodewalk style={tree}, |
| 6181 |
%given options processing order/.style={processing order}, |
| 6182 |
%before typesetting nodes processing order/.style={processing order}, |
| 6183 |
%before packing processing order/.style={processing order}, |
| 6184 |
%before computing xy processing order/.style={processing order}, |
| 6185 |
%before drawing tree processing order/.style={processing order}, |
| 6186 |
} |
| 6187 |
\newtoks\forest@do@dynamics |
| 6188 |
\newif\ifforest@havedelayedoptions |
| 6189 |
\def\forest@process@hook@keylist#1#2{%,#1=keylist,#2=processing order nodewalk |
| 6190 |
\safeloop |
| 6191 |
\forest@fornode{\forest@root}{\forest@process@hook@keylist@{#1}{#2}}% |
| 6192 |
\expandafter\ifstrempty\expandafter{\the\forest@do@dynamics}{}{% |
| 6193 |
\the\forest@do@dynamics |
| 6194 |
\forest@do@dynamics={}% |
| 6195 |
\forest@node@Compute@numeric@ts@info{\forest@root}% |
| 6196 |
}% |
| 6197 |
\forest@fornode{\forest@root}{\forest@havedelayedoptions{#1}{#2}}% |
| 6198 |
\ifforest@havedelayedoptions |
| 6199 |
\saferepeat |
| 6200 |
} |
| 6201 |
\def\forest@process@hook@keylist@nodynamics#1#2{%#1=keylist,#2=processing order nodewalk |
| 6202 |
% note: this macro works on (nodewalk starting at) the current node |
| 6203 |
\safeloop |
| 6204 |
\forest@forthis{\forest@process@hook@keylist@{#1}{#2}}% |
| 6205 |
\forest@havedelayedoptions{#1}{#2}% |
| 6206 |
\ifforest@havedelayedoptions |
| 6207 |
\saferepeat |
| 6208 |
} |
| 6209 |
\def\forest@process@hook@keylist@#1#2{%#1=keylist,#2=processing order nodewalk |
| 6210 |
\forest@nodewalk{#2}{% |
| 6211 |
TeX={% |
| 6212 |
\forestoget{#1}\forest@temp@keys |
| 6213 |
\ifdefvoid\forest@temp@keys{}{% |
| 6214 |
\forestoset{#1}{}% |
| 6215 |
\expandafter\forestset\expandafter{\forest@temp@keys}% |
| 6216 |
}% |
| 6217 |
}% |
| 6218 |
}% |
| 6219 |
} |
| 6220 |
\def\forest@process@keylist@register#1{% |
| 6221 |
\edef\forest@marshal{% |
| 6222 |
\noexpand\forestset{\forestregister{#1}}% |
| 6223 |
}\forest@marshal |
| 6224 |
} |
| 6225 |
\def\forest@havedelayedoptions#1#2{%#1 = keylist, #2=nodewalk |
| 6226 |
\forest@havedelayedoptionsfalse |
| 6227 |
\forest@forthis{% |
| 6228 |
\forest@nodewalk{#2}{% |
| 6229 |
TeX={% |
| 6230 |
\forestoget{delay}\forest@temp@delayed |
| 6231 |
\ifdefempty\forest@temp@delayed{}{\forest@havedelayedoptionstrue}% |
| 6232 |
\forestolet{#1}\forest@temp@delayed |
| 6233 |
\forestoset{delay}{}% |
| 6234 |
}% |
| 6235 |
}% |
| 6236 |
}% |
| 6237 |
} |
| 6238 |
\def\forest@node@typeset{% |
| 6239 |
\let\forest@next\forest@node@typeset@ |
| 6240 |
\forestoifdefined{@box}{% |
| 6241 |
\forestoget{@box}\forest@temp |
| 6242 |
\ifdefempty\forest@temp{% |
| 6243 |
\locbox\forest@temp@box |
| 6244 |
\forestolet{@box}\forest@temp@box |
| 6245 |
}{% |
| 6246 |
\ifforest@drawtree@preservenodeboxes@ |
| 6247 |
\let\forest@next\relax |
| 6248 |
\fi |
| 6249 |
}% |
| 6250 |
}{% |
| 6251 |
\locbox\forest@temp@box |
| 6252 |
\forestolet{@box}\forest@temp@box |
| 6253 |
}% |
| 6254 |
\def\forest@node@typeset@restore{}% |
| 6255 |
\ifdefined\ifsa@tikz\forest@standalone@hack\fi |
| 6256 |
\forest@next |
| 6257 |
\forest@node@typeset@restore |
| 6258 |
} |
| 6259 |
\def\forest@standalone@hack{% |
| 6260 |
\ifsa@tikz |
| 6261 |
\let\forest@standalone@tikzpicture\tikzpicture |
| 6262 |
\let\forest@standalone@endtikzpicture\endtikzpicture |
| 6263 |
\let\tikzpicture\sa@orig@tikzpicture |
| 6264 |
\let\endtikzpicture\sa@orig@endtikzpicture |
| 6265 |
\def\forest@node@typeset@restore{% |
| 6266 |
\let\tikzpicture\forest@standalone@tikzpicture |
| 6267 |
\let\endtikzpicture\forest@standalone@endtikzpicture |
| 6268 |
}% |
| 6269 |
\fi |
| 6270 |
} |
| 6271 |
\newbox\forest@box |
| 6272 |
\def\forest@pgf@notyetpositioned{not yet positionedPGFINTERNAL} |
| 6273 |
\def\forest@node@typeset@{% |
| 6274 |
\forestanchortotikzanchor{anchor}\forest@temp |
| 6275 |
\edef\forest@marshal{% |
| 6276 |
\noexpand\forestolet{anchor}\noexpand\forest@temp |
| 6277 |
\noexpand\forest@node@typeset@@ |
| 6278 |
\noexpand\forestoset{anchor}{\forestov{anchor}}% |
| 6279 |
}\forest@marshal |
| 6280 |
} |
| 6281 |
\def\forest@node@typeset@@{% |
| 6282 |
\forestoget{name}\forest@nodename |
| 6283 |
\edef\forest@temp@nodeformat{\forestove{node format}}% |
| 6284 |
\gdef\forest@smuggle{}% |
| 6285 |
\setbox0=\hbox{% |
| 6286 |
\begin{tikzpicture}[% |
| 6287 |
/forest/copy command key={/tikz/anchor}{/tikz/forest@orig@anchor}, |
| 6288 |
anchor/.style={% |
| 6289 |
/forest/TeX={\forestanchortotikzanchor{##1}\forest@temp@anchor}, |
| 6290 |
forest@orig@anchor/.expand once=\forest@temp@anchor |
| 6291 |
}] |
| 6292 |
\pgfpositionnodelater{\forest@positionnodelater@save}% |
| 6293 |
\forest@temp@nodeformat |
| 6294 |
\pgfinterruptpath |
| 6295 |
\pgfpointanchor{\forest@pgf@notyetpositioned\forest@nodename}{forestcomputenodeboundary}% |
| 6296 |
\endpgfinterruptpath |
| 6297 |
\end{tikzpicture}% |
| 6298 |
}% |
| 6299 |
\setbox\forestove{@box}=\box\forest@box % smuggle the box |
| 6300 |
\forestolet{@boundary}\forest@global@boundary |
| 6301 |
\forest@smuggle % ... and the rest |
| 6302 |
} |
| 6303 |
|
| 6304 |
\forestset{ |
| 6305 |
declare readonly dimen={min x}{0pt}, |
| 6306 |
declare readonly dimen={min y}{0pt}, |
| 6307 |
declare readonly dimen={max x}{0pt}, |
| 6308 |
declare readonly dimen={max y}{0pt}, |
| 6309 |
} |
| 6310 |
\def\forest@patch@enormouscoordinateboxbounds@plus#1{% |
| 6311 |
\expandafter\ifstrequal\expandafter{#1}{16000.0pt}{\edef#1{0.0\pgfmath@pt}}{}% |
| 6312 |
} |
| 6313 |
\def\forest@patch@enormouscoordinateboxbounds@minus#1{% |
| 6314 |
\expandafter\ifstrequal\expandafter{#1}{-16000.0pt}{\edef#1{0.0\pgfmath@pt}}{}% |
| 6315 |
} |
| 6316 |
\def\forest@positionnodelater@save{% |
| 6317 |
\global\setbox\forest@box=\box\pgfpositionnodelaterbox |
| 6318 |
\xappto\forest@smuggle{\noexpand\forestoset{later@name}{\pgfpositionnodelatername}}% |
| 6319 |
% a bug in pgf? ---well, here's a patch |
| 6320 |
\forest@patch@enormouscoordinateboxbounds@plus\pgfpositionnodelaterminx |
| 6321 |
\forest@patch@enormouscoordinateboxbounds@plus\pgfpositionnodelaterminy |
| 6322 |
\forest@patch@enormouscoordinateboxbounds@minus\pgfpositionnodelatermaxx |
| 6323 |
\forest@patch@enormouscoordinateboxbounds@minus\pgfpositionnodelatermaxy |
| 6324 |
% end of patch |
| 6325 |
% when shape=coordinate, pgf returns \pgfpositionnodelater... with wrong catcode of pt |
| 6326 |
\forest@pnn@addtosmuggle{min x}\pgfpositionnodelaterminx |
| 6327 |
\forest@pnn@addtosmuggle{max x}\pgfpositionnodelatermaxx |
| 6328 |
\forest@pnn@addtosmuggle{min y}\pgfpositionnodelaterminy |
| 6329 |
\forest@pnn@addtosmuggle{max y}\pgfpositionnodelatermaxy |
| 6330 |
} |
| 6331 |
\def\forest@pnn@addtosmuggle#1#2{% |
| 6332 |
{% |
| 6333 |
\pgfutil@tempdima=#2\relax |
| 6334 |
\xappto\forest@smuggle{\noexpand\forestoset{#1}{\the\pgfutil@tempdima}}% |
| 6335 |
}% |
| 6336 |
} |
| 6337 |
\def\forest@node@forest@positionnodelater@restore{% |
| 6338 |
\ifforest@drawtree@preservenodeboxes@ |
| 6339 |
\let\forest@boxorcopy\copy |
| 6340 |
\else |
| 6341 |
\let\forest@boxorcopy\box |
| 6342 |
\fi |
| 6343 |
\forestoget{@box}\forest@temp |
| 6344 |
\setbox\pgfpositionnodelaterbox=\forest@boxorcopy\forest@temp |
| 6345 |
\edef\pgfpositionnodelatername{\forestove{later@name}}% |
| 6346 |
\edef\pgfpositionnodelaterminx{\forestove{min x}}% |
| 6347 |
\edef\pgfpositionnodelaterminy{\forestove{min y}}% |
| 6348 |
\edef\pgfpositionnodelatermaxx{\forestove{max x}}% |
| 6349 |
\edef\pgfpositionnodelatermaxy{\forestove{max y}}% |
| 6350 |
\ifforest@drawtree@preservenodeboxes@ |
| 6351 |
\else |
| 6352 |
\forestoset{@box}{}% |
| 6353 |
\fi |
| 6354 |
} |
| 6355 |
\def\forest@pack{% |
| 6356 |
\pgfsyssoftpath@getcurrentpath\forest@pack@original@path |
| 6357 |
\forest@pack@computetiers |
| 6358 |
\forest@pack@computegrowthuniformity |
| 6359 |
\forest@@pack |
| 6360 |
\pgfsyssoftpath@setcurrentpath\forest@pack@original@path |
| 6361 |
} |
| 6362 |
\def\forest@@pack{% |
| 6363 |
\ifnum\forestove{uniform growth}>0 |
| 6364 |
\ifnum\forestove{n children}>0 |
| 6365 |
\forest@pack@level@uniform |
| 6366 |
\forest@pack@aligntiers@ofsubtree |
| 6367 |
\forest@pack@sibling@uniform@recursive |
| 6368 |
\fi |
| 6369 |
\else |
| 6370 |
\forest@node@foreachchild{\forest@@pack}% |
| 6371 |
\forest@process@hook@keylist@nodynamics{before packing node}{current}% |
| 6372 |
\ifnum\forestove{n children}>0 |
| 6373 |
\forest@pack@level@nonuniform |
| 6374 |
\forest@pack@aligntiers |
| 6375 |
\forest@pack@sibling@uniform@applyreversed |
| 6376 |
\fi |
| 6377 |
\forestoget{after packing node}\forest@temp@keys |
| 6378 |
\forest@process@hook@keylist@nodynamics{after packing node}{current}% |
| 6379 |
\fi |
| 6380 |
} |
| 6381 |
\def\forest@pack@onlythisnode{% |
| 6382 |
\ifnum\forestove{n children}>0 |
| 6383 |
\forest@pack@computetiers |
| 6384 |
\forest@pack@level@nonuniform |
| 6385 |
\forest@pack@aligntiers |
| 6386 |
\forest@node@foreachchild{\forestoset{s}{0\pgfmath@pt}}% |
| 6387 |
\forest@pack@sibling@uniform@applyreversed |
| 6388 |
\fi |
| 6389 |
} |
| 6390 |
\def\forest@pack@computegrowthuniformity{% |
| 6391 |
\forest@node@foreachchild{\forest@pack@computegrowthuniformity}% |
| 6392 |
\edef\forest@pack@cgu@uniformity{% |
| 6393 |
\ifnum\forestove{n children}=0 |
| 6394 |
2\else 1\fi |
| 6395 |
}% |
| 6396 |
\forestoget{grow}\forest@pack@cgu@parentgrow |
| 6397 |
\forest@node@foreachchild{% |
| 6398 |
\ifnum\forestove{uniform growth}=0 |
| 6399 |
\def\forest@pack@cgu@uniformity{0}% |
| 6400 |
\else |
| 6401 |
\ifnum\forestove{uniform growth}=1 |
| 6402 |
\ifnum\forestove{grow}=\forest@pack@cgu@parentgrow\relax\else |
| 6403 |
\def\forest@pack@cgu@uniformity{0}% |
| 6404 |
\fi |
| 6405 |
\fi |
| 6406 |
\fi |
| 6407 |
}% |
| 6408 |
\forestoget{before packing node}\forest@temp@a |
| 6409 |
\forestoget{after packing node}\forest@temp@b |
| 6410 |
\expandafter\expandafter\expandafter\ifstrempty\expandafter\expandafter\expandafter{\expandafter\forest@temp@a\forest@temp@b}{% |
| 6411 |
\forestolet{uniform growth}\forest@pack@cgu@uniformity |
| 6412 |
}{% |
| 6413 |
\forestoset{uniform growth}{0}% |
| 6414 |
}% |
| 6415 |
} |
| 6416 |
\def\forest@pack@level@uniform{% |
| 6417 |
\let\forest@plu@minchildl\relax |
| 6418 |
\forestoget{grow}\forest@plu@grow |
| 6419 |
\forest@node@foreachchild{% |
| 6420 |
\forest@node@getboundingrectangle@ls{\forest@plu@grow}% |
| 6421 |
\advance\pgf@xa\forestove{l}\relax |
| 6422 |
\ifx\forest@plu@minchildl\relax |
| 6423 |
\edef\forest@plu@minchildl{\the\pgf@xa}% |
| 6424 |
\else |
| 6425 |
\ifdim\pgf@xa<\forest@plu@minchildl\relax |
| 6426 |
\edef\forest@plu@minchildl{\the\pgf@xa}% |
| 6427 |
\fi |
| 6428 |
\fi |
| 6429 |
}% |
| 6430 |
\forest@node@getboundingrectangle@ls{\forest@plu@grow}% |
| 6431 |
\pgfutil@tempdima=\pgf@xb\relax |
| 6432 |
\advance\pgfutil@tempdima -\forest@plu@minchildl\relax |
| 6433 |
\advance\pgfutil@tempdima \forestove{l sep}\relax |
| 6434 |
\ifdim\pgfutil@tempdima>0pt |
| 6435 |
\forest@node@foreachchild{% |
| 6436 |
\forestoeset{l}{\the\dimexpr\forestove{l}+\the\pgfutil@tempdima}% |
| 6437 |
}% |
| 6438 |
\fi |
| 6439 |
\forest@node@foreachchild{% |
| 6440 |
\ifnum\forestove{n children}>0 |
| 6441 |
\forest@pack@level@uniform |
| 6442 |
\fi |
| 6443 |
}% |
| 6444 |
} |
| 6445 |
\def\forest@pack@level@nonuniform{% |
| 6446 |
\let\forest@plu@minchildl\relax |
| 6447 |
\forestoget{grow}\forest@plu@grow |
| 6448 |
\forest@node@foreachchild{% |
| 6449 |
\forest@node@getedge{negative}{\forest@plu@grow}{\forest@plnu@negativechildedge}% |
| 6450 |
\forest@node@getedge{positive}{\forest@plu@grow}{\forest@plnu@positivechildedge}% |
| 6451 |
\def\forest@plnu@childedge{\forest@plnu@negativechildedge\forest@plnu@positivechildedge}% |
| 6452 |
\forest@path@getboundingrectangle@ls\forest@plnu@childedge{\forest@plu@grow}% |
| 6453 |
\advance\pgf@xa\forestove{l}\relax |
| 6454 |
\ifx\forest@plu@minchildl\relax |
| 6455 |
\edef\forest@plu@minchildl{\the\pgf@xa}% |
| 6456 |
\else |
| 6457 |
\ifdim\pgf@xa<\forest@plu@minchildl\relax |
| 6458 |
\edef\forest@plu@minchildl{\the\pgf@xa}% |
| 6459 |
\fi |
| 6460 |
\fi |
| 6461 |
}% |
| 6462 |
\forest@node@getboundingrectangle@ls{\forest@plu@grow}% |
| 6463 |
\pgfutil@tempdima=\pgf@xb\relax |
| 6464 |
\advance\pgfutil@tempdima -\forest@plu@minchildl\relax |
| 6465 |
\advance\pgfutil@tempdima \forestove{l sep}\relax |
| 6466 |
\ifdim\pgfutil@tempdima>0pt |
| 6467 |
\forest@node@foreachchild{% |
| 6468 |
\forestoeset{l}{\the\dimexpr\the\pgfutil@tempdima+\forestove{l}}% |
| 6469 |
}% |
| 6470 |
\fi |
| 6471 |
} |
| 6472 |
\def\forest@pack@aligntiers{% |
| 6473 |
\forestoget{grow}\forest@temp@parentgrow |
| 6474 |
\forestoget{@tiers}\forest@temp@tiers |
| 6475 |
\forlistloop\forest@pack@aligntier@\forest@temp@tiers |
| 6476 |
} |
| 6477 |
\def\forest@pack@aligntiers@ofsubtree{% |
| 6478 |
\forest@node@foreach{\forest@pack@aligntiers}% |
| 6479 |
} |
| 6480 |
\def\forest@pack@aligntiers@computeabsl{% |
| 6481 |
\forestoleto{abs@l}{l}% |
| 6482 |
\forest@node@foreachdescendant{\forest@pack@aligntiers@computeabsl@}% |
| 6483 |
} |
| 6484 |
\def\forest@pack@aligntiers@computeabsl@{% |
| 6485 |
\forestoeset{abs@l}{\the\dimexpr\forestove{l}+\forestOve{\forestove{@parent}}{abs@l}}% |
| 6486 |
} |
| 6487 |
\def\forest@pack@aligntier@#1{% |
| 6488 |
\forest@pack@aligntiers@computeabsl |
| 6489 |
\pgfutil@tempdima=-\maxdimen\relax |
| 6490 |
\def\forest@temp@currenttier{#1}% |
| 6491 |
\forest@node@foreach{% |
| 6492 |
\forestoget{tier}\forest@temp@tier |
| 6493 |
\ifx\forest@temp@currenttier\forest@temp@tier |
| 6494 |
\ifdim\pgfutil@tempdima<\forestove{abs@l}\relax |
| 6495 |
\pgfutil@tempdima=\forestove{abs@l}\relax |
| 6496 |
\fi |
| 6497 |
\fi |
| 6498 |
}% |
| 6499 |
\ifdim\pgfutil@tempdima=-\maxdimen\relax\else |
| 6500 |
\forest@node@foreach{% |
| 6501 |
\forestoget{tier}\forest@temp@tier |
| 6502 |
\ifx\forest@temp@currenttier\forest@temp@tier |
| 6503 |
\forestoeset{l}{\the\dimexpr\pgfutil@tempdima-\forestove{abs@l}+\forestove{l}}% |
| 6504 |
\fi |
| 6505 |
}% |
| 6506 |
\fi |
| 6507 |
} |
| 6508 |
\def\forest@pack@sibling@uniform@recursive{% |
| 6509 |
\forest@node@foreachchild{\forest@pack@sibling@uniform@recursive}% |
| 6510 |
\forest@pack@sibling@uniform@applyreversed |
| 6511 |
} |
| 6512 |
\def\forest@pack@sibling@uniform@applyreversed{% |
| 6513 |
\ifnum\forestove{n children}>1 |
| 6514 |
\ifnum\forestove{reversed}=0 |
| 6515 |
\forest@pack@sibling@uniform@main{first}{last}{next}{previous}% |
| 6516 |
\else |
| 6517 |
\forest@pack@sibling@uniform@main{last}{first}{previous}{next}% |
| 6518 |
\fi |
| 6519 |
\else |
| 6520 |
\ifnum\forestove{n children}=1 |
| 6521 |
\csname forest@calign@\forestove{calign}\endcsname |
| 6522 |
\fi |
| 6523 |
\fi |
| 6524 |
} |
| 6525 |
\def\forest@pack@sibling@uniform@main#1#2#3#4{% |
| 6526 |
\forestoget{@#1}\forest@child |
| 6527 |
\edef\forest@marshal{% |
| 6528 |
\noexpand\forest@fornode{\forestove{@#1}}{% |
| 6529 |
\noexpand\forest@node@getedge |
| 6530 |
{positive}% |
| 6531 |
{\forestove{grow}}% |
| 6532 |
\noexpand\forest@temp@edge |
| 6533 |
}% |
| 6534 |
}\forest@marshal |
| 6535 |
\forest@pack@pgfpoint@childsposition\forest@child |
| 6536 |
\let\forest@previous@positive@edge\pgfutil@empty |
| 6537 |
\forest@extendpath\forest@previous@positive@edge\forest@temp@edge{}% |
| 6538 |
\forestOget{\forest@child}{@#3}\forest@child |
| 6539 |
\edef\forest@previous@child@s{0\pgfmath@pt}% |
| 6540 |
\safeloop |
| 6541 |
\unless\ifnum\forest@child=0 |
| 6542 |
\edef\forest@temp{% |
| 6543 |
\noexpand\forest@fornode{\forest@child}{% |
| 6544 |
\noexpand\forest@node@getedge |
| 6545 |
{negative}% |
| 6546 |
{\forestove{grow}}% |
| 6547 |
\noexpand\forest@temp@edge |
| 6548 |
}% |
| 6549 |
}\forest@temp |
| 6550 |
\forest@pack@pgfpoint@childsposition\forest@child |
| 6551 |
\let\forest@child@negative@edge\pgfutil@empty |
| 6552 |
\forest@extendpath\forest@child@negative@edge\forest@temp@edge{}% |
| 6553 |
\forest@setupgrowline{\forestove{grow}}% |
| 6554 |
\forest@distance@between@edge@paths\forest@previous@positive@edge\forest@child@negative@edge\forest@csdistance |
| 6555 |
\ifx\forest@csdistance\relax |
| 6556 |
%\forestOeset{\forest@child}{s}{\forest@previous@child@s}% |
| 6557 |
\else |
| 6558 |
\advance\pgfutil@tempdimb-\forest@csdistance\relax |
| 6559 |
\advance\pgfutil@tempdimb\forestove{s sep}\relax |
| 6560 |
\forestOeset{\forest@child}{s}{\the\dimexpr\forestOve{\forest@child}{s}-\forest@csdistance+\forestove{s sep}}% |
| 6561 |
\fi |
| 6562 |
\ifdim\forestOve{\forest@child}{s}<\forest@previous@child@s\relax |
| 6563 |
\forestOeset{\forest@child}{s}{\forest@previous@child@s}% |
| 6564 |
\fi |
| 6565 |
\forestOget{\forest@child}{s}\forest@child@s |
| 6566 |
\edef\forest@previous@child@s{\forest@child@s}% |
| 6567 |
\edef\forest@temp{% |
| 6568 |
\noexpand\forest@fornode{\forest@child}{% |
| 6569 |
\noexpand\forest@node@getedge |
| 6570 |
{positive}% |
| 6571 |
{\forestove{grow}}% |
| 6572 |
\noexpand\forest@temp@edge |
| 6573 |
}% |
| 6574 |
}\forest@temp |
| 6575 |
\forest@pack@pgfpoint@childsposition\forest@child |
| 6576 |
\forest@extendpath\forest@previous@positive@edge\forest@temp@edge{}% |
| 6577 |
\forest@getpositivetightedgeofpath\forest@previous@positive@edge\forest@previous@positive@edge |
| 6578 |
\forestOget{\forest@child}{@#3}\forest@child |
| 6579 |
\saferepeat |
| 6580 |
\csname forest@calign@\forestove{calign}\endcsname |
| 6581 |
} |
| 6582 |
\def\forest@pack@pgfpoint@childsposition#1{% |
| 6583 |
{% |
| 6584 |
\pgftransformreset |
| 6585 |
\forest@pgfqtransformrotate{\forestove{grow}}% |
| 6586 |
\forest@fornode{#1}{% |
| 6587 |
\pgfpointtransformed{\pgfqpoint{\forestove{l}}{\forestove{s}}}% |
| 6588 |
}% |
| 6589 |
}% |
| 6590 |
} |
| 6591 |
\def\forest@pack@pgfpoint@positioningrow#1{% |
| 6592 |
{% |
| 6593 |
\pgftransformreset |
| 6594 |
\forest@pgfqtransformrotate{#1}% |
| 6595 |
\pgfpointtransformed{\pgfqpoint{\forestove{l}}{\forestove{s}}}% |
| 6596 |
}% |
| 6597 |
} |
| 6598 |
\def\forest@calign@s@shift#1{% |
| 6599 |
\pgfutil@tempdima=#1\relax |
| 6600 |
\forest@node@foreachchild{% |
| 6601 |
\forestoeset{s}{\the\dimexpr\forestove{s}+\pgfutil@tempdima}% |
| 6602 |
}% |
| 6603 |
} |
| 6604 |
\def\forest@calign@child{% |
| 6605 |
\forest@calign@s@shift{-\forestOve{\forest@node@nornbarthchildid{\forestove{calign primary child}}}{s}}% |
| 6606 |
} |
| 6607 |
\csdef{forest@calign@child edge}{% |
| 6608 |
{% |
| 6609 |
\edef\forest@temp@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% |
| 6610 |
\pgftransformreset |
| 6611 |
\forest@pgfqtransformrotate{\forestove{grow}}% |
| 6612 |
\pgfpointtransformed{\pgfqpoint{\forestOve{\forest@temp@child}{l}}{\forestOve{\forest@temp@child}{s}}}% |
| 6613 |
\pgf@xa=\pgf@x\relax\pgf@ya=\pgf@y\relax |
| 6614 |
\forest@Pointanchor{\forest@temp@child}{child anchor}% |
| 6615 |
\advance\pgf@xa\pgf@x\relax\advance\pgf@ya\pgf@y\relax |
| 6616 |
\forest@pointanchor{parent anchor}% |
| 6617 |
\advance\pgf@xa-\pgf@x\relax\advance\pgf@ya-\pgf@y\relax |
| 6618 |
\edef\forest@marshal{% |
| 6619 |
\noexpand\pgftransformreset |
| 6620 |
\noexpand\forest@pgfqtransformrotate{-\forestove{grow}}% |
| 6621 |
\noexpand\pgfpointtransformed{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% |
| 6622 |
}\forest@marshal |
| 6623 |
}% |
| 6624 |
\forest@calign@s@shift{\the\dimexpr-\the\pgf@y}% |
| 6625 |
} |
| 6626 |
\csdef{forest@calign@midpoint}{% |
| 6627 |
\forest@calign@s@shift{\the\dimexpr 0pt -% |
| 6628 |
(\forestOve{\forest@node@nornbarthchildid{\forestove{calign primary child}}}{s}% |
| 6629 |
+\forestOve{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}{s}% |
| 6630 |
)/2\relax |
| 6631 |
}% |
| 6632 |
} |
| 6633 |
\csdef{forest@calign@edge midpoint}{% |
| 6634 |
{% |
| 6635 |
\edef\forest@temp@firstchild{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% |
| 6636 |
\edef\forest@temp@secondchild{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% |
| 6637 |
\pgftransformreset |
| 6638 |
\forest@pgfqtransformrotate{\forestove{grow}}% |
| 6639 |
\pgfpointtransformed{\pgfqpoint{\forestOve{\forest@temp@firstchild}{l}}{\forestOve{\forest@temp@firstchild}{s}}}% |
| 6640 |
\pgf@xa=\pgf@x\relax\pgf@ya=\pgf@y\relax |
| 6641 |
\forest@Pointanchor{\forest@temp@firstchild}{child anchor}% |
| 6642 |
\advance\pgf@xa\pgf@x\relax\advance\pgf@ya\pgf@y\relax |
| 6643 |
\edef\forest@marshal{% |
| 6644 |
\noexpand\pgfpointtransformed{\noexpand\pgfqpoint{\forestOve{\forest@temp@secondchild}{l}}{\forestOve{\forest@temp@secondchild}{s}}}% |
| 6645 |
}\forest@marshal |
| 6646 |
\advance\pgf@xa\pgf@x\relax\advance\pgf@ya\pgf@y\relax |
| 6647 |
\forest@Pointanchor{\forest@temp@secondchild}{child anchor}% |
| 6648 |
\advance\pgf@xa\pgf@x\relax\advance\pgf@ya\pgf@y\relax |
| 6649 |
\divide\pgf@xa2 \divide\pgf@ya2 |
| 6650 |
\forest@pointanchor{parent anchor}% |
| 6651 |
\advance\pgf@xa-\pgf@x\relax\advance\pgf@ya-\pgf@y\relax |
| 6652 |
\edef\forest@marshal{% |
| 6653 |
\noexpand\pgftransformreset |
| 6654 |
\noexpand\forest@pgfqtransformrotate{-\forestove{grow}}% |
| 6655 |
\noexpand\pgfpointtransformed{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% |
| 6656 |
}\forest@marshal |
| 6657 |
}% |
| 6658 |
\forest@calign@s@shift{\the\dimexpr-\the\pgf@y}% |
| 6659 |
} |
| 6660 |
\def\forest@edef@strippt#1#2{% |
| 6661 |
\edef#1{#2}% |
| 6662 |
\edef#1{\expandafter\Pgf@geT#1}% |
| 6663 |
} |
| 6664 |
\csdef{forest@calign@fixed angles}{% |
| 6665 |
\ifnum\forestove{n children}>1 |
| 6666 |
\edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% |
| 6667 |
\edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% |
| 6668 |
\ifnum\forestove{reversed}=1 |
| 6669 |
\let\forest@temp\forest@ca@first@child |
| 6670 |
\let\forest@ca@first@child\forest@ca@second@child |
| 6671 |
\let\forest@ca@second@child\forest@temp |
| 6672 |
\fi |
| 6673 |
\forestOget{\forest@ca@first@child}{l}\forest@ca@first@l |
| 6674 |
\edef\forest@ca@first@l{\expandafter\Pgf@geT\forest@ca@first@l}% |
| 6675 |
\forestOget{\forest@ca@second@child}{l}\forest@ca@second@l |
| 6676 |
\edef\forest@ca@second@l{\expandafter\Pgf@geT\forest@ca@second@l}% |
| 6677 |
\pgfmathtan@{\forestove{calign secondary angle}}% |
| 6678 |
\pgfmathmultiply@{\pgfmathresult}{\forest@ca@second@l}% |
| 6679 |
\let\forest@calign@temp\pgfmathresult |
| 6680 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6681 |
\pgfmathmultiply@{\pgfmathresult}{\forest@ca@first@l}% |
| 6682 |
\edef\forest@ca@desired@s@distance{\the\dimexpr |
| 6683 |
\forest@calign@temp pt-\pgfmathresult pt}% |
| 6684 |
% \pgfmathsetlengthmacro\forest@ca@desired@s@distance{% |
| 6685 |
% tan(\forestove{calign secondary angle})*\forest@ca@second@l |
| 6686 |
% -tan(\forestove{calign primary angle})*\forest@ca@first@l |
| 6687 |
% }% |
| 6688 |
\forestOget{\forest@ca@first@child}{s}\forest@ca@first@s |
| 6689 |
\forestOget{\forest@ca@second@child}{s}\forest@ca@second@s |
| 6690 |
\edef\forest@ca@actual@s@distance{\the\dimexpr |
| 6691 |
\forest@ca@second@s-\forest@ca@first@s}% |
| 6692 |
%\pgfmathsetlengthmacro\forest@ca@actual@s@distance{% |
| 6693 |
% \forest@ca@second@s-\forest@ca@first@s}% |
| 6694 |
\ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax |
| 6695 |
\ifdim\forest@ca@actual@s@distance=0pt |
| 6696 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6697 |
\pgfmathmultiply@{\pgfmathresult}{\forest@ca@second@l}% |
| 6698 |
\pgfutil@tempdima=\pgfmathresult pt |
| 6699 |
% \pgfmathsetlength\pgfutil@tempdima{tan(\forestove{calign primary angle})*\forest@ca@second@l}% |
| 6700 |
\pgfutil@tempdimb=\dimexpr |
| 6701 |
\forest@ca@desired@s@distance/(\forestove{n children}-1)\relax% |
| 6702 |
%\pgfmathsetlength\pgfutil@tempdimb{\forest@ca@desired@s@distance/(\forestove{n children}-1)}% |
| 6703 |
\forest@node@foreachchild{% |
| 6704 |
\forestoeset{s}{\the\pgfutil@tempdima}% |
| 6705 |
\advance\pgfutil@tempdima\pgfutil@tempdimb |
| 6706 |
}% |
| 6707 |
\def\forest@calign@anchor{0pt}% |
| 6708 |
\else |
| 6709 |
\edef\forest@marshal{\noexpand\pgfmathdivide@ |
| 6710 |
{\expandafter\Pgf@geT\forest@ca@desired@s@distance}% |
| 6711 |
{\expandafter\Pgf@geT\forest@ca@actual@s@distance}% |
| 6712 |
}\forest@marshal |
| 6713 |
\let\forest@ca@ratio\pgfmathresult |
| 6714 |
%\pgfmathsetmacro\forest@ca@ratio{% |
| 6715 |
% \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% |
| 6716 |
\forest@node@foreachchild{% |
| 6717 |
\forest@edef@strippt\forest@temp{\forestove{s}}% |
| 6718 |
\pgfmathmultiply@{\forest@ca@ratio}{\forest@temp}% |
| 6719 |
\forestoeset{s}{\the\dimexpr\pgfmathresult pt}% |
| 6720 |
%\pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{s}}% |
| 6721 |
%\forestolet{s}\forest@temp |
| 6722 |
}% |
| 6723 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6724 |
\pgfmathmultiply@{\pgfmathresult}{\forest@ca@first@l}% |
| 6725 |
\edef\forest@calign@anchor{\the\dimexpr-\pgfmathresult pt}% |
| 6726 |
%\pgfmathsetlengthmacro\forest@calign@anchor{% |
| 6727 |
% -tan(\forestove{calign primary angle})*\forest@ca@first@l}% |
| 6728 |
\fi |
| 6729 |
\else |
| 6730 |
\ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax |
| 6731 |
\edef\forest@marshal{\noexpand\pgfmathdivide@ |
| 6732 |
{\expandafter\Pgf@geT\forest@ca@actual@s@distance}% |
| 6733 |
{\expandafter\Pgf@geT\forest@ca@desired@s@distance}% |
| 6734 |
}\forest@marshal |
| 6735 |
\let\forest@ca@ratio\pgfmathresult |
| 6736 |
%\pgfmathsetlengthmacro\forest@ca@ratio{% |
| 6737 |
% \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% |
| 6738 |
\forest@node@foreachchild{% |
| 6739 |
\forest@edef@strippt\forest@temp{\forestove{l}}% |
| 6740 |
\pgfmathmultiply@{\forest@ca@ratio}{\forest@temp}% |
| 6741 |
\forestoeset{l}{\the\dimexpr\pgfmathresult pt}% |
| 6742 |
%\pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{l}}% |
| 6743 |
%\forestolet{l}\forest@temp |
| 6744 |
}% |
| 6745 |
\forestOget{\forest@ca@first@child}{l}\forest@ca@first@l |
| 6746 |
\edef\forest@ca@first@l{\expandafter\Pgf@geT\forest@ca@first@l}% |
| 6747 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6748 |
\pgfmathmultiply@{\pgfmathresult}{\forest@ca@first@l}% |
| 6749 |
\edef\forest@calign@anchor{\the\dimexpr-\pgfmathresult pt}% |
| 6750 |
%\pgfmathsetlengthmacro\forest@calign@anchor{% |
| 6751 |
% -tan(\forestove{calign primary angle})*\forest@ca@first@l}% |
| 6752 |
\fi |
| 6753 |
\fi |
| 6754 |
\forest@calign@s@shift{-\forest@calign@anchor}% |
| 6755 |
\fi |
| 6756 |
} |
| 6757 |
\csdef{forest@calign@fixed edge angles}{% |
| 6758 |
\ifnum\forestove{n children}>1 |
| 6759 |
\edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% |
| 6760 |
\edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% |
| 6761 |
\ifnum\forestove{reversed}=1 |
| 6762 |
\let\forest@temp\forest@ca@first@child |
| 6763 |
\let\forest@ca@first@child\forest@ca@second@child |
| 6764 |
\let\forest@ca@second@child\forest@temp |
| 6765 |
\fi |
| 6766 |
\forestOget{\forest@ca@first@child}{l}\forest@ca@first@l |
| 6767 |
\forestOget{\forest@ca@second@child}{l}\forest@ca@second@l |
| 6768 |
\forest@pointanchor{parent anchor}% |
| 6769 |
\edef\forest@ca@parent@anchor@s{\the\pgf@x}% |
| 6770 |
\edef\forest@ca@parent@anchor@l{\the\pgf@y}% |
| 6771 |
\forest@Pointanchor{\forest@ca@first@child}{child anchor}% |
| 6772 |
\edef\forest@ca@first@child@anchor@s{\the\pgf@x}% |
| 6773 |
\edef\forest@ca@first@child@anchor@l{\the\pgf@y}% |
| 6774 |
\forest@Pointanchor{\forest@ca@second@child}{child anchor}% |
| 6775 |
\edef\forest@ca@second@child@anchor@s{\the\pgf@x}% |
| 6776 |
\edef\forest@ca@second@child@anchor@l{\the\pgf@y}% |
| 6777 |
\pgfmathtan@{\forestove{calign secondary angle}}% |
| 6778 |
\edef\forest@temp{\the\dimexpr |
| 6779 |
\forest@ca@second@l-\forest@ca@second@child@anchor@l+\forest@ca@parent@anchor@l}% |
| 6780 |
\pgfmathmultiply@{\pgfmathresult}{\expandafter\Pgf@geT\forest@temp}% |
| 6781 |
\edef\forest@ca@desired@second@edge@s{\the\dimexpr\pgfmathresult pt}% |
| 6782 |
%\pgfmathsetlengthmacro\forest@ca@desired@second@edge@s{% |
| 6783 |
% tan(\forestove{calign secondary angle})*% |
| 6784 |
% (\forest@ca@second@l-\forest@ca@second@child@anchor@l+\forest@ca@parent@anchor@l)}% |
| 6785 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6786 |
\edef\forest@temp{\the\dimexpr |
| 6787 |
\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l}% |
| 6788 |
\pgfmathmultiply@{\pgfmathresult}{\expandafter\Pgf@geT\forest@temp}% |
| 6789 |
\edef\forest@ca@desired@first@edge@s{\the\dimexpr\pgfmathresult pt}% |
| 6790 |
%\pgfmathsetlengthmacro\forest@ca@desired@first@edge@s{% |
| 6791 |
% tan(\forestove{calign primary angle})*% |
| 6792 |
% (\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)}% |
| 6793 |
\edef\forest@ca@desired@s@distance{\the\dimexpr |
| 6794 |
\forest@ca@desired@second@edge@s-\forest@ca@desired@first@edge@s}% |
| 6795 |
%\pgfmathsetlengthmacro\forest@ca@desired@s@distance{\forest@ca@desired@second@edge@s-\forest@ca@desired@first@edge@s}% |
| 6796 |
\forestOget{\forest@ca@first@child}{s}\forest@ca@first@s |
| 6797 |
\forestOget{\forest@ca@second@child}{s}\forest@ca@second@s |
| 6798 |
\edef\forest@ca@actual@s@distance{\the\dimexpr |
| 6799 |
\forest@ca@second@s+\forest@ca@second@child@anchor@s |
| 6800 |
-\forest@ca@first@s-\forest@ca@first@child@anchor@s}% |
| 6801 |
%\pgfmathsetlengthmacro\forest@ca@actual@s@distance{% |
| 6802 |
% \forest@ca@second@s+\forest@ca@second@child@anchor@s |
| 6803 |
% -\forest@ca@first@s-\forest@ca@first@child@anchor@s}% |
| 6804 |
\ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax |
| 6805 |
\ifdim\forest@ca@actual@s@distance=0pt |
| 6806 |
\forestoget{n children}\forest@temp@n@children |
| 6807 |
\forest@node@foreachchild{% |
| 6808 |
\forest@pointanchor{child anchor}% |
| 6809 |
\edef\forest@temp@child@anchor@s{\the\pgf@x}% |
| 6810 |
\forestoeset{s}{\the\dimexpr |
| 6811 |
\forest@ca@desired@first@edge@s+\forest@ca@desired@s@distance*(\forestove{n}-1)/(\forest@temp@n@children-1)+\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% |
| 6812 |
%\pgfmathsetlengthmacro\forest@temp{% |
| 6813 |
% \forest@ca@desired@first@edge@s+(\forestove{n}-1)*\forest@ca@desired@s@distance/(\forest@temp@n@children-1)+\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% |
| 6814 |
%\forestolet{s}\forest@temp |
| 6815 |
}% |
| 6816 |
\def\forest@calign@anchor{0pt}% |
| 6817 |
\else |
| 6818 |
\edef\forest@marshal{\noexpand\pgfmathdivide@ |
| 6819 |
{\expandafter\Pgf@geT\forest@ca@desired@s@distance}% |
| 6820 |
{\expandafter\Pgf@geT\forest@ca@actual@s@distance}% |
| 6821 |
}\forest@marshal |
| 6822 |
\let\forest@ca@ratio\pgfmathresult |
| 6823 |
%\pgfmathsetmacro\forest@ca@ratio{% |
| 6824 |
% \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% |
| 6825 |
\forest@node@foreachchild{% |
| 6826 |
\forest@pointanchor{child anchor}% |
| 6827 |
\edef\forest@temp@child@anchor@s{\the\pgf@x}% |
| 6828 |
\edef\forest@marshal{\noexpand\pgfmathmultiply@ |
| 6829 |
{\forest@ca@ratio}% |
| 6830 |
{\expandafter\Pgf@geT\the\dimexpr |
| 6831 |
\forestove{s}-\forest@ca@first@s+% |
| 6832 |
\forest@temp@child@anchor@s-\forest@ca@first@child@anchor@s}% |
| 6833 |
}\forest@marshal |
| 6834 |
\forestoeset{s}{\the\dimexpr\pgfmathresult pt+\forest@ca@first@s |
| 6835 |
+\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% |
| 6836 |
% \pgfmathsetlengthmacro\forest@temp{% |
| 6837 |
% \forest@ca@ratio*(% |
| 6838 |
% \forestove{s}-\forest@ca@first@s |
| 6839 |
% +\forest@temp@child@anchor@s-\forest@ca@first@child@anchor@s)% |
| 6840 |
% +\forest@ca@first@s |
| 6841 |
% +\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% |
| 6842 |
% \forestolet{s}\forest@temp |
| 6843 |
}% |
| 6844 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6845 |
\edef\forest@marshal{\noexpand\pgfmathmultiply@ |
| 6846 |
{\pgfmathresult}% |
| 6847 |
{\expandafter\Pgf@geT\the\dimexpr |
| 6848 |
\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l}% |
| 6849 |
}\forest@marshal |
| 6850 |
\edef\forest@calign@anchor{\the\dimexpr |
| 6851 |
-\pgfmathresult pt+\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s}% |
| 6852 |
% \pgfmathsetlengthmacro\forest@calign@anchor{% |
| 6853 |
% -tan(\forestove{calign primary angle})*(\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)% |
| 6854 |
% +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s |
| 6855 |
% }% |
| 6856 |
\fi |
| 6857 |
\else |
| 6858 |
\ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax |
| 6859 |
\edef\forest@marshal{\noexpand\pgfmathdivide@ |
| 6860 |
{\expandafter\Pgf@geT\forest@ca@actual@s@distance}% |
| 6861 |
{\expandafter\Pgf@geT\forest@ca@desired@s@distance}% |
| 6862 |
}\forest@marshal |
| 6863 |
\let\forest@ca@ratio\pgfmathresult |
| 6864 |
%\pgfmathsetlengthmacro\forest@ca@ratio{% |
| 6865 |
% \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% |
| 6866 |
\forest@node@foreachchild{% |
| 6867 |
\forest@pointanchor{child anchor}% |
| 6868 |
\edef\forest@temp@child@anchor@l{\the\pgf@y}% |
| 6869 |
\edef\forest@marshal{\noexpand\pgfmathmultiply@ |
| 6870 |
{\forest@ca@ratio}% |
| 6871 |
{\expandafter\Pgf@geT\the\dimexpr\forestove{l}+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l}% |
| 6872 |
}\forest@marshal |
| 6873 |
\forestoeset{l}{\the\dimexpr |
| 6874 |
\pgfmathresult pt-\forest@ca@parent@anchor@l+\forest@temp@child@anchor@l}% |
| 6875 |
% \pgfmathsetlengthmacro\forest@temp{% |
| 6876 |
% \forest@ca@ratio*(% |
| 6877 |
% \forestove{l}+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l) |
| 6878 |
% -\forest@ca@parent@anchor@l+\forest@temp@child@anchor@l}% |
| 6879 |
% \forestolet{l}\forest@temp |
| 6880 |
}% |
| 6881 |
\forestOget{\forest@ca@first@child}{l}\forest@ca@first@l |
| 6882 |
\pgfmathtan@{\forestove{calign primary angle}}% |
| 6883 |
\edef\forest@marshal{\noexpand\pgfmathmultiply@ |
| 6884 |
{\pgfmathresult}% |
| 6885 |
{\expandafter\Pgf@geT\the\dimexpr |
| 6886 |
\forest@ca@first@l+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l}% |
| 6887 |
}\forest@marshal |
| 6888 |
\edef\forest@calign@anchor{\the\dimexpr |
| 6889 |
-\pgfmathresult pt+\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s}% |
| 6890 |
% \pgfmathsetlengthmacro\forest@calign@anchor{% |
| 6891 |
% -tan(\forestove{calign primary angle})*(\forest@ca@first@l+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l)% |
| 6892 |
% +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s |
| 6893 |
% }% |
| 6894 |
\fi |
| 6895 |
\fi |
| 6896 |
\forest@calign@s@shift{-\forest@calign@anchor}% |
| 6897 |
\fi |
| 6898 |
} |
| 6899 |
\def\forest@node@getedge#1#2#3{% |
| 6900 |
\forestoget{#1@edge@#2}#3% |
| 6901 |
\ifx#3\relax |
| 6902 |
\forest@node@foreachchild{% |
| 6903 |
\forest@node@getedge{#1}{#2}{\forest@temp@edge}% |
| 6904 |
}% |
| 6905 |
\forest@forthis{\forest@node@getedges{#2}}% |
| 6906 |
\forestoget{#1@edge@#2}#3% |
| 6907 |
\fi |
| 6908 |
} |
| 6909 |
\def\forest@node@getedges#1{% |
| 6910 |
%{% |
| 6911 |
\forest@setupgrowline{#1}% |
| 6912 |
\ifnum\forestove{ignore}=0 |
| 6913 |
\forestoget{@boundary}\forest@node@boundary |
| 6914 |
\else |
| 6915 |
\def\forest@node@boundary{}% |
| 6916 |
\fi |
| 6917 |
\csname forest@getboth\forestove{fit}edgesofpath\endcsname |
| 6918 |
\forest@node@boundary\forest@negative@node@edge\forest@positive@node@edge |
| 6919 |
\forestolet{negative@edge@#1}\forest@negative@node@edge |
| 6920 |
\forestolet{positive@edge@#1}\forest@positive@node@edge |
| 6921 |
\forest@get@edges@merge{negative}{#1}% |
| 6922 |
\forest@get@edges@merge{positive}{#1}% |
| 6923 |
%}% |
| 6924 |
} |
| 6925 |
\def\forest@get@edges@merge#1#2{% |
| 6926 |
\ifnum\forestove{n children}>0 |
| 6927 |
\forestoget{#1@edge@#2}\forest@node@edge |
| 6928 |
\forest@pointanchor{parent anchor}% |
| 6929 |
\edef\forest@getedge@pa@l{\the\pgf@x}% |
| 6930 |
\edef\forest@getedge@pa@s{\the\pgf@y}% |
| 6931 |
\eappto\forest@node@edge{\noexpand\pgfsyssoftpath@movetotoken{\forest@getedge@pa@l}{\forest@getedge@pa@s}}% |
| 6932 |
\pgfgettransform\forest@temp@transform |
| 6933 |
\pgftransformreset |
| 6934 |
\forest@pgfqtransformrotate{\forestove{grow}}% |
| 6935 |
\def\forest@all@edges{}% |
| 6936 |
\forest@node@foreachchild{% |
| 6937 |
\forestoget{#1@edge@#2}\forest@temp@edge |
| 6938 |
\pgfpointtransformed{\pgfqpoint{\forestove{l}}{\forestove{s}}}% |
| 6939 |
\forest@extendpath\forest@node@edge\forest@temp@edge{}% |
| 6940 |
\ifnum\forestove{ignore edge}=0 |
| 6941 |
\pgfpointadd |
| 6942 |
{\pgfpointtransformed{\pgfqpoint{\forestove{l}}{\forestove{s}}}}% |
| 6943 |
{\forest@pointanchor{child anchor}}% |
| 6944 |
\pgfgetlastxy{\forest@getedge@ca@l}{\forest@getedge@ca@s}% |
| 6945 |
\eappto\forest@all@edges{% |
| 6946 |
\noexpand\pgfsyssoftpath@movetotoken{\forest@getedge@pa@l}{\forest@getedge@pa@s}% |
| 6947 |
\noexpand\pgfsyssoftpath@linetotoken{\forest@getedge@ca@l}{\forest@getedge@ca@s}% |
| 6948 |
}% |
| 6949 |
% this deals with potential overlap of the edges: |
| 6950 |
\eappto\forest@node@edge{\noexpand\pgfsyssoftpath@movetotoken{\forest@getedge@ca@l}{\forest@getedge@ca@s}}% |
| 6951 |
\fi |
| 6952 |
}% |
| 6953 |
\ifdefempty{\forest@all@edges}{}{% |
| 6954 |
\pgfintersectionofpaths{\pgfsetpath\forest@all@edges}{\pgfsetpath\forest@node@edge}% |
| 6955 |
\def\forest@edgenode@intersections{}% |
| 6956 |
\forest@merge@intersectionloop |
| 6957 |
\eappto\forest@node@edge{\expandonce{\forest@all@edges}\expandonce{\forest@edgenode@intersections}}% |
| 6958 |
}% |
| 6959 |
\pgfsettransform\forest@temp@transform |
| 6960 |
\csname forest@get#1\forestove{fit}edgeofpath\endcsname\forest@node@edge\forest@node@edge |
| 6961 |
\forestolet{#1@edge@#2}\forest@node@edge |
| 6962 |
\fi |
| 6963 |
} |
| 6964 |
\def\forest@merge@intersectionloop{% |
| 6965 |
\c@pgf@counta=0 |
| 6966 |
\forest@loop |
| 6967 |
\ifnum\c@pgf@counta<\pgfintersectionsolutions\relax |
| 6968 |
\advance\c@pgf@counta1 |
| 6969 |
\pgfpointintersectionsolution{\the\c@pgf@counta}% |
| 6970 |
\eappto\forest@edgenode@intersections{\noexpand\pgfsyssoftpath@movetotoken |
| 6971 |
{\the\pgf@x}{\the\pgf@y}}% |
| 6972 |
\forest@repeat |
| 6973 |
} |
| 6974 |
\def\forest@node@getboundingrectangle@ls#1{% |
| 6975 |
\forestoget{@boundary}\forest@node@boundary |
| 6976 |
\forest@path@getboundingrectangle@ls\forest@node@boundary{#1}% |
| 6977 |
} |
| 6978 |
\def\forest@pgfpathtransformed#1{% |
| 6979 |
\forest@save@pgfsyssoftpath@tokendefs |
| 6980 |
\let\pgfsyssoftpath@movetotoken\forest@pgfpathtransformed@moveto |
| 6981 |
\let\pgfsyssoftpath@linetotoken\forest@pgfpathtransformed@lineto |
| 6982 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty |
| 6983 |
#1% |
| 6984 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 6985 |
} |
| 6986 |
\def\forest@pgfpathtransformed@moveto#1#2{% |
| 6987 |
\forest@pgfpathtransformed@op\pgfsyssoftpath@moveto{#1}{#2}% |
| 6988 |
} |
| 6989 |
\def\forest@pgfpathtransformed@lineto#1#2{% |
| 6990 |
\forest@pgfpathtransformed@op\pgfsyssoftpath@lineto{#1}{#2}% |
| 6991 |
} |
| 6992 |
\def\forest@pgfpathtransformed@op#1#2#3{% |
| 6993 |
\pgfpointtransformed{\pgfqpoint{#2}{#3}}% |
| 6994 |
\edef\forest@temp{% |
| 6995 |
\noexpand#1{\the\pgf@x}{\the\pgf@y}% |
| 6996 |
}% |
| 6997 |
\forest@temp |
| 6998 |
} |
| 6999 |
\def\forest@pack@computetiers{% |
| 7000 |
{% |
| 7001 |
\forest@pack@tiers@getalltiersinsubtree |
| 7002 |
\forest@pack@tiers@computetierhierarchy |
| 7003 |
\forest@pack@tiers@findcontainers |
| 7004 |
\forest@pack@tiers@raisecontainers |
| 7005 |
\forest@pack@tiers@computeprocessingorder |
| 7006 |
\gdef\forest@smuggle{}% |
| 7007 |
\forest@pack@tiers@write |
| 7008 |
}% |
| 7009 |
\forest@node@foreach{\forestoset{@tiers}{}}% |
| 7010 |
\forest@smuggle |
| 7011 |
} |
| 7012 |
\def\forest@pack@tiers@getalltiersinsubtree{% |
| 7013 |
\ifnum\forestove{n children}>0 |
| 7014 |
\forest@node@foreachchild{\forest@pack@tiers@getalltiersinsubtree}% |
| 7015 |
\fi |
| 7016 |
\forestoget{tier}\forest@temp@mytier |
| 7017 |
\def\forest@temp@mytiers{}% |
| 7018 |
\ifdefempty\forest@temp@mytier{}{% |
| 7019 |
\listeadd\forest@temp@mytiers\forest@temp@mytier |
| 7020 |
}% |
| 7021 |
\ifnum\forestove{n children}>0 |
| 7022 |
\forest@node@foreachchild{% |
| 7023 |
\forestoget{tiers}\forest@temp@tiers |
| 7024 |
\forlistloop\forest@pack@tiers@forhandlerA\forest@temp@tiers |
| 7025 |
}% |
| 7026 |
\fi |
| 7027 |
\forestolet{tiers}\forest@temp@mytiers |
| 7028 |
} |
| 7029 |
\def\forest@pack@tiers@forhandlerA#1{% |
| 7030 |
\ifinlist{#1}\forest@temp@mytiers{}{% |
| 7031 |
\listeadd\forest@temp@mytiers{#1}% |
| 7032 |
}% |
| 7033 |
} |
| 7034 |
\def\forest@pack@tiers@computetierhierarchy{% |
| 7035 |
\def\forest@tiers@ancestors{}% |
| 7036 |
\forestoget{tiers}\forest@temp@mytiers |
| 7037 |
\forlistloop\forest@pack@tiers@cth@init\forest@temp@mytiers |
| 7038 |
\forest@pack@tiers@computetierhierarchy@ |
| 7039 |
} |
| 7040 |
\def\forest@pack@tiers@cth@init#1{% |
| 7041 |
\csdef{forest@tiers@higher@#1}{}% |
| 7042 |
\csdef{forest@tiers@lower@#1}{}% |
| 7043 |
} |
| 7044 |
\def\forest@pack@tiers@computetierhierarchy@{% |
| 7045 |
\forestoget{tier}\forest@temp@mytier |
| 7046 |
\ifdefempty\forest@temp@mytier{}{% |
| 7047 |
\forlistloop\forest@pack@tiers@forhandlerB\forest@tiers@ancestors |
| 7048 |
\listeadd\forest@tiers@ancestors\forest@temp@mytier |
| 7049 |
}% |
| 7050 |
\forest@node@foreachchild{% |
| 7051 |
\forest@pack@tiers@computetierhierarchy@ |
| 7052 |
}% |
| 7053 |
\forestoget{tier}\forest@temp@mytier |
| 7054 |
\ifdefempty\forest@temp@mytier{}{% |
| 7055 |
\forest@listedel\forest@tiers@ancestors\forest@temp@mytier |
| 7056 |
}% |
| 7057 |
} |
| 7058 |
\def\forest@pack@tiers@forhandlerB#1{% |
| 7059 |
\def\forest@temp@tier{#1}% |
| 7060 |
\ifx\forest@temp@tier\forest@temp@mytier |
| 7061 |
\PackageError{forest}{Circular tier hierarchy (tier \forest@temp@mytier)}{}% |
| 7062 |
\fi |
| 7063 |
\ifinlistcs{#1}{forest@tiers@higher@\forest@temp@mytier}{}{% |
| 7064 |
\listcsadd{forest@tiers@higher@\forest@temp@mytier}{#1}}% |
| 7065 |
\xifinlistcs\forest@temp@mytier{forest@tiers@lower@#1}{}{% |
| 7066 |
\listcseadd{forest@tiers@lower@#1}{\forest@temp@mytier}}% |
| 7067 |
} |
| 7068 |
\def\forest@pack@tiers@findcontainers{% |
| 7069 |
\forestoget{tiers}\forest@temp@tiers |
| 7070 |
\forlistloop\forest@pack@tiers@findcontainer\forest@temp@tiers |
| 7071 |
} |
| 7072 |
\def\forest@pack@tiers@findcontainer#1{% |
| 7073 |
\def\forest@temp@tier{#1}% |
| 7074 |
\forestoget{tier}\forest@temp@mytier |
| 7075 |
\ifx\forest@temp@tier\forest@temp@mytier |
| 7076 |
\csedef{forest@tiers@container@#1}{\forest@cn}% |
| 7077 |
\else\@escapeif{% |
| 7078 |
\forest@pack@tiers@findcontainerA{#1}% |
| 7079 |
}\fi% |
| 7080 |
} |
| 7081 |
\def\forest@pack@tiers@findcontainerA#1{% |
| 7082 |
\c@pgf@counta=0 |
| 7083 |
\forest@node@foreachchild{% |
| 7084 |
\forestoget{tiers}\forest@temp@tiers |
| 7085 |
\ifinlist{#1}\forest@temp@tiers{% |
| 7086 |
\advance\c@pgf@counta 1 |
| 7087 |
\let\forest@temp@child\forest@cn |
| 7088 |
}{}% |
| 7089 |
}% |
| 7090 |
\ifnum\c@pgf@counta>1 |
| 7091 |
\csedef{forest@tiers@container@#1}{\forest@cn}% |
| 7092 |
\else\@escapeif{% surely =1 |
| 7093 |
\forest@fornode{\forest@temp@child}{% |
| 7094 |
\forest@pack@tiers@findcontainer{#1}% |
| 7095 |
}% |
| 7096 |
}\fi |
| 7097 |
} |
| 7098 |
\def\forest@pack@tiers@raisecontainers{% |
| 7099 |
\forestoget{tiers}\forest@temp@mytiers |
| 7100 |
\forlistloop\forest@pack@tiers@rc@forhandlerA\forest@temp@mytiers |
| 7101 |
} |
| 7102 |
\def\forest@pack@tiers@rc@forhandlerA#1{% |
| 7103 |
\edef\forest@tiers@temptier{#1}% |
| 7104 |
\letcs\forest@tiers@containernodeoftier{forest@tiers@container@#1}% |
| 7105 |
\letcs\forest@temp@lowertiers{forest@tiers@lower@#1}% |
| 7106 |
\forlistloop\forest@pack@tiers@rc@forhandlerB\forest@temp@lowertiers |
| 7107 |
} |
| 7108 |
\def\forest@pack@tiers@rc@forhandlerB#1{% |
| 7109 |
\letcs\forest@tiers@containernodeoflowertier{forest@tiers@container@#1}% |
| 7110 |
\forestOget{\forest@tiers@containernodeoflowertier}{content}\lowercontent |
| 7111 |
\forestOget{\forest@tiers@containernodeoftier}{content}\uppercontent |
| 7112 |
\forest@fornode{\forest@tiers@containernodeoflowertier}{% |
| 7113 |
\forest@ifancestorof |
| 7114 |
{\forest@tiers@containernodeoftier} |
| 7115 |
{\csletcs{forest@tiers@container@\forest@tiers@temptier}{forest@tiers@container@#1}}% |
| 7116 |
{}% |
| 7117 |
}% |
| 7118 |
} |
| 7119 |
\def\forest@pack@tiers@computeprocessingorder{% |
| 7120 |
\def\forest@tiers@processingorder{}% |
| 7121 |
\forestoget{tiers}\forest@tiers@cpo@tierstodo |
| 7122 |
\safeloop |
| 7123 |
\ifdefempty\forest@tiers@cpo@tierstodo{\forest@tempfalse}{\forest@temptrue}% |
| 7124 |
\ifforest@temp |
| 7125 |
\def\forest@tiers@cpo@tiersremaining{}% |
| 7126 |
\def\forest@tiers@cpo@tiersindependent{}% |
| 7127 |
\forlistloop\forest@pack@tiers@cpo@forhandlerA\forest@tiers@cpo@tierstodo |
| 7128 |
\ifdefempty\forest@tiers@cpo@tiersindependent{% |
| 7129 |
\PackageError{forest}{Circular tiers!}{}}{}% |
| 7130 |
\forlistloop\forest@pack@tiers@cpo@forhandlerB\forest@tiers@cpo@tiersremaining |
| 7131 |
\let\forest@tiers@cpo@tierstodo\forest@tiers@cpo@tiersremaining |
| 7132 |
\saferepeat |
| 7133 |
} |
| 7134 |
\def\forest@pack@tiers@cpo@forhandlerA#1{% |
| 7135 |
\ifcsempty{forest@tiers@higher@#1}{% |
| 7136 |
\listadd\forest@tiers@cpo@tiersindependent{#1}% |
| 7137 |
\listadd\forest@tiers@processingorder{#1}% |
| 7138 |
}{% |
| 7139 |
\listadd\forest@tiers@cpo@tiersremaining{#1}% |
| 7140 |
}% |
| 7141 |
} |
| 7142 |
\def\forest@pack@tiers@cpo@forhandlerB#1{% |
| 7143 |
\def\forest@pack@tiers@cpo@aremainingtier{#1}% |
| 7144 |
\forlistloop\forest@pack@tiers@cpo@forhandlerC\forest@tiers@cpo@tiersindependent |
| 7145 |
} |
| 7146 |
\def\forest@pack@tiers@cpo@forhandlerC#1{% |
| 7147 |
\ifinlistcs{#1}{forest@tiers@higher@\forest@pack@tiers@cpo@aremainingtier}{% |
| 7148 |
\forest@listcsdel{forest@tiers@higher@\forest@pack@tiers@cpo@aremainingtier}{#1}% |
| 7149 |
}{}% |
| 7150 |
} |
| 7151 |
\def\forest@pack@tiers@write{% |
| 7152 |
\forlistloop\forest@pack@tiers@write@forhandler\forest@tiers@processingorder |
| 7153 |
} |
| 7154 |
\def\forest@pack@tiers@write@forhandler#1{% |
| 7155 |
\forest@fornode{\csname forest@tiers@container@#1\endcsname}{% |
| 7156 |
\forest@pack@tiers@check{#1}% |
| 7157 |
}% |
| 7158 |
\xappto\forest@smuggle{% |
| 7159 |
\noexpand\listadd |
| 7160 |
\forestOm{\csname forest@tiers@container@#1\endcsname}{@tiers}% |
| 7161 |
{#1}% |
| 7162 |
}% |
| 7163 |
} |
| 7164 |
% checks if the tier is compatible with growth changes and calign=node/edge angle |
| 7165 |
\def\forest@pack@tiers@check#1{% |
| 7166 |
\def\forest@temp@currenttier{#1}% |
| 7167 |
\forest@node@foreachdescendant{% |
| 7168 |
\ifnum\forestove{grow}=\forestOve{\forestove{@parent}}{grow} |
| 7169 |
\else |
| 7170 |
\forest@pack@tiers@check@grow |
| 7171 |
\fi |
| 7172 |
\ifnum\forestove{n children}>1 |
| 7173 |
\forestoget{calign}\forest@temp |
| 7174 |
\ifx\forest@temp\forest@pack@tiers@check@nodeangle |
| 7175 |
\forest@pack@tiers@check@calign |
| 7176 |
\fi |
| 7177 |
\ifx\forest@temp\forest@pack@tiers@check@edgeangle |
| 7178 |
\forest@pack@tiers@check@calign |
| 7179 |
\fi |
| 7180 |
\fi |
| 7181 |
}% |
| 7182 |
} |
| 7183 |
\def\forest@pack@tiers@check@nodeangle{node angle}% |
| 7184 |
\def\forest@pack@tiers@check@edgeangle{edge angle}% |
| 7185 |
\def\forest@pack@tiers@check@grow{% |
| 7186 |
\forestoget{content}\forest@temp@content |
| 7187 |
\let\forest@temp@currentnode\forest@cn |
| 7188 |
\forest@node@foreachdescendant{% |
| 7189 |
\forestoget{tier}\forest@temp |
| 7190 |
\ifx\forest@temp@currenttier\forest@temp |
| 7191 |
\forest@pack@tiers@check@grow@error |
| 7192 |
\fi |
| 7193 |
}% |
| 7194 |
} |
| 7195 |
\def\forest@pack@tiers@check@grow@error{% |
| 7196 |
\PackageError{forest}{Tree growth direction changes in node \forest@temp@currentnode\space |
| 7197 |
(content: \forest@temp@content), while tier '\forest@temp' is specified for nodes both |
| 7198 |
out- and inside the subtree rooted in node \forest@temp@currentnode. This will not work.}{}% |
| 7199 |
} |
| 7200 |
\def\forest@pack@tiers@check@calign{% |
| 7201 |
\forest@node@foreachchild{% |
| 7202 |
\forestoget{tier}\forest@temp |
| 7203 |
\ifx\forest@temp@currenttier\forest@temp |
| 7204 |
\forest@pack@tiers@check@calign@warning |
| 7205 |
\fi |
| 7206 |
}% |
| 7207 |
} |
| 7208 |
\def\forest@pack@tiers@check@calign@warning{% |
| 7209 |
\PackageWarning{forest}{Potential option conflict: node \forestove{@parent} (content: |
| 7210 |
'\forestOve{\forestove{@parent}}{content}') was given 'calign=\forestove{calign}', while its |
| 7211 |
child \forest@cn\space (content: '\forestove{content}') was given 'tier=\forestove{tier}'. |
| 7212 |
The parent's 'calign' will only work if the child was the lowest node on its tier before the |
| 7213 |
alignment.}% |
| 7214 |
} |
| 7215 |
\pgfdeclaregenericanchor{forestcomputenodeboundary}{% |
| 7216 |
\letcs\forest@temp@boundary@macro{forest@compute@node@boundary@#1}% |
| 7217 |
\ifcsname forest@compute@node@boundary@#1\endcsname |
| 7218 |
\csname forest@compute@node@boundary@#1\endcsname |
| 7219 |
\else |
| 7220 |
\forest@compute@node@boundary@rectangle |
| 7221 |
\fi |
| 7222 |
\pgfsyssoftpath@getcurrentpath\forest@temp |
| 7223 |
\global\let\forest@global@boundary\forest@temp |
| 7224 |
} |
| 7225 |
\def\forest@mt#1{% |
| 7226 |
\expandafter\pgfpointanchor\expandafter{\pgfreferencednodename}{#1}% |
| 7227 |
\pgfsyssoftpath@moveto{\the\pgf@x}{\the\pgf@y}% |
| 7228 |
}% |
| 7229 |
\def\forest@lt#1{% |
| 7230 |
\expandafter\pgfpointanchor\expandafter{\pgfreferencednodename}{#1}% |
| 7231 |
\pgfsyssoftpath@lineto{\the\pgf@x}{\the\pgf@y}% |
| 7232 |
}% |
| 7233 |
\def\forest@compute@node@boundary@coordinate{% |
| 7234 |
\forest@mt{center}% |
| 7235 |
} |
| 7236 |
\def\forest@compute@node@boundary@circle{% |
| 7237 |
\forest@mt{east}% |
| 7238 |
\forest@lt{north east}% |
| 7239 |
\forest@lt{north}% |
| 7240 |
\forest@lt{north west}% |
| 7241 |
\forest@lt{west}% |
| 7242 |
\forest@lt{south west}% |
| 7243 |
\forest@lt{south}% |
| 7244 |
\forest@lt{south east}% |
| 7245 |
\forest@lt{east}% |
| 7246 |
} |
| 7247 |
\def\forest@compute@node@boundary@rectangle{% |
| 7248 |
\forest@mt{south west}% |
| 7249 |
\forest@lt{south east}% |
| 7250 |
\forest@lt{north east}% |
| 7251 |
\forest@lt{north west}% |
| 7252 |
\forest@lt{south west}% |
| 7253 |
} |
| 7254 |
\def\forest@compute@node@boundary@diamond{% |
| 7255 |
\forest@mt{east}% |
| 7256 |
\forest@lt{north}% |
| 7257 |
\forest@lt{west}% |
| 7258 |
\forest@lt{south}% |
| 7259 |
\forest@lt{east}% |
| 7260 |
} |
| 7261 |
\let\forest@compute@node@boundary@ellipse\forest@compute@node@boundary@circle |
| 7262 |
\def\forest@compute@node@boundary@trapezium{% |
| 7263 |
\forest@mt{top right corner}% |
| 7264 |
\forest@lt{top left corner}% |
| 7265 |
\forest@lt{bottom left corner}% |
| 7266 |
\forest@lt{bottom right corner}% |
| 7267 |
\forest@lt{top right corner}% |
| 7268 |
} |
| 7269 |
\def\forest@compute@node@boundary@semicircle{% |
| 7270 |
\forest@mt{arc start}% |
| 7271 |
\forest@lt{north}% |
| 7272 |
\forest@lt{east}% |
| 7273 |
\forest@lt{north east}% |
| 7274 |
\forest@lt{apex}% |
| 7275 |
\forest@lt{north west}% |
| 7276 |
\forest@lt{west}% |
| 7277 |
\forest@lt{arc end}% |
| 7278 |
\forest@lt{arc start}% |
| 7279 |
} |
| 7280 |
\csdef{forest@compute@node@boundary@regular polygon}{% |
| 7281 |
\forest@mt{corner 1}% |
| 7282 |
\c@pgf@counta=\sides\relax |
| 7283 |
\forest@loop |
| 7284 |
\ifnum\c@pgf@counta>0 |
| 7285 |
\forest@lt{corner \the\c@pgf@counta}% |
| 7286 |
\advance\c@pgf@counta-1 |
| 7287 |
\forest@repeat |
| 7288 |
}% |
| 7289 |
\def\forest@compute@node@boundary@star{% |
| 7290 |
\forest@mt{outer point 1}% |
| 7291 |
\c@pgf@counta=\totalstarpoints\relax |
| 7292 |
\divide\c@pgf@counta2 |
| 7293 |
\forest@loop |
| 7294 |
\ifnum\c@pgf@counta>0 |
| 7295 |
\forest@lt{inner point \the\c@pgf@counta}% |
| 7296 |
\forest@lt{outer point \the\c@pgf@counta}% |
| 7297 |
\advance\c@pgf@counta-1 |
| 7298 |
\forest@repeat |
| 7299 |
}% |
| 7300 |
\csdef{forest@compute@node@boundary@isosceles triangle}{% |
| 7301 |
\forest@mt{apex}% |
| 7302 |
\forest@lt{left corner}% |
| 7303 |
\forest@lt{right corner}% |
| 7304 |
\forest@lt{apex}% |
| 7305 |
} |
| 7306 |
\def\forest@compute@node@boundary@kite{% |
| 7307 |
\forest@mt{upper vertex}% |
| 7308 |
\forest@lt{left vertex}% |
| 7309 |
\forest@lt{lower vertex}% |
| 7310 |
\forest@lt{right vertex}% |
| 7311 |
\forest@lt{upper vertex}% |
| 7312 |
} |
| 7313 |
\def\forest@compute@node@boundary@dart{% |
| 7314 |
\forest@mt{tip}% |
| 7315 |
\forest@lt{left tail}% |
| 7316 |
\forest@lt{tail center}% |
| 7317 |
\forest@lt{right tail}% |
| 7318 |
\forest@lt{tip}% |
| 7319 |
} |
| 7320 |
\csdef{forest@compute@node@boundary@circular sector}{% |
| 7321 |
\forest@mt{sector center}% |
| 7322 |
\forest@lt{arc start}% |
| 7323 |
\forest@lt{arc center}% |
| 7324 |
\forest@lt{arc end}% |
| 7325 |
\forest@lt{sector center}% |
| 7326 |
} |
| 7327 |
\def\forest@compute@node@boundary@cylinder{% |
| 7328 |
\forest@mt{top}% |
| 7329 |
\forest@lt{after top}% |
| 7330 |
\forest@lt{before bottom}% |
| 7331 |
\forest@lt{bottom}% |
| 7332 |
\forest@lt{after bottom}% |
| 7333 |
\forest@lt{before top}% |
| 7334 |
\forest@lt{top}% |
| 7335 |
} |
| 7336 |
\cslet{forest@compute@node@boundary@forbidden sign}\forest@compute@node@boundary@circle |
| 7337 |
\cslet{forest@compute@node@boundary@magnifying glass}\forest@compute@node@boundary@circle |
| 7338 |
\def\forest@compute@node@boundary@cloud{% |
| 7339 |
\getradii |
| 7340 |
\forest@mt{puff 1}% |
| 7341 |
\c@pgf@counta=\puffs\relax |
| 7342 |
\forest@loop |
| 7343 |
\ifnum\c@pgf@counta>0 |
| 7344 |
\forest@lt{puff \the\c@pgf@counta}% |
| 7345 |
\advance\c@pgf@counta-1 |
| 7346 |
\forest@repeat |
| 7347 |
} |
| 7348 |
\def\forest@compute@node@boundary@starburst{ |
| 7349 |
\calculatestarburstpoints |
| 7350 |
\forest@mt{outer point 1}% |
| 7351 |
\c@pgf@counta=\totalpoints\relax |
| 7352 |
\divide\c@pgf@counta2 |
| 7353 |
\forest@loop |
| 7354 |
\ifnum\c@pgf@counta>0 |
| 7355 |
\forest@lt{inner point \the\c@pgf@counta}% |
| 7356 |
\forest@lt{outer point \the\c@pgf@counta}% |
| 7357 |
\advance\c@pgf@counta-1 |
| 7358 |
\forest@repeat |
| 7359 |
}% |
| 7360 |
\def\forest@compute@node@boundary@signal{% |
| 7361 |
\forest@mt{east}% |
| 7362 |
\forest@lt{south east}% |
| 7363 |
\forest@lt{south west}% |
| 7364 |
\forest@lt{west}% |
| 7365 |
\forest@lt{north west}% |
| 7366 |
\forest@lt{north east}% |
| 7367 |
\forest@lt{east}% |
| 7368 |
} |
| 7369 |
\def\forest@compute@node@boundary@tape{% |
| 7370 |
\forest@mt{north east}% |
| 7371 |
\forest@lt{60}% |
| 7372 |
\forest@lt{north}% |
| 7373 |
\forest@lt{120}% |
| 7374 |
\forest@lt{north west}% |
| 7375 |
\forest@lt{south west}% |
| 7376 |
\forest@lt{240}% |
| 7377 |
\forest@lt{south}% |
| 7378 |
\forest@lt{310}% |
| 7379 |
\forest@lt{south east}% |
| 7380 |
\forest@lt{north east}% |
| 7381 |
} |
| 7382 |
\csdef{forest@compute@node@boundary@single arrow}{% |
| 7383 |
\forest@mt{tip}% |
| 7384 |
\forest@lt{after tip}% |
| 7385 |
\forest@lt{after head}% |
| 7386 |
\forest@lt{before tail}% |
| 7387 |
\forest@lt{after tail}% |
| 7388 |
\forest@lt{before head}% |
| 7389 |
\forest@lt{before tip}% |
| 7390 |
\forest@lt{tip}% |
| 7391 |
} |
| 7392 |
\csdef{forest@compute@node@boundary@double arrow}{% |
| 7393 |
\forest@mt{tip 1}% |
| 7394 |
\forest@lt{after tip 1}% |
| 7395 |
\forest@lt{after head 1}% |
| 7396 |
\forest@lt{before head 2}% |
| 7397 |
\forest@lt{before tip 2}% |
| 7398 |
\forest@mt{tip 2}% |
| 7399 |
\forest@lt{after tip 2}% |
| 7400 |
\forest@lt{after head 2}% |
| 7401 |
\forest@lt{before head 1}% |
| 7402 |
\forest@lt{before tip 1}% |
| 7403 |
\forest@lt{tip 1}% |
| 7404 |
} |
| 7405 |
\csdef{forest@compute@node@boundary@arrow box}{% |
| 7406 |
\forest@mt{before north arrow}% |
| 7407 |
\forest@lt{before north arrow head}% |
| 7408 |
\forest@lt{before north arrow tip}% |
| 7409 |
\forest@lt{north arrow tip}% |
| 7410 |
\forest@lt{after north arrow tip}% |
| 7411 |
\forest@lt{after north arrow head}% |
| 7412 |
\forest@lt{after north arrow}% |
| 7413 |
\forest@lt{north east}% |
| 7414 |
\forest@lt{before east arrow}% |
| 7415 |
\forest@lt{before east arrow head}% |
| 7416 |
\forest@lt{before east arrow tip}% |
| 7417 |
\forest@lt{east arrow tip}% |
| 7418 |
\forest@lt{after east arrow tip}% |
| 7419 |
\forest@lt{after east arrow head}% |
| 7420 |
\forest@lt{after east arrow}% |
| 7421 |
\forest@lt{south east}% |
| 7422 |
\forest@lt{before south arrow}% |
| 7423 |
\forest@lt{before south arrow head}% |
| 7424 |
\forest@lt{before south arrow tip}% |
| 7425 |
\forest@lt{south arrow tip}% |
| 7426 |
\forest@lt{after south arrow tip}% |
| 7427 |
\forest@lt{after south arrow head}% |
| 7428 |
\forest@lt{after south arrow}% |
| 7429 |
\forest@lt{south west}% |
| 7430 |
\forest@lt{before west arrow}% |
| 7431 |
\forest@lt{before west arrow head}% |
| 7432 |
\forest@lt{before west arrow tip}% |
| 7433 |
\forest@lt{west arrow tip}% |
| 7434 |
\forest@lt{after west arrow tip}% |
| 7435 |
\forest@lt{after west arrow head}% |
| 7436 |
\forest@lt{after west arrow}% |
| 7437 |
\forest@lt{north west}% |
| 7438 |
\forest@lt{before north arrow}% |
| 7439 |
} |
| 7440 |
\cslet{forest@compute@node@boundary@circle split}\forest@compute@node@boundary@circle |
| 7441 |
\cslet{forest@compute@node@boundary@circle solidus}\forest@compute@node@boundary@circle |
| 7442 |
\cslet{forest@compute@node@boundary@ellipse split}\forest@compute@node@boundary@ellipse |
| 7443 |
\cslet{forest@compute@node@boundary@rectangle split}\forest@compute@node@boundary@rectangle |
| 7444 |
\def\forest@compute@node@boundary@@callout{% |
| 7445 |
\beforecalloutpointer |
| 7446 |
\pgfsyssoftpath@moveto{\the\pgf@x}{\the\pgf@y}% |
| 7447 |
\calloutpointeranchor |
| 7448 |
\pgfsyssoftpath@lineto{\the\pgf@x}{\the\pgf@y}% |
| 7449 |
\aftercalloutpointer |
| 7450 |
\pgfsyssoftpath@lineto{\the\pgf@x}{\the\pgf@y}% |
| 7451 |
} |
| 7452 |
\csdef{forest@compute@node@boundary@rectangle callout}{% |
| 7453 |
\forest@compute@node@boundary@rectangle |
| 7454 |
\rectanglecalloutpoints |
| 7455 |
\forest@compute@node@boundary@@callout |
| 7456 |
} |
| 7457 |
\csdef{forest@compute@node@boundary@ellipse callout}{% |
| 7458 |
\forest@compute@node@boundary@ellipse |
| 7459 |
\ellipsecalloutpoints |
| 7460 |
\forest@compute@node@boundary@@callout |
| 7461 |
} |
| 7462 |
\csdef{forest@compute@node@boundary@cloud callout}{% |
| 7463 |
\forest@compute@node@boundary@cloud |
| 7464 |
% at least a first approx... |
| 7465 |
\forest@mt{center}% |
| 7466 |
\forest@lt{pointer}% |
| 7467 |
}% |
| 7468 |
\csdef{forest@compute@node@boundary@cross out}{% |
| 7469 |
\forest@mt{south east}% |
| 7470 |
\forest@lt{north west}% |
| 7471 |
\forest@mt{south west}% |
| 7472 |
\forest@lt{north east}% |
| 7473 |
}% |
| 7474 |
\csdef{forest@compute@node@boundary@strike out}{% |
| 7475 |
\forest@mt{north east}% |
| 7476 |
\forest@lt{south west}% |
| 7477 |
}% |
| 7478 |
\csdef{forest@compute@node@boundary@rounded rectangle}{% |
| 7479 |
\forest@mt{east}% |
| 7480 |
\forest@lt{north east}% |
| 7481 |
\forest@lt{north}% |
| 7482 |
\forest@lt{north west}% |
| 7483 |
\forest@lt{west}% |
| 7484 |
\forest@lt{south west}% |
| 7485 |
\forest@lt{south}% |
| 7486 |
\forest@lt{south east}% |
| 7487 |
\forest@lt{east}% |
| 7488 |
}% |
| 7489 |
\csdef{forest@compute@node@boundary@chamfered rectangle}{% |
| 7490 |
\forest@mt{before south west}% |
| 7491 |
\forest@mt{after south west}% |
| 7492 |
\forest@lt{before south east}% |
| 7493 |
\forest@lt{after south east}% |
| 7494 |
\forest@lt{before north east}% |
| 7495 |
\forest@lt{after north east}% |
| 7496 |
\forest@lt{before north west}% |
| 7497 |
\forest@lt{after north west}% |
| 7498 |
\forest@lt{before south west}% |
| 7499 |
}% |
| 7500 |
\def\forest@node@computeabsolutepositions{% |
| 7501 |
\edef\forest@marshal{% |
| 7502 |
\noexpand\forest@node@foreachchild{% |
| 7503 |
\noexpand\forest@node@computeabsolutepositions@{\forestove{x}}{\forestove{y}}{\forestove{grow}}% |
| 7504 |
}% |
| 7505 |
}\forest@marshal |
| 7506 |
} |
| 7507 |
\def\forest@node@computeabsolutepositions@#1#2#3{% |
| 7508 |
\pgfpointadd |
| 7509 |
{\pgfqpoint{#1}{#2}}% |
| 7510 |
{\pgfpointadd |
| 7511 |
{\pgfqpointpolar{#3}{\forestove{l}}}% |
| 7512 |
{\pgfqpointpolar{\numexpr 90+#3\relax}{\forestove{s}}}% |
| 7513 |
}% |
| 7514 |
\pgfgetlastxy\forest@temp@x\forest@temp@y |
| 7515 |
\forestolet{x}\forest@temp@x |
| 7516 |
\forestolet{y}\forest@temp@y |
| 7517 |
\edef\forest@marshal{% |
| 7518 |
\noexpand\forest@node@foreachchild{% |
| 7519 |
\noexpand\forest@node@computeabsolutepositions@{\forest@temp@x}{\forest@temp@y}{\forestove{grow}}% |
| 7520 |
}% |
| 7521 |
}\forest@marshal |
| 7522 |
} |
| 7523 |
\newif\ifforest@drawtree@preservenodeboxes@ |
| 7524 |
\def\forest@node@drawtree{% |
| 7525 |
\expandafter\ifstrequal\expandafter{\forest@drawtreebox}{\pgfkeysnovalue}{% |
| 7526 |
\let\forest@drawtree@beginbox\relax |
| 7527 |
\let\forest@drawtree@endbox\relax |
| 7528 |
}{% |
| 7529 |
\edef\forest@drawtree@beginbox{\global\setbox\forest@drawtreebox=\hbox\bgroup}% |
| 7530 |
\let\forest@drawtree@endbox\egroup |
| 7531 |
}% |
| 7532 |
\ifforest@external@ |
| 7533 |
\ifforest@externalize@tree@ |
| 7534 |
\forest@temptrue |
| 7535 |
\else |
| 7536 |
\tikzifexternalizing{% |
| 7537 |
\ifforest@was@tikzexternalwasenable |
| 7538 |
\forest@temptrue |
| 7539 |
\pgfkeys{/tikz/external/optimize=false}% |
| 7540 |
\let\forest@drawtree@beginbox\relax |
| 7541 |
\let\forest@drawtree@endbox\relax |
| 7542 |
\else |
| 7543 |
\forest@tempfalse |
| 7544 |
\fi |
| 7545 |
}{% |
| 7546 |
\forest@tempfalse |
| 7547 |
}% |
| 7548 |
\fi |
| 7549 |
\ifforest@temp |
| 7550 |
\advance\forest@externalize@inner@n 1 |
| 7551 |
\edef\forest@externalize@filename{% |
| 7552 |
\tikzexternalrealjob-forest-\forest@externalize@outer@n |
| 7553 |
\ifnum\forest@externalize@inner@n=0 \else.\the\forest@externalize@inner@n\fi}% |
| 7554 |
\expandafter\tikzsetnextfilename\expandafter{\forest@externalize@filename}% |
| 7555 |
\tikzexternalenable |
| 7556 |
\pgfkeysalso{/tikz/external/remake next,/tikz/external/export next}% |
| 7557 |
\fi |
| 7558 |
\ifforest@externalize@tree@ |
| 7559 |
\typeout{forest: Invoking a recursive call to generate the external picture |
| 7560 |
'\forest@externalize@filename' for the following context+code: |
| 7561 |
'\expandafter\detokenize\expandafter{\forest@externalize@id}'}% |
| 7562 |
\fi |
| 7563 |
\fi |
| 7564 |
% |
| 7565 |
\ifforesttikzcshack |
| 7566 |
\let\forest@original@tikz@parse@node\tikz@parse@node |
| 7567 |
\let\tikz@parse@node\forest@tikz@parse@node |
| 7568 |
\fi |
| 7569 |
\pgfkeysgetvalue{/forest/begin draw/.@cmd}\forest@temp@begindraw |
| 7570 |
\pgfkeysgetvalue{/forest/end draw/.@cmd}\forest@temp@enddraw |
| 7571 |
\edef\forest@marshal{% |
| 7572 |
\noexpand\forest@drawtree@beginbox |
| 7573 |
\expandonce{\forest@temp@begindraw\pgfkeysnovalue\pgfeov}% |
| 7574 |
\noexpand\forest@node@drawtree@ |
| 7575 |
\expandonce{\forest@temp@enddraw\pgfkeysnovalue\pgfeov}% |
| 7576 |
\noexpand\forest@drawtree@endbox |
| 7577 |
}\forest@marshal |
| 7578 |
\ifforesttikzcshack |
| 7579 |
\let\tikz@parse@node\forest@original@tikz@parse@node |
| 7580 |
\fi |
| 7581 |
% |
| 7582 |
\ifforest@external@ |
| 7583 |
\ifforest@externalize@tree@ |
| 7584 |
\tikzexternaldisable |
| 7585 |
\eappto\forest@externalize@checkimages{% |
| 7586 |
\noexpand\forest@includeexternal@check{\forest@externalize@filename}% |
| 7587 |
}% |
| 7588 |
\expandafter\ifstrequal\expandafter{\forest@drawtreebox}{\pgfkeysnovalue}{% |
| 7589 |
\eappto\forest@externalize@loadimages{% |
| 7590 |
\noexpand\forest@includeexternal{\forest@externalize@filename}% |
| 7591 |
}% |
| 7592 |
}{% |
| 7593 |
\eappto\forest@externalize@loadimages{% |
| 7594 |
\noexpand\forest@includeexternal@box\forest@drawtreebox{\forest@externalize@filename}% |
| 7595 |
}% |
| 7596 |
}% |
| 7597 |
\fi |
| 7598 |
\fi |
| 7599 |
} |
| 7600 |
\def\forest@drawtree@root{0} |
| 7601 |
\def\forest@node@drawtree@{% |
| 7602 |
\def\forest@clear@drawn{}% |
| 7603 |
\forest@forthis{% |
| 7604 |
\forest@saveandrestoremacro\forest@drawtree@root{% |
| 7605 |
\edef\forest@drawtree@root{\forest@cn}% |
| 7606 |
\forestset{draw tree method}% |
| 7607 |
}% |
| 7608 |
}% |
| 7609 |
\forest@node@Ifnamedefined{forest@baseline@node}{% |
| 7610 |
\edef\forest@baseline@id{\forest@node@Nametoid{forest@baseline@node}}% |
| 7611 |
\ifnum\forest@baseline@id=0 |
| 7612 |
\else |
| 7613 |
\ifcsdef{forest@drawn@\forest@baseline@id}{% |
| 7614 |
\edef\forest@marshal{% |
| 7615 |
\noexpand\pgfsetbaselinepointlater{% |
| 7616 |
\noexpand\pgfpointanchor |
| 7617 |
{\forestOve{\forest@baseline@id}{name}}% |
| 7618 |
{\forestOve{\forest@baseline@id}{anchor}}% |
| 7619 |
}% |
| 7620 |
}\forest@marshal |
| 7621 |
}{% |
| 7622 |
\PackageWarning{forest}{Baseline node (id=\forest@cn) was not drawn (most likely it's a phantom node)}% |
| 7623 |
}% |
| 7624 |
\fi |
| 7625 |
}% |
| 7626 |
\forest@clear@drawn |
| 7627 |
} |
| 7628 |
\def\forest@draw@node{% |
| 7629 |
\ifnum\forestove{phantom}=0 |
| 7630 |
\forest@draw@node@ |
| 7631 |
\fi |
| 7632 |
} |
| 7633 |
\def\forest@draw@node@{% |
| 7634 |
\forest@node@forest@positionnodelater@restore |
| 7635 |
\ifforest@drawtree@preservenodeboxes@ |
| 7636 |
\pgfnodealias{forest@temp}{\forestove{later@name}}% |
| 7637 |
\fi |
| 7638 |
\pgfpositionnodenow{\pgfqpoint{\forestove{x}}{\forestove{y}}}% |
| 7639 |
\ifforest@drawtree@preservenodeboxes@ |
| 7640 |
\pgfnodealias{\forestove{later@name}}{forest@temp}% |
| 7641 |
\fi |
| 7642 |
\csdef{forest@drawn@\forest@cn}{}% |
| 7643 |
\eappto\forest@clear@drawn{\noexpand\csundef{forest@drawn@\forest@cn}}% |
| 7644 |
} |
| 7645 |
\def\forest@draw@edge{% |
| 7646 |
\ifcsdef{forest@drawn@\forest@cn}{% was the current node drawn? |
| 7647 |
\ifnum\forestove{@parent}=0 % do we have a parent? |
| 7648 |
\else |
| 7649 |
\ifcsdef{forest@drawn@\forestove{@parent}}{% was the parent drawn? |
| 7650 |
\forest@draw@edge@ |
| 7651 |
}{}% |
| 7652 |
\fi |
| 7653 |
}{}% |
| 7654 |
} |
| 7655 |
\def\forest@draw@edge@{% |
| 7656 |
\edef\forest@temp{\forestove{edge path}}\forest@temp |
| 7657 |
} |
| 7658 |
\def\forest@draw@tikz{% |
| 7659 |
\ifnum\forestove{phantom}=0 |
| 7660 |
\forest@draw@tikz@ |
| 7661 |
\fi |
| 7662 |
} |
| 7663 |
\def\forest@draw@tikz@{% |
| 7664 |
\forestove{tikz}% |
| 7665 |
} |
| 7666 |
\newdimen\forest@xg |
| 7667 |
\newdimen\forest@yg |
| 7668 |
\newdimen\forest@xs |
| 7669 |
\newdimen\forest@ys |
| 7670 |
\def\forest@setupgrowline#1{% |
| 7671 |
\edef\forest@grow{#1}% |
| 7672 |
\pgfqpointpolar{\forest@grow}{1pt}% |
| 7673 |
\forest@xg=\pgf@x |
| 7674 |
\forest@yg=\pgf@y |
| 7675 |
\forest@xs=-\pgf@y |
| 7676 |
\forest@ys=\pgf@x |
| 7677 |
} |
| 7678 |
\def\forest@pgfpointprojectiontogrowline#1{{% |
| 7679 |
\pgf@process{#1}% |
| 7680 |
\pgfutil@tempdima=\pgf@sys@tonumber{\pgf@x}\forest@xg% |
| 7681 |
\advance\pgfutil@tempdima by\pgf@sys@tonumber{\pgf@y}\forest@yg% |
| 7682 |
\global\pgf@x=\pgf@sys@tonumber{\pgfutil@tempdima}\forest@xg% |
| 7683 |
\global\pgf@y=\pgf@sys@tonumber{\pgfutil@tempdima}\forest@yg% |
| 7684 |
}} |
| 7685 |
\def\forest@distancetogrowline#1#2{% |
| 7686 |
\pgf@process{#2}% |
| 7687 |
#1=\pgf@sys@tonumber{\pgf@x}\forest@xs\relax |
| 7688 |
\advance#1 by\pgf@sys@tonumber{\pgf@y}\forest@ys\relax |
| 7689 |
} |
| 7690 |
\let\forest@pp@n\relax |
| 7691 |
\def\forest@projectpathtogrowline#1#2{% |
| 7692 |
\edef\forest@pp@prefix{#2}% |
| 7693 |
\forest@save@pgfsyssoftpath@tokendefs |
| 7694 |
\let\pgfsyssoftpath@movetotoken\forest@projectpath@processpoint |
| 7695 |
\let\pgfsyssoftpath@linetotoken\forest@projectpath@processpoint |
| 7696 |
\c@pgf@counta=0 |
| 7697 |
#1% |
| 7698 |
\csedef{#2n}{\the\c@pgf@counta}% |
| 7699 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 7700 |
} |
| 7701 |
\def\forest@projectpath@processpoint#1#2{% |
| 7702 |
\pgfqpoint{#1}{#2}% |
| 7703 |
\expandafter\edef\csname\forest@pp@prefix\the\c@pgf@counta xo\endcsname{\the\pgf@x}% |
| 7704 |
\expandafter\edef\csname\forest@pp@prefix\the\c@pgf@counta yo\endcsname{\the\pgf@y}% |
| 7705 |
\forest@pgfpointprojectiontogrowline{}% |
| 7706 |
\expandafter\edef\csname\forest@pp@prefix\the\c@pgf@counta xp\endcsname{\the\pgf@x}% |
| 7707 |
\expandafter\edef\csname\forest@pp@prefix\the\c@pgf@counta yp\endcsname{\the\pgf@y}% |
| 7708 |
\advance\c@pgf@counta 1\relax |
| 7709 |
} |
| 7710 |
\def\forest@sortprojections#1{% |
| 7711 |
% todo: optimize in cases when we know that the array is actually a |
| 7712 |
% merger of sorted arrays; when does this happen? in |
| 7713 |
% distance_between_paths, and when merging the edges of the parent |
| 7714 |
% and its children in a uniform growth tree |
| 7715 |
\edef\forest@ppi@inputprefix{#1}% |
| 7716 |
\c@pgf@counta=\csname#1n\endcsname\relax |
| 7717 |
\advance\c@pgf@counta -1 |
| 7718 |
\forest@sort\forest@ppiraw@cmp\forest@ppiraw@let\forest@sort@ascending{0}{\the\c@pgf@counta}% |
| 7719 |
} |
| 7720 |
\def\forest@processprojectioninfo#1#2#3{% |
| 7721 |
\edef\forest@ppi@inputprefix{#1}% |
| 7722 |
\c@pgf@counta=0 |
| 7723 |
\c@pgf@countb=-1 |
| 7724 |
\safeloop |
| 7725 |
\ifnum\c@pgf@counta<\csname#1n\endcsname\relax |
| 7726 |
\letcs\forest@xo{#1\the\c@pgf@counta xo}% |
| 7727 |
\letcs\forest@yo{#1\the\c@pgf@counta yo}% |
| 7728 |
\letcs\forest@xp{#1\the\c@pgf@counta xp}% |
| 7729 |
\letcs\forest@yp{#1\the\c@pgf@counta yp}% |
| 7730 |
\ifnum\c@pgf@countb<0 |
| 7731 |
\forest@equaltotolerancefalse |
| 7732 |
\else |
| 7733 |
\forest@equaltotolerance |
| 7734 |
{\pgfqpoint\forest@xp\forest@yp}% |
| 7735 |
{\pgfqpoint |
| 7736 |
{\csname#2\the\c@pgf@countb x\endcsname}% |
| 7737 |
{\csname#2\the\c@pgf@countb y\endcsname}% |
| 7738 |
}% |
| 7739 |
\fi |
| 7740 |
\ifforest@equaltotolerance\else |
| 7741 |
\advance\c@pgf@countb 1 |
| 7742 |
\cslet{#2\the\c@pgf@countb x}\forest@xp |
| 7743 |
\cslet{#2\the\c@pgf@countb y}\forest@yp |
| 7744 |
\csdef{#2\the\c@pgf@countb @n}{0}% |
| 7745 |
\fi |
| 7746 |
% todo: this is ugly! |
| 7747 |
\ifdefined\forest@xo\ifx\forest@xo\relax\else |
| 7748 |
\ifdefined\forest@yo\ifx\forest@yo\relax\else |
| 7749 |
\forest@append@point@to@inner@array |
| 7750 |
\forest@xo\forest@yo |
| 7751 |
{#2\the\c@pgf@countb @}% |
| 7752 |
\eapptotoks#3{(\forest@xo,\forest@yo){\the\c@pgf@countb}}% |
| 7753 |
\fi\fi |
| 7754 |
\fi\fi |
| 7755 |
% todo: is this really necessary? (yes: see the "ugly" thing above) |
| 7756 |
\cslet{#1\the\c@pgf@counta xo}\relax |
| 7757 |
\cslet{#1\the\c@pgf@counta yo}\relax |
| 7758 |
\cslet{#1\the\c@pgf@counta xp}\relax |
| 7759 |
\cslet{#1\the\c@pgf@counta yp}\relax |
| 7760 |
\advance\c@pgf@counta 1 |
| 7761 |
\saferepeat |
| 7762 |
% todo: is this really necessary? |
| 7763 |
\cslet{#1n}\relax |
| 7764 |
\advance\c@pgf@countb 1 |
| 7765 |
\csedef{#2n}{\the\c@pgf@countb}% |
| 7766 |
} |
| 7767 |
\def\forest@ppiraw@let#1#2{% |
| 7768 |
\csletcs{\forest@ppi@inputprefix#1xo}{\forest@ppi@inputprefix#2xo}% |
| 7769 |
\csletcs{\forest@ppi@inputprefix#1yo}{\forest@ppi@inputprefix#2yo}% |
| 7770 |
\csletcs{\forest@ppi@inputprefix#1xp}{\forest@ppi@inputprefix#2xp}% |
| 7771 |
\csletcs{\forest@ppi@inputprefix#1yp}{\forest@ppi@inputprefix#2yp}% |
| 7772 |
} |
| 7773 |
\def\forest@ppiraw@cmp#1#2{% |
| 7774 |
\forest@sort@cmptwodimcs |
| 7775 |
{\forest@ppi@inputprefix#1xp}{\forest@ppi@inputprefix#1yp}% |
| 7776 |
{\forest@ppi@inputprefix#2xp}{\forest@ppi@inputprefix#2yp}% |
| 7777 |
} |
| 7778 |
\def\forest@append@point@to@inner@array#1#2#3{% |
| 7779 |
\c@pgf@countc=\csname#3n\endcsname\relax |
| 7780 |
\csedef{#3\the\c@pgf@countc x}{#1}% |
| 7781 |
\csedef{#3\the\c@pgf@countc y}{#2}% |
| 7782 |
\forest@distancetogrowline\pgfutil@tempdima{\pgfqpoint#1#2}% |
| 7783 |
\csedef{#3\the\c@pgf@countc d}{\the\pgfutil@tempdima}% |
| 7784 |
\advance\c@pgf@countc 1 |
| 7785 |
\csedef{#3n}{\the\c@pgf@countc}% |
| 7786 |
} |
| 7787 |
\def\forest@breakpath#1#2#3#4{% |
| 7788 |
\edef\forest@bp@prefix{#2}% |
| 7789 |
\let\forest@breakpath@toks#3% |
| 7790 |
\forest@save@pgfsyssoftpath@tokendefs |
| 7791 |
\let\pgfsyssoftpath@movetotoken\forest@breakpath@processfirstpoint |
| 7792 |
\let\pgfsyssoftpath@linetotoken\forest@breakpath@processfirstpoint |
| 7793 |
%\pgfusepath{}% empty the current path. ok? |
| 7794 |
#1% |
| 7795 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 7796 |
\pgfsyssoftpath@getcurrentpath#4% |
| 7797 |
} |
| 7798 |
\def\forest@breakpath@processfirstpoint#1#2{% |
| 7799 |
\forest@breakpath@processmoveto{#1}{#2}% |
| 7800 |
\let\pgfsyssoftpath@movetotoken\forest@breakpath@processmoveto |
| 7801 |
\let\pgfsyssoftpath@linetotoken\forest@breakpath@processlineto |
| 7802 |
} |
| 7803 |
\def\forest@breakpath@processmoveto#1#2{% |
| 7804 |
\pgfsyssoftpath@moveto{#1}{#2}% |
| 7805 |
\def\forest@previous@x{#1}% |
| 7806 |
\def\forest@previous@y{#2}% |
| 7807 |
\forest@breakpath@getfromtoks\forest@breakpath@toks\forest@previous@i{#1}{#2}% |
| 7808 |
\expandafter\let\expandafter\forest@previous@px |
| 7809 |
\csname\forest@bp@prefix\forest@previous@i x\endcsname |
| 7810 |
\expandafter\let\expandafter\forest@previous@py |
| 7811 |
\csname\forest@bp@prefix\forest@previous@i y\endcsname |
| 7812 |
} |
| 7813 |
\def\forest@breakpath@getfromtoks#1#2#3#4{% |
| 7814 |
% #1=cache toks register, #2=receiving cs, (#3,#4)=point; |
| 7815 |
% we rely on the fact that the point we're looking up should always be present |
| 7816 |
\def\forest@breakpath@getfromtoks@##1(#3,#4)##2##3\forest@END{##2}% |
| 7817 |
\edef#2{\expandafter\forest@breakpath@getfromtoks@\the#1\forest@END}% |
| 7818 |
} |
| 7819 |
\def\forest@breakpath@processlineto#1#2{% |
| 7820 |
\let\forest@breakpath@op\pgfsyssoftpath@lineto |
| 7821 |
\forest@breakpath@getfromtoks\forest@breakpath@toks\forest@i{#1}{#2}% |
| 7822 |
\expandafter\let\expandafter\forest@px |
| 7823 |
\csname\forest@bp@prefix\forest@i x\endcsname |
| 7824 |
\expandafter\let\expandafter\forest@py |
| 7825 |
\csname\forest@bp@prefix\forest@i y\endcsname |
| 7826 |
\forest@equaltotolerance |
| 7827 |
{\pgfqpoint{\forest@previous@px}{\forest@previous@py}}% |
| 7828 |
{\pgfqpoint{\forest@px}{\forest@py}}% |
| 7829 |
\ifforest@equaltotolerance |
| 7830 |
\let\forest@breakpath@op\pgfsyssoftpath@moveto |
| 7831 |
\else |
| 7832 |
\forest@temp@count=\forest@previous@i\relax |
| 7833 |
\ifnum\forest@previous@i<\forest@i\relax |
| 7834 |
\def\forest@breakpath@step{1}% |
| 7835 |
\def\forest@breakpath@test{\forest@temp@count<\forest@i\relax}% |
| 7836 |
\else |
| 7837 |
\def\forest@breakpath@step{-1}% |
| 7838 |
\def\forest@breakpath@test{\forest@temp@count>\forest@i\relax}% |
| 7839 |
\fi |
| 7840 |
\safeloop |
| 7841 |
\advance\forest@temp@count\forest@breakpath@step\relax |
| 7842 |
\expandafter\ifnum\forest@breakpath@test |
| 7843 |
\pgfpointintersectionoflines |
| 7844 |
{\pgfqpoint |
| 7845 |
{\csname\forest@bp@prefix\the\forest@temp@count x\endcsname}% |
| 7846 |
{\csname\forest@bp@prefix\the\forest@temp@count y\endcsname}% |
| 7847 |
}% |
| 7848 |
{\pgfpointadd |
| 7849 |
{\pgfqpoint |
| 7850 |
{\csname\forest@bp@prefix\the\forest@temp@count x\endcsname}% |
| 7851 |
{\csname\forest@bp@prefix\the\forest@temp@count y\endcsname}% |
| 7852 |
}% |
| 7853 |
{\pgfqpoint{\forest@xs}{\forest@ys}}% |
| 7854 |
}% |
| 7855 |
{\pgfqpoint{\forest@previous@x}{\forest@previous@y}}% |
| 7856 |
{\pgfqpoint{#1}{#2}}% |
| 7857 |
\pgfgetlastxy\forest@last@x\forest@last@y |
| 7858 |
\pgfsyssoftpath@lineto\forest@last@x\forest@last@y |
| 7859 |
\forest@append@point@to@inner@array |
| 7860 |
\forest@last@x\forest@last@y |
| 7861 |
{\forest@bp@prefix\the\forest@temp@count @}% |
| 7862 |
\saferepeat |
| 7863 |
\fi |
| 7864 |
\forest@breakpath@op{#1}{#2}% |
| 7865 |
\def\forest@previous@x{#1}% |
| 7866 |
\def\forest@previous@y{#2}% |
| 7867 |
\let\forest@previous@i\forest@i |
| 7868 |
\let\forest@previous@px\forest@px |
| 7869 |
\let\forest@previous@py\forest@py |
| 7870 |
} |
| 7871 |
\patchcmd{\pgfpointintersectionoflines}{\pgfpoint}{\pgfqpoint}{}{} |
| 7872 |
\def\forest@getnegativetightedgeofpath#1#2{% |
| 7873 |
\forest@get@onetightedgeofpath#1\forest@sort@ascending#2} |
| 7874 |
\def\forest@getpositivetightedgeofpath#1#2{% |
| 7875 |
\forest@get@onetightedgeofpath#1\forest@sort@descending#2} |
| 7876 |
\def\forest@get@onetightedgeofpath#1#2#3{% |
| 7877 |
{% |
| 7878 |
\forest@get@one@tightedgeofpath#1#2\forest@gep@edge |
| 7879 |
\global\let\forest@gep@global@edge\forest@gep@edge |
| 7880 |
}% |
| 7881 |
\let#3\forest@gep@global@edge |
| 7882 |
} |
| 7883 |
\newtoks\forest@pi@toks |
| 7884 |
\newtoks\forest@segment@toks |
| 7885 |
\def\forest@get@one@tightedgeofpath#1#2#3{% |
| 7886 |
\forest@projectpathtogrowline#1{forest@pp@}% |
| 7887 |
\forest@sortprojections{forest@pp@}% |
| 7888 |
\forest@processprojectioninfo{forest@pp@}{forest@pi@}\forest@pi@toks |
| 7889 |
\forest@breakpath#1{forest@pi@}\forest@pi@toks\forest@brokenpath |
| 7890 |
\forest@sort@inner@arrays{forest@pi@}#2% |
| 7891 |
\forest@pathtodict\forest@brokenpath\forest@segment@toks |
| 7892 |
\forest@gettightedgeofpath@getedge\forest@edge |
| 7893 |
\forest@simplifypath\forest@edge#3% |
| 7894 |
} |
| 7895 |
\def\forest@getbothtightedgesofpath#1#2#3{% |
| 7896 |
{% |
| 7897 |
\forest@get@one@tightedgeofpath#1\forest@sort@ascending\forest@gep@firstedge |
| 7898 |
\c@pgf@counta=0 |
| 7899 |
\forest@loop |
| 7900 |
\ifnum\c@pgf@counta<\forest@pi@n\relax |
| 7901 |
\forest@ppi@deflet{forest@pi@\the\c@pgf@counta @}% |
| 7902 |
\forest@reversearray\forest@ppi@let |
| 7903 |
{0}% |
| 7904 |
{\csname forest@pi@\the\c@pgf@counta @n\endcsname}% |
| 7905 |
\advance\c@pgf@counta 1 |
| 7906 |
\forest@repeat |
| 7907 |
\forest@gettightedgeofpath@getedge\forest@edge |
| 7908 |
\forest@simplifypath\forest@edge\forest@gep@secondedge |
| 7909 |
\global\let\forest@gep@global@firstedge\forest@gep@firstedge |
| 7910 |
\global\let\forest@gep@global@secondedge\forest@gep@secondedge |
| 7911 |
}% |
| 7912 |
\let#2\forest@gep@global@firstedge |
| 7913 |
\let#3\forest@gep@global@secondedge |
| 7914 |
} |
| 7915 |
\def\forest@sort@inner@arrays#1#2{% |
| 7916 |
\c@pgf@counta=0 |
| 7917 |
\safeloop |
| 7918 |
\ifnum\c@pgf@counta<\csname#1n\endcsname |
| 7919 |
\c@pgf@countb=\csname#1\the\c@pgf@counta @n\endcsname\relax |
| 7920 |
\ifnum\c@pgf@countb>1 |
| 7921 |
\advance\c@pgf@countb -1 |
| 7922 |
\forest@ppi@deflet{#1\the\c@pgf@counta @}% |
| 7923 |
\forest@ppi@defcmp{#1\the\c@pgf@counta @}% |
| 7924 |
\forest@sort\forest@ppi@cmp\forest@ppi@let#2{0}{\the\c@pgf@countb}% |
| 7925 |
\fi |
| 7926 |
\advance\c@pgf@counta 1 |
| 7927 |
\saferepeat |
| 7928 |
} |
| 7929 |
\def\forest@ppi@deflet#1{% |
| 7930 |
\edef\forest@ppi@let##1##2{% |
| 7931 |
\noexpand\csletcs{#1##1x}{#1##2x}% |
| 7932 |
\noexpand\csletcs{#1##1y}{#1##2y}% |
| 7933 |
\noexpand\csletcs{#1##1d}{#1##2d}% |
| 7934 |
}% |
| 7935 |
} |
| 7936 |
\def\forest@ppi@defcmp#1{% |
| 7937 |
\edef\forest@ppi@cmp##1##2{% |
| 7938 |
\noexpand\forest@sort@cmpdimcs{#1##1d}{#1##2d}% |
| 7939 |
}% |
| 7940 |
} |
| 7941 |
\def\forest@pathtodict#1#2{% |
| 7942 |
\let\forest@pathtodict@toks#2% |
| 7943 |
\forest@save@pgfsyssoftpath@tokendefs |
| 7944 |
\let\pgfsyssoftpath@movetotoken\forest@pathtodict@movetoop |
| 7945 |
\let\pgfsyssoftpath@linetotoken\forest@pathtodict@linetoop |
| 7946 |
\def\forest@pathtodict@subpathstart{}% |
| 7947 |
#1% |
| 7948 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 7949 |
} |
| 7950 |
\def\forest@pathtodict@movetoop#1#2{% |
| 7951 |
\apptotoks\forest@pathtodict@toks{(#1,#2)}% |
| 7952 |
} |
| 7953 |
\def\forest@pathtodict@linetoop#1#2{% |
| 7954 |
\apptotoks\forest@pathtodict@toks{--(#1,#2)}% |
| 7955 |
} |
| 7956 |
\def\forest@gettightedgeofpath@getedge#1{% cs to store the edge into |
| 7957 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty |
| 7958 |
\let\forest@last@x\relax |
| 7959 |
\let\forest@last@y\relax |
| 7960 |
\c@pgf@counta=0 |
| 7961 |
\forest@temp@count=\forest@pi@n\relax |
| 7962 |
\advance\forest@temp@count -1 |
| 7963 |
\edef\forest@nminusone{\the\forest@temp@count}% |
| 7964 |
\safeloop |
| 7965 |
\ifnum\c@pgf@counta<\forest@nminusone\relax |
| 7966 |
\forest@gettightedgeofpath@getedge@loopa |
| 7967 |
\saferepeat |
| 7968 |
\ifnum\forest@nminusone<\forest@n\relax\else |
| 7969 |
\ifnum\csname forest@pi@\forest@nminusone @n\endcsname>0 |
| 7970 |
\forest@gettightedgeofpath@maybemoveto{\forest@nminusone}{0}% |
| 7971 |
\fi |
| 7972 |
\fi |
| 7973 |
\pgfsyssoftpath@getcurrentpath#1% |
| 7974 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty |
| 7975 |
} |
| 7976 |
\def\forest@gettightedgeofpath@getedge@loopa{% |
| 7977 |
\ifnum\csname forest@pi@\the\c@pgf@counta @n\endcsname>0 |
| 7978 |
\forest@gettightedgeofpath@maybemoveto{\the\c@pgf@counta}{0}% |
| 7979 |
\c@pgf@countb=0 |
| 7980 |
\safeloop |
| 7981 |
\ifnum\c@pgf@countb<\csname forest@pi@\the\c@pgf@counta @n\endcsname\relax |
| 7982 |
\forest@gettightedgeofpath@getedge@loopb |
| 7983 |
\saferepeat |
| 7984 |
\fi |
| 7985 |
\advance\c@pgf@counta 1 |
| 7986 |
} |
| 7987 |
\def\forest@gettightedgeofpath@getedge@loopb{% |
| 7988 |
\c@pgf@countc=0 |
| 7989 |
\advance\c@pgf@counta 1 |
| 7990 |
\edef\forest@aplusone{\the\c@pgf@counta}% |
| 7991 |
\advance\c@pgf@counta -1 |
| 7992 |
\safeloop |
| 7993 |
\ifnum\c@pgf@countc<\csname forest@pi@\forest@aplusone @n\endcsname\relax |
| 7994 |
\edef\forest@temp{% |
| 7995 |
(\csname forest@pi@\the\c@pgf@counta @\the\c@pgf@countb x\endcsname,% |
| 7996 |
\csname forest@pi@\the\c@pgf@counta @\the\c@pgf@countb y\endcsname)--(% |
| 7997 |
\csname forest@pi@\forest@aplusone @\the\c@pgf@countc x\endcsname,% |
| 7998 |
\csname forest@pi@\forest@aplusone @\the\c@pgf@countc y\endcsname)% |
| 7999 |
}% |
| 8000 |
\expandafter\expandafter\expandafter\pgfutil@in@\expandafter\expandafter\expandafter |
| 8001 |
{\expandafter\forest@temp\expandafter}\expandafter |
| 8002 |
{\the\forest@segment@toks}% |
| 8003 |
\ifpgfutil@in@ |
| 8004 |
\else |
| 8005 |
\edef\forest@temp{% |
| 8006 |
(\csname forest@pi@\forest@aplusone @\the\c@pgf@countc x\endcsname,% |
| 8007 |
\csname forest@pi@\forest@aplusone @\the\c@pgf@countc y\endcsname)--(% |
| 8008 |
\csname forest@pi@\the\c@pgf@counta @\the\c@pgf@countb x\endcsname,% |
| 8009 |
\csname forest@pi@\the\c@pgf@counta @\the\c@pgf@countb y\endcsname)% |
| 8010 |
}% |
| 8011 |
\expandafter\expandafter\expandafter\pgfutil@in@\expandafter\expandafter\expandafter |
| 8012 |
{\expandafter\forest@temp\expandafter}\expandafter |
| 8013 |
{\the\forest@segment@toks}% |
| 8014 |
\fi |
| 8015 |
\ifpgfutil@in@ |
| 8016 |
\forest@gettightedgeofpath@maybemoveto{\the\c@pgf@counta}{\the\c@pgf@countb}% |
| 8017 |
\edef\forest@last@x{% |
| 8018 |
\csname forest@pi@\forest@aplusone @\the\c@pgf@countc x\endcsname}% |
| 8019 |
\edef\forest@last@y{% |
| 8020 |
\csname forest@pi@\forest@aplusone @\the\c@pgf@countc y\endcsname}% |
| 8021 |
\pgfsyssoftpath@lineto\forest@last@x\forest@last@y |
| 8022 |
\c@pgf@countc=\csname forest@pi@\forest@aplusone @n\endcsname |
| 8023 |
\c@pgf@countb=\csname forest@pi@\the\c@pgf@counta @n\endcsname |
| 8024 |
\fi |
| 8025 |
\advance\c@pgf@countc 1 |
| 8026 |
\saferepeat |
| 8027 |
\advance\c@pgf@countb 1 |
| 8028 |
} |
| 8029 |
\def\forest@gettightedgeofpath@maybemoveto#1#2{% |
| 8030 |
\forest@temptrue |
| 8031 |
\ifx\forest@last@x\relax\else |
| 8032 |
\ifdim\forest@last@x=\csname forest@pi@#1@#2x\endcsname\relax |
| 8033 |
\ifdim\forest@last@y=\csname forest@pi@#1@#2y\endcsname\relax |
| 8034 |
\forest@tempfalse |
| 8035 |
\fi |
| 8036 |
\fi |
| 8037 |
\fi |
| 8038 |
\ifforest@temp |
| 8039 |
\edef\forest@last@x{\csname forest@pi@#1@#2x\endcsname}% |
| 8040 |
\edef\forest@last@y{\csname forest@pi@#1@#2y\endcsname}% |
| 8041 |
\pgfsyssoftpath@moveto\forest@last@x\forest@last@y |
| 8042 |
\fi |
| 8043 |
} |
| 8044 |
\def\forest@simplifypath#1#2{% |
| 8045 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty |
| 8046 |
\forest@save@pgfsyssoftpath@tokendefs |
| 8047 |
\let\pgfsyssoftpath@movetotoken\forest@simplifypath@moveto |
| 8048 |
\let\pgfsyssoftpath@linetotoken\forest@simplifypath@lineto |
| 8049 |
\let\forest@last@x\relax |
| 8050 |
\let\forest@last@y\relax |
| 8051 |
\let\forest@last@atan\relax |
| 8052 |
#1% |
| 8053 |
\ifx\forest@last@x\relax\else |
| 8054 |
\ifx\forest@last@atan\relax\else |
| 8055 |
\pgfsyssoftpath@lineto\forest@last@x\forest@last@y |
| 8056 |
\fi |
| 8057 |
\fi |
| 8058 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 8059 |
\pgfsyssoftpath@getcurrentpath#2% |
| 8060 |
\pgfsyssoftpath@setcurrentpath\pgfutil@empty |
| 8061 |
} |
| 8062 |
\def\forest@simplifypath@moveto#1#2{% |
| 8063 |
\ifx\forest@last@x\relax\else |
| 8064 |
\pgfsyssoftpath@lineto\forest@last@x\forest@last@y |
| 8065 |
\fi |
| 8066 |
\pgfsyssoftpath@moveto{#1}{#2}% |
| 8067 |
\def\forest@last@x{#1}% |
| 8068 |
\def\forest@last@y{#2}% |
| 8069 |
\let\forest@last@atan\relax |
| 8070 |
} |
| 8071 |
\def\forest@getedgeofpath@precision{1pt} |
| 8072 |
\def\forest@simplifypath@lineto#1#2{% |
| 8073 |
\ifx\forest@last@x\relax |
| 8074 |
\def\forest@last@x{#1}% |
| 8075 |
\def\forest@last@y{#2}% |
| 8076 |
\let\forest@last@atan\relax |
| 8077 |
\else |
| 8078 |
\pgfpointdiff{\pgfqpoint{#1}{#2}}{\pgfqpoint{\forest@last@x}{\forest@last@y}}% |
| 8079 |
\ifdim\pgf@x<\pgfintersectiontolerance |
| 8080 |
\ifdim-\pgf@x<\pgfintersectiontolerance |
| 8081 |
\pgf@x=0pt |
| 8082 |
\fi |
| 8083 |
\fi |
| 8084 |
\edef\forest@marshal{% |
| 8085 |
\noexpand\pgfmathatantwo@ |
| 8086 |
{\expandafter\Pgf@geT\the\pgf@x}% |
| 8087 |
{\expandafter\Pgf@geT\the\pgf@y}% |
| 8088 |
}\forest@marshal |
| 8089 |
\let\forest@current@atan\pgfmathresult |
| 8090 |
\ifx\forest@last@atan\relax |
| 8091 |
\def\forest@last@x{#1}% |
| 8092 |
\def\forest@last@y{#2}% |
| 8093 |
\let\forest@last@atan\forest@current@atan |
| 8094 |
\else |
| 8095 |
\pgfutil@tempdima=\forest@current@atan pt |
| 8096 |
\advance\pgfutil@tempdima -\forest@last@atan pt |
| 8097 |
\ifdim\pgfutil@tempdima<0pt\relax |
| 8098 |
\multiply\pgfutil@tempdima -1 |
| 8099 |
\fi |
| 8100 |
\ifdim\pgfutil@tempdima<\forest@getedgeofpath@precision\relax |
| 8101 |
\else |
| 8102 |
\pgfsyssoftpath@lineto\forest@last@x\forest@last@y |
| 8103 |
\let\forest@last@atan\forest@current@atan |
| 8104 |
\fi |
| 8105 |
\def\forest@last@x{#1}% |
| 8106 |
\def\forest@last@y{#2}% |
| 8107 |
\fi |
| 8108 |
\fi |
| 8109 |
} |
| 8110 |
\def\forest@getnegativerectangleedgeofpath#1#2{% |
| 8111 |
\forest@getnegativerectangleorbandedgeofpath{#1}{#2}{\the\pgf@xb}} |
| 8112 |
\def\forest@getpositiverectangleedgeofpath#1#2{% |
| 8113 |
\forest@getpositiverectangleorbandedgeofpath{#1}{#2}{\the\pgf@xb}} |
| 8114 |
\def\forest@getbothrectangleedgesofpath#1#2#3{% |
| 8115 |
\forest@getbothrectangleorbandedgesofpath{#1}{#2}{#3}{\the\pgf@xb}} |
| 8116 |
\def\forest@bandlength{5000pt} % something large (ca. 180cm), but still manageable for TeX without producing `too large' errors |
| 8117 |
\def\forest@getnegativebandedgeofpath#1#2{% |
| 8118 |
\forest@getnegativerectangleorbandedgeofpath{#1}{#2}{\forest@bandlength}} |
| 8119 |
\def\forest@getpositivebandedgeofpath#1#2{% |
| 8120 |
\forest@getpositiverectangleorbandedgeofpath{#1}{#2}{\forest@bandlength}} |
| 8121 |
\def\forest@getbothbandedgesofpath#1#2#3{% |
| 8122 |
\forest@getbothrectangleorbandedgesofpath{#1}{#2}{#3}{\forest@bandlength}} |
| 8123 |
\def\forest@getnegativerectangleorbandedgeofpath#1#2#3{% |
| 8124 |
\forest@path@getboundingrectangle@ls#1{\forest@grow}% |
| 8125 |
\edef\forest@gre@path{% |
| 8126 |
\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xa}{\the\pgf@ya}% |
| 8127 |
\noexpand\pgfsyssoftpath@linetotoken{#3}{\the\pgf@ya}% |
| 8128 |
}% |
| 8129 |
{% |
| 8130 |
\pgftransformreset |
| 8131 |
\forest@pgfqtransformrotate{\forest@grow}% |
| 8132 |
\forest@pgfpathtransformed\forest@gre@path |
| 8133 |
}% |
| 8134 |
\pgfsyssoftpath@getcurrentpath#2% |
| 8135 |
} |
| 8136 |
\def\forest@getpositiverectangleorbandedgeofpath#1#2#3{% |
| 8137 |
\forest@path@getboundingrectangle@ls#1{\forest@grow}% |
| 8138 |
\edef\forest@gre@path{% |
| 8139 |
\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xa}{\the\pgf@yb}% |
| 8140 |
\noexpand\pgfsyssoftpath@linetotoken{#3}{\the\pgf@yb}% |
| 8141 |
}% |
| 8142 |
{% |
| 8143 |
\pgftransformreset |
| 8144 |
\forest@pgfqtransformrotate{\forest@grow}% |
| 8145 |
\forest@pgfpathtransformed\forest@gre@path |
| 8146 |
}% |
| 8147 |
\pgfsyssoftpath@getcurrentpath#2% |
| 8148 |
} |
| 8149 |
\def\forest@getbothrectangleorbandedgesofpath#1#2#3#4{% |
| 8150 |
\forest@path@getboundingrectangle@ls#1{\forest@grow}% |
| 8151 |
\edef\forest@gre@negpath{% |
| 8152 |
\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xa}{\the\pgf@ya}% |
| 8153 |
\noexpand\pgfsyssoftpath@linetotoken{#4}{\the\pgf@ya}% |
| 8154 |
}% |
| 8155 |
\edef\forest@gre@pospath{% |
| 8156 |
\noexpand\pgfsyssoftpath@movetotoken{\the\pgf@xa}{\the\pgf@yb}% |
| 8157 |
\noexpand\pgfsyssoftpath@linetotoken{#4}{\the\pgf@yb}% |
| 8158 |
}% |
| 8159 |
{% |
| 8160 |
\pgftransformreset |
| 8161 |
\forest@pgfqtransformrotate{\forest@grow}% |
| 8162 |
\forest@pgfpathtransformed\forest@gre@negpath |
| 8163 |
}% |
| 8164 |
\pgfsyssoftpath@getcurrentpath#2% |
| 8165 |
{% |
| 8166 |
\pgftransformreset |
| 8167 |
\forest@pgfqtransformrotate{\forest@grow}% |
| 8168 |
\forest@pgfpathtransformed\forest@gre@pospath |
| 8169 |
}% |
| 8170 |
\pgfsyssoftpath@getcurrentpath#3% |
| 8171 |
} |
| 8172 |
\newtoks\forest@PIi@toks |
| 8173 |
\newtoks\forest@PIii@toks |
| 8174 |
\def\forest@distance@between@edge@paths#1#2#3{% |
| 8175 |
\begingroup |
| 8176 |
% #1, #2 = (edge) paths |
| 8177 |
% |
| 8178 |
% project paths |
| 8179 |
\forest@projectpathtogrowline#1{forest@p1@}% |
| 8180 |
\forest@projectpathtogrowline#2{forest@p2@}% |
| 8181 |
% merge projections (the lists are sorted already, because edge |
| 8182 |
% paths are |sorted|) |
| 8183 |
\forest@dbep@mergeprojections |
| 8184 |
{forest@p1@}{forest@p2@}% |
| 8185 |
{forest@P1@}{forest@P2@}% |
| 8186 |
% process projections |
| 8187 |
\forest@processprojectioninfo{forest@P1@}{forest@PI1@}\forest@PIi@toks |
| 8188 |
\forest@processprojectioninfo{forest@P2@}{forest@PI2@}\forest@PIii@toks |
| 8189 |
% break paths |
| 8190 |
\forest@breakpath#1{forest@PI1@}\forest@PIi@toks\forest@broken@one |
| 8191 |
\forest@breakpath#2{forest@PI2@}\forest@PIii@toks\forest@broken@two |
| 8192 |
% sort inner arrays ---optimize: it's enough to find max and min |
| 8193 |
\forest@sort@inner@arrays{forest@PI1@}\forest@sort@descending |
| 8194 |
\forest@sort@inner@arrays{forest@PI2@}\forest@sort@ascending |
| 8195 |
% compute the distance |
| 8196 |
\let\forest@distance\relax |
| 8197 |
\c@pgf@countc=0 |
| 8198 |
\forest@loop |
| 8199 |
\ifnum\c@pgf@countc<\csname forest@PI1@n\endcsname\relax |
| 8200 |
\ifnum\csname forest@PI1@\the\c@pgf@countc @n\endcsname=0 \else |
| 8201 |
\ifnum\csname forest@PI2@\the\c@pgf@countc @n\endcsname=0 \else |
| 8202 |
\pgfutil@tempdima=\csname forest@PI2@\the\c@pgf@countc @0d\endcsname\relax |
| 8203 |
\advance\pgfutil@tempdima -\csname forest@PI1@\the\c@pgf@countc @0d\endcsname\relax |
| 8204 |
\ifx\forest@distance\relax |
| 8205 |
\edef\forest@distance{\the\pgfutil@tempdima}% |
| 8206 |
\else |
| 8207 |
\ifdim\pgfutil@tempdima<\forest@distance\relax |
| 8208 |
\edef\forest@distance{\the\pgfutil@tempdima}% |
| 8209 |
\fi |
| 8210 |
\fi |
| 8211 |
\fi |
| 8212 |
\fi |
| 8213 |
\advance\c@pgf@countc 1 |
| 8214 |
\forest@repeat |
| 8215 |
\global\let\forest@global@temp\forest@distance |
| 8216 |
\endgroup |
| 8217 |
\let#3\forest@global@temp |
| 8218 |
} |
| 8219 |
% merge projections: we need two projection arrays, both containing |
| 8220 |
% projection points from both paths, but each with the original |
| 8221 |
% points from only one path |
| 8222 |
\def\forest@dbep@mergeprojections#1#2#3#4{% |
| 8223 |
% TODO: optimize: v bistvu ni treba sortirat, ker je edge path že sortiran |
| 8224 |
\forest@sortprojections{#1}% |
| 8225 |
\forest@sortprojections{#2}% |
| 8226 |
\c@pgf@counta=0 |
| 8227 |
\c@pgf@countb=0 |
| 8228 |
\c@pgf@countc=0 |
| 8229 |
\edef\forest@input@prefix@one{#1}% |
| 8230 |
\edef\forest@input@prefix@two{#2}% |
| 8231 |
\edef\forest@output@prefix@one{#3}% |
| 8232 |
\edef\forest@output@prefix@two{#4}% |
| 8233 |
\forest@dbep@mp@iterate |
| 8234 |
\csedef{#3n}{\the\c@pgf@countc}% |
| 8235 |
\csedef{#4n}{\the\c@pgf@countc}% |
| 8236 |
} |
| 8237 |
\def\forest@dbep@mp@iterate{% |
| 8238 |
\let\forest@dbep@mp@next\forest@dbep@mp@iterate |
| 8239 |
\ifnum\c@pgf@counta<\csname\forest@input@prefix@one n\endcsname\relax |
| 8240 |
\ifnum\c@pgf@countb<\csname\forest@input@prefix@two n\endcsname\relax |
| 8241 |
\let\forest@dbep@mp@next\forest@dbep@mp@do |
| 8242 |
\else |
| 8243 |
\let\forest@dbep@mp@next\forest@dbep@mp@iteratefirst |
| 8244 |
\fi |
| 8245 |
\else |
| 8246 |
\ifnum\c@pgf@countb<\csname\forest@input@prefix@two n\endcsname\relax |
| 8247 |
\let\forest@dbep@mp@next\forest@dbep@mp@iteratesecond |
| 8248 |
\else |
| 8249 |
\let\forest@dbep@mp@next\relax |
| 8250 |
\fi |
| 8251 |
\fi |
| 8252 |
\forest@dbep@mp@next |
| 8253 |
} |
| 8254 |
\def\forest@dbep@mp@do{% |
| 8255 |
\forest@sort@cmptwodimcs% |
| 8256 |
{\forest@input@prefix@one\the\c@pgf@counta xp}% |
| 8257 |
{\forest@input@prefix@one\the\c@pgf@counta yp}% |
| 8258 |
{\forest@input@prefix@two\the\c@pgf@countb xp}% |
| 8259 |
{\forest@input@prefix@two\the\c@pgf@countb yp}% |
| 8260 |
\if\forest@sort@cmp@result=% |
| 8261 |
\forest@dbep@mp@@store@p\forest@input@prefix@one\c@pgf@counta |
| 8262 |
\forest@dbep@mp@@store@o\forest@input@prefix@one |
| 8263 |
\c@pgf@counta\forest@output@prefix@one |
| 8264 |
\forest@dbep@mp@@store@o\forest@input@prefix@two |
| 8265 |
\c@pgf@countb\forest@output@prefix@two |
| 8266 |
\advance\c@pgf@counta 1 |
| 8267 |
\advance\c@pgf@countb 1 |
| 8268 |
\else |
| 8269 |
\if\forest@sort@cmp@result>% |
| 8270 |
\forest@dbep@mp@@store@p\forest@input@prefix@two\c@pgf@countb |
| 8271 |
\forest@dbep@mp@@store@o\forest@input@prefix@two |
| 8272 |
\c@pgf@countb\forest@output@prefix@two |
| 8273 |
\advance\c@pgf@countb 1 |
| 8274 |
\else%< |
| 8275 |
\forest@dbep@mp@@store@p\forest@input@prefix@one\c@pgf@counta |
| 8276 |
\forest@dbep@mp@@store@o\forest@input@prefix@one |
| 8277 |
\c@pgf@counta\forest@output@prefix@one |
| 8278 |
\advance\c@pgf@counta 1 |
| 8279 |
\fi |
| 8280 |
\fi |
| 8281 |
\advance\c@pgf@countc 1 |
| 8282 |
\forest@dbep@mp@iterate |
| 8283 |
} |
| 8284 |
\def\forest@dbep@mp@@store@p#1#2{% |
| 8285 |
\csletcs |
| 8286 |
{\forest@output@prefix@one\the\c@pgf@countc xp}% |
| 8287 |
{#1\the#2xp}% |
| 8288 |
\csletcs |
| 8289 |
{\forest@output@prefix@one\the\c@pgf@countc yp}% |
| 8290 |
{#1\the#2yp}% |
| 8291 |
\csletcs |
| 8292 |
{\forest@output@prefix@two\the\c@pgf@countc xp}% |
| 8293 |
{#1\the#2xp}% |
| 8294 |
\csletcs |
| 8295 |
{\forest@output@prefix@two\the\c@pgf@countc yp}% |
| 8296 |
{#1\the#2yp}% |
| 8297 |
} |
| 8298 |
\def\forest@dbep@mp@@store@o#1#2#3{% |
| 8299 |
\csletcs{#3\the\c@pgf@countc xo}{#1\the#2xo}% |
| 8300 |
\csletcs{#3\the\c@pgf@countc yo}{#1\the#2yo}% |
| 8301 |
} |
| 8302 |
\def\forest@dbep@mp@iteratefirst{% |
| 8303 |
\forest@dbep@mp@iterateone\forest@input@prefix@one\c@pgf@counta\forest@output@prefix@one |
| 8304 |
} |
| 8305 |
\def\forest@dbep@mp@iteratesecond{% |
| 8306 |
\forest@dbep@mp@iterateone\forest@input@prefix@two\c@pgf@countb\forest@output@prefix@two |
| 8307 |
} |
| 8308 |
\def\forest@dbep@mp@iterateone#1#2#3{% |
| 8309 |
\forest@loop |
| 8310 |
\ifnum#2<\csname#1n\endcsname\relax |
| 8311 |
\forest@dbep@mp@@store@p#1#2% |
| 8312 |
\forest@dbep@mp@@store@o#1#2#3% |
| 8313 |
\advance\c@pgf@countc 1 |
| 8314 |
\advance#21 |
| 8315 |
\forest@repeat |
| 8316 |
} |
| 8317 |
\newif\ifforest@equaltotolerance |
| 8318 |
\def\forest@equaltotolerance#1#2{{% |
| 8319 |
\pgfpointdiff{#1}{#2}% |
| 8320 |
\ifdim\pgf@x<0pt \multiply\pgf@x -1 \fi |
| 8321 |
\ifdim\pgf@y<0pt \multiply\pgf@y -1 \fi |
| 8322 |
\global\forest@equaltotolerancefalse |
| 8323 |
\ifdim\pgf@x<\pgfintersectiontolerance\relax |
| 8324 |
\ifdim\pgf@y<\pgfintersectiontolerance\relax |
| 8325 |
\global\forest@equaltotolerancetrue |
| 8326 |
\fi |
| 8327 |
\fi |
| 8328 |
}} |
| 8329 |
\def\forest@save@pgfsyssoftpath@tokendefs{% |
| 8330 |
\let\forest@origmovetotoken\pgfsyssoftpath@movetotoken |
| 8331 |
\let\forest@origlinetotoken\pgfsyssoftpath@linetotoken |
| 8332 |
\let\forest@origcurvetosupportatoken\pgfsyssoftpath@curvetosupportatoken |
| 8333 |
\let\forest@origcurvetosupportbtoken\pgfsyssoftpath@curvetosupportbtoken |
| 8334 |
\let\forest@origcurvetotoken\pgfsyssoftpath@curvetototoken |
| 8335 |
\let\forest@origrectcornertoken\pgfsyssoftpath@rectcornertoken |
| 8336 |
\let\forest@origrectsizetoken\pgfsyssoftpath@rectsizetoken |
| 8337 |
\let\forest@origclosepathtoken\pgfsyssoftpath@closepathtoken |
| 8338 |
\let\pgfsyssoftpath@movetotoken\forest@badtoken |
| 8339 |
\let\pgfsyssoftpath@linetotoken\forest@badtoken |
| 8340 |
\let\pgfsyssoftpath@curvetosupportatoken\forest@badtoken |
| 8341 |
\let\pgfsyssoftpath@curvetosupportbtoken\forest@badtoken |
| 8342 |
\let\pgfsyssoftpath@curvetototoken\forest@badtoken |
| 8343 |
\let\pgfsyssoftpath@rectcornertoken\forest@badtoken |
| 8344 |
\let\pgfsyssoftpath@rectsizetoken\forest@badtoken |
| 8345 |
\let\pgfsyssoftpath@closepathtoken\forest@badtoken |
| 8346 |
} |
| 8347 |
\def\forest@badtoken{% |
| 8348 |
\PackageError{forest}{This token should not be in this path}{}% |
| 8349 |
} |
| 8350 |
\def\forest@restore@pgfsyssoftpath@tokendefs{% |
| 8351 |
\let\pgfsyssoftpath@movetotoken\forest@origmovetotoken |
| 8352 |
\let\pgfsyssoftpath@linetotoken\forest@origlinetotoken |
| 8353 |
\let\pgfsyssoftpath@curvetosupportatoken\forest@origcurvetosupportatoken |
| 8354 |
\let\pgfsyssoftpath@curvetosupportbtoken\forest@origcurvetosupportbtoken |
| 8355 |
\let\pgfsyssoftpath@curvetototoken\forest@origcurvetotoken |
| 8356 |
\let\pgfsyssoftpath@rectcornertoken\forest@origrectcornertoken |
| 8357 |
\let\pgfsyssoftpath@rectsizetoken\forest@origrectsizetoken |
| 8358 |
\let\pgfsyssoftpath@closepathtoken\forest@origclosepathtoken |
| 8359 |
} |
| 8360 |
\def\forest@extendpath#1#2#3{% |
| 8361 |
\pgf@process{#3}% |
| 8362 |
\pgfsyssoftpath@setcurrentpath#1% |
| 8363 |
\forest@save@pgfsyssoftpath@tokendefs |
| 8364 |
\let\pgfsyssoftpath@movetotoken\forest@extendpath@moveto |
| 8365 |
\let\pgfsyssoftpath@linetotoken\forest@extendpath@lineto |
| 8366 |
#2% |
| 8367 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 8368 |
\pgfsyssoftpath@getcurrentpath#1% |
| 8369 |
} |
| 8370 |
\def\forest@extendpath@moveto#1#2{% |
| 8371 |
\forest@extendpath@do{#1}{#2}\pgfsyssoftpath@moveto |
| 8372 |
} |
| 8373 |
\def\forest@extendpath@lineto#1#2{% |
| 8374 |
\forest@extendpath@do{#1}{#2}\pgfsyssoftpath@lineto |
| 8375 |
} |
| 8376 |
\def\forest@extendpath@do#1#2#3{% |
| 8377 |
{% |
| 8378 |
\advance\pgf@x #1 |
| 8379 |
\advance\pgf@y #2 |
| 8380 |
#3{\the\pgf@x}{\the\pgf@y}% |
| 8381 |
}% |
| 8382 |
} |
| 8383 |
\def\forest@path@getboundingrectangle@ls#1#2{% |
| 8384 |
{% |
| 8385 |
\pgftransformreset |
| 8386 |
\forest@pgfqtransformrotate{-#2}% |
| 8387 |
\forest@pgfpathtransformed#1% |
| 8388 |
}% |
| 8389 |
\pgfsyssoftpath@getcurrentpath\forest@gbr@rotatedpath |
| 8390 |
\forest@path@getboundingrectangle@xy\forest@gbr@rotatedpath |
| 8391 |
} |
| 8392 |
\def\forest@path@getboundingrectangle@xy#1{% |
| 8393 |
\forest@save@pgfsyssoftpath@tokendefs |
| 8394 |
\let\pgfsyssoftpath@movetotoken\forest@gbr@firstpoint |
| 8395 |
\let\pgfsyssoftpath@linetotoken\forest@gbr@firstpoint |
| 8396 |
#1% |
| 8397 |
\forest@restore@pgfsyssoftpath@tokendefs |
| 8398 |
} |
| 8399 |
\def\forest@gbr@firstpoint#1#2{% |
| 8400 |
\pgf@xa=#1 \pgf@xb=#1 \pgf@ya=#2 \pgf@yb=#2 |
| 8401 |
\let\pgfsyssoftpath@movetotoken\forest@gbr@point |
| 8402 |
\let\pgfsyssoftpath@linetotoken\forest@gbr@point |
| 8403 |
} |
| 8404 |
\def\forest@gbr@point#1#2{% |
| 8405 |
\ifdim#1<\pgf@xa\relax\pgf@xa=#1 \fi |
| 8406 |
\ifdim#1>\pgf@xb\relax\pgf@xb=#1 \fi |
| 8407 |
\ifdim#2<\pgf@ya\relax\pgf@ya=#2 \fi |
| 8408 |
\ifdim#2>\pgf@yb\relax\pgf@yb=#2 \fi |
| 8409 |
} |
| 8410 |
\let\forest@pgfqtransformrotate\pgftransformrotate |
| 8411 |
\let\forest@pgftransformcm\pgftransformcm |
| 8412 |
\let\forest@pgf@transformcm\pgf@transformcm |
| 8413 |
\patchcmd{\forest@pgfqtransformrotate}{\pgfmathparse{#1}}{\edef\pgfmathresult{\number\numexpr#1}}{}{} |
| 8414 |
\patchcmd{\forest@pgfqtransformrotate}{\pgftransformcm}{\forest@pgftransformcm}{}{} |
| 8415 |
\patchcmd{\forest@pgftransformcm}{\pgf@transformcm}{\forest@pgf@transformcm}{}{} |
| 8416 |
\patchcmd{\forest@pgf@transformcm}{\pgfmathsetlength}{\forest@pgf@transformcm@setlength}{}{} % 4x |
| 8417 |
\patchcmd{\forest@pgf@transformcm}{\pgfmathsetlength}{\forest@pgf@transformcm@setlength}{}{} % 4x |
| 8418 |
\patchcmd{\forest@pgf@transformcm}{\pgfmathsetlength}{\forest@pgf@transformcm@setlength}{}{} % 4x |
| 8419 |
\patchcmd{\forest@pgf@transformcm}{\pgfmathsetlength}{\forest@pgf@transformcm@setlength}{}{} % 4x |
| 8420 |
\def\forest@pgf@transformcm@setlength#1#2{#1=#2pt} |
| 8421 |
\pgfkeys{/forest/external/.cd, |
| 8422 |
%copy command/.initial={cp "\source" "\target"}, |
| 8423 |
copy command/.initial={}, |
| 8424 |
optimize/.is if=forest@external@optimize@, |
| 8425 |
context/.initial={% |
| 8426 |
\forestOve{\csname forest@id@of@standard node\endcsname}{environment@formula}}, |
| 8427 |
depends on macro/.style={context/.append/.expanded={% |
| 8428 |
\expandafter\detokenize\expandafter{#1}}}, |
| 8429 |
} |
| 8430 |
\def\forest@file@copy#1#2{% |
| 8431 |
\IfFileExists{#1}{% |
| 8432 |
\pgfkeysgetvalue{/forest/external/copy command}\forest@copy@command |
| 8433 |
\ifdefempty\forest@copy@command{% |
| 8434 |
\forest@file@copy@{#1}{#2}% |
| 8435 |
}{ % copy by external command |
| 8436 |
\def\source{#1}% |
| 8437 |
\def\target{#2}% |
| 8438 |
\immediate\write18{\forest@copy@command}% |
| 8439 |
}% |
| 8440 |
}{}% |
| 8441 |
} |
| 8442 |
\newread\forest@copy@in |
| 8443 |
\newwrite\forest@copy@out |
| 8444 |
\def\forest@file@copy@#1#2{% |
| 8445 |
\begingroup |
| 8446 |
\openin\forest@copy@in=#1 |
| 8447 |
\immediate\openout\forest@copy@out#2 |
| 8448 |
\endlinechar-1 |
| 8449 |
\loop |
| 8450 |
\unless\ifeof\forest@copy@in |
| 8451 |
\readline\forest@copy@in to\forest@temp |
| 8452 |
\immediate\write\forest@copy@out{\forest@temp}% |
| 8453 |
\repeat |
| 8454 |
\immediate\closeout\forest@copy@out |
| 8455 |
\closein\forest@copy@in |
| 8456 |
\endgroup |
| 8457 |
} |
| 8458 |
\newif\ifforest@external@optimize@ |
| 8459 |
\forest@external@optimize@true |
| 8460 |
\ifforest@install@keys@to@tikz@path@ |
| 8461 |
\tikzset{ |
| 8462 |
fit to/.style={ |
| 8463 |
/forest/for nodewalk=% |
| 8464 |
{TeX={\def\forest@fitto{}},#1}% |
| 8465 |
{TeX={\eappto\forest@fitto{(\forestove{name})}}}, |
| 8466 |
fit/.expanded={\forest@fitto} |
| 8467 |
}, |
| 8468 |
} |
| 8469 |
\fi |
| 8470 |
\ifforest@external@ |
| 8471 |
\ifdefined\tikzexternal@tikz@replacement\else |
| 8472 |
\usetikzlibrary{external}% |
| 8473 |
\fi |
| 8474 |
\pgfkeys{% |
| 8475 |
/tikz/external/failed ref warnings for={}, |
| 8476 |
/pgf/images/aux in dpth=false, |
| 8477 |
}% |
| 8478 |
\tikzifexternalizing{}{% |
| 8479 |
\forest@file@copy{\jobname.aux}{\jobname.aux.copy}% |
| 8480 |
}% |
| 8481 |
\AtBeginDocument{% |
| 8482 |
\tikzifexternalizing{% |
| 8483 |
\IfFileExists{\tikzexternalrealjob.aux.copy}{% |
| 8484 |
\makeatletter |
| 8485 |
\input\tikzexternalrealjob.aux.copy\relax |
| 8486 |
\makeatother |
| 8487 |
}{}% |
| 8488 |
}{% |
| 8489 |
\newwrite\forest@auxout |
| 8490 |
\immediate\openout\forest@auxout=\tikzexternalrealjob.for.tmp |
| 8491 |
}% |
| 8492 |
\IfFileExists{\tikzexternalrealjob.for}{% |
| 8493 |
{% |
| 8494 |
\makehashother\makeatletter |
| 8495 |
\input\tikzexternalrealjob.for\relax |
| 8496 |
}% |
| 8497 |
}{}% |
| 8498 |
}% |
| 8499 |
\AtEndDocument{% |
| 8500 |
\tikzifexternalizing{}{% |
| 8501 |
\immediate\closeout\forest@auxout |
| 8502 |
\forest@file@copy{\jobname.for.tmp}{\jobname.for}% |
| 8503 |
}% |
| 8504 |
}% |
| 8505 |
\fi |
| 8506 |
\NewDocumentEnvironment{forest}{D(){}}{% |
| 8507 |
\forest@config{#1}% |
| 8508 |
\Collect@Body |
| 8509 |
\forest@env |
| 8510 |
}{} |
| 8511 |
\NewDocumentCommand{\Forest}{s D(){} m}{% |
| 8512 |
\forest@config{#2}% |
| 8513 |
\IfBooleanTF{#1}{\let\forest@next\forest@env}{\let\forest@next\forest@group@env}% |
| 8514 |
\forest@next{#3}% |
| 8515 |
} |
| 8516 |
\def\forest@config#1{% |
| 8517 |
\forest@defstages{stages}% |
| 8518 |
\forestset{@config/.cd,#1}% |
| 8519 |
} |
| 8520 |
\def\forest@defstages#1{% |
| 8521 |
\def\forest@stages{#1}% |
| 8522 |
} |
| 8523 |
\forestset{@config/.cd, |
| 8524 |
%stages/.store in=\forest@stages, |
| 8525 |
stages/.code={\forest@defstages{#1}}, |
| 8526 |
.unknown/.code={\PackageError{forest}{Unknown config option for forest environment/command.}{In Forest v2.0.0 and v2.0.1, this (parenthesized) argument accepted the definition of style stages for the current forest environment/macro. Since v2.0.2, you should write "\string\begin{forest}(stages={...})...\string\end{forest}", or "\string\Forest(stages={...}){...}" instead.}} |
| 8527 |
} |
| 8528 |
\def\forest@group@env#1{{\forest@env{#1}}} |
| 8529 |
\newif\ifforest@externalize@tree@ |
| 8530 |
\newif\ifforest@was@tikzexternalwasenable |
| 8531 |
\newcommand\forest@env[1]{% |
| 8532 |
\let\forest@external@next\forest@begin |
| 8533 |
\forest@was@tikzexternalwasenablefalse |
| 8534 |
\ifdefined\tikzexternal@tikz@replacement |
| 8535 |
\ifx\tikz\tikzexternal@tikz@replacement |
| 8536 |
\forest@was@tikzexternalwasenabletrue |
| 8537 |
\tikzexternaldisable |
| 8538 |
\fi |
| 8539 |
\fi |
| 8540 |
\forest@externalize@tree@false |
| 8541 |
\ifforest@external@ |
| 8542 |
\ifforest@was@tikzexternalwasenable |
| 8543 |
\forest@env@ |
| 8544 |
\fi |
| 8545 |
\fi |
| 8546 |
\forest@standardnode@calibrate |
| 8547 |
\forest@external@next{#1}% |
| 8548 |
} |
| 8549 |
\def\forest@env@{% |
| 8550 |
\iftikzexternalexportnext |
| 8551 |
\tikzifexternalizing{% |
| 8552 |
\let\forest@external@next\forest@begin@externalizing |
| 8553 |
}{% |
| 8554 |
\let\forest@external@next\forest@begin@externalize |
| 8555 |
}% |
| 8556 |
\else |
| 8557 |
\tikzexternalexportnexttrue |
| 8558 |
\fi |
| 8559 |
} |
| 8560 |
\long\def\forest@begin@externalizing#1{% |
| 8561 |
\forest@external@setup{#1}% |
| 8562 |
\let\forest@external@next\forest@begin |
| 8563 |
\forest@externalize@inner@n=-1 |
| 8564 |
\ifforest@external@optimize@\forest@externalizing@maybeoptimize\fi |
| 8565 |
\forest@external@next{#1}% |
| 8566 |
\tikzexternalenable |
| 8567 |
} |
| 8568 |
\def\forest@externalizing@maybeoptimize{% |
| 8569 |
\edef\forest@temp{\tikzexternalrealjob-forest-\forest@externalize@outer@n}% |
| 8570 |
\edef\forest@marshal{% |
| 8571 |
\noexpand\pgfutil@in@ |
| 8572 |
{\expandafter\detokenize\expandafter{\forest@temp}.} |
| 8573 |
{\expandafter\detokenize\expandafter{\pgfactualjobname}.}% |
| 8574 |
}\forest@marshal |
| 8575 |
\ifpgfutil@in@ |
| 8576 |
\else |
| 8577 |
\let\forest@external@next\@gobble |
| 8578 |
\fi |
| 8579 |
} |
| 8580 |
\long\def\forest@begin@externalize#1{% |
| 8581 |
\forest@external@setup{#1}% |
| 8582 |
\iftikzexternal@file@isuptodate |
| 8583 |
\setbox0=\hbox{% |
| 8584 |
\csname forest@externalcheck@\forest@externalize@outer@n\endcsname |
| 8585 |
}% |
| 8586 |
\fi |
| 8587 |
\iftikzexternal@file@isuptodate |
| 8588 |
\csname forest@externalload@\forest@externalize@outer@n\endcsname |
| 8589 |
\else |
| 8590 |
\forest@externalize@tree@true |
| 8591 |
\forest@externalize@inner@n=-1 |
| 8592 |
\forest@begin{#1}% |
| 8593 |
\ifcsdef{forest@externalize@@\forest@externalize@id}{}{% |
| 8594 |
\immediate\write\forest@auxout{% |
| 8595 |
\noexpand\forest@external |
| 8596 |
{\forest@externalize@outer@n}% |
| 8597 |
{\expandafter\detokenize\expandafter{\forest@externalize@id}}% |
| 8598 |
{\expandonce\forest@externalize@checkimages}% |
| 8599 |
{\expandonce\forest@externalize@loadimages}% |
| 8600 |
}% |
| 8601 |
}% |
| 8602 |
\fi |
| 8603 |
\tikzexternalenable |
| 8604 |
} |
| 8605 |
\def\forest@includeexternal@check#1{% |
| 8606 |
\tikzsetnextfilename{#1}% |
| 8607 |
\IfFileExists{\tikzexternal@filenameprefix/#1}{\tikzexternal@file@isuptodatetrue}{\tikzexternal@file@isuptodatefalse}% |
| 8608 |
} |
| 8609 |
\def\makehashother{\catcode`\#=12}% |
| 8610 |
\long\def\forest@external@setup#1{% |
| 8611 |
% set up \forest@externalize@id and \forest@externalize@outer@n |
| 8612 |
% we need to deal with #s correctly (\write doubles them) |
| 8613 |
\setbox0=\hbox{\makehashother\makeatletter |
| 8614 |
\scantokens{\forest@temp@toks{#1}}\expandafter |
| 8615 |
}% |
| 8616 |
\expandafter\forest@temp@toks\expandafter{\the\forest@temp@toks}% |
| 8617 |
\edef\forest@temp{\pgfkeysvalueof{/forest/external/context}}% |
| 8618 |
\edef\forest@externalize@id{% |
| 8619 |
\expandafter\detokenize\expandafter{\forest@temp}% |
| 8620 |
@@% |
| 8621 |
\expandafter\detokenize\expandafter{\the\forest@temp@toks}% |
| 8622 |
}% |
| 8623 |
\letcs\forest@externalize@outer@n{forest@externalize@@\forest@externalize@id}% |
| 8624 |
\ifdefined\forest@externalize@outer@n |
| 8625 |
\global\tikzexternal@file@isuptodatetrue |
| 8626 |
\else |
| 8627 |
\global\advance\forest@externalize@max@outer@n 1 |
| 8628 |
\edef\forest@externalize@outer@n{\the\forest@externalize@max@outer@n}% |
| 8629 |
\global\tikzexternal@file@isuptodatefalse |
| 8630 |
\fi |
| 8631 |
\def\forest@externalize@loadimages{}% |
| 8632 |
\def\forest@externalize@checkimages{}% |
| 8633 |
} |
| 8634 |
\newcount\forest@externalize@max@outer@n |
| 8635 |
\global\forest@externalize@max@outer@n=0 |
| 8636 |
\newcount\forest@externalize@inner@n |
| 8637 |
\long\def\forest@external#1#2#3#4{% #1=n,#2=context+source code,#3=update check code, #4=load code |
| 8638 |
\ifnum\forest@externalize@max@outer@n<#1 |
| 8639 |
\global\forest@externalize@max@outer@n=#1 |
| 8640 |
\fi |
| 8641 |
\global\csdef{forest@externalize@@\detokenize{#2}}{#1}% |
| 8642 |
\global\csdef{forest@externalcheck@#1}{#3}% |
| 8643 |
\global\csdef{forest@externalload@#1}{#4}% |
| 8644 |
\tikzifexternalizing{}{% |
| 8645 |
\immediate\write\forest@auxout{% |
| 8646 |
\noexpand\forest@external{#1}% |
| 8647 |
{\expandafter\detokenize\expandafter{#2}}% |
| 8648 |
{\unexpanded{#3}}% |
| 8649 |
{\unexpanded{#4}}% |
| 8650 |
}% |
| 8651 |
}% |
| 8652 |
} |
| 8653 |
\def\forest@includeexternal#1{% |
| 8654 |
\edef\forest@temp{\pgfkeysvalueof{/forest/external/context}}% |
| 8655 |
%\typeout{forest: Including external picture '#1' for forest context+code: '\expandafter\detokenize\expandafter{\forest@externalize@id}'}% |
| 8656 |
{% |
| 8657 |
%\def\pgf@declaredraftimage##1##2{\def\pgf@image{\hbox{}}}% |
| 8658 |
\tikzsetnextfilename{#1}% |
| 8659 |
\tikzexternalenable |
| 8660 |
\tikz{}% |
| 8661 |
}% |
| 8662 |
} |
| 8663 |
\def\forest@includeexternal@box#1#2{% |
| 8664 |
\global\setbox#1=\hbox{\forest@includeexternal{#2}}% |
| 8665 |
} |
| 8666 |
\long\def\forest@begin#1{% |
| 8667 |
\iffalse{\fi\forest@parsebracket#1}% |
| 8668 |
} |
| 8669 |
\def\forest@parsebracket{% |
| 8670 |
\bracketParse{\forest@get@root@afterthought}\forest@root=% |
| 8671 |
} |
| 8672 |
\def\forest@get@root@afterthought{% |
| 8673 |
\expandafter\forest@get@root@afterthought@\expandafter{\iffalse}\fi |
| 8674 |
} |
| 8675 |
\long\def\forest@get@root@afterthought@#1{% |
| 8676 |
\ifblank{#1}{}{% |
| 8677 |
\forestOeappto{\forest@root}{given options}{,afterthought={\unexpanded{#1}}}% |
| 8678 |
}% |
| 8679 |
\forest@do |
| 8680 |
} |
| 8681 |
\def\forest@do{% |
| 8682 |
\forest@node@Compute@numeric@ts@info{\forest@root}% |
| 8683 |
\expandafter\forestset\expandafter{\forest@stages}% |
| 8684 |
\ifforest@was@tikzexternalwasenable |
| 8685 |
\tikzexternalenable |
| 8686 |
\fi |
| 8687 |
} |
| 8688 |
\def\forest@standardnode@new{% |
| 8689 |
\advance\forest@node@maxid1 |
| 8690 |
\forest@fornode{\the\forest@node@maxid}{% |
| 8691 |
\forest@node@init |
| 8692 |
\forestoeset{id}{\forest@cn}% |
| 8693 |
\forest@node@setname@silent{standard node}% |
| 8694 |
}% |
| 8695 |
} |
| 8696 |
\def\forest@standardnode@calibrate{% |
| 8697 |
\forest@fornode{\forest@node@Nametoid{standard node}}{% |
| 8698 |
\edef\forest@environment{\forestove{environment@formula}}% |
| 8699 |
\forestoget{previous@environment}\forest@previous@environment |
| 8700 |
\ifx\forest@environment\forest@previous@environment\else |
| 8701 |
\forestolet{previous@environment}\forest@environment |
| 8702 |
\forest@node@typeset |
| 8703 |
\forestoget{calibration@procedure}\forest@temp |
| 8704 |
\expandafter\forestset\expandafter{\forest@temp}% |
| 8705 |
\fi |
| 8706 |
}% |
| 8707 |
} |
| 8708 |
\def\forestStandardNode[#1]#2#3#4{% |
| 8709 |
\let\forest@standardnode@restoretikzexternal\relax |
| 8710 |
\ifdefined\tikzexternaldisable |
| 8711 |
\ifx\tikz\tikzexternal@tikz@replacement |
| 8712 |
\tikzexternaldisable |
| 8713 |
\let\forest@standardnode@restoretikzexternal\tikzexternalenable |
| 8714 |
\fi |
| 8715 |
\fi |
| 8716 |
\forest@standardnode@new |
| 8717 |
\forest@fornode{\forest@node@Nametoid{standard node}}{% |
| 8718 |
\forestset{content=#1}% |
| 8719 |
\forestoset{environment@formula}{#2}% |
| 8720 |
\edef\forest@temp{\unexpanded{#3}}% |
| 8721 |
\forestolet{calibration@procedure}\forest@temp |
| 8722 |
\def\forest@calibration@initializing@code{}% |
| 8723 |
\pgfqkeys{/forest/initializing@code}{#4}% |
| 8724 |
\forestolet{initializing@code}\forest@calibration@initializing@code |
| 8725 |
\forest@standardnode@restoretikzexternal |
| 8726 |
} |
| 8727 |
} |
| 8728 |
\forestset{initializing@code/.unknown/.code={% |
| 8729 |
\eappto\forest@calibration@initializing@code{% |
| 8730 |
\noexpand\forestOget{\forest@node@Nametoid{standard node}}{\pgfkeyscurrentname}\noexpand\forest@temp |
| 8731 |
\noexpand\forestolet{\pgfkeyscurrentname}\noexpand\forest@temp |
| 8732 |
}% |
| 8733 |
} |
| 8734 |
} |
| 8735 |
\def\forest@initializefromstandardnode{% |
| 8736 |
\forestOve{\forest@node@Nametoid{standard node}}{initializing@code}% |
| 8737 |
} |
| 8738 |
\forestStandardNode[dj] |
| 8739 |
{% |
| 8740 |
\forestOve{\forest@node@Nametoid{standard node}}{content},% |
| 8741 |
\the\ht\strutbox,\the\pgflinewidth,% |
| 8742 |
\pgfkeysvalueof{/pgf/inner ysep},\pgfkeysvalueof{/pgf/outer ysep},% |
| 8743 |
\pgfkeysvalueof{/pgf/inner xsep},\pgfkeysvalueof{/pgf/outer xsep}% |
| 8744 |
} |
| 8745 |
{ |
| 8746 |
l sep'/.expanded={\the\dimexpr\the\ht\strutbox+\pgfkeysvalueof{/pgf/inner ysep}}, |
| 8747 |
l={l_sep()+abs(max_y()-min_y())+2*\pgfkeysvalueof{/pgf/outer ysep}}, |
| 8748 |
s sep'/.expanded={\the\dimexpr \pgfkeysvalueof{/pgf/inner xsep}*2} |
| 8749 |
} |
| 8750 |
{l sep,l,s sep} |
| 8751 |
\pgfqkeys{/forest/@cs}{% |
| 8752 |
name/.code={% |
| 8753 |
\edef\forest@cn{\forest@node@Nametoid{#1}}% |
| 8754 |
\forest@forestcs@resetxy}, |
| 8755 |
id/.code={% |
| 8756 |
\edef\forest@cn{#1}% |
| 8757 |
\forest@forestcs@resetxy}, |
| 8758 |
go/.code={% |
| 8759 |
\forest@go{#1}% |
| 8760 |
\forest@forestcs@resetxy}, |
| 8761 |
anchor/.code={\forest@forestcs@anchor{#1}}, |
| 8762 |
l/.code={% |
| 8763 |
\forestmathsetlengthmacro\forest@forestcs@l{#1}% |
| 8764 |
\forest@forestcs@ls |
| 8765 |
}, |
| 8766 |
s/.code={% |
| 8767 |
\forestmathsetlengthmacro\forest@forestcs@s{#1}% |
| 8768 |
\forest@forestcs@ls |
| 8769 |
}, |
| 8770 |
.unknown/.code={% |
| 8771 |
\expandafter\pgfutil@in@\expandafter.\expandafter{\pgfkeyscurrentname}% |
| 8772 |
\ifpgfutil@in@ |
| 8773 |
\expandafter\forest@forestcs@namegoanchor\pgfkeyscurrentname\forest@end |
| 8774 |
\else |
| 8775 |
\expandafter\forest@nameandgo\expandafter{\pgfkeyscurrentname}% |
| 8776 |
\forest@forestcs@resetxy |
| 8777 |
\fi |
| 8778 |
} |
| 8779 |
} |
| 8780 |
\def\forest@forestcs@resetxy{% |
| 8781 |
\ifnum\forest@cn=0 \forest@cs@invalidnodeerror\fi |
| 8782 |
\global\pgf@x\forestove{x}\relax |
| 8783 |
\global\pgf@y\forestove{y}\relax |
| 8784 |
} |
| 8785 |
\def\forest@forestcs@ls{% |
| 8786 |
\ifdefined\forest@forestcs@l |
| 8787 |
\ifdefined\forest@forestcs@s |
| 8788 |
{% |
| 8789 |
\pgftransformreset |
| 8790 |
\forest@pgfqtransformrotate{\forestove{grow}}% |
| 8791 |
\pgfpointtransformed{\pgfqpoint{\forest@forestcs@l}{\forest@forestcs@s}}% |
| 8792 |
}% |
| 8793 |
\global\advance\pgf@x\forestove{x}% |
| 8794 |
\global\advance\pgf@y\forestove{y}% |
| 8795 |
\fi |
| 8796 |
\fi |
| 8797 |
} |
| 8798 |
\def\forest@forestcs@anchor#1{% |
| 8799 |
\edef\forest@marshal{% |
| 8800 |
\noexpand\forest@original@tikz@parse@node\relax |
| 8801 |
(\forestove{name}\ifx\relax#1\relax\else.\fi#1)% |
| 8802 |
}\forest@marshal |
| 8803 |
} |
| 8804 |
\def\forest@forestcs@namegoanchor#1.#2\forest@end{% |
| 8805 |
\forest@nameandgo{#1}% |
| 8806 |
\ifnum\forest@cn=0 \forest@cs@invalidnodeerror\fi |
| 8807 |
\forest@forestcs@anchor{#2}% |
| 8808 |
} |
| 8809 |
\def\forest@cs@invalidnodeerror{% |
| 8810 |
\PackageError{forest}{Attempt to refer to the invalid node by "forest cs"}{}% |
| 8811 |
} |
| 8812 |
\tikzdeclarecoordinatesystem{forest}{% |
| 8813 |
\forest@forthis{% |
| 8814 |
\forest@forestcs@resetxy |
| 8815 |
\ifdefined\forest@forestcs@l\undef\forest@forestcs@l\fi |
| 8816 |
\ifdefined\forest@forestcs@s\undef\forest@forestcs@s\fi |
| 8817 |
\pgfqkeys{/forest/@cs}{#1}% |
| 8818 |
}% |
| 8819 |
} |
| 8820 |
\def\forest@tikz@parse@node#1(#2){% |
| 8821 |
\pgfutil@in@.{#2}% |
| 8822 |
\ifpgfutil@in@ |
| 8823 |
\expandafter\forest@tikz@parse@node@checkiftikzname@withdot |
| 8824 |
\else% |
| 8825 |
\expandafter\forest@tikz@parse@node@checkiftikzname@withoutdot |
| 8826 |
\fi% |
| 8827 |
#1(#2)\forest@end |
| 8828 |
} |
| 8829 |
\def\forest@tikz@parse@node@checkiftikzname@withdot#1(#2.#3)\forest@end{% |
| 8830 |
\forest@tikz@parse@node@checkiftikzname#1{#2}{.#3}} |
| 8831 |
\def\forest@tikz@parse@node@checkiftikzname@withoutdot#1(#2)\forest@end{% |
| 8832 |
\forest@tikz@parse@node@checkiftikzname#1{#2}{}} |
| 8833 |
\def\forest@tikz@parse@node@checkiftikzname#1#2#3{% |
| 8834 |
\expandafter\ifx\csname pgf@sh@ns@#2\endcsname\relax |
| 8835 |
\forest@forthis{% |
| 8836 |
\forest@nameandgo{#2}% |
| 8837 |
\ifnum\forest@cn=0 \forest@cs@invalidnodeerror\fi |
| 8838 |
\edef\forest@temp@relativenodename{\forestove{name}}% |
| 8839 |
}% |
| 8840 |
\else |
| 8841 |
\def\forest@temp@relativenodename{#2}% |
| 8842 |
\fi |
| 8843 |
\expandafter\forest@original@tikz@parse@node\expandafter#1\expandafter(\forest@temp@relativenodename#3)% |
| 8844 |
} |
| 8845 |
\def\forest@nameandgo#1{% |
| 8846 |
\pgfutil@in@!{#1}% |
| 8847 |
\ifpgfutil@in@ |
| 8848 |
\forest@nameandgo@(#1)% |
| 8849 |
\else |
| 8850 |
\ifstrempty{#1}{}{\edef\forest@cn{\forest@node@Nametoid{#1}}}% |
| 8851 |
\fi |
| 8852 |
} |
| 8853 |
\def\forest@nameandgo@(#1!#2){% |
| 8854 |
\ifstrempty{#1}{}{\edef\forest@cn{\forest@node@Nametoid{#1}}}% |
| 8855 |
\forest@go{#2}% |
| 8856 |
} |
| 8857 |
\forestset{ |
| 8858 |
declare count={rotate}{0}, |
| 8859 |
autoforward'={rotate}{node options}, |
| 8860 |
} |
| 8861 |
\newif\ifforest@anchor@snapbordertocompass |
| 8862 |
\newif\ifforest@anchor@forwardtotikz |
| 8863 |
\newif\ifforest@anchor@isborder |
| 8864 |
\def\forestanchortotikzanchor#1#2{% #1 = forest anchor, #2 = macro to receive the tikz anchor |
| 8865 |
\forest@anchor@forwardtotikzfalse |
| 8866 |
\forest@anchor@do{}{#1}{\forest@cn}% |
| 8867 |
\let#2\forest@temp@anchor |
| 8868 |
} |
| 8869 |
\pgfdeclaregenericanchor{child anchor}{% |
| 8870 |
\forest@anchor@forwardtotikztrue |
| 8871 |
\forest@anchor@do{#1}{child anchor}{\forest@referencednodeid}% |
| 8872 |
} |
| 8873 |
\pgfdeclaregenericanchor{parent anchor}{% |
| 8874 |
\forest@anchor@forwardtotikztrue |
| 8875 |
\forest@anchor@do{#1}{parent anchor}{\forest@referencednodeid}% |
| 8876 |
} |
| 8877 |
\pgfdeclaregenericanchor{anchor}{% |
| 8878 |
\forest@anchor@forwardtotikztrue |
| 8879 |
\forest@anchor@do{#1}{anchor}{\forest@referencednodeid}% |
| 8880 |
} |
| 8881 |
\pgfdeclaregenericanchor{children}{% |
| 8882 |
\forest@anchor@forwardtotikztrue |
| 8883 |
\forest@anchor@do{#1}{children}{\forest@referencednodeid}% |
| 8884 |
} |
| 8885 |
\pgfdeclaregenericanchor{-children}{% |
| 8886 |
\forest@anchor@forwardtotikztrue |
| 8887 |
\forest@anchor@do{#1}{-children}{\forest@referencednodeid}% |
| 8888 |
} |
| 8889 |
\pgfdeclaregenericanchor{children first}{% |
| 8890 |
\forest@anchor@forwardtotikztrue |
| 8891 |
\forest@anchor@do{#1}{children first}{\forest@referencednodeid}% |
| 8892 |
} |
| 8893 |
\pgfdeclaregenericanchor{-children first}{% |
| 8894 |
\forest@anchor@forwardtotikztrue |
| 8895 |
\forest@anchor@do{#1}{-children first}{\forest@referencednodeid}% |
| 8896 |
} |
| 8897 |
\pgfdeclaregenericanchor{first}{% |
| 8898 |
\forest@anchor@forwardtotikztrue |
| 8899 |
\forest@anchor@do{#1}{first}{\forest@referencednodeid}% |
| 8900 |
} |
| 8901 |
\pgfdeclaregenericanchor{parent first}{% |
| 8902 |
\forest@anchor@forwardtotikztrue |
| 8903 |
\forest@anchor@do{#1}{parent first}{\forest@referencednodeid}% |
| 8904 |
} |
| 8905 |
\pgfdeclaregenericanchor{-parent first}{% |
| 8906 |
\forest@anchor@forwardtotikztrue |
| 8907 |
\forest@anchor@do{#1}{-parent first}{\forest@referencednodeid}% |
| 8908 |
} |
| 8909 |
\pgfdeclaregenericanchor{parent}{% |
| 8910 |
\forest@anchor@forwardtotikztrue |
| 8911 |
\forest@anchor@do{#1}{parent}{\forest@referencednodeid}% |
| 8912 |
} |
| 8913 |
\pgfdeclaregenericanchor{-parent}{% |
| 8914 |
\forest@anchor@forwardtotikztrue |
| 8915 |
\forest@anchor@do{#1}{-parent}{\forest@referencednodeid}% |
| 8916 |
} |
| 8917 |
\pgfdeclaregenericanchor{parent last}{% |
| 8918 |
\forest@anchor@forwardtotikztrue |
| 8919 |
\forest@anchor@do{#1}{parent last}{\forest@referencednodeid}% |
| 8920 |
} |
| 8921 |
\pgfdeclaregenericanchor{-parent last}{% |
| 8922 |
\forest@anchor@forwardtotikztrue |
| 8923 |
\forest@anchor@do{#1}{-parent last}{\forest@referencednodeid}% |
| 8924 |
} |
| 8925 |
\pgfdeclaregenericanchor{last}{% |
| 8926 |
\forest@anchor@forwardtotikztrue |
| 8927 |
\forest@anchor@do{#1}{last}{\forest@referencednodeid}% |
| 8928 |
} |
| 8929 |
\pgfdeclaregenericanchor{children last}{% |
| 8930 |
\forest@anchor@forwardtotikztrue |
| 8931 |
\forest@anchor@do{#1}{children last}{\forest@referencednodeid}% |
| 8932 |
} |
| 8933 |
\pgfdeclaregenericanchor{-children last}{% |
| 8934 |
\forest@anchor@forwardtotikztrue |
| 8935 |
\forest@anchor@do{#1}{-children last}{\forest@referencednodeid}% |
| 8936 |
} |
| 8937 |
\pgfdeclaregenericanchor{children'}{% |
| 8938 |
\forest@anchor@forwardtotikztrue |
| 8939 |
\forest@anchor@do{#1}{children'}{\forest@referencednodeid}% |
| 8940 |
} |
| 8941 |
\pgfdeclaregenericanchor{-children'}{% |
| 8942 |
\forest@anchor@forwardtotikztrue |
| 8943 |
\forest@anchor@do{#1}{-children'}{\forest@referencednodeid}% |
| 8944 |
} |
| 8945 |
\pgfdeclaregenericanchor{children first'}{% |
| 8946 |
\forest@anchor@forwardtotikztrue |
| 8947 |
\forest@anchor@do{#1}{children first'}{\forest@referencednodeid}% |
| 8948 |
} |
| 8949 |
\pgfdeclaregenericanchor{-children first'}{% |
| 8950 |
\forest@anchor@forwardtotikztrue |
| 8951 |
\forest@anchor@do{#1}{-children first'}{\forest@referencednodeid}% |
| 8952 |
} |
| 8953 |
\pgfdeclaregenericanchor{first'}{% |
| 8954 |
\forest@anchor@forwardtotikztrue |
| 8955 |
\forest@anchor@do{#1}{first'}{\forest@referencednodeid}% |
| 8956 |
} |
| 8957 |
\pgfdeclaregenericanchor{parent first'}{% |
| 8958 |
\forest@anchor@forwardtotikztrue |
| 8959 |
\forest@anchor@do{#1}{parent first'}{\forest@referencednodeid}% |
| 8960 |
} |
| 8961 |
\pgfdeclaregenericanchor{-parent first'}{% |
| 8962 |
\forest@anchor@forwardtotikztrue |
| 8963 |
\forest@anchor@do{#1}{-parent first'}{\forest@referencednodeid}% |
| 8964 |
} |
| 8965 |
\pgfdeclaregenericanchor{parent'}{% |
| 8966 |
\forest@anchor@forwardtotikztrue |
| 8967 |
\forest@anchor@do{#1}{parent'}{\forest@referencednodeid}% |
| 8968 |
} |
| 8969 |
\pgfdeclaregenericanchor{-parent'}{% |
| 8970 |
\forest@anchor@forwardtotikztrue |
| 8971 |
\forest@anchor@do{#1}{-parent'}{\forest@referencednodeid}% |
| 8972 |
} |
| 8973 |
\pgfdeclaregenericanchor{parent last'}{% |
| 8974 |
\forest@anchor@forwardtotikztrue |
| 8975 |
\forest@anchor@do{#1}{parent last'}{\forest@referencednodeid}% |
| 8976 |
} |
| 8977 |
\pgfdeclaregenericanchor{-parent last'}{% |
| 8978 |
\forest@anchor@forwardtotikztrue |
| 8979 |
\forest@anchor@do{#1}{-parent last'}{\forest@referencednodeid}% |
| 8980 |
} |
| 8981 |
\pgfdeclaregenericanchor{last'}{% |
| 8982 |
\forest@anchor@forwardtotikztrue |
| 8983 |
\forest@anchor@do{#1}{last'}{\forest@referencednodeid}% |
| 8984 |
} |
| 8985 |
\pgfdeclaregenericanchor{children last'}{% |
| 8986 |
\forest@anchor@forwardtotikztrue |
| 8987 |
\forest@anchor@do{#1}{children last'}{\forest@referencednodeid}% |
| 8988 |
} |
| 8989 |
\pgfdeclaregenericanchor{-children last'}{% |
| 8990 |
\forest@anchor@forwardtotikztrue |
| 8991 |
\forest@anchor@do{#1}{-children last'}{\forest@referencednodeid}% |
| 8992 |
} |
| 8993 |
\def\forest@anchor@do#1#2#3{% #1 = shape name, #2 = (potentially) forest anchor, #3 = node id |
| 8994 |
\forest@fornode{#3}{% |
| 8995 |
\def\forest@temp@anchor{#2}% |
| 8996 |
\forest@anchor@snapbordertocompassfalse |
| 8997 |
\forest@anchor@isborderfalse |
| 8998 |
\forest@anchor@to@tikz@anchor |
| 8999 |
\forest@anchor@border@to@compass |
| 9000 |
\ifforest@anchor@forwardtotikz |
| 9001 |
\forest@anchor@forward{#1}% |
| 9002 |
\else |
| 9003 |
\fi |
| 9004 |
}% |
| 9005 |
} |
| 9006 |
\def\forest@anchor@to@tikz@anchor{% |
| 9007 |
\ifcsdef{forest@anchor@@\forest@temp@anchor}{% |
| 9008 |
\csuse{forest@anchor@@\forest@temp@anchor}% |
| 9009 |
\forest@anchor@to@tikz@anchor |
| 9010 |
}{}% |
| 9011 |
} |
| 9012 |
\csdef{forest@anchor@@parent anchor}{% |
| 9013 |
\forestoget{parent anchor}\forest@temp@anchor} |
| 9014 |
\csdef{forest@anchor@@child anchor}{% |
| 9015 |
\forestoget{child anchor}\forest@temp@anchor} |
| 9016 |
\csdef{forest@anchor@@anchor}{% |
| 9017 |
\forestoget{anchor}\forest@temp@anchor} |
| 9018 |
\csdef{forest@anchor@@children'}{% |
| 9019 |
\forest@anchor@isbordertrue |
| 9020 |
\edef\forest@temp@anchor{\number\numexpr\forestove{grow}-\forestove{rotate}}% |
| 9021 |
} |
| 9022 |
\csdef{forest@anchor@@-children'}{% |
| 9023 |
\forest@anchor@isbordertrue |
| 9024 |
\edef\forest@temp@anchor{\number\numexpr 180+\forestove{grow}-\forestove{rotate}}% |
| 9025 |
} |
| 9026 |
\csdef{forest@anchor@@parent'}{% |
| 9027 |
\forest@anchor@isbordertrue |
| 9028 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9029 |
\edef\forest@temp@anchor{\number\numexpr\forest@temp@grow-\forestove{rotate}+180}% |
| 9030 |
} |
| 9031 |
\csdef{forest@anchor@@-parent'}{% |
| 9032 |
\forest@anchor@isbordertrue |
| 9033 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9034 |
\edef\forest@temp@anchor{\number\numexpr\forest@temp@grow-\forestove{rotate}}% |
| 9035 |
} |
| 9036 |
\csdef{forest@anchor@@first'}{% |
| 9037 |
\forest@anchor@isbordertrue |
| 9038 |
\edef\forest@temp@anchor{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 -\else+\fi90}% |
| 9039 |
} |
| 9040 |
\csdef{forest@anchor@@last'}{% |
| 9041 |
\forest@anchor@isbordertrue |
| 9042 |
\edef\forest@temp@anchor{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 +\else-\fi90}% |
| 9043 |
} |
| 9044 |
\csdef{forest@anchor@@parent first'}{% |
| 9045 |
\forest@anchor@isbordertrue |
| 9046 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9047 |
\edef\forest@temp@reversed{\ifnum\forestove{@parent}=0 \forestove{reversed}\else\forestOve{\forestove{@parent}}{reversed}\fi}% |
| 9048 |
\edef\forest@temp@anchor@parent{\number\numexpr\forest@temp@grow-\forestove{rotate}+180}% |
| 9049 |
\edef\forest@temp@anchor@first{\number\numexpr\forest@temp@grow-\forestove{rotate}\ifnum\forest@temp@reversed=0 -\else+\fi90}% |
| 9050 |
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@first}\forest@temp@anchor |
| 9051 |
} |
| 9052 |
\csdef{forest@anchor@@-parent first'}{% |
| 9053 |
\forest@anchor@isbordertrue |
| 9054 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9055 |
\edef\forest@temp@reversed{\ifnum\forestove{@parent}=0 \forestove{reversed}\else\forestOve{\forestove{@parent}}{reversed}\fi}% |
| 9056 |
\edef\forest@temp@anchor@parent{\number\numexpr\forest@temp@grow-\forestove{rotate}}% |
| 9057 |
\edef\forest@temp@anchor@first{\number\numexpr\forest@temp@grow-\forestove{rotate}\ifnum\forest@temp@reversed=0 -\else+\fi90}% |
| 9058 |
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@first}\forest@temp@anchor |
| 9059 |
} |
| 9060 |
\csdef{forest@anchor@@parent last'}{% |
| 9061 |
\forest@anchor@isbordertrue |
| 9062 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9063 |
\edef\forest@temp@reversed{\ifnum\forestove{@parent}=0 \forestove{reversed}\else\forestOve{\forestove{@parent}}{reversed}\fi}% |
| 9064 |
\edef\forest@temp@anchor@parent{\number\numexpr\forest@temp@grow-\forestove{rotate}+180}% |
| 9065 |
\edef\forest@temp@anchor@last{\number\numexpr\forest@temp@grow-\forestove{rotate}\ifnum\forest@temp@reversed=0 +\else-\fi90}% |
| 9066 |
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@last}\forest@temp@anchor |
| 9067 |
} |
| 9068 |
\csdef{forest@anchor@@-parent last'}{% |
| 9069 |
\forest@anchor@isbordertrue |
| 9070 |
\edef\forest@temp@grow{\ifnum\forestove{@parent}=0 \forestove{grow}\else\forestOve{\forestove{@parent}}{grow}\fi}% |
| 9071 |
\edef\forest@temp@reversed{\ifnum\forestove{@parent}=0 \forestove{reversed}\else\forestOve{\forestove{@parent}}{reversed}\fi}% |
| 9072 |
\edef\forest@temp@anchor@parent{\number\numexpr\forest@temp@grow-\forestove{rotate}}% |
| 9073 |
\edef\forest@temp@anchor@last{\number\numexpr\forest@temp@grow-\forestove{rotate}\ifnum\forest@temp@reversed=0 +\else-\fi90}% |
| 9074 |
\forest@getaverageangle{\forest@temp@anchor@parent}{\forest@temp@anchor@last}\forest@temp@anchor |
| 9075 |
} |
| 9076 |
\csdef{forest@anchor@@children first'}{% |
| 9077 |
\forest@anchor@isbordertrue |
| 9078 |
\edef\forest@temp@anchor@first{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 -\else+\fi90}% |
| 9079 |
\forest@getaverageangle{\forestove{grow}-\forestove{rotate}}{\forest@temp@anchor@first}\forest@temp@anchor |
| 9080 |
} |
| 9081 |
\csdef{forest@anchor@@-children first'}{% |
| 9082 |
\forest@anchor@isbordertrue |
| 9083 |
\edef\forest@temp@anchor@first{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 -\else+\fi90}% |
| 9084 |
\forest@getaverageangle{180+\forestove{grow}-\forestove{rotate}}{\forest@temp@anchor@first}\forest@temp@anchor |
| 9085 |
} |
| 9086 |
\csdef{forest@anchor@@children last'}{% |
| 9087 |
\forest@anchor@isbordertrue |
| 9088 |
\edef\forest@temp@anchor@last{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 +\else-\fi90}% |
| 9089 |
\forest@getaverageangle{\forestove{grow}-\forestove{rotate}}{\forest@temp@anchor@last}\forest@temp@anchor |
| 9090 |
} |
| 9091 |
\csdef{forest@anchor@@-children last'}{% |
| 9092 |
\forest@anchor@isbordertrue |
| 9093 |
\edef\forest@temp@anchor@last{\number\numexpr\forestove{grow}-\forestove{rotate}\ifnum\forestove{reversed}=0 +\else-\fi90}% |
| 9094 |
\forest@getaverageangle{180+\forestove{grow}-\forestove{rotate}}{\forest@temp@anchor@last}\forest@temp@anchor |
| 9095 |
} |
| 9096 |
\csdef{forest@anchor@@children}{% |
| 9097 |
\forest@anchor@snapbordertocompasstrue |
| 9098 |
\csuse{forest@anchor@@children'}% |
| 9099 |
} |
| 9100 |
\csdef{forest@anchor@@-children}{% |
| 9101 |
\forest@anchor@snapbordertocompasstrue |
| 9102 |
\csuse{forest@anchor@@-children'}% |
| 9103 |
} |
| 9104 |
\csdef{forest@anchor@@parent}{% |
| 9105 |
\forest@anchor@snapbordertocompasstrue |
| 9106 |
\csuse{forest@anchor@@parent'}% |
| 9107 |
} |
| 9108 |
\csdef{forest@anchor@@-parent}{% |
| 9109 |
\forest@anchor@snapbordertocompasstrue |
| 9110 |
\csuse{forest@anchor@@-parent'}% |
| 9111 |
} |
| 9112 |
\csdef{forest@anchor@@first}{% |
| 9113 |
\forest@anchor@snapbordertocompasstrue |
| 9114 |
\csuse{forest@anchor@@first'}% |
| 9115 |
} |
| 9116 |
\csdef{forest@anchor@@last}{% |
| 9117 |
\forest@anchor@snapbordertocompasstrue |
| 9118 |
\csuse{forest@anchor@@last'}% |
| 9119 |
} |
| 9120 |
\csdef{forest@anchor@@parent first}{% |
| 9121 |
\forest@anchor@snapbordertocompasstrue |
| 9122 |
\csuse{forest@anchor@@parent first'}% |
| 9123 |
} |
| 9124 |
\csdef{forest@anchor@@-parent first}{% |
| 9125 |
\forest@anchor@snapbordertocompasstrue |
| 9126 |
\csuse{forest@anchor@@-parent first'}% |
| 9127 |
} |
| 9128 |
\csdef{forest@anchor@@parent last}{% |
| 9129 |
\forest@anchor@snapbordertocompasstrue |
| 9130 |
\csuse{forest@anchor@@parent last'}% |
| 9131 |
} |
| 9132 |
\csdef{forest@anchor@@-parent last}{% |
| 9133 |
\forest@anchor@snapbordertocompasstrue |
| 9134 |
\csuse{forest@anchor@@-parent last'}% |
| 9135 |
} |
| 9136 |
\csdef{forest@anchor@@children first}{% |
| 9137 |
\forest@anchor@snapbordertocompasstrue |
| 9138 |
\csuse{forest@anchor@@children first'}% |
| 9139 |
} |
| 9140 |
\csdef{forest@anchor@@-children first}{% |
| 9141 |
\forest@anchor@snapbordertocompasstrue |
| 9142 |
\csuse{forest@anchor@@-children first'}% |
| 9143 |
} |
| 9144 |
\csdef{forest@anchor@@children last}{% |
| 9145 |
\forest@anchor@snapbordertocompasstrue |
| 9146 |
\csuse{forest@anchor@@children last'}% |
| 9147 |
} |
| 9148 |
\csdef{forest@anchor@@-children last}{% |
| 9149 |
\forest@anchor@snapbordertocompasstrue |
| 9150 |
\csuse{forest@anchor@@-children last'}% |
| 9151 |
} |
| 9152 |
\def\forest@getaverageangle#1#2#3{% |
| 9153 |
\edef\forest@temp{\number\numexpr #1-#2+540}% |
| 9154 |
\expandafter\pgfmathMod@\expandafter{\forest@temp}{360}% |
| 9155 |
\forest@truncatepgfmathresult |
| 9156 |
\edef\forest@temp{\number\numexpr 360+#2+((\pgfmathresult-180)/2)}% |
| 9157 |
\expandafter\pgfmathMod@\expandafter{\forest@temp}{360}% |
| 9158 |
\forest@truncatepgfmathresult |
| 9159 |
\let#3\pgfmathresult |
| 9160 |
} |
| 9161 |
\def\forest@truncatepgfmathresult{% |
| 9162 |
\afterassignment\forest@gobbletoEND |
| 9163 |
\forest@temp@count=\pgfmathresult\forest@END |
| 9164 |
\def\pgfmathresult{\the\forest@temp@count}% |
| 9165 |
} |
| 9166 |
\def\forest@gobbletoEND#1\forest@END{} |
| 9167 |
\def\forest@anchor@border@to@compass{% |
| 9168 |
\ifforest@anchor@isborder % snap to 45 deg, to range 0-360 |
| 9169 |
\ifforest@anchor@snapbordertocompass |
| 9170 |
\forest@anchor@snap@border@to@compass |
| 9171 |
\else % to range 0-360 |
| 9172 |
\pgfmathMod@{\forest@temp@anchor}{360}% |
| 9173 |
\forest@truncatepgfmathresult |
| 9174 |
\let\forest@temp@anchor\pgfmathresult |
| 9175 |
\fi |
| 9176 |
\ifforest@anchor@snapbordertocompass |
| 9177 |
\ifforest@anchor@forwardtotikz |
| 9178 |
\ifcsname pgf@anchor% |
| 9179 |
@\csname pgf@sh@ns@\pgfreferencednodename\endcsname |
| 9180 |
@\csname forest@compass@\forest@temp@anchor\endcsname |
| 9181 |
\endcsname |
| 9182 |
\letcs\forest@temp@anchor{forest@compass@\forest@temp@anchor}% |
| 9183 |
\fi |
| 9184 |
\else |
| 9185 |
\letcs\forest@temp@anchor{forest@compass@\forest@temp@anchor}% |
| 9186 |
\fi |
| 9187 |
\fi |
| 9188 |
\fi |
| 9189 |
} |
| 9190 |
\csdef{forest@compass@0}{east} |
| 9191 |
\csdef{forest@compass@45}{north east} |
| 9192 |
\csdef{forest@compass@90}{north} |
| 9193 |
\csdef{forest@compass@135}{north west} |
| 9194 |
\csdef{forest@compass@180}{west} |
| 9195 |
\csdef{forest@compass@225}{south west} |
| 9196 |
\csdef{forest@compass@270}{south} |
| 9197 |
\csdef{forest@compass@315}{south east} |
| 9198 |
\csdef{forest@compass@360}{east} |
| 9199 |
\def\forest@anchor@snap@border@to@compass{% |
| 9200 |
\pgfmathMod@{\forest@temp@anchor}{360}% |
| 9201 |
\pgfmathdivide@{\pgfmathresult}{45}% |
| 9202 |
\pgfmathround@{\pgfmathresult}% |
| 9203 |
\pgfmathmultiply@{\pgfmathresult}{45}% |
| 9204 |
\forest@truncatepgfmathresult |
| 9205 |
\let\forest@temp@anchor\pgfmathresult |
| 9206 |
} |
| 9207 |
\def\forest@anchor@forward#1{% #1 = shape name |
| 9208 |
\ifdefempty\forest@temp@anchor{% |
| 9209 |
\pgf@sh@reanchor{#1}{center}% |
| 9210 |
\xdef\forest@hack@tikzshapeborder{% |
| 9211 |
\noexpand\tikz@shapebordertrue |
| 9212 |
\def\noexpand\tikz@shapeborder@name{\pgfreferencednodename}% |
| 9213 |
}\aftergroup\forest@hack@tikzshapeborder |
| 9214 |
}{% |
| 9215 |
\pgf@sh@reanchor{#1}{\forest@temp@anchor}% |
| 9216 |
}% |
| 9217 |
} |
| 9218 |
\def\forest@referencednodeid{\forest@node@Nametoid{\forest@referencednodename}}% |
| 9219 |
\def\forest@referencednodename{% |
| 9220 |
\expandafter\expandafter\expandafter\forest@referencednodename@\expandafter\pgfreferencednodename\forest@pgf@notyetpositioned\relax |
| 9221 |
} |
| 9222 |
\expandafter\def\expandafter\forest@referencednodename@\expandafter#\expandafter1\forest@pgf@notyetpositioned#2\relax{% |
| 9223 |
\if\relax#1\relax\forest@referencednodename@stripafter#2\relax\fi |
| 9224 |
\if\relax#2\relax#1\fi |
| 9225 |
} |
| 9226 |
\expandafter\def\expandafter\forest@referencednodename@stripafter\expandafter#\expandafter1\forest@pgf@notyetpositioned\relax{#1} |
| 9227 |
\def\forest@pointanchor#1{% #1 = anchor |
| 9228 |
\forest@Pointanchor{\forest@cn}{#1}% |
| 9229 |
} |
| 9230 |
\def\forest@Pointanchor#1#2{% #1 = node id, #2 = anchor |
| 9231 |
\def\forest@pa@temp@name{name}% |
| 9232 |
\forestOifdefined{#1}{@box}{% |
| 9233 |
\forestOget{#1}{@box}\forest@temp |
| 9234 |
\ifdefempty\forest@temp{}{% |
| 9235 |
\def\forest@pa@temp@name{later@name}% |
| 9236 |
}% |
| 9237 |
}{}% |
| 9238 |
\setbox0\hbox{% |
| 9239 |
\begin{pgfpicture}% |
| 9240 |
\if\relax\forestOve{#1}{#2}\relax |
| 9241 |
\pgfpointanchor{\forestOve{#1}{\forest@pa@temp@name}}{center}% |
| 9242 |
\else |
| 9243 |
\pgfpointanchor{\forestOve{#1}{\forest@pa@temp@name}}{\forestOve{#1}{#2}}% |
| 9244 |
\fi |
| 9245 |
\xdef\forest@global@marshal{% |
| 9246 |
\noexpand\global\noexpand\pgf@x=\the\pgf@x\relax |
| 9247 |
\noexpand\global\noexpand\pgf@y=\the\pgf@y\relax\relax |
| 9248 |
}% |
| 9249 |
\end{pgfpicture}% |
| 9250 |
}% |
| 9251 |
\forest@global@marshal |
| 9252 |
} |
| 9253 |
\forest@node@init |
| 9254 |
\ifdefempty{\forest@compat}{}{% |
| 9255 |
\RequirePackage{forest-compat} |
| 9256 |
} |
| 9257 |
\endinput |
| 9258 |
%% |
| 9259 |
%% End of file `forest.sty'. |