summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-09-27 21:27:46 +0000
committerKarl Berry <karl@freefriends.org>2020-09-27 21:27:46 +0000
commit88f3fea0e61c7d9183c2d9de8d59af21db852d82 (patch)
tree64ee0af542867c76e3f686efedbfddbea8d9b3bf /Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
parentf7a5fce4f1f54626e099adbbfc80dcf92745b4de (diff)
koma-script (27sep20)
git-svn-id: svn://tug.org/texlive/trunk@56454 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty')
-rw-r--r--Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty302
1 files changed, 302 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty b/Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
new file mode 100644
index 00000000000..ac3d109d5e1
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
@@ -0,0 +1,302 @@
+%%
+%% This is file `scrlfile-hook.sty',
+%% generated with the docstrip utility, extended by scrdocstrip.
+%%
+%% The original source files were:
+%%
+%% scrlfile-hook.dtx (with options: `package')
+%%
+%% Copyright (c) 2002-2019 Markus Kohm [komascript at gmx info]
+%%
+%% This file was generated from file(s) of the KOMA-Script bundle.
+%% ---------------------------------------------------------------
+%%
+%% It may be distributed under the conditions of the
+%% LaTeX Project Public License in the version distributed together
+%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
+%%
+%% This file may only be distributed together with a copy of the
+%% KOMA-Script bundle. You may however distribute the
+%% KOMA-Script bundle without all such generated files. See also
+%% `lppl.txt' or `lppl-de.txt' for additional information.
+%%
+%% The list of files belonging to KOMA-Script distribution is given in
+%% the file `manifest.txt'. See also `lppl.txt' or `lppl-de.txt' for
+%% additional information.
+%%
+%% If this file is a beta version, you may not be allowed to distribute
+%% it. Look at the comments below to see if this is the case.
+%%
+%% English and German manuals are part of KOMA-Script bundle.
+%% ----------------------------------------------------------
+%%
+%% See `README'.
+%%
+%% The KOMA-Script bundle (but maybe not this file) was based upon the
+%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
+%% standard classes created by The LaTeX3 Project 1994-1996. You can
+%% find a complete unmodified copy of LaTeX2e at
+%% <http://mirror.ctan.org/tex-archive/macros/latex/base/>.
+%%
+%%% From File: $Id: scrlfile-hook.dtx$
+\ProvidesPackage{scrlfile-hook}[%
+ 2020/09/21 v3.32 KOMA-Script
+ package
+ (using LaTeX hooks)]
+\@ifundefined{AddToHook}{%
+ \PackageError{scrlfile-hook}{LaTeX too old for this package}{%
+ \string\AddToHook\space of LaTeX 2020-10-01 or newer is
+ needed.\MessageBreak
+ Please update LaTeX or use package scrlfile-patch instead of\MessageBreak
+ scrlfile-hook.\MessageBreak
+ If you would continue, I will try to load scrlfile-patch
+ }%
+ \RequirePackage{scrlfile-patch}%
+ \endinput
+}{}
+\ExplSyntaxOn
+\NewDocumentCommand \BeforeFile { m }
+ {
+ \AddToHook { file / before / #1 }
+ }
+\NewDocumentCommand \AfterFile { m }
+ {
+ \AddToHook { file / after / #1 }
+ }
+\NewDocumentCommand \BeforeClass { m }
+ {
+ \BeforeFile { #1.\@clsextension }
+ }
+\NewDocumentCommand \BeforePackage { m }
+ {
+ \BeforeFile { #1.\@pkgextension }
+ }
+\NewDocumentCommand \AfterAtEndOfClass { s m o +m }
+ {
+ \IfBooleanTF { #1 }
+ {
+ \scrlfile_if_class_loaded:nTF { #2 }
+ { #4 }
+ { \hook_gput_code:nnn { class / after / #2 } { #3 } { #4 } }
+ }
+ { \hook_gput_code:nnn { class / after / #2 } { #3 } { #4 } }
+ }
+\NewDocumentCommand \AfterAtEndOfPackage { s m o +m }
+ {
+ \IfBooleanTF { #1 }
+ {
+ \scrlfile_if_package_loaded:nTF { #2 }
+ { #4 }
+ { \hook_gput_code:nnn { package / after / #2 } { #3 } { #4 } }
+ }
+ { \hook_gput_code:nnn { package / after / #2} { #3 } { #4 } }
+ }
+\seq_new:N \g__scrlfile_input_file_seq
+\hook_gput_code:nnn { file / before } { . }
+ { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFile } }
+\hook_gput_code:nnn { file / after } { . }
+ {
+ \seq_gpop:NNF \g__scrlfile_input_file_seq \l_tmpa_seq
+ {
+ \msg_new:nnn { scrlfile-hook } { to-much-pops }
+ {
+ More~file~names~popped~from~stack~than~put~to.~
+ This~should~never~happen.~
+ However,~it~could~happen~if~scrlfile-hook~is~loaded~by~another~
+ package~or~class.~In~this~case~some~packages~or~classes~are~not~
+ recognised~correctly.
+ }
+ \msg_warning:nn { scrlfile-hook } { to-much-pops }
+ }
+ }
+\cs_if_exist:NTF \g__filehook_input_file_seq
+ {
+ \seq_map_inline:Nn \g__filehook_input_file_seq
+ {
+ \seq_gput_right:Nx \g__scrlfile_input_file_seq
+ { \tl_item:nn { #1 } { 2 } }
+ }
+ }
+ {
+ \seq_gpush:Nx \g__scrlfile_input_file_seq { }
+ \cs_if_exist:NTF \CurrentFileUsed
+ { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFileUsed } }
+ { \seq_gpush:Nx \g__scrlfile_input_file_seq { \CurrentFile } }
+ }
+\prg_new_protected_conditional:Npnn \__scrlfile_if_loading:n #1 { T, F, TF }
+ {
+ \str_set:Nx \l_tmpa_str { #1 }
+ \seq_if_in:NxTF \g__scrlfile_input_file_seq { \str_use:N \l_tmpa_str }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+\prg_new_protected_conditional:Npnn \scrlfile_if_class_loaded:n #1 { T, F, TF }
+ {
+ \@ifclassloaded { #1 }
+ {
+ \__scrlfile_if_loading:nTF { #1.\@clsextension }
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+ {
+ \prg_return_false:
+ }
+ }
+\prg_new_protected_conditional:Npnn \scrlfile_if_package_loaded:n #1 { T, F, TF }
+ {
+ \@ifpackageloaded { #1 }
+ {
+ \__scrlfile_if_loading:nTF { #1.\@pkgextension }
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+ {
+ \prg_return_false:
+ }
+ }
+\NewDocumentCommand \scrlfile@AfterClass { s m o +m }
+ {
+ \IfBooleanTF { #1 }
+ {
+ \@ifclassloaded{ #2 }
+ { #4 }
+ {
+ \hook_gput_code:nnn
+ { file / after / #2.\@clsextension }
+ { #3 }
+ { #4 }
+ }
+ }
+ {
+ \hook_gput_code:nnn { file / after / #2.\@clsextension } { #3 } { #4 }
+ }
+ }
+\NewDocumentCommand \AfterClass { } { \scrlfile@AfterClass }
+\NewDocumentCommand \scrlfile@AfterPackage { s m o +m }
+ {
+ \IfBooleanTF { #1 }
+ {
+ \@ifpackageloaded{ #2 }
+ { #4 }
+ {
+ \hook_gput_code:nnn
+ { file / after / #2.\@pkgextension }
+ { #3 }
+ { #4 }
+ }
+ }
+ {
+ \hook_gput_code:nnn { file / after / #2.\@pkgextension } { #3 } { #4 }
+ }
+ }
+\NewDocumentCommand \AfterPackage { } { \scrlfile@AfterPackage }
+\NewDocumentCommand{\ReplaceInput}{}{\declare@file@substitution}
+\NewDocumentCommand\ReplaceClass{mm}{%
+ \declare@file@substitution{#1.\@clsextension}{#2.\@clsextension}%
+}
+\NewDocumentCommand\ReplacePackage{mm}{%
+ \declare@file@substitution{#1.\@pkgextension}{#2.\@pkgextension}%
+}
+\NewDocumentCommand{\UnReplaceInput}{}{\undeclare@file@substitution}
+\NewDocumentCommand\UnReplaceClass{m}{%
+ \undeclare@file@substitution{#1.\@clsextension}%
+}
+\NewDocumentCommand\UnReplacePackage{mm}{%
+ \undeclare@file@substitution{#1.\@pkgextension}%
+}
+\clist_new:N \g__scrlfile_prevent_clist
+\NewDocumentCommand \PreventPackageFromLoading { s +o m }
+ {
+ \clist_set:Nx \l__scrlfile_package_clist { #3 }
+ \clist_map_inline:Nn \l__scrlfile_package_clist
+ {
+ \@ifpackageloaded { ##1 }
+ {
+ \IfBooleanTF { #1 } { \msg_info:nnn } { \msg_warning:nnn }
+ { scrlfile } { no-prevent-for-already-loaded } { ##1 }
+ }
+ {
+ \clist_if_in:NnF \g__scrlfile_prevent_clist { ##1 }
+ { \clist_gput_right:Nn \g__scrlfile_prevent_clist { ##1 } }
+ \tl_if_exist:cF { g__scrlfile_exclude_package_##1_tl }
+ {
+ \tl_new:c { g__scrlfile_exclude_package_##1_tl }
+ }
+ \IfValueT { #2 }
+ {
+ \tl_gput_right:cn { g__scrlfile_exclude_package_##1_tl } { #2 }
+ }
+ \disable@package@load { ##1 }
+ { \tl_use:c { g__scrlfile_exclude_package_##1_tl } }
+ }
+ }
+ \clist_clear:N \l__scrlfile_package_clist
+ }
+\clist_new:N \l__scrlfile_package_clist
+\msg_new:nnn { scrlfile } { no-prevent-for-already-loaded }
+ {
+ Cannot~prevent~package~`#1'~from~being~loaded,~
+ because~it~has~been~loaded~already~before~line~\msg_line_number:
+ }
+\NewDocumentCommand \StorePreventPackageFromLoading { m }
+ { \edef #1 { \clist_use:Nn \g__scrlfile_prevent_clist { , } } }
+\NewDocumentCommand \ResetPreventPackageFromLoading {}
+ {
+ \clist_map_function:NN \g__scrlfile_prevent_clist \reenable@package@load
+ \clist_gclear:N \g__scrlfile_prevent_clist
+ }
+\NewDocumentCommand \UnPreventPackageFromLoading { s m }
+ {
+ \clist_set:Nx \l__scrlfile_package_clist { #2 }
+ \clist_map_inline:Nn \l__scrlfile_package_clist
+ {
+ \clist_if_in:NnT \g__scrlfile_prevent_clist { ##1 }
+ {
+ \clist_gremove_all:Nn \g__scrlfile_prevent_clist { ##1 }
+ \reenable@package@load { ##1 }
+ \IfBooleanT { #1 }
+ { \cs_undefine:c { g__scrlfile_exclude_package_##1_tl } }
+ }
+ }
+ }
+\NewDocumentCommand \BeforeClosingMainAux { o m }
+ {
+ \hook_gput_code:nnn { enddocument / afterlastpage } { #1 }
+ {
+ \debug_suspend:
+ \RenewDocumentCommand \BeforeClosingMainAux { m } { ##1 }
+ \cs_set_eq:NN \__scrlfile_protected@write:Nnn \protected@write
+ \cs_set_eq:NN \protected@write \protected@immediate@write
+ #2
+ \cs_set_eq:NN \protected@write \__scrlfile_protected@write:Nnn
+ \debug_resume:
+ }
+ }
+\NewDocumentCommand \AfterReadingMainAux { o m }
+ {
+ \hook_gput_code:nnn { enddocument / afteraux } { #1 }
+ {
+ \debug_suspend:
+ \RenewDocumentCommand \AfterReadingMainAux { m } { ##1 }
+ \cs_set_eq:NN \__scrlfile_protected@write:Nnn \protected@write
+ \cs_set_eq:NN \protected@write \protected@immediate@write
+ #2
+ \cs_set_eq:NN \protected@write \__scrlfile_protected@write:Nnn
+ \debug_resume:
+ }
+ }
+\ExplSyntaxOff
+\ProvideDocumentCommand\protected@immediate@write{m+m+m}
+ {%
+ \begingroup
+ #2%
+ \let\protect\@unexpandable@protect
+ \edef\reserved@a{\immediate\write#1{#3}}%
+ \reserved@a
+ \endgroup
+ \if@nobreak\ifvmode\nobreak\fi\fi
+ }
+\RequirePackage{scrlogo}
+\endinput
+%%
+%% End of file `scrlfile-hook.sty'.