summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/scrlfile.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/koma-script/source/scrlfile.dtx')
-rw-r--r--macros/latex/contrib/koma-script/source/scrlfile.dtx244
1 files changed, 137 insertions, 107 deletions
diff --git a/macros/latex/contrib/koma-script/source/scrlfile.dtx b/macros/latex/contrib/koma-script/source/scrlfile.dtx
index a56dbe6266..b52fe0b59e 100644
--- a/macros/latex/contrib/koma-script/source/scrlfile.dtx
+++ b/macros/latex/contrib/koma-script/source/scrlfile.dtx
@@ -1,8 +1,8 @@
-% \CheckSum{772}
+% \CheckSum{820}
% \iffalse^^A meta-comment
% ======================================================================
% scrlfile.dtx
-% Copyright (c) Markus Kohm, 2002-2018
+% Copyright (c) Markus Kohm, 2002-2019
%
% This file is part of the work `scrlfile' which is part of the LaTeX2e
% KOMA-Script bundle.
@@ -21,7 +21,7 @@
% This work consists of all files listed in manifest.txt.
% ----------------------------------------------------------------------
% scrlfile.dtx
-% Copyright (c) Markus Kohm, 2002-2018
+% Copyright (c) Markus Kohm, 2002-2019
%
% Diese Datei ist Teil des Werks `scrlfile', das wiederum Teil des
% LaTeX2e KOMA-Script Pakets ist.
@@ -59,12 +59,12 @@
% Right brace \} Tilde \~}
%
% \iffalse
-%%% From File: $Id: scrlfile.dtx 3011 2018-08-29 07:35:17Z kohm $
+%%% From File: $Id: scrlfile.dtx 3243 2019-10-07 13:32:53Z kohm $
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
- \filedate$Date: 2018-08-29 09:35:17 +0200 (Wed, 29 Aug 2018) $
+ \filedate$Date: 2019-10-07 15:32:53 +0200 (Mon, 07 Oct 2019) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 2631 $
\edef\reserved@a{%
@@ -127,8 +127,8 @@
%
% \selectlanguage{english}
%
-% \changes{v2.95}{2002/06/11}{First version split from hugh scrclass.dtx}^^A
-% \changes{v3.24}{2017/05/06}{standalone manual removed}^^A
+% \changes{v2.95}{2002/06/11}{First version split from hugh scrclass.dtx}%^^A
+% \changes{v3.24}{2017/05/06}{standalone manual removed}%^^A
%
% \StopEventually{\PrintIndex\PrintChanges}
%
@@ -140,7 +140,7 @@
%
% \subsection{Preamble}
%
-% \changes{v3.24}{2017/05/06}{Preamble sub-section removed}^^A
+% \changes{v3.24}{2017/05/06}{Preamble sub-section removed}%^^A
% Since \KOMAScript~3.24 we do not longer output version information into the
% \texttt{log}-file.
%
@@ -155,8 +155,8 @@
%
% \subsection{The macros}
%
-% \begin{macro}{\InputIfFileExists}
-% \changes{v2.96}{2006/07/19}{replacement code added}
+% \begin{macro}{\InputIfFileExists}
+% \changes{v2.96}{2006/07/19}{replacement code added}%^^A
% \LaTeX{} uses this macro for loading files with
% \cs{input}\marg{filename}, \cs{include}, \cs{LoadClass},
% \cs{LoadClassWithOptions}, \cs{documentclass}, \cs{documentstyle},
@@ -169,14 +169,30 @@
% macros\,---\,one before loading the file and one after loading the
% file. But before we redefine the macro, we test, if the macro was
% defined like we expected. \LaTeX{} will warn, if not.
+% \changes{v3.27}{2019/10/06}{\LaTeX{} 2019-10-01 changed the definition}%^^A
% \begin{macrocode}
-\CheckCommand{\InputIfFileExists}[2]{%
+\long\def\reserved@a#1#2{%
\IfFileExists{#1}%
- {#2\@addtofilelist{#1}\@@input \@filef@und}}
+ {#2\@addtofilelist{#1}\@@input \@filef@und}}%
+\ifx\reserved@a\InputIfFileExists\else
+ \expandafter\CheckCommand\expandafter*\expandafter\InputIfFileExists
+ \expandafter{%
+ \expandafter\protect\csname InputIfFileExists \endcsname
+ }%
+ \expandafter\CheckCommand \csname InputIfFileExists \endcsname[2]{%
+ \IfFileExists {#1}{%
+ \expandafter \@swaptwoargs \expandafter {\@filef@und }%
+ {#2\@addtofilelist {#1}\@@input }%
+ }%
+ }%
+\fi
% \end{macrocode}
% Now we can redefine the macro like described above:
% \begin{macrocode}
-\renewcommand{\InputIfFileExists}[2]{%
+\expandafter\renewcommand\expandafter*\expandafter\InputIfFileExists
+\expandafter{\expandafter
+ \protect\csname InputIfFileExists \endcsname}%
+\expandafter\long\expandafter\def\csname InputIfFileExists \endcsname#1#2{%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname #1-@alias\endcsname\relax
\expandafter\@secondoftwo
@@ -189,21 +205,31 @@
#1-@alias\endcsname}{#2}%
}%
{\IfFileExists{#1}{%
- \scr@load@hook{before}{#1}%
- #2\@addtofilelist{#1}%
- \@@input \@filef@und
- \scr@load@hook{after}{#1}%
+ \expandafter\scr@input@withhook\expandafter{\@filef@und}{#1}{#2}%
}}%
}
% \end{macrocode}
-% \end{macro}
+% \begin{macro}{\scr@input@withhook}
+% \changes{v3.27}{2019/03/28}{new (internal)}%^^A
+% We need a new internal, because of expanding \cs{@file@und} before inputting
+% the file.
+% \begin{macrocode}
+\newcommand{\scr@input@withhook}[3]{%
+ \scr@load@hook{before}{#2}%
+ #3\@addtofilelist{#2}%
+ \@@input #1%
+ \scr@load@hook{after}{#2}%
+}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@loadwithoptions}
-% \changes{v2.96}{2006/07/19}{new redefinition}
-% \begin{macro}{\scr@loadwithoptions}
-% \changes{v2.96}{2006/07/19}{new helper macro}
-% \begin{macro}{\scr@@loadwithoptions}
-% \changes{v2.97a}{2007/03/07}{new helper macro}
+% \begin{macro}{\@loadwithoptions}
+% \changes{v2.96}{2006/07/19}{new redefinition}
+% \begin{macro}{\scr@loadwithoptions}
+% \changes{v2.96}{2006/07/19}{new helper macro}
+% \begin{macro}{\scr@@loadwithoptions}
+% \changes{v2.97a}{2007/03/07}{new helper macro}
% \LaTeX{} uses this macro for loading classes and packages using
% \cs{LoadClassWithOptions} or \cs{RequirePackageWithOptions}. We simply say
% now: if the class or package should be replaced by another, try it again
@@ -227,16 +253,16 @@
\scr@@loadwithoptions
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \begin{macro}{\@onefilewithoption}
-% \changes{v2.96}{2006/07/19}{new redefinition}
-% \begin{macro}{\scr@onefilewithoption}
-% \changes{v2.96}{2006/07/19}{new helper macro}
-% \begin{macro}{\scr@@onefilewithoption}
-% \changes{v2.98}{2007/12/18}{new helper macro}
+% \begin{macro}{\@onefilewithoption}
+% \changes{v2.96}{2006/07/19}{new redefinition}
+% \begin{macro}{\scr@onefilewithoption}
+% \changes{v2.96}{2006/07/19}{new helper macro}
+% \begin{macro}{\scr@@onefilewithoption}
+% \changes{v2.98}{2007/12/18}{new helper macro}
% \LaTeX{} uses this macro for loading classes and packages using
% \cs{LoadClass}, \cs{documentclass}, \cs{RequirePackage}, and
% \cs{usepackage}. We simply say now: if the class or package should be
@@ -266,13 +292,13 @@
\scr@load@hook{lateafter}{#1.#4}%
}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\ReplaceInput}
-% \changes{v2.96}{2006/07/19}{new command}
-% \changes{v3.12}{2013/11/15}{implemented}
+% \changes{v2.96}{2006/07/19}{new command}
+% \changes{v3.12}{2013/11/15}{implemented}
% Defining the replacement by definition of \cs{\#1-@alias}.
% \begin{macrocode}
\newcommand*{\ReplaceInput}[2]{%
@@ -280,8 +306,8 @@
}
% \end{macrocode}
% \begin{macro}{\ReplaceFile}
-% \changes{v2.96}{2006/07/19}{new command}
-% \changes{v3.12}{2013/11/15}{throw error}
+% \changes{v2.96}{2006/07/19}{new command}
+% \changes{v3.12}{2013/11/15}{throw error}
% Sorry, but I've implemented the wrong command some time ago.
% \begin{macrocode}
\newcommand*{\ReplaceFile}{%
@@ -302,7 +328,7 @@
% \end{macro}
%
% \begin{macro}{\UnReplaceInput}
-% \changes{v3.12}{2013/11/15}{new command}
+% \changes{v3.12}{2013/11/15}{new command}
% Do not longer replace a file.
% \begin{macrocode}
\newcommand*{\UnReplaceInput}[1]{%
@@ -314,11 +340,11 @@
% \end{macro}
%
% \begin{macro}{\ReplacePackage}
-% \changes{v2.96}{2006/07/19}{new command}
+% \changes{v2.96}{2006/07/19}{new command}
% \begin{macro}{\ReplaceClass}
-% \changes{v2.96}{2006/07/19}{new command}
+% \changes{v2.96}{2006/07/19}{new command}
% \begin{macro}{\@replacefilewithext}
-% \changes{v2.96}{2006/07/19}{new helper command}^^A
+% \changes{v2.96}{2006/07/19}{new helper command}%^^A
% Note that replacing a package or class will not replace the input of the
% file of the package or class but only the input of package or class.
% \begin{macrocode}
@@ -337,11 +363,11 @@
% \end{macro}
%
% \begin{macro}{\UnReplacePackage}
-% \changes{v3.12}{2013/11/15}{new command}
+% \changes{v3.12}{2013/11/15}{new command}
% \begin{macro}{\UnReplaceClass}
-% \changes{v3.12}{2013/11/15}{new command}
+% \changes{v3.12}{2013/11/15}{new command}
% \begin{macro}{\@unreplacefilewithext}
-% \changes{v3.12}{2013/11/15}{new helper command}^^A
+% \changes{v3.12}{2013/11/15}{new helper command}%^^A
% Do not nolonger replace a class or package.
% \begin{macrocode}
\newcommand*{\@unreplacefilewithext}[2]{%
@@ -362,8 +388,8 @@
%
%
% \begin{macro}{\scr@replacefile@msg}
-% \changes{v2.96}{2006/07/19}{new helper command}
-% \changes{v2.98}{2007/12/18}{spellfix}
+% \changes{v2.96}{2006/07/19}{new helper command}
+% \changes{v2.98}{2007/12/18}{spellfix}
% Last but not least \textsf{scrlfile} will write a message to the log file at
% every replacement.
% \begin{macrocode}
@@ -405,29 +431,31 @@
% \begin{macro}{\AfterFile}
% \begin{macro}{\BeforeClass}
% \begin{macro}{\AfterClass}
-% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
-% \cs{kernel@ifnextchar}}^^A
-% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
-% ersetzt}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}%^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}%^^A
% \begin{macro}{\AfterAtEndOfClass}
% \begin{macro}{\@AfterClass}
% \begin{macro}{\@@AfterClass}
-% \changes{v3.09}{2011/03/08}{new (internal)}
+% \changes{v3.09}{2011/03/08}{new (internal)}
% \begin{macro}{\@@@AfterClass}
-% \changes{v3.09}{2011/03/09}{new (internal)}
+% \changes{v3.09}{2011/03/09}{new (internal)}
+% \changes{v3.27}{2019/08/26}{using inside class fixed}
% \begin{macro}{\@sAfterClass}
% \begin{macro}{\BeforePackage}
% \begin{macro}{\AfterPackage}
-% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
-% \cs{kernel@ifnextchar}}^^A
-% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
-% ersetzt}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}%^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}%^^A
% \begin{macro}{\AfterAtEndOfPackage}
% \begin{macro}{\@AfterPackage}
% \begin{macro}{\@@AfterPackage}
-% \changes{v3.09}{2011/03/08}{new (internal)}
+% \changes{v3.09}{2011/03/08}{new (internal)}
% \begin{macro}{\@@@AfterPackage}
-% \changes{v3.09}{2011/03/09}{new (internal)}
+% \changes{v3.09}{2011/03/09}{new (internal)}
+% \changes{v3.27}{2019/08/26}{using inside package fixed}
% \begin{macro}{\@sAfterPackage}
% These macros add stuff to a load-file-hook of a file, class or
% package. First argument is the name of the file (with extension),
@@ -450,11 +478,12 @@
}%
}
\newcommand*{\@@@AfterClass}[2]{%
- \begingroup\ifx\csname #2.\@clsextension-h@@k\endcsname\relax
- \aftergroup\@sAfterClass
- \else
- \aftergroup\AfterAtEndOfClass
- \fi
+ \begingroup
+ \expandafter\ifx\csname #2.\@clsextension-h@@k\endcsname\relax
+ \aftergroup\@sAfterClass
+ \else
+ \aftergroup\AfterAtEndOfClass
+ \fi
\endgroup{#2}%
}
\newcommand*{\AfterAtEndOfClass}[1]{%
@@ -490,11 +519,12 @@
}%
}
\newcommand*{\@@@AfterPackage}[2]{%
- \begingroup\ifx\csname #2.\@pkgextension-h@@k\endcsname\relax
- \aftergroup\@sAfterPackage
- \else
- \aftergroup\AfterAtEndOfPackage
- \fi
+ \begingroup
+ \expandafter\ifx\csname #2.\@pkgextension-h@@k\endcsname\relax
+ \aftergroup\@sAfterPackage
+ \else
+ \aftergroup\AfterAtEndOfPackage
+ \fi
\endgroup{#2}%
}
\newcommand*{\AfterAtEndOfPackage}[1]{%
@@ -539,24 +569,24 @@
% \end{macro}
%
% \begin{macro}{\PreventPackageFromLoading}
-% \changes{v3.08}{2010/11/04}{New}
-% \changes{v3.11a}{2012/06/13}{write fault error in \cs{MessageBreak} fixed}
-% \changes{v3.12}{2012/06/15}{new star version allowes empty argument with
+% \changes{v3.08}{2010/11/04}{New}
+% \changes{v3.11a}{2012/06/13}{write fault error in \cs{MessageBreak} fixed}
+% \changes{v3.12}{2012/06/15}{new star version allowes empty argument with
% info instead of warning}
-% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
-% ersetzt}^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}%^^A
% \begin{macro}{\@PreventPackageFromLoading}
-% \changes{v3.12}{2012/06/15}{New (internal)}^^A
-% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
-% \cs{kernel@ifnextchar}}^^A
+% \changes{v3.12}{2012/06/15}{New (internal)}%^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
+% \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\@@PreventPackageFromLoading}
-% \changes{v3.12}{2013/11/22}{New (internal)}^^A
-% \changes{v3.12}{2013/11/22}{\cs{usepackage} before \cs{documentclass}
-% fixed}^^A
+% \changes{v3.12}{2013/11/22}{New (internal)}%^^A
+% \changes{v3.12}{2013/11/22}{\cs{usepackage} before \cs{documentclass}
+% fixed}%^^A
% \begin{macro}{\scrlfile@excludedpackages}
-% \changes{v3.08}{2010/11/04}{New (internal)}^^A
+% \changes{v3.08}{2010/11/04}{New (internal)}%^^A
% \begin{macro}{\scrlfile@saved@RequirePackage}
-% \changes{v3.08}{2010/11/04}{New (internal)}^^A
+% \changes{v3.08}{2010/11/04}{New (internal)}%^^A
% \begin{macrocode}
\newcommand*{\scrlfile@excludedpackages}{}
\let\scrlfile@excludedpackages\@empty
@@ -611,8 +641,8 @@
% packages will be added to the exclusion list. Empty arguments will be
% ignored.
% \changes{v3.11a}{2012/06/11}{missing \cs{scrlfile@excludedpackages} at
-% redefinition of \cs{scrlfile@excludedpackages} added}^^A
-% \changes{v3.26}{2018/08/29}{spurious \cs{expandafter} removed}^^A
+% redefinition of \cs{scrlfile@excludedpackages} added}%^^A
+% \changes{v3.26}{2018/08/29}{spurious \cs{expandafter} removed}%^^A
% \begin{macrocode}
\@for\reserved@a:=\reserved@b\do {%
\ifx\reserved@a\@empty
@@ -657,9 +687,9 @@
\@onlypreamble\PreventPackageFromLoading
% \end{macrocode}
% \begin{macro}{\ResetPreventPackageFromLoading}
-% \changes{v3.08}{2010/11/04}{New}
+% \changes{v3.08}{2010/11/04}{New}
% \begin{macro}{\StorePreventPackageFromLoading}
-% \changes{v3.08}{2010/11/04}{New}
+% \changes{v3.08}{2010/11/04}{New}
% These two are very simple
% \begin{macrocode}
\newcommand*{\ResetPreventPackageFromLoading}{%
@@ -678,11 +708,11 @@
\@onlypreamble\StorePreventPackageFromLoading
% \end{macrocode}
% \begin{macro}{\UnPreventPackageFromLoading}
-% \changes{v3.12}{2013/11/22}{New}^^A
-% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
-% ersetzt}^^A
+% \changes{v3.12}{2013/11/22}{New}%^^A
+% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
+% ersetzt}%^^A
% \begin{macro}{\@UnPreventPackageFromLoading}
-% \changes{v3.12}{2013/11/22}{New (internal)}^^A
+% \changes{v3.12}{2013/11/22}{New (internal)}%^^A
% This removes packages from the prevent exclude list. The star variant also
% undefines the instead code.
% \begin{macrocode}
@@ -726,9 +756,9 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\scrlfile@RequirePackage}
-% \changes{v3.08}{2010/11/04}{New (internal)}
-% \changes{v3.12}{2013/11/22}{tolerate spaces}
-% \changes{v3.12}{2013/11/22}{execute the optional argument of
+% \changes{v3.08}{2010/11/04}{New (internal)}
+% \changes{v3.12}{2013/11/22}{tolerate spaces}
+% \changes{v3.12}{2013/11/22}{execute the optional argument of
% \cs{PreventPackageFromLoading}}
% This macro will replace \cs{RequirePackage} whenever the exlude list is not
% empty
@@ -781,8 +811,8 @@
% \end{macro}
%
% \begin{macro}{\scr@gobbleopt}
-% \changes{v3.08}{2010/11/04}{New (internal)}
-% \changes{v3.08a}{2011/02/11}{\cs{@gobbleopt} renamed due to compaibility
+% \changes{v3.08}{2010/11/04}{New (internal)}
+% \changes{v3.08a}{2011/02/11}{\cs{@gobbleopt} renamed due to compaibility
% problems with \texttt{ntheorem}}
% Eat the optional argument if it exists.
% \begin{macrocode}
@@ -791,19 +821,19 @@
% \end{macro}
%
% \begin{macro}{\kernel@ifstar}
-% \changes{v3.20}{2016/04/12}{New (internal)}
+% \changes{v3.20}{2016/04/12}{New (internal)}
% I hope, the \LaTeX{} kernel will define this command in future. But
% nevertheless, there are \LaTeX{} kernels in real live without this
% command. So I do it again if needed:
% \begin{macrocode}
\providecommand*\kernel@ifstar[1]{\kernel@ifnextchar*{\@firstoftwo{#1}}}
% \end{macrocode}
-% \end{macro}^^A \kernel@ifstar
+% \end{macro}%^^A \kernel@ifstar
%
% \begin{macro}{\BeforeClosingMainAux}
-% \changes{v2.95}{2002/09/03}{new}
+% \changes{v2.95}{2002/09/03}{new}
% \begin{macro}{\AfterReadingMainAux}
-% \changes{v3.03}{2009/03/25}{new}
+% \changes{v3.03}{2009/03/25}{new}
% These are completly different. First we have to establish a new hook
% at \cs{end\{document\}}, just after closing the group and after the
% final \cs{clearpage}.
@@ -830,9 +860,9 @@
}
% \end{macrocode}
% \begin{macro}{\scr@saved@checkend}
-% \changes{v2.95}{2002/09/03}{new (internal)}
+% \changes{v2.95}{2002/09/03}{new (internal)}
% \begin{macro}{\scr@saved@dofilelist}
-% \changes{v3.03}{2009/03/25}{new}
+% \changes{v3.03}{2009/03/25}{new}
% You may see above, that we need save-to macros.
% \begin{macrocode}
\newcommand*{\scr@saved@checkend}{}
@@ -841,12 +871,12 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\scr@redefine@newpage}
-% \changes{v3.00}{2008/07/09}{new (internal)}
+% \changes{v3.00}{2008/07/09}{new (internal)}
% Some classes (e.g. \textsf{letter}) write output to the aux file.
% Because of this, redefinition of \cs{newpage} will only be done, if
% \cs{BeforeClosingMainAux} is used.
% \begin{macro}{\scr@saved@newpage}
-% \changes{v3.00}{2008/07/09}{new (internal)}
+% \changes{v3.00}{2008/07/09}{new (internal)}
% And \cs{newpage} will be restored after the hook.
% \begin{macro}{\scr@restore@newpage}
% \begin{macrocode}
@@ -887,9 +917,9 @@
% \end{macro}
% \end{macro}
% \begin{macro}{\scr@hook@bcma}
-% \changes{v2.95}{2002/09/03}{new (internal)}
+% \changes{v2.95}{2002/09/03}{new (internal)}
% \begin{macro}{\scr@hook@acma}
-% \changes{v3.03}{2009/03/25}{new (internal)}
+% \changes{v3.03}{2009/03/25}{new (internal)}
% We also need macros, that saves the commands at the hooks and are
% extendable using \cs{g@addto@macro}.
% \begin{macrocode}