Debian Codegraph @

texmf-dist/tex/latex/koma-script/scrlfile-hook-3.34.sty

raw
1 %%
2 %% This is file `scrlfile-hook-3.34.sty',
3 %% generated with the docstrip utility, extended by scrdocstrip.
4 %%
5 %% The original source files were:
6 %%
7 %% scrlfile-hook.dtx (with options: `package,3.34')
8 %% scrlogo.dtx (with options: `logo')
9 %%
10 %% Copyright (c) 2002-2026 Markus Kohm [komascript at gmx info]
11 %%
12 %% This file was generated from file(s) of the KOMA-Script bundle.
13 %% ---------------------------------------------------------------
14 %%
15 %% It may be distributed under the conditions of the
16 %% LaTeX Project Public License in the version distributed together
17 %% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
18 %%
19 %% This file may only be distributed together with a copy of the
20 %% KOMA-Script bundle. You may however distribute the
21 %% KOMA-Script bundle without all such generated files. See also
22 %% `lppl.txt' or `lppl-de.txt' for additional information.
23 %%
24 %% The list of files belonging to KOMA-Script distribution is given in
25 %% the file `MANIFEST.md'. See also `lppl.txt' or `lppl-de.txt' for
26 %% additional information.
27 %%
28 %% If this file is a beta version, you may not be allowed to distribute
29 %% it. Look at the comments below to see if this is the case.
30 %%
31 %% English and German manuals are part of KOMA-Script bundle.
32 %% ----------------------------------------------------------
33 %%
34 %% See `README'.
35 %%
36 %% The KOMA-Script bundle (but maybe not this file) was based upon the
37 %% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
38 %% standard classes created by The LaTeX3 Project 1994-1996. You can
39 %% find a complete unmodified copy of LaTeX2e at
40 %% <http://mirror.ctan.org/tex-archive/macros/latex/base/>.
41 %%
42 %%% From File: $Id: scrlfile-hook.dtx$
43 \ProvidesPackage{scrlfile-hook-3.34}[%
44 2026/02/02 v3.49.2 KOMA-Script
45 package
46 (using LaTeX hooks)]
47 \@ifundefined{IfFormatAtLeastTF}{%
48 \PackageError{scrlfile-hook}{not recommended usage of package}{%
49 It seems this package has been loaded directly using a LaTeX
50 version\MessageBreak
51 prior to 2020-10-01. This is not recommended. Please always load
52 package\MessageBreak
53 scrlfile instead of scrlfile-hook.\MessageBreak
54 If you would continue, I will try to load scrlfile-patcholdlatex%
55 }%
56 \RequirePackage{scrlfile-patcholdlatex}\endinput
57 }{%
58 \IfFormatAtLeastTF{2020/10/01}{%
59 \IfFormatAtLeastTF{2021/11/15}{%
60 \PackageError{scrlfile-hook-3.34}{LaTeX too new for this package}{%
61 It seems this package has ben loaded directly using a LaTeX
62 version\MessageBreak
63 newer than 2021-06-01. This is not recommended. Please always load
64 package\MessageBreak
65 scrlfile instead of scrlfile-hook-3.34.\MessageBreak
66 If you would continue, I will try to load scrlfile-hook%
67 }%
68 \RequirePackage{scrlfile-hook}\endinput
69 }{%
70 }%
71 }{%
72 \PackageError{scrlfile-hook}{LaTeX too old for this package}{%
73 It seems this package has been loaded directly using a LaTeX
74 version\MessageBreak
75 prior to 2020-10-01. This is not recommended. Please always load
76 package\MessageBreak
77 scrlfile instead of scrlfile-hook.\MessageBreak
78 If you would continue, I will try to load scrlfile-patcholdlatex%
79 }%
80 \RequirePackage{scrlfile-patcholdlatex}\endinput
81 }%
82 }
83 \ExplSyntaxOn
84 \NewDocumentCommand \BeforeFile { m }
85 {
86 \AddToHook { file / before / #1 }
87 }
88 \NewDocumentCommand \AfterFile { m }
89 {
90 \AddToHook { file / after / #1 }
91 }
92 \NewDocumentCommand \BeforeClass { m }
93 {
94 \BeforeFile { #1.\@clsextension }
95 }
96 \NewDocumentCommand \BeforePackage { m }
97 {
98 \BeforeFile { #1.\@pkgextension }
99 }
100 \NewDocumentCommand \AfterAtEndOfClass { s m o +m }
101 {
102 \IfBooleanTF { #1 }
103 {
104 \scrlfile_if_class_loaded:nTF { #2 }
105 { #4 }
106 { \hook_gput_code:nnn { class / after / #2 } { #3 } { #4 } }
107 }
108 { \hook_gput_code:nnn { class / after / #2 } { #3 } { #4 } }
109 }
110 \NewDocumentCommand \AfterAtEndOfPackage { s m o +m }
111 {
112 \IfBooleanTF { #1 }
113 {
114 \scrlfile_if_package_loaded:nTF { #2 }
115 { #4 }
116 { \hook_gput_code:nnn { package / after / #2 } { #3 } { #4 } }
117 }
118 { \hook_gput_code:nnn { package / after / #2 } { #3 } { #4 } }
119 }
120 \seq_new:N \g__scrlfile_input_file_seq
121 \hook_gput_code:nnn { file / before } { . }
122 { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFile } }
123 \msg_new:nnn { scrlfile-hook } { too-many-pops }
124 {
125 More~file~names~popped~from~stack~than~put~to.~
126 This~should~never~happen.~
127 However,~it~could~happen~if~scrlfile-hook~is~loaded~by~another~
128 package~or~class.~In~this~case~some~packages~or~classes~are~not~
129 recognised~correctly.
130 }
131 \hook_gput_code:nnn { file / after } { . }
132 {
133 \seq_gpop:NNF \g__scrlfile_input_file_seq \l_tmpa_seq
134 {
135 \msg_warning:nn { scrlfile-hook } { too-many-pops }
136 }
137 }
138 \cs_if_exist:NTF \g__filehook_input_file_seq
139 {
140 \seq_map_inline:Nn \g__filehook_input_file_seq
141 {
142 \seq_gput_right:Nx \g__scrlfile_input_file_seq
143 { \tl_item:nn { #1 } { 2 } }
144 }
145 }
146 {
147 \seq_gpush:Nx \g__scrlfile_input_file_seq { }
148 \cs_if_exist:NTF \CurrentFileUsed
149 { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFileUsed } }
150 { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFile } }
151 }
152 \prg_new_protected_conditional:Npnn \__scrlfile_if_loading:n #1 { T, F, TF }
153 {
154 \str_set:Nx \l_tmpa_str { #1 }
155 \seq_if_in:NxTF \g__scrlfile_input_file_seq { \str_use:N \l_tmpa_str }
156 { \prg_return_true: }
157 { \prg_return_false: }
158 }
159 \prg_new_protected_conditional:Npnn \scrlfile_if_class_loaded:n #1 { T, F, TF }
160 {
161 \@ifclassloaded { #1 }
162 {
163 \__scrlfile_if_loading:nTF { #1.\@clsextension }
164 { \prg_return_false: }
165 { \prg_return_true: }
166 }
167 {
168 \prg_return_false:
169 }
170 }
171 \prg_new_protected_conditional:Npnn \scrlfile_if_package_loaded:n #1 { T, F, TF }
172 {
173 \@ifpackageloaded { #1 }
174 {
175 \__scrlfile_if_loading:nTF { #1.\@pkgextension }
176 { \prg_return_false: }
177 { \prg_return_true: }
178 }
179 {
180 \prg_return_false:
181 }
182 }
183 \NewDocumentCommand \scrlfile@AfterClass { s m o +m }
184 {
185 \IfBooleanTF { #1 }
186 {
187 \@ifclassloaded{ #2 }
188 { #4 }
189 {
190 \hook_gput_code:nnn
191 { file / after / #2.\@clsextension }
192 { #3 }
193 { #4 }
194 }
195 }
196 {
197 \hook_gput_code:nnn { file / after / #2.\@clsextension } { #3 } { #4 }
198 }
199 }
200 \NewDocumentCommand \AfterClass { } { \scrlfile@AfterClass }
201 \NewDocumentCommand \scrlfile@AfterPackage { s m o +m }
202 {
203 \IfBooleanTF { #1 }
204 {
205 \@ifpackageloaded{ #2 }
206 { #4 }
207 {
208 \hook_gput_code:nnn
209 { file / after / #2.\@pkgextension }
210 { #3 }
211 { #4 }
212 }
213 }
214 {
215 \hook_gput_code:nnn { file / after / #2.\@pkgextension } { #3 } { #4 }
216 }
217 }
218 \NewDocumentCommand \AfterPackage { } { \scrlfile@AfterPackage }
219 \NewDocumentCommand{\ReplaceInput}{}{\declare@file@substitution}
220 \NewDocumentCommand\ReplaceClass{mm}{%
221 \declare@file@substitution{#1.\@clsextension}{#2.\@clsextension}%
222 }
223 \NewDocumentCommand\ReplacePackage{mm}{%
224 \declare@file@substitution{#1.\@pkgextension}{#2.\@pkgextension}%
225 }
226 \NewDocumentCommand{\UnReplaceInput}{}{\undeclare@file@substitution}
227 \NewDocumentCommand\UnReplaceClass{m}{%
228 \undeclare@file@substitution{#1.\@clsextension}%
229 }
230 \NewDocumentCommand\UnReplacePackage{mm}{%
231 \undeclare@file@substitution{#1.\@pkgextension}%
232 }
233 \clist_new:N \g__scrlfile_prevent_clist
234 \NewDocumentCommand \PreventPackageFromLoading { s +o m }
235 {
236 \clist_set:Nx \l__scrlfile_package_clist { #3 }
237 \clist_map_inline:Nn \l__scrlfile_package_clist
238 {
239 \@ifpackageloaded { ##1 }
240 {
241 \IfBooleanTF { #1 } { \msg_info:nnn } { \msg_warning:nnn }
242 { scrlfile } { no-prevent-for-already-loaded } { ##1 }
243 }
244 {
245 \clist_if_in:NnF \g__scrlfile_prevent_clist { ##1 }
246 { \clist_gput_right:Nn \g__scrlfile_prevent_clist { ##1 } }
247 \tl_if_exist:cF { g__scrlfile_exclude_package_##1_tl }
248 {
249 \tl_new:c { g__scrlfile_exclude_package_##1_tl }
250 }
251 \IfValueT { #2 }
252 {
253 \tl_gput_right:cn { g__scrlfile_exclude_package_##1_tl } { #2 }
254 }
255 \disable@package@load { ##1 }
256 { \tl_use:c { g__scrlfile_exclude_package_##1_tl } }
257 }
258 }
259 \clist_clear:N \l__scrlfile_package_clist
260 }
261 \clist_new:N \l__scrlfile_package_clist
262 \msg_new:nnn { scrlfile } { no-prevent-for-already-loaded }
263 {
264 Cannot~prevent~package~`#1'~from~being~loaded,~
265 because~it~has~been~loaded~already~before~line~\msg_line_number:
266 }
267 \NewDocumentCommand \StorePreventPackageFromLoading { m }
268 { \edef #1 { \clist_use:Nn \g__scrlfile_prevent_clist { , } } }
269 \NewDocumentCommand \ResetPreventPackageFromLoading {}
270 {
271 \clist_map_function:NN \g__scrlfile_prevent_clist \reenable@package@load
272 \clist_gclear:N \g__scrlfile_prevent_clist
273 }
274 \NewDocumentCommand \UnPreventPackageFromLoading { s m }
275 {
276 \clist_set:Nx \l__scrlfile_package_clist { #2 }
277 \clist_map_inline:Nn \l__scrlfile_package_clist
278 {
279 \clist_if_in:NnT \g__scrlfile_prevent_clist { ##1 }
280 {
281 \clist_gremove_all:Nn \g__scrlfile_prevent_clist { ##1 }
282 \reenable@package@load { ##1 }
283 \IfBooleanT { #1 }
284 { \cs_undefine:c { g__scrlfile_exclude_package_##1_tl } }
285 }
286 }
287 }
288 \NewDocumentCommand \BeforeClosingMainAux { o m }
289 {
290 \hook_gput_code:nnn { enddocument / afterlastpage } { #1 }
291 {
292 \debug_suspend:
293 \RenewDocumentCommand \BeforeClosingMainAux { m } { ##1 }
294 \cs_set_eq:NN \__scrlfile_protected@write:Nnn \protected@write
295 \cs_set_eq:NN \protected@write \protected@immediate@write
296 #2
297 \cs_set_eq:NN \protected@write \__scrlfile_protected@write:Nnn
298 \debug_resume:
299 }
300 }
301 \NewDocumentCommand \AfterReadingMainAux { o m }
302 {
303 \hook_gput_code:nnn { enddocument / afteraux } { #1 }
304 {
305 \debug_suspend:
306 \RenewDocumentCommand \AfterReadingMainAux { m } { ##1 }
307 \cs_set_eq:NN \__scrlfile_protected@write:Nnn \protected@write
308 \cs_set_eq:NN \protected@write \protected@immediate@write
309 #2
310 \cs_set_eq:NN \protected@write \__scrlfile_protected@write:Nnn
311 \debug_resume:
312 }
313 }
314 \ExplSyntaxOff
315 \ProvideDocumentCommand\protected@immediate@write{m+m+m}
316 {%
317 \begingroup
318 #2%
319 \let\protect\@unexpandable@protect
320 \edef\reserved@a{\immediate\write#1{#3}}%
321 \reserved@a
322 \endgroup
323 \if@nobreak\ifvmode\nobreak\fi\fi
324 }
325 %%% From File: $Id: scrlogo.dtx 4032 2023-04-17 09:45:11Z kohm $
326 \RequirePackage{scrlogo}
327 \endinput
328 %%
329 %% End of file `scrlfile-hook-3.34.sty'.