Debian Codegraph @

texmf-dist/source/latex-dev/latex-lab/latex-lab-firstaid.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: latex-lab-firstaid.dtx (C) Copyright 2023-2026 LaTeX Project
4 %
5 % It may be distributed and/or modified under the conditions of the
6 % LaTeX Project Public License (LPPL), either version 1.3c of this
7 % license or (at your option) any later version. The latest version
8 % of this license is in the file
9 %
10 % https://www.latex-project.org/lppl.txt
11 %
12 %
13 % The latex-lab bundle is developed in the LaTeX2e GitHub.
14 % Issues may be reported at
15 %
16 % https://github.com/latex3/latex2e/issues
17 %
18 \def\ltlabfirstaiddate{2026-04-24}
19 \def\ltlabfirstaidversion{0.85u}
20
21 %<*driver>
22 \DocumentMetadata{tagging=on,pdfstandard=ua-2}
23 \documentclass{l3in2edoc}
24
25 \EnableCrossrefs
26 \CodelineIndex
27 \begin{document}
28 \DocInput{latex-lab-firstaid.dtx}
29 \end{document}
30 %</driver>
31 %
32 % \fi
33 %
34 % \title{The \textsf{latex-lab-firstaid} package\\
35 % Temporary patches to external packages needed for the tagging project}
36 % \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
37 % \date{v\ltlabfirstaidversion\ \ltlabfirstaiddate}
38 %
39 % \maketitle
40 %
41 % \newcommand{\xt}[1]{\textsl{\textsf{#1}}}
42 % \newcommand{\TODO}[1]{\textbf{[TODO:} #1\textbf{]}}
43 % \newcommand{\docclass}{document class \marginpar{\raggedright document class
44 % customizations}}
45 %
46 % \providecommand\hook[1]{\texttt{#1}}
47 %
48 % \begin{abstract}
49 % \end{abstract}
50 %
51 % \section{Introduction}
52 %
53 % The followings contains small temporary changes to external packages to avoid
54 % errors with the new tagging code.
55 %
56 % Similar to the main firstaid package the goal is to remove the
57 % patches once the packages have been updated.
58 %
59 % \changes{v0.85g}{2024/10/04}{Removed firstaid for blindtext.
60 % No longer needed with new \cs{@doendpe} code.}
61 % \changes{v0.85g}{2024/10/04}{Added firstaid for fancyvrb.}
62 % \changes{v0.85n}{2025-10-12}{Added firstaid for pgf.}
63 % \changes{v0.85t}{2026-03-12}{Switch from \texttt{x}- to \texttt{e}-type
64 % expansion in expl3 code}
65 % \changes{v0.85u}{2026-04-24}{Added firstaid for H-floats.}
66 % \changes{v0.85u}{2026-04-24}{Removed microtype firstaid. No longer needed.}
67 %
68 % \section{Implementation}
69 %
70 % \begin{macrocode}
71 %<*package>
72 %<@@=tag>
73 % \end{macrocode}
74 % \begin{macrocode}
75 \ProvidesPackage {latex-lab-testphase-firstaid} [%
76 \ltlabfirstaiddate\space v\ltlabfirstaidversion\space
77 Temporary patches to external packages needed for the tagging project]
78 % \end{macrocode}
79 % \begin{macro}[no-user-doc]{\FirstAidNeededT}
80 % This is a very simple help to ensure that we only apply first aid
81 % to an unmodified package or class. It only works in the case the
82 % file has already been loaded and the csname \cs{ver@\#1.\#2} got
83 % defined (holding the current date, version, and short description
84 % info). We then compare its content to a frozen string and make
85 % the modification \verb=#3= only if both agree. If they differ we
86 % assume that the package/class in question got updated by its
87 % maintainer.
88 % \begin{macrocode}
89 \ExplSyntaxOn
90 \providecommand\FirstAidNeededT[3]{
91 \exp_args:Nce\str_if_eq:onF{ver@#1.#2}{#3}
92 { \typeout{==>~ First~ Aid~ for~ #1.#2~ no~ longer~ applied!^^J
93 \@spaces Expected:^^J
94 \@spaces\@spaces #3^^J
95 \@spaces but~ found:^^J
96 \@spaces\@spaces \use:c{ver@#1.#2}^^J
97 \@spaces so~ I'm~ assuming~ it~ got~ fixed.
98 } }
99 \exp_args:Nce\str_if_eq:onT{ver@#1.#2}{#3}
100 }
101 % \end{macrocode}
102 % \end{macro}
103 % \subsection{tikz/pgf}
104 % ti\textit{k}z inputs libraries with the primitive \cs{input} command. This means that
105 % these libraries are not listed in the file list written by \cs{listfiles} and the new
106 % tagging status report created with the \texttt{check-tagging-status} key.
107 %
108 % We therefore redefine one \texttt{pgf} command to use the \LaTeX{} \cs{input} command.
109 % Check https://github.com/pgf-tikz/pgf/issues/1424 for changes.
110 % \begin{macrocode}
111 \AddToHook{package/pgfrcs/after}
112 {\def\pgfutil@InputIfFileExists#1#2#3{\pgfutil@IfFileExists{#1}{\input{#1}\relax#2}{#3}}}
113 % \end{macrocode}
114 %
115 % \subsection{ams classes}
116 % The amsart, amsbook and amsproc classes do not use \cs{@author} to store the author list
117 % but a command \cs{authors}. To be able to nevertheless use the authors in the
118 % xmp-metadata we map \cs{@author} to this new command.
119 %
120 % The authors are set with a trivlist, this leads to faulty spacing and wrong tagging.
121 % This is not yet handled here, but an example how to correct this is in the test-amsart-title
122 % test.
123 %
124 % \begin{macrocode}
125 \AddToHook{class/amsart/after}
126 {\def\@author{\authors}}
127 \AddToHook{class/amsbook/after}
128 {\def\@author{\authors}}
129 \AddToHook{class/amsproc/after}
130 {\def\@author{\authors}}
131 % \end{macrocode}
132 %
133 % The classes redefine \cs{@startsection} and define their own heading commands
134 % which are not tagging compatible. The template code will reinstate the new
135 % \cs{@startsection} and so handle the headings using it. But we also need to
136 % redefine \cs{chapter} and \cs{part}. The following does not try to create exactly
137 % the same design, only near enough. This will not properly handle \cs{specialsection}.
138 % \changes{0.85r}{2026-01-06}
139 % {Add tagging support for headings in ams-classes, tagging issue \#970}
140 % \changes{v0.85u}{2026-04-24}{Adapt keys to changes in sec-template.}
141 % \begin{macrocode}
142 \cs_new_protected:Npn \@@_firstaid_amsbook_heading:
143 {
144 \DeclareDocumentCommand \chapter {s ={shorttitle}o m}
145 { \ParseLaTeXeHeading {chapter} {##1} {##2} {##3} }
146 \DeclareInstance{heading}{chapter}{display}
147 {
148 , name = chapter
149 , level = 0
150 , placement = top
151 , after-penalty-sep = 32pt
152 , after-sep = 22pt
153 , number-format = \MakeUppercase{\chaptername}\enspace \thechapter
154 , heading-decls = \centering
155 , number-decls = \normalsize\mdseries
156 , title-decls = \fontsize{\@xivpt}{18}\bfseries
157 , headformat-instance = chapter
158 , mark-cmd = \chaptermark{##1}
159 , para-indent = true
160 , contents-extra= \addtocontents{lof}{\protect\addvspace{10\p@}}%
161 \addtocontents{lot}{\protect\addvspace{10\p@}}%
162 }
163 \DeclareInstance{headformat}{chapter}{display}
164 {
165 , heading-indent = 0pt
166 , number-title-sep = 18pt
167 }
168 \DeclareDocumentCommand \part {s ={shorttitle}o m}
169 { \ParseLaTeXeHeading {part} {##1} {##2} {##3} }
170 \DeclareInstance{heading}{part}{display}
171 {
172 , name = part
173 , level = -1
174 , placement = page
175 , start-code= {\cleardoublepage\thispagestyle{empty}%
176 \null\vfil\markboth{}{}}
177 , final-code= \vfil\vfil\newpage\newpage\thispagestyle{empty}
178 , number-format = \partname\nobreakspace\thepart
179 , heading-decls = \centering\bfseries
180 , number-decls = \huge
181 , title-decls = \Huge
182 , headformat-instance = display
183 , mark-cmd = \partmark {##1}
184 }
185 }
186 \cs_new_protected:Npn\@@_firstaid_amsart_heading:
187 {
188 \DeclareInstance{heading}{part-@startsection}{display}
189 {
190 name=part,
191 level=-1,
192 mark-cmd=\partmark {##1},
193 para-indent = true,
194 before-sep = 12.0pt plus 12.0pt,
195 after-penalty-sep = 0pt,
196 after-sep = 6.0pt,
197 heading-decls = \normalfont \bfseries \raggedright,
198 headformat-instance = part-@startsection,
199 number-format = \partname\space\theheading.
200 }
201 \DeclareInstance{headformat}{part-@startsection}{hang}
202 {heading-indent = \z@, number-title-sep = 0.5em}
203 }
204 % \end{macrocode}
205 %
206 % The redefinitions for amsbook:
207 % \begin{macrocode}
208 \AddToHook{class/amsbook/after}[latex-lab-testphase-firstaid/amschap]
209 {\@@_firstaid_amsbook_heading:}
210 % \end{macrocode}
211 % amsart and amsproc can use the same definition:
212 % \begin{macrocode}
213 \AddToHook{class/amsproc/after}[latex-lab-testphase-firstaid/amschap]
214 {\@@_firstaid_amsart_heading:}
215 \AddToHook{class/amsart/after}[latex-lab-testphase-firstaid/amschap]
216 {\@@_firstaid_amsart_heading:}
217 % \end{macrocode}
218 %
219 % \subsection{ams classes and amsthm}
220 % In these classes the abstract is stored in a \cs{vbox}, as it ends with a list
221 % an explicit \cs{par} is needed.
222 % \begin{macrocode}
223 \AddToHook{class/amsart/after}[latex-lab-testphase-firstaid/abstract]
224 {
225 \@@_firstaid_ams_abstract:
226 }
227 \AddToHook{class/amsbook/after}[latex-lab-testphase-firstaid/abstract]
228 {
229 \@@_firstaid_ams_abstract:
230 }
231 % \end{macrocode}
232 %
233 % \changes{v0.85i}{2025/01/26}{Add missing \cs{par} to abstract env (gh/1641)}
234 % \begin{macrocode}
235 \cs_new_protected:Npn \@@_firstaid_ams_abstract:
236 {
237 \renewenvironment{abstract}{%
238 \ifx\maketitle\relax
239 \ClassWarning{\@classname}{Abstract~ should~ precede~
240 \protect\maketitle\space in~ AMS~ document~ classes;~ reported}%
241 \fi
242 \global\setbox\abstractbox=\vtop \bgroup
243 \normalfont\Small
244 \list{}{\labelwidth\z@
245 \leftmargin3pc \rightmargin\leftmargin
246 \listparindent\normalparindent \itemindent\z@
247 \parsep\z@ \@plus\p@
248 \let\fullwidthdisplay\relax
249 }%
250 \item[\hskip\labelsep\scshape\abstractname.]%
251 }{%
252 \endlist
253 \par % <--- added
254 \egroup
255 \ifx\@setabstract\relax \@setabstracta \fi
256 }
257 }
258 \ExplSyntaxOff
259 % \end{macrocode}
260 %
261 % \subsection{verse}
262 %
263 % The \pkg{verse} package has its own definition of the
264 % \env{verse} environment, which would tag correctly, except that
265 % it is overwritten by the block code in the hook
266 % \texttt{begindocument/before}. So the simplest way to make
267 % tagging work is to reinstall the package version afterwards,
268 % which is what we are doing here.
269 % \begin{macrocode}
270 \AddToHook{package/verse/after}[latex-lab-firstaid]{%
271 \FirstAidNeededT{verse}{sty}{2014/05/10 v2.4b verse typesetting}%
272 {%
273 \AtBeginDocument{%
274 \renewenvironment{verse}[1][\linewidth]{%
275 \stepcounter{verse@envctr}%
276 \setcounter{poemline}{0}\refstepcounter{poemline}%
277 \setcounter{vslineno}{1}%
278 \let\\=\@vscentercr
279 \list{}{\itemsep \z@
280 \itemindent -\vindent
281 \listparindent\itemindent
282 \parsep \stanzaskip
283 \ifdim #1 < \linewidth
284 \rightmargin \z@
285 \setlength{\leftmargin}{\linewidth}%
286 \addtolength{\leftmargin}{-#1}%
287 \addtolength{\leftmargin}{-0.5\leftmargin}%
288 \else
289 \rightmargin \leftmargin
290 \fi
291 \addtolength{\leftmargin}{\vindent}}%
292 \item[]%
293 }%
294 {\endlist}%
295 }%
296 }%
297 }
298 % \end{macrocode}
299 % Of course, this means that the
300 % optional argument of the environment then only accepts a length
301 % value and not any more a key value list for altering the
302 % environment settings.
303 %
304 % A more elaborate version could be something like this that allows
305 % key/val and legacy interface. Or one could extend the list
306 % template to support a \texttt{list-width} key.
307 %\begin{verbatim}
308 % \ExplSyntaxOn
309 % \cs_new_protected:Npn \ExtractAndDropKey #1#2#3#4#5 {
310 % \tl_set_eq:NN #4 \c_novalue_tl % or empty?
311 % \keys_define:nn { #1 } { #2 .code:n = \tl_set:Nn #4{##1} }
312 % \keys_set_known:nnN { #1 } { #3 } #5
313 % }
314 % \ExplSyntaxOff
315 %
316 % % Change the env definition for verse matching verse.sty
317 % % This keeps the verse.sty interface as it is and only adjusts the
318 % % main environment to use the basic list env with the verse.sty
319 % % specific settings.
320 % \makeatletter
321 %
322 % \AddToHook{package/verse/after}{%
323 % \AtBeginDocument{%
324 % \RenewDocumentEnvironment{verse}{={verse-width}!O{\linewidth}}%
325 % {%
326 % \stepcounter{verse@envctr}%
327 % \setcounter{poemline}{0}\refstepcounter{poemline}%
328 % \setcounter{vslineno}{1}%
329 % \let\\=\@vscentercr
330 % %
331 % \ExtractAndDropKey{verse}{verse-width}{#1}\@vswidth\@vsremainingkvlist
332 % % If other keys have been specified but not verse-width we have no
333 % % default for \@vswidth and need to set it again
334 % \ExpandArgs{o}\IfNoValueT \@vswidth
335 % {\def\@vswidth{\linewidth}}%
336 % %
337 % % This is a bit ugly but we can't stick \cs{@vsremainingkvlist} into
338 % % the instance argument as keys are expected to be visible on
339 % % top-level not hidden inside a macro. The alternative is to push
340 % % in \verb=#1= but then the key/value \verb/verse-width=.../ is
341 % % passed into the instance which is not known there (not harmful as
342 % % it will get ignored but noticeably more and unnecessary
343 % % processing).
344 % %
345 % \def\next##1{%
346 % \UseInstance{blockenv}{list}%
347 % {%
348 % item-indent = -\vindent,%
349 % para-indent = -\vindent,%
350 % para-vspace = \stanzaskip,%
351 % item-skip = 0pt,%
352 % left-margin = (\linewidth-\@vswidth)/2+\vindent,%
353 % right-margin = \ifdim\@vswidth<\linewidth 0pt
354 % \else (\linewidth-\@vswidth)/2\fi,%
355 % ##1%
356 % }}%
357 % \ExpandArgs{o}\next\@vsremainingkvlist
358 % \item\relax
359 % }{\endblockenv}%
360 % }%
361 % }
362 % \makeatother
363 %\end{verbatim}
364 %
365 %
366 % \subsection{cleveref}
367 %
368 % The cleveref package redefines \cs{@makefntext} and this means that the patches in
369 % the new footnote code fails. We use a hook instead.
370 % \changes{v0.85h}{2024/10/16}{Remove redefinition of refstepcounter. It no longer uses
371 % the hook.}
372 % \begin{macrocode}
373 \AddToHook{package/cleveref/after}
374 {
375 \let\@makefntext\cref@old@makefntext
376 \AddToHook{cmd/@makefntext/before}{%
377 \cref@constructprefix{footnote}{\cref@result}%
378 \protected@edef\cref@currentlabel{%
379 [footnote][\arabic{footnote}][\cref@result]%
380 \p@footnote\@thefnmark}}
381 }
382 % \end{macrocode}
383 %
384 % \subsection{booktabs}
385 % In some cases booktabs inserts a
386 % \cs{multispan} into the table (through the commands \cs{@cmidruleb}
387 % and \cs{@cmidrulea} and this then errors
388 % with the tagging code.
389 % This affects both tabular and longtable
390 % (but longtable more as booktabs handles lines in longtable differently).
391 % See also issue \url{https://github.com/latex3/tagging-project/issues/69}
392 %
393 % \changes{0.85u}{2026-04-24}{Use tagging sockets}
394 % \begin{macrocode}
395 \ExplSyntaxOn
396 \AddToHook{package/booktabs/after}
397 {
398 \def\@cmidrulea{
399 \multispan\@cmidla
400 &\multispan\@cmidlb
401 \unskip\hskip\cmrkern@l
402 {
403 \UseTaggingSocket{tbl/leaders/begin}
404 \CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill\kern\z@}
405 \hskip\cmrkern@r
406 \UseTaggingSocket{tbl/leaders/end}
407 \tbl_gdecr_row_count:
408 \cr}
409
410 \def\@cmidruleb{%
411 \multispan\@cmidlb
412 \unskip\hskip \cmrkern@l%
413 {
414 \UseTaggingSocket{tbl/leaders/begin}
415 \CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill\kern\z@}
416 \hskip\cmrkern@r
417 \UseTaggingSocket{tbl/leaders/end}
418 \tbl_gdecr_row_count:
419 \cr}
420 }
421 \ExplSyntaxOff
422 % \end{macrocode}
423 %
424 %
425 % \subsection{fancyvrb}
426 % The firstaid adds first partial tagging support to the environments
427 % of fancyvrb (inline verbatim is untested).
428 % This supports then also packages like minted which internally uses fancyvrb
429 % and classes like l3doc (where currently the verbatim environment based on fancyvrb
430 % is overwritten by the block code).
431 % The environments are surrounded by a \texttt{verbatim} structure,
432 % every line by a \texttt{codeline}
433 % structure. Line numbers are tagged as \texttt{Lbl}, inside of the
434 % \texttt{codeline} structure. The frame lines are marked as artifact.
435 %
436 % \begin{macro}[no-user-doc]{\FV@LeaveVMode}
437 % If we are in vmode we have to open a text-unit structure, if we are
438 % in hmode we have to set para mode to flattened before the fancyvrb code
439 % issues the\cs{par}. The closing of the text-unit structure is handled by the
440 % doendpe code in the block code.
441 % \changes{0.85u}{2026-04-24}{Use tagging sockets}
442 % \begin{macrocode}
443 \ExplSyntaxOn
444 \AddToHook{package/fancyvrb/after}
445 {
446 \def\FV@LeaveVMode{%
447 \if@noskipsec
448 \leavevmode
449 \else
450 \if@FV@ResetMargins\if@inlabel\leavevmode\fi\fi
451 \fi
452 \ifvmode
453 \@noparlisttrue
454 \UseTaggingSocket{para/semantic/begin}{}
455 \else
456 \tagpdfsetup{para/flattened=true}
457 \@noparlistfalse
458 \unskip\par
459 \fi
460 }
461 % \end{macrocode}
462 % \end{macro}
463 %
464 % \begin{macro}[no-user-doc]{\FV@List}
465 % At the begin of the list code we have to tag the frame as artifact
466 % and start the \texttt{verbatim} structure
467 % \begin{macrocode}
468 \def\FV@List#1{%
469 \begingroup
470 \FV@UseKeyValues
471 \FV@LeaveVMode
472 \if@inlabel\else\setbox\@labels=\box\voidb@x\fi
473 \FV@ListNesting{#1}%
474 \FV@ListParameterHook
475 \FV@ListVSpace
476 \FV@SetLineWidth
477 \FV@InterLinePenalty
478 \let\FV@ProcessLine\FV@ListProcessLine@i
479 \FV@CatCodes
480 \FV@FormattingPrep
481 \FV@ObeyTabsInit
482 \cs_if_exist:NT \FV@BeginListFrame
483 {
484 \UseTaggingSocket{mc}{artifact}{\FV@BeginListFrame}
485 }
486 \UseTaggingSocket{struct/begin}{tag=\UseStructureName{block/verbatim}}
487 }
488 % \end{macrocode}
489 % \end{macro}
490 % \begin{macro}[no-user-doc]{\FV@EndList}
491 % At the end of the list code we close the \texttt{verbatim} structure and
492 % tag the frame as artifact.
493 % \begin{macrocode}
494 \def\FV@EndList{%
495 \FV@ListProcessLastLine
496 \UseTaggingSocket{struct/end}
497 \cs_if_exist:NT \FV@EndListFrame
498 {
499 \UseTaggingSocket{mc}{artifact}{\FV@EndListFrame}
500 }
501 \@endparenv
502 \endgroup
503 \@endpetrue
504 }
505 % \end{macrocode}
506 % \end{macro}
507 %
508 % \begin{macro}[no-user-doc]{\FV@ListProcessLine}
509 % At last the tagging of the code lines. Here we have to tag also
510 % numbers and frame parts if they exist.
511 % \begin{macrocode}
512 \def\FV@ListProcessLine#1{%
513 \hbox to \hsize{%
514 \kern\leftmargin
515 \hbox to \linewidth{%
516 \UseTaggingSocket{struct/begin}{tag=\UseStructureName{block/verbatim/codeline}}
517 \cs_if_exist:NT \FV@LeftListNumber
518 {
519 \UseTaggingSocket{struct-mc}{tag=\UseStructureName{block/verbatim/linenumber}}
520 {
521 \FV@LeftListNumber
522 }
523 }
524 \cs_if_exist:NT \FV@LeftListFrame
525 {
526 \UseTaggingSocket{mc}{artifact}{\FV@LeftListFrame}
527 }
528 \UseTaggingSocket{mc}{}{\FancyVerbFormatLine{#1}}%
529 \UseTaggingSocket{struct/end}\hss
530 \cs_if_exist:NT \FV@RightListFrame
531 {
532 \UseTaggingSocket{mc}{artifact}{\FV@RightListFrame}
533 }
534 \cs_if_exist:NT \FV@RightListNumber
535 {
536 \UseTaggingSocket{struct-mc}{tag=\UseStructureName{block/verbatim/linenumber}}
537 {
538 \FV@RightListNumber
539 }
540 }
541 }
542 \hss}}
543 }
544 \ExplSyntaxOff
545 % \end{macrocode}
546 % \end{macro}
547 %
548 % \subsection{The \pkg{float} package first aid}
549 %
550 % The float package has a number of incompatibilites:
551 % \begin{itemize}
552 % \item Restyling floats with \cs{restylefloat} breaks the tagging tagging support.
553 % \item New float types created with \cs{newfloat} are not properly tagged (tagging issue 890)
554 % \item Non-floating floats using the \texttt{H} placement are not properly tagged.
555 % \end{itemize}
556 % The following firstaid addresses the last problem.
557 % A flaw is that if the float is inside a paragraph and followed
558 % by text there the text is tagged as a new text-unit structure.
559 % TODO
560 % \begin{macrocode}
561 \ExplSyntaxOn
562 \AddToHook{package/float/after}[firstaid]
563 {
564 \@@_firstaid_float_patch_H:
565 }
566 \cs_new_protected:Npn \@@_firstaid_float_patch_H:
567 {
568 \NewTaggingSocket{float/H/begin}{1}
569 \NewTaggingSocketPlug{float/H/begin}{default}
570 {
571 \mode_if_horizontal:T {\tag_mc_end_push: \tag_struct_end:}
572 \tag_struct_begin:n {tag=\UseStructureName{float/##1}}
573 }
574 \AssignTaggingSocketPlug{float/H/begin}{default}
575
576 \NewTaggingSocket{float/H/end}{0}
577 \NewTaggingSocketPlug{float/H/end}{default}
578 {
579 \tag_struct_end:
580 \mode_if_horizontal:T
581 {
582 \tag_struct_begin:n {tag=\UseStructureName{para/textblock}}
583 \tag_mc_begin_pop:n {}
584 }
585 }
586 \AssignTaggingSocketPlug{float/H/end}{default}
587 % \end{macrocode}
588 % and here the redefinitions of the commands of \pkg{float}
589 % \begin{macrocode}
590 \def\@float@HH##1[H]{\UseTaggingSocket{float/H/begin}{##1}%
591 \expandafter\let\csname end##1\endcsname\float@endH
592 \let\@currbox\float@box
593 \def\@captype{##1}\setbox\@floatcapt=\vbox{}%
594 \expandafter\ifx\csname fst@##1\endcsname\relax
595 \@flstylefalse\else\@flstyletrue\fi
596 \setbox\@currbox\color@vbox\normalcolor
597 \vbox\bgroup \hsize\columnwidth \@parboxrestore
598 \@floatboxreset \@setnobreak
599 \ignorespaces}
600 \renewcommand\float@endH{\@endfloatbox\UseTaggingSocket{float/H/end}
601 \vskip\intextsep
602 \if@flstyle\setbox\@currbox\float@makebox\columnwidth\fi
603 \box\@currbox\vskip\intextsep\relax}
604 }
605 \ExplSyntaxOff
606 % \end{macrocode}
607 %
608 % \begin{macrocode}
609 %</package>
610 % \end{macrocode}