| 1 |
%% |
| 2 |
%% This is file `forest-lib-ext.multi.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% forest-ext-multi.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-multi.dtx 11668 2026-02-21 02:34:38Z cfrees $} |
| 31 |
\ProvidesForestLibrary{ext.multi}[2025-12-05 v0.1] |
| 32 |
\disable@package@load {forest-lib-ext.multi-debug} |
| 33 |
{% |
| 34 |
\PackageWarning {ext.multi (forest library)} |
| 35 |
{Only one of ext.multi and ext.multi-debug should be loaded. |
| 36 |
Since the |
| 37 |
ext.multi |
| 38 |
library has already been loaded, I will ignore your request for |
| 39 |
ext.multi-debug.% |
| 40 |
}% |
| 41 |
} |
| 42 |
\SetDefaultHookLabel{forest-ext/multi} |
| 43 |
\forestset{ |
| 44 |
declare keylist={every parent}{}, |
| 45 |
declare keylist={other parents}{}, |
| 46 |
declare boolean={multi@connector}{0}, |
| 47 |
declare count={multi@n@parents}{0}, |
| 48 |
declare count={multi@connects@fosterling}{-1}, |
| 49 |
declare count={multi@connects@foster@parent}{-1}, |
| 50 |
declare keylist={multi@foster@parents}{}, |
| 51 |
declare keylist={multi@fosterlings}{}, |
| 52 |
declare keylist={multi@all@parents}{}, |
| 53 |
declare toks={multi@edge}{}, |
| 54 |
declare toks={multi@edge@subpath}{edge}, |
| 55 |
declare toks={multi@edge@sublast}{--}, |
| 56 |
declare toks={multi@edge@route}{--}, |
| 57 |
declare toks={multi@parent@of}{}, |
| 58 |
declare count register={multi@temp@counta}, |
| 59 |
multi@temp@counta=0, |
| 60 |
declare toks register={multi@temp@toksa}, |
| 61 |
multi@temp@toksa={}, |
| 62 |
declare toks register={multi@temp@toksb}, |
| 63 |
multi@temp@toksb={}, |
| 64 |
define long step={fosterlings}{}{% |
| 65 |
if multi@fosterlings={}{}{% |
| 66 |
split option={multi@fosterlings}{,}{id}% |
| 67 |
}% |
| 68 |
}, |
| 69 |
define long step={foster parents}{}{% |
| 70 |
if multi@foster@parents={}{}{% |
| 71 |
split option={multi@foster@parents}{,}{id}% |
| 72 |
}% |
| 73 |
}, |
| 74 |
define long step={every fosterling}{n args=1}{% |
| 75 |
filter={#1}{>O_=!{multi@foster@parents}{}}% |
| 76 |
}, |
| 77 |
define long step={every foster parent}{n args=1}{% |
| 78 |
filter={#1}{>O_=!{multi@fosterlings}{}}% |
| 79 |
}, |
| 80 |
define long step={c fosterling}{}{% |
| 81 |
id/.option=multi@connects@fosterling% |
| 82 |
}, |
| 83 |
define long step={c foster parent}{}{% |
| 84 |
id/.option=multi@connects@foster@parent% |
| 85 |
}, |
| 86 |
multi/.style={% |
| 87 |
split={#1}{,}{multi@parent}, |
| 88 |
before typesetting nodes={% |
| 89 |
multi@parents/.process={% |
| 90 |
OOOw |
| 91 |
{name} |
| 92 |
{multi@n@parents} |
| 93 |
{multi@all@parents} |
| 94 |
{{##1}}% |
| 95 |
}, |
| 96 |
delay n=2{% |
| 97 |
multi@edge+= {(.child anchor) }, |
| 98 |
multi@temp@counta'=0, |
| 99 |
split option={multi@all@parents}{,}{multi@also@parent}, |
| 100 |
}, |
| 101 |
delay n=3{% |
| 102 |
edge path'/.option=multi@edge, |
| 103 |
}, |
| 104 |
}, |
| 105 |
}, |
| 106 |
multi@also@parent/.style={% |
| 107 |
multi@temp@counta'+=1, |
| 108 |
multi@edge+/.process={ |
| 109 |
OR= ? O w |
| 110 |
{multi@n@parents}{multi@temp@counta} |
| 111 |
{multi@edge@sublast}{multi@edge@subpath} |
| 112 |
{##1 (#1.parent anchor) } |
| 113 |
}, |
| 114 |
}, |
| 115 |
multi@parent/.style={% |
| 116 |
multi@n@parents'+=1, |
| 117 |
delay/.process={Ow{multi@n@parents}{% |
| 118 |
multi@all@parents+/.process={Ow{name}{parent ##1 of ####1}}, |
| 119 |
insert before/.process={% |
| 120 |
OOw2{name}{every parent} |
| 121 |
{% |
| 122 |
[#1,name=parent ##1 of ####1,multi@parent@of=####1, |
| 123 |
####2]% |
| 124 |
}% |
| 125 |
}, |
| 126 |
}% |
| 127 |
}, |
| 128 |
}, |
| 129 |
multi@parents/.style n args=3{% |
| 130 |
if={>nw+P{#2}{isodd(##1)}}{% |
| 131 |
multi@temp@counta/.expanded=\inteval{(#2 + 1)/2}, |
| 132 |
for nodewalk={% |
| 133 |
name/.expanded=parent \foresteregister{multi@temp@counta} of #1 % |
| 134 |
}{% |
| 135 |
append=#1, |
| 136 |
}, |
| 137 |
}{% |
| 138 |
multi@temp@counta/.expanded=\inteval{#2/2}, |
| 139 |
for nodewalk={% |
| 140 |
name/.expanded=parent \foresteregister{multi@temp@counta} of #1 % |
| 141 |
}{% |
| 142 |
insert after={% |
| 143 |
[,coordinate,no edge, |
| 144 |
tier=multi@tier@#1@parents, |
| 145 |
delay={% |
| 146 |
append=#1, |
| 147 |
}, |
| 148 |
]% |
| 149 |
}, |
| 150 |
}, |
| 151 |
}, |
| 152 |
}, |
| 153 |
multi@add@parent/.style n args=4{% |
| 154 |
delay n=2{% |
| 155 |
for nodewalk={% |
| 156 |
id=#4% |
| 157 |
}{% |
| 158 |
multi@fosterlings+=#1, |
| 159 |
#2={% |
| 160 |
[, |
| 161 |
multi@phantom, |
| 162 |
multi@connector, |
| 163 |
multi@connects@fosterling=#1, |
| 164 |
multi@connects@foster@parent=#4, |
| 165 |
for current/.option=!{id=#1}.every parent, |
| 166 |
delay n=3{% |
| 167 |
do dynamics, |
| 168 |
edge path'/.process={% |
| 169 |
Ow {!{id=#1}.multi@edge@route} {% |
| 170 |
(!c fosterling.child anchor) |
| 171 |
##1 (!c foster parent.parent anchor) % |
| 172 |
}% |
| 173 |
}, |
| 174 |
also={#3}, |
| 175 |
}, |
| 176 |
]% |
| 177 |
},% |
| 178 |
}, |
| 179 |
}, |
| 180 |
}, |
| 181 |
also parent/.style 2 args={% |
| 182 |
delay={% |
| 183 |
split={#2}{:}{multi@temp@toksa,multi@temp@toksb}, |
| 184 |
if nodewalk valid={name/.register=multi@temp@toksa}{% |
| 185 |
multi@temp@counta/.option=!{name/.register=multi@temp@toksa}.id, |
| 186 |
}{% |
| 187 |
multi@temp@counta/.option/.process={Rw{multi@temp@toksa}{##1.id}}, |
| 188 |
}, |
| 189 |
multi@foster@parents+/.register=multi@temp@counta, |
| 190 |
multi@add@parent/.process={% |
| 191 |
O_RwR |
| 192 |
{id} |
| 193 |
{#1} |
| 194 |
{multi@temp@toksb} |
| 195 |
{{##1}} |
| 196 |
{multi@temp@counta}% |
| 197 |
}, |
| 198 |
}, |
| 199 |
}, |
| 200 |
+also parent/.style={% |
| 201 |
also parent={prepend}{#1}, |
| 202 |
}, |
| 203 |
also parent+/.style={% |
| 204 |
also parent={append}{#1}, |
| 205 |
}, |
| 206 |
multi@phantom/.style={ |
| 207 |
before drawing tree={% |
| 208 |
coordinate, |
| 209 |
typeset node, |
| 210 |
}, |
| 211 |
}, |
| 212 |
debug multi phantoms/.code={% |
| 213 |
\PackageWarning{forest-lib-ext.multi}{% |
| 214 |
You requested the style 'debug multi phantoms', |
| 215 |
but did not load the debugging code. |
| 216 |
Either load 'ext.multi-debug' instead of |
| 217 |
'ext.multi' or remove this style. |
| 218 |
}% |
| 219 |
}, |
| 220 |
node debug multi phantoms/.code={% |
| 221 |
\PackageWarning{forest-lib-ext.multi}{% |
| 222 |
You requested the style 'not debug multi phantoms', |
| 223 |
but did not load the debugging code. |
| 224 |
Either load 'ext.multi-debug' instead of |
| 225 |
'ext.multi' or remove this style. |
| 226 |
}% |
| 227 |
}, |
| 228 |
libraries/ext.multi/defaults/.style= |
| 229 |
{}, |
| 230 |
} |
| 231 |
\AddToHook{begindocument}{% |
| 232 |
\IfPackageLoadedT{forest-lib-edges}{% |
| 233 |
\PackageInfo{forest-lib-ext.multi} |
| 234 |
{Found the edges library. Enabling support code.}% |
| 235 |
\usetikzlibrary{ext.paths.ortho}% |
| 236 |
\forestset{% |
| 237 |
multi@forked@edge/.style={% |
| 238 |
/forest/.cd, |
| 239 |
/tikz/ext/ortho/distance/.process={Ow{fork sep}{-##1}}, |
| 240 |
every parent+={% |
| 241 |
forked edge, |
| 242 |
/tikz/ext/ortho/distance/.process={Ow{fork sep}{-##1}}, |
| 243 |
}, |
| 244 |
multi@edge@subpath={% |
| 245 |
(.child anchor) -|- |
| 246 |
}, |
| 247 |
multi@edge@sublast={% |
| 248 |
(.child anchor) -|- |
| 249 |
}, |
| 250 |
multi@edge@route={% |
| 251 |
-|- |
| 252 |
}, |
| 253 |
}, |
| 254 |
libraries/ext.multi/defaults/.style= |
| 255 |
{% |
| 256 |
default preamble+={ |
| 257 |
Autoforward={fork sep}{% |
| 258 |
every parent+={% |
| 259 |
fork sep=##1, |
| 260 |
edge+={/tikz/ext/ortho/distance=-##1}, |
| 261 |
}, |
| 262 |
edge+={/tikz/ext/ortho/distance=-##1}, |
| 263 |
}, |
| 264 |
fork sep'=0.5em, |
| 265 |
forked edge'/.forward to=/forest/multi@forked@edge, |
| 266 |
}, |
| 267 |
}, |
| 268 |
libraries/edges/defaults/.append style={% |
| 269 |
libraries/ext.multi/defaults, |
| 270 |
/utils/exec={% |
| 271 |
\PackageInfo{forest-lib-ext.multi} |
| 272 |
{% |
| 273 |
Appending compatibility code for forked edges to default settings.% |
| 274 |
}% |
| 275 |
}, |
| 276 |
}% |
| 277 |
}% |
| 278 |
}% |
| 279 |
\ifcsname l_forestext_tagging_custom_bool\endcsname |
| 280 |
\PackageInfo{forest-lib-ext.multi} |
| 281 |
{% |
| 282 |
Found the ext.tagging or ext.tagging-debug library. |
| 283 |
Enabling support code.% |
| 284 |
}% |
| 285 |
\forestset{% |
| 286 |
libraries/ext.multi/defaults/.append style= |
| 287 |
{% |
| 288 |
also parent/.append style={% |
| 289 |
before collating tags={% |
| 290 |
alt text+/.process={Ow{##2.content}{ also child of ####1 }}, |
| 291 |
}, |
| 292 |
}, |
| 293 |
multi/.append style={% |
| 294 |
before collating tags={% |
| 295 |
alt text+={multiple parents: }, |
| 296 |
split={#1}{,}{multi@to@alt}, |
| 297 |
}, |
| 298 |
multi@to@alt/.style={% |
| 299 |
alt text+={#1, }, |
| 300 |
}, |
| 301 |
}, |
| 302 |
}, |
| 303 |
}% |
| 304 |
\fi |
| 305 |
} |
| 306 |
\endinput |
| 307 |
%% |
| 308 |
%% End of file `forest-lib-ext.multi.sty'. |