| 1 |
%% |
| 2 |
%% This is file `latex-lab-testphase-float.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% latex-lab-float.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright 2021-2025 LaTeX Project |
| 12 |
%% |
| 13 |
%% This file was generated from file(s) of the `LaTeX-lab Bundle'. |
| 14 |
%% ------------------------------------------------------------------------------------ |
| 15 |
%% |
| 16 |
%% It may be distributed and/or modified under the |
| 17 |
%% conditions of the LaTeX Project Public License, either version 1.3c |
| 18 |
%% of this license or (at your option) any later version. |
| 19 |
%% The latest version of this license is in |
| 20 |
%% http://www.latex-project.org/lppl.txt |
| 21 |
%% and version 1.3c or later is part of all distributions of LaTeX |
| 22 |
%% version 2008 or later. |
| 23 |
%% |
| 24 |
%% This file may only be distributed together with a copy of the LaTeX |
| 25 |
%% `LaTeX-lab Bundle'. You may however distribute the `LaTeX-lab Bundle' |
| 26 |
%% without such generated files. |
| 27 |
%% |
| 28 |
%% The newest sources can be found below |
| 29 |
%% |
| 30 |
%% https://github.com/latex3/latex2e/required/latex-lab |
| 31 |
%% |
| 32 |
%% where one can also log issues in case there are any. |
| 33 |
%% |
| 34 |
%% |
| 35 |
%% File: latex-lab-float.dtx (C) Copyright 2023 LaTeX Project |
| 36 |
\def\ltlabfloatdate{2025-10-17} |
| 37 |
\def\ltlabfloatversion{0.81l} |
| 38 |
\ProvidesExplPackage {latex-lab-testphase-float} {\ltlabfloatdate} {\ltlabfloatversion} |
| 39 |
{Code related to the tagging of floats} |
| 40 |
\prop_new:N \g__tag_float_sect_prop |
| 41 |
\seq_new:N \g__tag_float_types_seq |
| 42 |
\seq_gput_right:Nn \g__tag_float_types_seq {figure} |
| 43 |
\seq_gput_right:Nn \g__tag_float_types_seq {table} |
| 44 |
\tl_new:N\@current@float@struct |
| 45 |
\int_new:N\g__tag_float_int |
| 46 |
\bool_new:N \g__tag_float_sect_bool |
| 47 |
\bool_gset_true:N \g__tag_float_sect_bool |
| 48 |
\cs_new_protected:Npn \__tag_float_init: |
| 49 |
{ |
| 50 |
\int_gincr:N \g__tag_float_int |
| 51 |
\tl_set:Ne \@current@float@struct { \int_use:N \g__tag_float_int} |
| 52 |
} |
| 53 |
\cs_new_protected:Npn\__tag_float_init_collect: |
| 54 |
{ |
| 55 |
\bool_if:NT\g__tag_float_sect_bool |
| 56 |
{ |
| 57 |
\seq_map_inline:Nn\g__tag_float_types_seq |
| 58 |
{ |
| 59 |
\tag_struct_begin:n{tag=##1s,stash} |
| 60 |
\prop_gput:Nne\g__tag_float_sect_prop {##1-struct}{\int_use:N\c@g__tag_struct_abs_int} |
| 61 |
\tag_struct_end: |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
\cs_new_protected:Npn \__tag_float_stop_sect: |
| 66 |
{ |
| 67 |
\bool_if:NT\g__tag_float_sect_bool |
| 68 |
{ |
| 69 |
\seq_map_inline:Nn\g__tag_float_types_seq |
| 70 |
{ |
| 71 |
\prop_get:NnNT\g__tag_float_sect_prop{##1-used}\l__tag_tmpa_tl |
| 72 |
{ |
| 73 |
\exp_args:Ne |
| 74 |
\tag_struct_use_num:n{\prop_item:Nn\g__tag_float_sect_prop{##1-struct}} |
| 75 |
\prop_gremove:Nn \g__tag_float_sect_prop{##1-used} |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
\keys_define:nn { tag / tool} |
| 82 |
{ |
| 83 |
flush-floats .code:n = |
| 84 |
{ |
| 85 |
\keys_set:nn {tag / tool} {sec-stop=#1} |
| 86 |
\__tag_float_stop_sect: |
| 87 |
\__tag_float_init_collect: |
| 88 |
}, |
| 89 |
flush-float .default:n = Document |
| 90 |
} |
| 91 |
\AddToHook{begindocument/end}[latex-lab/float] |
| 92 |
{\__tag_float_init_collect:} |
| 93 |
\AddToHook{tagpdf/finish/before}[latex-lab/float] |
| 94 |
{\par\__tag_sec_end:n{-10}\__tag_float_stop_sect:} |
| 95 |
\DeclareHookRule{tagpdf/finish/before}{latex-lab/float}{before}{tagpdf} |
| 96 |
\keys_define:nn { tag / tool} |
| 97 |
{ |
| 98 |
split-float .code:n = |
| 99 |
{ |
| 100 |
\UseTaggingSocket{float/end} |
| 101 |
\__tag_float_init: |
| 102 |
\UseTaggingSocket{float/begin} |
| 103 |
\MakeLinkTarget*{floatstructure.\@current@float@struct} |
| 104 |
} |
| 105 |
} |
| 106 |
\socket_if_exist:nF {tagsupport/float/begin} |
| 107 |
{ |
| 108 |
\NewTaggingSocket{float/hmode/begin}{0} |
| 109 |
\NewTaggingSocket{float/hmode/end}{0} |
| 110 |
\NewTaggingSocket{float/begin}{0} |
| 111 |
\NewTaggingSocket{float/end}{0} |
| 112 |
} |
| 113 |
\NewTaggingSocketPlug{float/hmode/begin}{default} |
| 114 |
{ |
| 115 |
\__tag_float_stop_par: |
| 116 |
} |
| 117 |
\AssignTaggingSocketPlug{float/hmode/begin}{default} |
| 118 |
\NewTaggingSocketPlug{float/hmode/end}{default} |
| 119 |
{ |
| 120 |
\__tag_float_start_par: |
| 121 |
} |
| 122 |
\AssignTaggingSocketPlug{float/hmode/end}{default} |
| 123 |
\NewTaggingSocketPlug{float/begin}{default} |
| 124 |
{ |
| 125 |
\__tag_float_begin: |
| 126 |
} |
| 127 |
\AssignTaggingSocketPlug{float/begin}{default} |
| 128 |
\NewTaggingSocketPlug{float/end}{default} |
| 129 |
{ |
| 130 |
\__tag_float_end: |
| 131 |
} |
| 132 |
\AssignTaggingSocketPlug{float/end}{default} |
| 133 |
\cs_new_protected:Npn \__tag_float_stop_par: |
| 134 |
{ |
| 135 |
\tag_mc_end: |
| 136 |
\bool_if:NF \g__tag_float_sect_bool |
| 137 |
{ |
| 138 |
\tag_struct_end: |
| 139 |
} |
| 140 |
} |
| 141 |
\cs_new_protected:Npn \__tag_float_start_par: |
| 142 |
{ |
| 143 |
\bool_if:NF \g__tag_float_sect_bool |
| 144 |
{ |
| 145 |
\tag_struct_begin:n{tag=text}% |
| 146 |
} |
| 147 |
\tag_mc_begin:n{tag=P} |
| 148 |
} |
| 149 |
\cs_new_protected:Npn \__tag_float_begin: |
| 150 |
{% |
| 151 |
\bool_if:NTF\g__tag_float_sect_bool |
| 152 |
{ |
| 153 |
\exp_args:Ne |
| 154 |
\tag_struct_begin:n{tag=float,parent=0\prop_item:No\g__tag_float_sect_prop{\@captype-struct}}% |
| 155 |
\prop_gput:Nee \g__tag_float_sect_prop {\@captype-used}{true} |
| 156 |
} |
| 157 |
{ |
| 158 |
\tag_struct_begin:n{tag=float} |
| 159 |
} |
| 160 |
\tl_set:Ne\@current@float@struct{\tag_get:n{struct_num}}% |
| 161 |
\typeout{Float structure: \@current@float@struct} |
| 162 |
} |
| 163 |
|
| 164 |
\cs_new_protected:Npn\__tag_float_end:{\tag_struct_end:} %end Aside |
| 165 |
|
| 166 |
\ExplSyntaxOff |
| 167 |
\def\@xfloat #1[#2]{% |
| 168 |
\@nodocument |
| 169 |
\def \@captype {#1}% |
| 170 |
\def \@fps {#2}% |
| 171 |
\@onelevel@sanitize \@fps |
| 172 |
\def \reserved@b {!}% |
| 173 |
\ifx \reserved@b \@fps |
| 174 |
\@fpsadddefault |
| 175 |
\else |
| 176 |
\ifx \@fps \@empty |
| 177 |
\@fpsadddefault |
| 178 |
\fi |
| 179 |
\fi |
| 180 |
\ifhmode |
| 181 |
\@bsphack |
| 182 |
\UseTaggingSocket{float/hmode/begin}% |
| 183 |
\@floatpenalty -\@Mii |
| 184 |
\else |
| 185 |
\@floatpenalty-\@Miii |
| 186 |
\fi |
| 187 |
\ifinner |
| 188 |
\@parmoderr\@floatpenalty\z@ |
| 189 |
\else |
| 190 |
\@next\@currbox\@freelist |
| 191 |
{% |
| 192 |
\@tempcnta \sixt@@n |
| 193 |
\expandafter \@tfor \expandafter \reserved@a |
| 194 |
\expandafter :\expandafter =\@fps |
| 195 |
\do |
| 196 |
{% |
| 197 |
\if \reserved@a h% |
| 198 |
\ifodd \@tempcnta |
| 199 |
\else |
| 200 |
\advance \@tempcnta \@ne |
| 201 |
\fi |
| 202 |
\else\if \reserved@a t% |
| 203 |
\@setfpsbit \tw@ |
| 204 |
\else\if \reserved@a b% |
| 205 |
\@setfpsbit 4% |
| 206 |
\else\if \reserved@a p% |
| 207 |
\@setfpsbit 8% |
| 208 |
\else\if \reserved@a !% |
| 209 |
\ifnum \@tempcnta>15 |
| 210 |
\advance\@tempcnta -\sixt@@n\relax |
| 211 |
\fi |
| 212 |
\else |
| 213 |
\@latex@error{Unknown float option `\reserved@a'}% |
| 214 |
{Option `\reserved@a' ignored and `p' used.}% |
| 215 |
\@setfpsbit 8% |
| 216 |
\fi\fi\fi\fi\fi |
| 217 |
}% |
| 218 |
\@tempcntb \csname ftype@\@captype \endcsname |
| 219 |
\multiply \@tempcntb \@xxxii |
| 220 |
\advance \@tempcnta \@tempcntb |
| 221 |
\global \count\@currbox \@tempcnta |
| 222 |
}% |
| 223 |
\@fltovf |
| 224 |
\fi |
| 225 |
\csname __tag_float_init:\endcsname |
| 226 |
\UseTaggingSocket{float/begin}% |
| 227 |
\global \setbox\@currbox |
| 228 |
\color@vbox |
| 229 |
\normalcolor |
| 230 |
\vbox \bgroup |
| 231 |
\hsize\columnwidth |
| 232 |
\@parboxrestore |
| 233 |
\@floatboxreset |
| 234 |
\MakeLinkTarget*{\@captype.struct.\@current@float@struct}% |
| 235 |
}% |
| 236 |
\def\end@float{% |
| 237 |
\@endfloatbox |
| 238 |
\UseTaggingSocket{float/end}% |
| 239 |
\ifnum\@floatpenalty <\z@ |
| 240 |
\@largefloatcheck |
| 241 |
\@cons\@currlist\@currbox |
| 242 |
\ifnum\@floatpenalty <-\@Mii |
| 243 |
\penalty -\@Miv |
| 244 |
\@tempdima\prevdepth |
| 245 |
\vbox{}% |
| 246 |
\prevdepth\@tempdima |
| 247 |
\penalty\@floatpenalty |
| 248 |
\else |
| 249 |
\vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack |
| 250 |
\UseTaggingSocket{float/hmode/end}% |
| 251 |
\fi |
| 252 |
\fi |
| 253 |
} |
| 254 |
\def\end@dblfloat{% |
| 255 |
\if@twocolumn |
| 256 |
\@endfloatbox |
| 257 |
\UseTaggingSocket{float/end}% |
| 258 |
\ifnum\@floatpenalty <\z@ |
| 259 |
\@largefloatcheck |
| 260 |
\global\dp\@currbox1sp % |
| 261 |
\@cons\@currlist\@currbox |
| 262 |
\ifnum\@floatpenalty <-\@Mii |
| 263 |
\penalty -\@Miv |
| 264 |
\@tempdima\prevdepth |
| 265 |
\vbox{}% |
| 266 |
\prevdepth\@tempdima |
| 267 |
\penalty\@floatpenalty |
| 268 |
\else |
| 269 |
\vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack |
| 270 |
\UseTaggingSocket{float/hmode/end}% |
| 271 |
\fi |
| 272 |
\fi |
| 273 |
\else |
| 274 |
\end@float |
| 275 |
\fi |
| 276 |
}% |
| 277 |
\ExplSyntaxOn |
| 278 |
\def\hyper@nopatch@caption{} |
| 279 |
\socket_if_exist:nF {tagsupport/caption/begin} |
| 280 |
{ |
| 281 |
\NewTaggingSocket{caption/begin}{1} |
| 282 |
\NewTaggingSocket{caption/end}{0} |
| 283 |
\NewTaggingSocket{caption/label/begin}{0} |
| 284 |
\NewTaggingSocket{caption/label/end}{0} |
| 285 |
} |
| 286 |
\socket_if_exist:nF {tagsupport/para/begin} |
| 287 |
{ |
| 288 |
\NewTaggingSocket{para/begin}{0} |
| 289 |
\NewTaggingSocket{para/end}{0} |
| 290 |
} |
| 291 |
\NewSocket{caption/label}{1} |
| 292 |
\NewSocketPlug{caption/label}{kernel} |
| 293 |
{ |
| 294 |
#1:~ |
| 295 |
} |
| 296 |
\AssignSocketPlug{caption/label}{kernel} |
| 297 |
\NewTaggingSocketPlug{caption/begin}{default} |
| 298 |
{ |
| 299 |
\tl_if_empty:eTF {#1} |
| 300 |
{ |
| 301 |
\tag_struct_begin:n{tag=Caption,firstkid} |
| 302 |
} |
| 303 |
{ |
| 304 |
\tag_struct_begin:n{tag=Caption,parent=#1,firstkid} |
| 305 |
} |
| 306 |
\bool_set_true:N \l__tag_para_flattened_bool |
| 307 |
} |
| 308 |
\AssignTaggingSocketPlug{caption/begin}{default} |
| 309 |
\NewTaggingSocketPlug{caption/end}{default} |
| 310 |
{ |
| 311 |
\tag_struct_end: |
| 312 |
} |
| 313 |
\AssignTaggingSocketPlug{caption/end}{default} |
| 314 |
\NewTaggingSocketPlug{caption/label/begin}{default} |
| 315 |
{ |
| 316 |
\tagpdfparaOff |
| 317 |
\tag_struct_begin:n{tag=Lbl} |
| 318 |
\tag_mc_begin:n{} |
| 319 |
} |
| 320 |
\AssignTaggingSocketPlug{caption/label/begin}{default} |
| 321 |
\NewTaggingSocketPlug{caption/label/end}{default} |
| 322 |
{ |
| 323 |
\tag_mc_end: |
| 324 |
\tag_struct_end: |
| 325 |
\tagpdfparaOn |
| 326 |
} |
| 327 |
\AssignTaggingSocketPlug{caption/label/end}{default} |
| 328 |
\def\caption{% |
| 329 |
\ifx\@captype\@undefined |
| 330 |
\@latex@error{\noexpand\caption\c_space_tl outside~float}\@ehd |
| 331 |
\expandafter\@gobble |
| 332 |
\else |
| 333 |
\tl_if_empty:NTF\@current@float@struct |
| 334 |
{ |
| 335 |
\refstepcounter\@captype |
| 336 |
} |
| 337 |
{ |
| 338 |
\@kernel@refstepcounter\@captype |
| 339 |
\xdef\@currentHref{\@captype.struct.\@current@float@struct}% |
| 340 |
} |
| 341 |
\expandafter\@firstofone |
| 342 |
\fi |
| 343 |
{\@dblarg{\@caption\@captype}}% |
| 344 |
} |
| 345 |
\NewHookWithArguments{cmd/@makecaption/before}{2} |
| 346 |
\AddToHook{begindocument} |
| 347 |
{ |
| 348 |
\long\def\@makecaption#1#2{% |
| 349 |
\UseHookWithArguments{cmd/@makecaption/before}{2}{#1}{#2}% |
| 350 |
\vskip\abovecaptionskip |
| 351 |
\SuspendTagging{\@makecaption} |
| 352 |
\sbox\@tempboxa{\UseSocket{caption/label}{#1}#2}% |
| 353 |
\ResumeTagging{\@makecaption} |
| 354 |
\UseTaggingSocket{caption/begin}{\@current@float@struct} |
| 355 |
\ifdim \wd\@tempboxa >\hsize |
| 356 |
\UseTaggingSocket{caption/label/begin} |
| 357 |
\UseSocket{caption/label}{#1} |
| 358 |
\UseTaggingSocket{caption/label/end} |
| 359 |
\UseTaggingSocket{para/begin} |
| 360 |
#2 |
| 361 |
\par |
| 362 |
\else |
| 363 |
\global \@minipagefalse |
| 364 |
\hb@xt@\hsize{\hfil |
| 365 |
\UseTaggingSocket{caption/label/begin} |
| 366 |
\UseSocket{caption/label}{#1} |
| 367 |
\UseTaggingSocket{caption/label/end} |
| 368 |
\UseTaggingSocket{para/begin} |
| 369 |
#2 |
| 370 |
\UseTaggingSocket{para/end} |
| 371 |
\hfil}% |
| 372 |
\fi |
| 373 |
\UseTaggingSocket{caption/end} |
| 374 |
\vskip\belowcaptionskip} |
| 375 |
} |
| 376 |
|
| 377 |
\endinput |
| 378 |
%% |
| 379 |
%% End of file `latex-lab-testphase-float.sty'. |