Debian Codegraph @

texmf-dist/tex/latex/forest-ext/forest-lib-ext.utils-debug.sty

raw
1 %%
2 %% This is file `forest-lib-ext.utils-debug.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% forest-ext-utils.dtx (with options: `sty,debug')
8 %% Copyright (C) 2025-2026 Clea F. Rees.
9 %%
10 %% This work may be distributed and/or modified under the
11 %% conditions of the LaTeX Project Public License, either version 1.3c
12 %% of this license or (at your option) any later version.
13 %% The latest version of this license is in
14 %% https://www.latex-project.org/lppl.txt
15 %% and version 1.3c or later is part of all distributions of LaTeX
16 %% version 2008-05-04 or later.
17 %%
18 %% This work has the LPPL maintenance status `maintained'.
19 %%
20 %% The Current Maintainer of this work is Clea F. Rees.
21 %%
22 %% This file may only be distributed together with a copy of the package
23 %% forest-ext. You may however distribute the package forest-ext without
24 %% such generated files.
25 %%
26 %% This work consists of all files listed in manifest.txt.
27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29 \NeedsTeXFormat{LaTeX2e}
30 %% $Id: forest-ext-utils.dtx 11668 2026-02-21 02:34:38Z cfrees $}
31 \ProvidesForestLibrary{ext.utils-debug}[2025-12-05 v0.1]
32 \disable@package@load {forest-lib-ext.utils}
33 {%
34 \PackageWarning {ext.utils-debug (forest library)}
35 {Only one of ext.utils and ext.utils-debug should be loaded.
36 Since the
37 ext.utils-debug
38 library has already been loaded, I will ignore your request for
39 ext.utils.%
40 }%
41 }
42 \SetDefaultHookLabel{forest-ext/utils}
43 \ExplSyntaxOn
44 \cs_new:Npn \forestext@toksapp#1#2{#1\expandafter{\the #1#2}}
45 \@ifpackageloaded{memoize}
46 {}{
47 \newif\ifmemoizing\memoizingfalse
48 }
49 \cs_if_free:NT \socket_get_plug:nN
50 {
51 \cs_new_protected_nopar:Npn \socket_get_plug:nN #1#2
52 {
53 \str_set_eq:cN { l__socket_#1_plug_str } #2
54 }
55 }
56 \ExplSyntaxOn
57 \tl_new:N \l__forestext_tmpa_tl
58 \prop_new:N \l__forestext_tmpa_prop
59 \seq_new:N \l__forestext_tmpa_seq
60 \cs_new_protected_nopar:Npn \__forestext_fkeylist_declare:nn #1#2
61 {
62 \typeout{[Forest~ext.utils~debug]::~Declare~#1~with~#2.}
63 \prop_new:c {l__forestext_#1_prop}
64 \__forestext_fkeylist_put_from_keyval:nn {#1}{#2}
65 \__forestext_fkeylist_log:n {#1}
66 }
67 \cs_new_protected_nopar:Npn \__forestext_fkeylist_redeclare:nn #1#2
68 {
69 \typeout{[Forest~ext.utils~debug]::~Redeclare~#1~with~#2.}
70 \prop_clear:c {l__forestext_#1_prop}
71 \__forestext_fkeylist_put_from_keyval:nn {#1} {#2}
72 \__forestext_fkeylist_log:n {#1}
73 }
74 \cs_new_protected_nopar:Npn \__forestext_fkeylist_put_from_keyval:nn #1#2
75 {
76 \typeout{[Forest~ext.utils~debug]::~Processing~#2~for~#1.}
77 \exp_args:Nne \prop_put_from_keyval:ce {l__forestext_#1_prop}
78 {
79 \keyval_parse:NNn
80 \__forestext_fkeylist_put_from_keyval_aux:n
81 \__forestext_fkeylist_put_from_keyval_aux:nn
82 {#2}
83 }
84 }
85 \cs_new_nopar:Npn \__forestext_fkeylist_put_from_keyval_aux:n #1
86 {
87 \__forestext_fkeylist_put_from_keyval_aux:nn {#1} {\q_no_value}
88 }
89 \cs_new_nopar:Npn \__forestext_fkeylist_put_from_keyval_aux:nn #1#2
90 {
91 \exp_not:n { {#1} = {#2} },
92 }
93 \cs_new_nopar:Npn \__forestext_fkeylist_to_keyval:n #1
94 {
95 \prop_map_function:cN {l__forestext_#1_prop} \__forestext_fkeylist_to_keyval_aux:nn
96 }
97 \cs_new_nopar:Npn \__forestext_fkeylist_to_keyval_aux:nn #1#2
98 {
99 \quark_if_no_value:nTF {#2}
100 {\exp_not:n{#1},}{\exp_not:n{#1}=\exp_not:n{{#2}},}
101 }
102 \cs_new_protected_nopar:Npn \__forestext_fkeylist_put:nn #1#2
103 {
104 \__forestext_fkeylist_put_from_keyval:nn {#1} {#2}
105 \__forestext_fkeylist_log:n {#1}
106 }
107 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove:nn #1#2
108 {
109 \prop_remove:cn {l__forestext_#1_prop} {#2}
110 \__forestext_fkeylist_log:n {#1}
111 }
112 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_if_match:nn #1#2
113 {
114 \typeout{[Forest~ext.utils~debug]::~Remove~#2~from~#1~if~value~match.}
115 \prop_set_eq:Nc \l__forestext_tmpa_prop {l__forestext_#1_prop}
116 \keyval_parse:NNn
117 \__forestext_fkeylist_remove_from_keyval_aux:n
118 \__forestext_fkeylist_remove_from_keyval_aux:nn
119 {#2}
120 \prop_set_eq:cN {l__forestext_#1_prop} \l__forestext_tmpa_prop
121 \__forestext_fkeylist_log:n {#1}
122 }
123 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_from_keyval_aux:n #1
124 {
125 \__forestext_fkeylist_remove_from_keyval_aux:nn {#1} {\q_no_value}
126 }
127 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_from_keyval_aux:nn #1#2
128 {
129 \typeout{[Forest~ext.utils~debug]::~Remove~#1~if~value~is~#2.}
130 \prop_get:NnN \l__forestext_tmpa_prop {#1} \l__forestext_tmpa_tl
131 \tl_if_eq:NnT \l__forestext_tmpa_tl {#2}
132 {
133 \prop_remove:Nn \l__forestext_tmpa_prop {#1}
134 }
135 }
136 \cs_new_eq:NN \forestext@keylist@declare \__forestext_fkeylist_declare:nn
137 \cs_new_eq:NN \forestext@prop@to@keylist \__forestext_fkeylist_to_keyval:n
138 \cs_new_eq:NN \forestext@keylist@put \__forestext_fkeylist_put:nn
139 \cs_new_eq:NN \forestext@keylist@remove@key \__forestext_fkeylist_remove:nn
140 \cs_new_eq:NN \forestext@keylist@remove \__forestext_fkeylist_remove_if_match:nn
141 \cs_new_eq:NN \forestext@keylist@redeclare \__forestext_fkeylist_redeclare:nn
142 \cs_new_nopar:Npn \__forestext_fkeylist_log:n #1
143 {
144 \typeout{[tagforext~debug]::~ #1:~}
145 \prop_log:c {l__forestext_#1_prop}
146 \expandafter\typeout{\the\forestext@toksa}
147 }
148 \cs_new_eq:NN \forestext@keylist@log \__forestext_fkeylist_log:n
149 \cs_generate_variant:Nn \prop_to_keyval:N {c}
150 \cs_generate_variant:Nn \prop_put_from_keyval:Nn {ce}
151 \ExplSyntaxOff
152 \newtoks\forestext@toksa
153 \forestset{%
154 forestext utils debug/.style={%
155 typeout={[Forest ext.utils debug]:: #1},
156 },
157 declare tagging keylist/.code 2 args={%
158 \typeout{[Forest ext.utils debug]:: Declaring tagging keylist #1}%
159 \typeout{[Forest ext.utils debug]:: with default #2.}%
160 \forestext@keylist@declare {#1}{#2}%
161 \forestext@keylist@log{#1}%
162 \forestext@toksapp\forestext@toksa{%
163 declare keylist/.process={_x{#1}{\forestext@prop@to@keylist{#1}}},
164 }%
165 \typeout{[Forest ext.utils debug]:: forestext@toksa:}%
166 \expandafter\typeout{\the\forestext@toksa}%
167 \pgfqkeys{/forest}{%
168 forestext utils debug={Setting processing order for #1 to unique=tree.},
169 #1 processing order/.nodewalk style={unique=tree},
170 }%
171 },
172 redeclare tagging keylist/.code 2 args={%
173 \typeout{[Forest ext.utils debug]:: Redeclaring tagging keylist #1}%
174 \typeout{[Forest ext.utils debug]:: with default #2.}%
175 \forestext@keylist@redeclare {#1}{#2}%
176 \forestext@keylist@log{#1}%
177 },
178 tagging keylist put/.code 2 args={%
179 \forestext@keylist@put {#1}{#2}%
180 },
181 tagging keylist remove key/.code 2 args={%
182 \forestext@keylist@remove@key {#1}{#2}%
183 },
184 tagging keylist remove/.code 2 args={%
185 \forestext@keylist@remove {#1}{#2}%
186 },
187 }
188 \AddToHook{env/forest/begin}[.]{%
189 \typeout{[Forest ext.utils debug]:: Creating options set with declare tagging keylist.}%
190 \expandafter\typeout{\the\forestext@toksa}%
191 \expandafter\forestset\expandafter{\the\forestext@toksa}%
192 \forestset{%
193 tagging keylist error/.code={%
194 \PackageError{ext.tagging (forest library)}{%
195 The key '#1' cannot be used inside a forest environment.%
196 }{%
197 You need to use this key outside forest environments.
198 Please see forest-ext's documentation for details.%
199 }%
200 },
201 declare tagging keylist/.style 2 args={%
202 tagging keylist error=declare tagging keylist},
203 redeclare tagging keylist/.style 2 args={%
204 tagging keylist error=redeclare tagging keylist},
205 tagging keylist put/.style 2 args={%
206 tagging keylist error=tagging keylist put},
207 tagging keylist remove/.style 2 args={%
208 tagging keylist error=tagging keylist remove},
209 tagging keylist remove key/.style 2 args={%
210 tagging keylist error=tagging keylist remove key},
211 }%
212 }
213 \AddToHook{cmd/Forest/before}[.]{%
214 \AddToHookNext{cmd/forest@config/before}{%
215 \UseHook{env/forest/begin}%
216 }%
217 \AddToHookNext{cmd/forest@node@drawtree/after}{%
218 \UseHook{env/forest/end}%
219 }%
220 }
221 \forestset{
222 align middle child/.style={
223 before typesetting nodes={
224 if={
225 > Ow+P {n children}{isodd(##1)}
226 }{
227 calign child/.process={
228 Ow+n {n children}{(##1+1)/2}
229 },
230 calign=#1,
231 }{},
232 },
233 },
234 align middle child/.default=child edge,
235 align middle children/.style={
236 for tree={align middle child=#1},
237 },
238 align middle children/.default=child edge,
239 declare keylist={utils@outer@label@opts}{},
240 declare keylist register={outer labels},
241 outer labels={anchor=base west},
242 declare boolean register=utils@has@outer@labels,
243 utils@has@outer@labels=0,
244 declare toks register=outer labels at,
245 outer labels at=east,
246 declare autowrapped toks={utils@outer@label}{},
247 /forest/ext/utils/outer@label/anchor/.initial=base,
248 /forest/ext/utils/outer@label/anchor/.forward to=/tikz/anchor,
249 /forest/ext/utils/outer@label/.search also={/tikz,/pgf},
250 outer label/.style={%
251 split={#1}{:}{utils@outer@label,utils@outer@label@opts},
252 if utils@has@outer@labels={}{%
253 utils@has@outer@labels,
254 for root={%
255 tikz+={%
256 \coordinate (utils@outer@labels@align) at
257 (current bounding box.\foresteregister{outer labels at});
258 },
259 before drawing tree={%
260 where utils@outer@label={}{}{%
261 tikz+/.process={%
262 OOORw4
263 {utils@outer@label}
264 {utils@outer@label@opts}
265 {!u.grow}
266 {outer labels}
267 {%
268 \path [%
269 rotate=##3,
270 ] node [%
271 ##4,
272 /forest/ext/utils/outer@label/.cd,
273 ##2,
274 ] at (.\pgfkeysvalueof{/forest/ext/utils/outer@label/anchor}
275 |- utils@outer@labels@align)
276 {##1};
277 }%
278 },
279 },
280 },
281 },
282 },
283 },
284 libraries/ext.utils-debug/defaults/.style=
285 {}%
286 }
287 \endinput
288 %%
289 %% End of file `forest-lib-ext.utils-debug.sty'.