| 1 |
%% |
| 2 |
%% This is file `latex-lab-testphase-firstaid.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% latex-lab-firstaid.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-firstaid.dtx (C) Copyright 2023-2025 LaTeX Project |
| 36 |
\def\ltlabfirstaiddate{2025-11-03} |
| 37 |
\def\ltlabfirstaidversion{0.85o} |
| 38 |
\ProvidesPackage {latex-lab-testphase-firstaid} [% |
| 39 |
\ltlabfirstaiddate\space v\ltlabfirstaiddate\space |
| 40 |
Temporary patches to external packages needed for the tagging project] |
| 41 |
\ExplSyntaxOn |
| 42 |
\providecommand\FirstAidNeededT[3]{ |
| 43 |
\exp_args:Ncx\str_if_eq:onF{ver@#1.#2}{#3} |
| 44 |
{ \typeout{==>~ First~ Aid~ for~ #1.#2~ no~ longer~ applied!^^J |
| 45 |
\@spaces Expected:^^J |
| 46 |
\@spaces\@spaces #3^^J |
| 47 |
\@spaces but~ found:^^J |
| 48 |
\@spaces\@spaces \use:c{ver@#1.#2}^^J |
| 49 |
\@spaces so~ I'm~ assuming~ it~ got~ fixed. |
| 50 |
} } |
| 51 |
\exp_args:Ncx\str_if_eq:onT{ver@#1.#2}{#3} |
| 52 |
} |
| 53 |
\AddToHook{package/pgfrcs/after} |
| 54 |
{\def\pgfutil@InputIfFileExists#1#2#3{\pgfutil@IfFileExists{#1}{\input{#1}\relax#2}{#3}}} |
| 55 |
\AddToHook{class/amsart/after} |
| 56 |
{\def\@author{\authors}} |
| 57 |
\AddToHook{class/amsbook/after} |
| 58 |
{\def\@author{\authors}} |
| 59 |
\AddToHook{class/amsproc/after} |
| 60 |
{\def\@author{\authors}} |
| 61 |
\AddToHook{class/amsart/after}[latex-lab-testphase-firstaid/amsthm] |
| 62 |
{\__tag_firstaid_amsthm:\__tag_firstaid_ams_abstract:} |
| 63 |
\AddToHook{class/amsbook/after}[latex-lab-testphase-firstaid/amsthm] |
| 64 |
{\__tag_firstaid_amsthm:\__tag_firstaid_ams_abstract:} |
| 65 |
\AddToHook{class/amsproc/after}[latex-lab-testphase-firstaid/amsthm] |
| 66 |
{\__tag_firstaid_amsthm:} |
| 67 |
\AddToHook{package/amsthm/after}[latex-lab-testphase-firstaid/amsthm] |
| 68 |
{\__tag_firstaid_amsthm:} |
| 69 |
\cs_new_protected:Npn \__tag_firstaid_ams_abstract: |
| 70 |
{ |
| 71 |
\renewenvironment{abstract}{% |
| 72 |
\ifx\maketitle\relax |
| 73 |
\ClassWarning{\@classname}{Abstract~ should~ precede~ |
| 74 |
\protect\maketitle\space in~ AMS~ document~ classes;~ reported}% |
| 75 |
\fi |
| 76 |
\global\setbox\abstractbox=\vtop \bgroup |
| 77 |
\normalfont\Small |
| 78 |
\list{}{\labelwidth\z@ |
| 79 |
\leftmargin3pc \rightmargin\leftmargin |
| 80 |
\listparindent\normalparindent \itemindent\z@ |
| 81 |
\parsep\z@ \@plus\p@ |
| 82 |
\let\fullwidthdisplay\relax |
| 83 |
}% |
| 84 |
\item[\hskip\labelsep\scshape\abstractname.]% |
| 85 |
}{% |
| 86 |
\endlist |
| 87 |
\par % <--- added |
| 88 |
\egroup |
| 89 |
\ifx\@setabstract\relax \@setabstracta \fi |
| 90 |
} |
| 91 |
} |
| 92 |
\cs_new_protected:Npn \__tag_firstaid_amsthm: |
| 93 |
{ |
| 94 |
\def\@endtheorem{\endblockenv} |
| 95 |
\RenewDocumentCommand\@thm{mmmO{}}{% |
| 96 |
\ifhmode\unskip\unskip\par\fi |
| 97 |
\normalfont |
| 98 |
\let\thmheadnl\relax |
| 99 |
\let\thm@swap\@gobble |
| 100 |
\thm@notefont{\fontseries\mddefault\upshape}% |
| 101 |
\thm@headpunct{.}% add period after heading |
| 102 |
\thm@headsep 5\p@ plus\p@ minus\p@\relax |
| 103 |
\thm@space@setup |
| 104 |
##1% style overrides |
| 105 |
\@topsep \thm@preskip % used by thm head |
| 106 |
\@topsepadd \thm@postskip % used by \@endparenv |
| 107 |
\tl_set:Nn \l__block_thm_current_counter_tl{##2} |
| 108 |
\tl_if_empty:nTF{##2} |
| 109 |
{ |
| 110 |
\@begintheorem{##3}{}[##4] |
| 111 |
} |
| 112 |
{ |
| 113 |
\@kernel@refstepcounter{##2} |
| 114 |
\@begintheorem{##3}{\csname the##2\endcsname}[##4] |
| 115 |
} |
| 116 |
} |
| 117 |
\def\@begintheorem##1##2[##3]{% |
| 118 |
\UseInstance{blockenv}{theorem}{begin-vspace=\thm@preskip} |
| 119 |
\skip_set:Nn\l__block_topsepadd_skip { \thm@postskip } |
| 120 |
\tag_socket_use:n {para/off} |
| 121 |
\group_begin: |
| 122 |
\normalfont |
| 123 |
\the\thm@headfont \thm@indent |
| 124 |
\tl_if_empty:NTF \l__block_thm_current_counter_tl |
| 125 |
{\MakeLinkTarget[theorem]{}} |
| 126 |
{\MakeLinkTarget{\l__block_thm_current_counter_tl}} |
| 127 |
\@ifempty{##1} |
| 128 |
{\let\thmname\@gobble} |
| 129 |
{\def\thmname####1{\tag_socket_use:nnn {mc}{}{####1}}}% |
| 130 |
\@ifempty{##2} |
| 131 |
{\let\thmnumber\@gobble} |
| 132 |
{\def\thmnumber####1 |
| 133 |
{\tag_socket_use:nnn{struct-mc}{tag=Lbl}{####1}} |
| 134 |
}% |
| 135 |
\@ifempty{##3} |
| 136 |
{\let\thmnote\@gobble} |
| 137 |
{\def\thmnote####1{\tag_socket_use:nnn {mc}{}{####1}}}% |
| 138 |
\tag_socket_use:nnn{block/theorem/caption}{} |
| 139 |
{ |
| 140 |
\thm@swap\swappedhead\thmhead{##1}{##2}{##3}% |
| 141 |
\tag_socket_use:nnn {mc}{}{\the\thm@headpunct} |
| 142 |
} |
| 143 |
\thmheadnl % possibly a newline. |
| 144 |
\group_end: |
| 145 |
\tag_socket_use:n {para/on} |
| 146 |
\tag_socket_use:n {para/begin} |
| 147 |
\hskip\thm@headsep |
| 148 |
\ignorespaces} |
| 149 |
\def\thmhead@plain##1##2##3{% |
| 150 |
\thmname{##1} |
| 151 |
\thmnumber{ |
| 152 |
\@ifnotempty{##1}{~}\@upn{##2} |
| 153 |
}% |
| 154 |
\thmnote{\pdffakespace\space{\the\thm@notefont(##3)}} |
| 155 |
} |
| 156 |
\let\thmhead\thmhead@plain |
| 157 |
\def\swappedhead##1##2##3{% |
| 158 |
\thmnumber{##2} |
| 159 |
\thmname{\@ifnotempty{##2}{\nobreakspace}##1} |
| 160 |
\thmnote{\pdffakespace\space{\the\thm@notefont(##3)}} |
| 161 |
} |
| 162 |
\let\swappedhead@plain=\swappedhead |
| 163 |
\renewcommand{\openbox}{\leavevmode |
| 164 |
\hbox to.77778em{\pdf_bdc:nn{Span}{/ActualText<FEFF220E>}% |
| 165 |
\pdffakespace\hfil\vrule |
| 166 |
\vbox to.675em{\hrule width.6em\vfil\hrule}% |
| 167 |
\vrule\hfil\pdf_emc:}} |
| 168 |
\renewenvironment{proof}[1][\proofname]{\par |
| 169 |
\pushQED{\qed}% |
| 170 |
\UseInstance{blockenv}{theorem}{begin-vspace=6\p@\@plus6\p@} |
| 171 |
\normalfont |
| 172 |
\tag_socket_use:n {para/off} |
| 173 |
\AddToHookNext{para/begin} |
| 174 |
{ |
| 175 |
\tag_socket_use:nnn{block/theorem/caption}{} |
| 176 |
{ |
| 177 |
\tag_socket_use:nnn {mc}{} |
| 178 |
{\textit{##1\@addpunct{.}}} |
| 179 |
} |
| 180 |
\tag_socket_use:n {para/on} |
| 181 |
\tag_socket_use:n {para/begin} |
| 182 |
\pdffakespace\hspace{\labelsep}} |
| 183 |
\ignorespaces |
| 184 |
}{% |
| 185 |
\popQED\endblockenv\par |
| 186 |
} |
| 187 |
} |
| 188 |
\ExplSyntaxOff |
| 189 |
\AddToHook{package/verse/after}[latex-lab-firstaid]{% |
| 190 |
\FirstAidNeededT{verse}{sty}{2014/05/10 v2.4b verse typesetting}% |
| 191 |
{% |
| 192 |
\AtBeginDocument{% |
| 193 |
\renewenvironment{verse}[1][\linewidth]{% |
| 194 |
\stepcounter{verse@envctr}% |
| 195 |
\setcounter{poemline}{0}\refstepcounter{poemline}% |
| 196 |
\setcounter{vslineno}{1}% |
| 197 |
\let\\=\@vscentercr |
| 198 |
\list{}{\itemsep \z@ |
| 199 |
\itemindent -\vindent |
| 200 |
\listparindent\itemindent |
| 201 |
\parsep \stanzaskip |
| 202 |
\ifdim #1 < \linewidth |
| 203 |
\rightmargin \z@ |
| 204 |
\setlength{\leftmargin}{\linewidth}% |
| 205 |
\addtolength{\leftmargin}{-#1}% |
| 206 |
\addtolength{\leftmargin}{-0.5\leftmargin}% |
| 207 |
\else |
| 208 |
\rightmargin \leftmargin |
| 209 |
\fi |
| 210 |
\addtolength{\leftmargin}{\vindent}}% |
| 211 |
\item[]% |
| 212 |
}% |
| 213 |
{\endlist}% |
| 214 |
}% |
| 215 |
}% |
| 216 |
} |
| 217 |
\AddToHook{package/cleveref/after} |
| 218 |
{ |
| 219 |
\let\@makefntext\cref@old@makefntext |
| 220 |
\AddToHook{cmd/@makefntext/before}{% |
| 221 |
\cref@constructprefix{footnote}{\cref@result}% |
| 222 |
\protected@edef\cref@currentlabel{% |
| 223 |
[footnote][\arabic{footnote}][\cref@result]% |
| 224 |
\p@footnote\@thefnmark}} |
| 225 |
} |
| 226 |
\ExplSyntaxOn |
| 227 |
\AddToHook{package/booktabs/after} |
| 228 |
{ |
| 229 |
\def\@cmidrulea{ |
| 230 |
\multispan\@cmidla |
| 231 |
&\multispan\@cmidlb |
| 232 |
\unskip\hskip\cmrkern@l |
| 233 |
{ |
| 234 |
\tag_mc_begin:n{artifact} |
| 235 |
\CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill\kern\z@} |
| 236 |
\hskip\cmrkern@r |
| 237 |
\tag_mc_end: \int_gdecr:N \g__tbl_row_int |
| 238 |
\cr} |
| 239 |
|
| 240 |
\def\@cmidruleb{% |
| 241 |
\multispan\@cmidlb |
| 242 |
\unskip\hskip \cmrkern@l% |
| 243 |
{ |
| 244 |
\tag_mc_begin:n{artifact} |
| 245 |
\CT@arc@\leaders\hrule \@height\@thisrulewidth\hfill\kern\z@} |
| 246 |
\hskip\cmrkern@r |
| 247 |
\tag_mc_end: \int_gdecr:N \g__tbl_row_int |
| 248 |
\cr} |
| 249 |
} |
| 250 |
\ExplSyntaxOff |
| 251 |
|
| 252 |
\ExplSyntaxOn |
| 253 |
\AddToHook{package/fancyvrb/after} |
| 254 |
{ |
| 255 |
\def\FV@LeaveVMode{% |
| 256 |
\if@noskipsec |
| 257 |
\leavevmode |
| 258 |
\else |
| 259 |
\if@FV@ResetMargins\if@inlabel\leavevmode\fi\fi |
| 260 |
\fi |
| 261 |
\ifvmode |
| 262 |
\@noparlisttrue |
| 263 |
\__tag_gincr_para_main_begin_int: |
| 264 |
\tag_struct_begin:n{tag=\l__tag_para_main_tag_tl} |
| 265 |
\else |
| 266 |
\bool_set_true:N\l__tag_para_flattened_bool |
| 267 |
\@noparlistfalse |
| 268 |
\unskip\par |
| 269 |
\fi |
| 270 |
} |
| 271 |
\def\FV@List#1{% |
| 272 |
\begingroup |
| 273 |
\FV@UseKeyValues |
| 274 |
\FV@LeaveVMode |
| 275 |
\if@inlabel\else\setbox\@labels=\box\voidb@x\fi |
| 276 |
\FV@ListNesting{#1}% |
| 277 |
\FV@ListParameterHook |
| 278 |
\FV@ListVSpace |
| 279 |
\FV@SetLineWidth |
| 280 |
\FV@InterLinePenalty |
| 281 |
\let\FV@ProcessLine\FV@ListProcessLine@i |
| 282 |
\FV@CatCodes |
| 283 |
\FV@FormattingPrep |
| 284 |
\FV@ObeyTabsInit |
| 285 |
\cs_if_exist:NT \FV@BeginListFrame |
| 286 |
{ |
| 287 |
\tag_mc_begin:n{artifact} |
| 288 |
\FV@BeginListFrame |
| 289 |
\tag_mc_end: |
| 290 |
} |
| 291 |
\tag_struct_begin:n{tag=verbatim} |
| 292 |
} |
| 293 |
\def\FV@EndList{% |
| 294 |
\FV@ListProcessLastLine |
| 295 |
\tag_struct_end: |
| 296 |
\cs_if_exist:NT \FV@EndListFrame |
| 297 |
{ |
| 298 |
\tag_mc_begin:n{artifact} |
| 299 |
\FV@EndListFrame |
| 300 |
\tag_mc_end: |
| 301 |
} |
| 302 |
\@endparenv |
| 303 |
\endgroup |
| 304 |
\@endpetrue |
| 305 |
} |
| 306 |
\def\FV@ListProcessLine#1{% |
| 307 |
\hbox to \hsize{% |
| 308 |
\kern\leftmargin |
| 309 |
\hbox to \linewidth{% |
| 310 |
\tag_struct_begin:n{tag=codeline} |
| 311 |
\cs_if_exist:NT \FV@LeftListNumber |
| 312 |
{ |
| 313 |
\tag_struct_begin:n{tag=Lbl} |
| 314 |
\tag_mc_begin:n{} |
| 315 |
\FV@LeftListNumber |
| 316 |
\tag_mc_end: |
| 317 |
\tag_struct_end: |
| 318 |
} |
| 319 |
\cs_if_exist:NT \FV@LeftListFrame |
| 320 |
{ |
| 321 |
\tag_mc_begin:n{artifact} |
| 322 |
\FV@LeftListFrame |
| 323 |
\tag_mc_end: |
| 324 |
} |
| 325 |
\tag_mc_begin:n{}% |
| 326 |
\FancyVerbFormatLine{#1}% |
| 327 |
\tag_mc_end: |
| 328 |
\tag_struct_end:\hss |
| 329 |
\cs_if_exist:NT \FV@RightListFrame |
| 330 |
{ |
| 331 |
\tag_mc_begin:n{artifact} |
| 332 |
\FV@RightListFrame |
| 333 |
\tag_mc_end: |
| 334 |
} |
| 335 |
\cs_if_exist:NT \FV@RightListNumber |
| 336 |
{ |
| 337 |
\tag_struct_begin:n{tag=Lbl} |
| 338 |
\tag_mc_begin:n{} |
| 339 |
\FV@RightListNumber |
| 340 |
\tag_mc_begin:n{} |
| 341 |
\tag_struct_end: |
| 342 |
} |
| 343 |
} |
| 344 |
\hss}} |
| 345 |
} |
| 346 |
\ExplSyntaxOff |
| 347 |
\AddToHook{package/microtype/after}[firstaid]{% |
| 348 |
\FirstAidNeededT{microtype}{sty}{2025/07/09 v3.2b |
| 349 |
Micro-typographical refinements |
| 350 |
(RS)} |
| 351 |
{% |
| 352 |
\def\MT@get@prot#1#2{% |
| 353 |
\begingroup |
| 354 |
\SuspendTagging{\MT@get@prot}%%added by firstaid |
| 355 |
\setbox\MT@tempbox\vbox{% |
| 356 |
\everypar{}% |
| 357 |
\parfillskip=\z@skip |
| 358 |
\hbadness\@M |
| 359 |
\clubpenalty\z@ |
| 360 |
\widowpenalty\z@ |
| 361 |
\interlinepenalty\z@ |
| 362 |
\@newlistfalse |
| 363 |
\MT@prot@hook |
| 364 |
\begingroup |
| 365 |
\MT@noindent #1\relax\MT@csq@eqgroup |
| 366 |
\endgroup}% |
| 367 |
\vbadness=\@M |
| 368 |
\splittopskip=\z@ |
| 369 |
\vfuzz=\maxdimen |
| 370 |
\setbox\MT@tempbox\vbox{% |
| 371 |
\ifvbox\MT@tempbox |
| 372 |
\global\setbox\MT@tempbox=\vsplit\MT@tempbox to \normalbaselineskip |
| 373 |
\unvbox\MT@tempbox |
| 374 |
\global\setbox\MT@tempbox=\lastbox |
| 375 |
\fi |
| 376 |
}% |
| 377 |
\endgroup |
| 378 |
\ifhbox\MT@tempbox |
| 379 |
\@tempdima=\@nameuse{#2marginkern}\MT@tempbox\relax |
| 380 |
\expandafter\ifdim\@tempdima=\z@ \else |
| 381 |
\leavevmode |
| 382 |
\MT@vinfo{|<< adding #2 margin kern for `#1':\MessageBreak |
| 383 |
\the\@tempdima \on@line}% |
| 384 |
\kern\@tempdima |
| 385 |
\fi |
| 386 |
\fi |
| 387 |
}} |
| 388 |
} |
| 389 |
\endinput |
| 390 |
%% |
| 391 |
%% End of file `latex-lab-testphase-firstaid.sty'. |