Debian Codegraph @

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

raw
1 %%
2 %% This is file `forest-lib-ext.utils.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% forest-ext-utils.dtx (with options: `sty')
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}[2025-12-05 v0.1]
32 \disable@package@load {forest-lib-ext.utils-debug}
33 {%
34 \PackageWarning {ext.utils (forest library)}
35 {Only one of ext.utils and ext.utils-debug should be loaded.
36 Since the
37 ext.utils
38 library has already been loaded, I will ignore your request for
39 ext.utils-debug.%
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 \prop_new:c {l__forestext_#1_prop}
63 \__forestext_fkeylist_put_from_keyval:nn {#1}{#2}
64 }
65 \cs_new_protected_nopar:Npn \__forestext_fkeylist_redeclare:nn #1#2
66 {
67 \prop_clear:c {l__forestext_#1_prop}
68 \__forestext_fkeylist_put_from_keyval:nn {#1} {#2}
69 }
70 \cs_new_protected_nopar:Npn \__forestext_fkeylist_put_from_keyval:nn #1#2
71 {
72 \exp_args:Nne \prop_put_from_keyval:ce {l__forestext_#1_prop}
73 {
74 \keyval_parse:NNn
75 \__forestext_fkeylist_put_from_keyval_aux:n
76 \__forestext_fkeylist_put_from_keyval_aux:nn
77 {#2}
78 }
79 }
80 \cs_new_nopar:Npn \__forestext_fkeylist_put_from_keyval_aux:n #1
81 {
82 \__forestext_fkeylist_put_from_keyval_aux:nn {#1} {\q_no_value}
83 }
84 \cs_new_nopar:Npn \__forestext_fkeylist_put_from_keyval_aux:nn #1#2
85 {
86 \exp_not:n { {#1} = {#2} },
87 }
88 \cs_new_nopar:Npn \__forestext_fkeylist_to_keyval:n #1
89 {
90 \prop_map_function:cN {l__forestext_#1_prop} \__forestext_fkeylist_to_keyval_aux:nn
91 }
92 \cs_new_nopar:Npn \__forestext_fkeylist_to_keyval_aux:nn #1#2
93 {
94 \quark_if_no_value:nTF {#2}
95 {\exp_not:n{#1},}{\exp_not:n{#1}=\exp_not:n{{#2}},}
96 }
97 \cs_new_protected_nopar:Npn \__forestext_fkeylist_put:nn #1#2
98 {
99 \__forestext_fkeylist_put_from_keyval:nn {#1} {#2}
100 }
101 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove:nn #1#2
102 {
103 \prop_remove:cn {l__forestext_#1_prop} {#2}
104 }
105 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_if_match:nn #1#2
106 {
107 \prop_set_eq:Nc \l__forestext_tmpa_prop {l__forestext_#1_prop}
108 \keyval_parse:NNn
109 \__forestext_fkeylist_remove_from_keyval_aux:n
110 \__forestext_fkeylist_remove_from_keyval_aux:nn
111 {#2}
112 \prop_set_eq:cN {l__forestext_#1_prop} \l__forestext_tmpa_prop
113 }
114 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_from_keyval_aux:n #1
115 {
116 \__forestext_fkeylist_remove_from_keyval_aux:nn {#1} {\q_no_value}
117 }
118 \cs_new_protected_nopar:Npn \__forestext_fkeylist_remove_from_keyval_aux:nn #1#2
119 {
120 \prop_get:NnN \l__forestext_tmpa_prop {#1} \l__forestext_tmpa_tl
121 \tl_if_eq:NnT \l__forestext_tmpa_tl {#2}
122 {
123 \prop_remove:Nn \l__forestext_tmpa_prop {#1}
124 }
125 }
126 \cs_new_eq:NN \forestext@keylist@declare \__forestext_fkeylist_declare:nn
127 \cs_new_eq:NN \forestext@prop@to@keylist \__forestext_fkeylist_to_keyval:n
128 \cs_new_eq:NN \forestext@keylist@put \__forestext_fkeylist_put:nn
129 \cs_new_eq:NN \forestext@keylist@remove@key \__forestext_fkeylist_remove:nn
130 \cs_new_eq:NN \forestext@keylist@remove \__forestext_fkeylist_remove_if_match:nn
131 \cs_new_eq:NN \forestext@keylist@redeclare \__forestext_fkeylist_redeclare:nn
132 \cs_generate_variant:Nn \prop_to_keyval:N {c}
133 \cs_generate_variant:Nn \prop_put_from_keyval:Nn {ce}
134 \ExplSyntaxOff
135 \newtoks\forestext@toksa
136 \forestset{%
137 forestext utils debug/.style={%
138 typeout={[Forest ext.utils debug]:: #1},
139 },
140 declare tagging keylist/.code 2 args={%
141 \forestext@keylist@declare {#1}{#2}%
142 \forestext@toksapp\forestext@toksa{%
143 declare keylist/.process={_x{#1}{\forestext@prop@to@keylist{#1}}},
144 }%
145 \pgfqkeys{/forest}{%
146 forestext utils debug={Setting processing order for #1 to unique=tree.},
147 #1 processing order/.nodewalk style={unique=tree},
148 }%
149 },
150 redeclare tagging keylist/.code 2 args={%
151 \forestext@keylist@redeclare {#1}{#2}%
152 },
153 tagging keylist put/.code 2 args={%
154 \forestext@keylist@put {#1}{#2}%
155 },
156 tagging keylist remove key/.code 2 args={%
157 \forestext@keylist@remove@key {#1}{#2}%
158 },
159 tagging keylist remove/.code 2 args={%
160 \forestext@keylist@remove {#1}{#2}%
161 },
162 }
163 \AddToHook{env/forest/begin}[.]{%
164 \expandafter\forestset\expandafter{\the\forestext@toksa}%
165 \forestset{%
166 tagging keylist error/.code={%
167 \PackageError{ext.tagging (forest library)}{%
168 The key '#1' cannot be used inside a forest environment.%
169 }{%
170 You need to use this key outside forest environments.
171 Please see forest-ext's documentation for details.%
172 }%
173 },
174 declare tagging keylist/.style 2 args={%
175 tagging keylist error=declare tagging keylist},
176 redeclare tagging keylist/.style 2 args={%
177 tagging keylist error=redeclare tagging keylist},
178 tagging keylist put/.style 2 args={%
179 tagging keylist error=tagging keylist put},
180 tagging keylist remove/.style 2 args={%
181 tagging keylist error=tagging keylist remove},
182 tagging keylist remove key/.style 2 args={%
183 tagging keylist error=tagging keylist remove key},
184 }%
185 }
186 \AddToHook{cmd/Forest/before}[.]{%
187 \AddToHookNext{cmd/forest@config/before}{%
188 \UseHook{env/forest/begin}%
189 }%
190 \AddToHookNext{cmd/forest@node@drawtree/after}{%
191 \UseHook{env/forest/end}%
192 }%
193 }
194 \forestset{
195 align middle child/.style={
196 before typesetting nodes={
197 if={
198 > Ow+P {n children}{isodd(##1)}
199 }{
200 calign child/.process={
201 Ow+n {n children}{(##1+1)/2}
202 },
203 calign=#1,
204 }{},
205 },
206 },
207 align middle child/.default=child edge,
208 align middle children/.style={
209 for tree={align middle child=#1},
210 },
211 align middle children/.default=child edge,
212 declare keylist={utils@outer@label@opts}{},
213 declare keylist register={outer labels},
214 outer labels={anchor=base west},
215 declare boolean register=utils@has@outer@labels,
216 utils@has@outer@labels=0,
217 declare toks register=outer labels at,
218 outer labels at=east,
219 declare autowrapped toks={utils@outer@label}{},
220 /forest/ext/utils/outer@label/anchor/.initial=base,
221 /forest/ext/utils/outer@label/anchor/.forward to=/tikz/anchor,
222 /forest/ext/utils/outer@label/.search also={/tikz,/pgf},
223 outer label/.style={%
224 split={#1}{:}{utils@outer@label,utils@outer@label@opts},
225 if utils@has@outer@labels={}{%
226 utils@has@outer@labels,
227 for root={%
228 tikz+={%
229 \coordinate (utils@outer@labels@align) at
230 (current bounding box.\foresteregister{outer labels at});
231 },
232 before drawing tree={%
233 where utils@outer@label={}{}{%
234 tikz+/.process={%
235 OOORw4
236 {utils@outer@label}
237 {utils@outer@label@opts}
238 {!u.grow}
239 {outer labels}
240 {%
241 \path [%
242 rotate=##3,
243 ] node [%
244 ##4,
245 /forest/ext/utils/outer@label/.cd,
246 ##2,
247 ] at (.\pgfkeysvalueof{/forest/ext/utils/outer@label/anchor}
248 |- utils@outer@labels@align)
249 {##1};
250 }%
251 },
252 },
253 },
254 },
255 },
256 },
257 libraries/ext.utils/defaults/.style=
258 {}%
259 }
260 \endinput
261 %%
262 %% End of file `forest-lib-ext.utils.sty'.