summaryrefslogtreecommitdiff
path: root/macros/latex/required/latex-lab/latex-lab-firstaid.dtx
blob: 8f474e6b121698fc35e5057d2fab7b763ca98fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
% \iffalse meta-comment
%
%% File: latex-lab-firstaid.dtx (C) Copyright 2023 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version.  The latest version
% of this license is in the file
%
%    https://www.latex-project.org/lppl.txt
%
%
% The development version of the bundle can be found below
%
%    https://github.com/latex3/latex2e/required/latex-lab
%
% for those people who are interested or want to report an issue.
%
%<*driver>
\documentclass{l3doc}
\EnableCrossrefs
\CodelineIndex
\begin{document}
  \DocInput{latex-lab-firstaid.dtx}
\end{document}
%</driver>
%
% \fi
%
% \title{The \textsf{latex-lab-firstaid} package\\
% Temporary patches to external packages}
% \author{\LaTeX{} Project\thanks{Initial implementation done by Ulrike Fischer}}
% \date{Version 0.80 2023-06-04}
%
% \maketitle
%
% \newcommand{\xt}[1]{\textsl{\textsf{#1}}}
% \newcommand{\TODO}[1]{\textbf{[TODO:} #1\textbf{]}}
% \newcommand{\docclass}{document class \marginpar{\raggedright document class
% customizations}}
%
% \providecommand\hook[1]{\texttt{#1}}
%
% \begin{abstract}
% \end{abstract}
%
% \section{Introduction}
%
% The followings contains small temporary changes to external packages to avoid
% errors with the new tagging code. 
% 
% Similar to the main firstaid package the goal is to remove the 
% patches once the packages have been updated.

% \section{Implementation}
%    \begin{macrocode}
%<*package>
%<@@=tag>
%    \end{macrocode}
%    \begin{macrocode}
\ProvidesPackage {latex-lab-testphase-firstaid} [2023-06-04 v0.8
   Temporary patches to external packages need for the tagging project]
%    \end{macrocode}

% \subsection{blindtext}
% The blindtext package generates lists with nested \cs{loop} command.
% The inner loop introduces a group around the list which error when lists are tagged
% as \cs{@doendpe} is lost.
%    \begin{macrocode}
\AddToHook{file/blindtext.sty/after}[latex-lab-firstaid]{%
  \FirstAidNeededT{blindtext}{sty}{\blindfiledate\space\blindfileversion\space%
                 blindtext-Package}%
   {%
    \renewcommand{\blind@items}{%
       \setcounter{blind@listcount}{1}%
      \loop
      \ifblind@optional
        \ifblind@long
          \item[\blindtext@countitem] \blindtext@text
        \else
          \item[\blindtext@count] \blindtext@item
        \fi
        \else % \blind@optionalfalse
          \ifblind@long
            \item \blindtext@text
          \else
            \item \blindtext@countitem
          \fi
        \fi % \ifblind@optional
        {%
          \loop
          \ifnum\value{blindlistlevel}>\value{blindlist@level}%
            \stepcounter{blind@levelcount}%
            \blind@list[\value{blindlist}]\relax
            \addtocounter{blind@levelcount}{-1}%
            \setcounter{blind@listcount}{1}%
          \repeat
        \expandafter}\if@endpe\@doendpe\fi % <----------changed
      \ifnum\value{blind@listcount}<\value{blindlist}%
        \stepcounter{blind@listcount}%
      \repeat
    }
   }%
 }
%    \end{macrocode}
% \subsection{ltugboat}
% ltugboat need only a redefinition of \cs{l@section} to add the hooks
%    \begin{macrocode}
\AddToHook{file/ltugboat.cls/after}
 {
   \def\l@section#1#2{\addpenalty{\@secpenalty}%
     \addvspace{\TBtocsectionspace}%
     \@tempdima 1.5em
     \begingroup
       \parindent\z@ \rightskip\z@  % article style makes \rightskip > 0
       \parfillskip\z@
       \TBtocsectionfont
       \leavevmode\advance\leftskip\@tempdima\hskip-\leftskip
        \UseHookWithArguments{contentsline/text/before}{4}
            {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
          \csname contentsline@text@1@format\endcsname{#1}%
        \UseHookWithArguments{contentsline/text/after}{4}
            {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
          \nobreak\hfil
       \nobreak\hb@xt@\@pnumwidth{\hss  
         \UseHookWithArguments{contentsline/page/before}{4}
            {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
          #2%
         \UseHookWithArguments{contentsline/page/after}{4}
            {\toclevel@part}{#1}{#2}{\@contentsline@destination}%
         }\par
     \endgroup}
 }  
%    \end{macrocode}
 
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%    \begin{macrocode}
%<*latex-lab>
\ProvidesFile{firstaid-latex-lab-testphase.ltx}
        [2023-06-04 v0.8 Temporary patches to external packages need for the tagging project]

\RequirePackage{latex-lab-testphase-firstaid}

%</latex-lab>
%    \end{macrocode}