diff options
author | Karl Berry <karl@freefriends.org> | 2013-12-26 23:18:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-12-26 23:18:36 +0000 |
commit | 9b219d1b664067729034647a4b37626cf2bf5e26 (patch) | |
tree | 00708467b44f90736dc32ed1bebb95e9c4710139 /Master/texmf-dist/source/latex/koma-script/scrlfile.dtx | |
parent | c00c8298eb6913b74270a36c1f1018f1e9946f7b (diff) |
koma-script (26dec13)
git-svn-id: svn://tug.org/texlive/trunk@32489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/scrlfile.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/scrlfile.dtx | 286 |
1 files changed, 229 insertions, 57 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/scrlfile.dtx b/Master/texmf-dist/source/latex/koma-script/scrlfile.dtx index 01f99fd20b0..c0b5498135b 100644 --- a/Master/texmf-dist/source/latex/koma-script/scrlfile.dtx +++ b/Master/texmf-dist/source/latex/koma-script/scrlfile.dtx @@ -1,8 +1,8 @@ -% \CheckSum{599} +% \CheckSum{781} % \iffalse meta-comment % ====================================================================== % scrlfile.dtx -% Copyright (c) Markus Kohm, 2002-2012 +% Copyright (c) Markus Kohm, 2002-2013 % % This file is part of the work `scrlfile' which is part of the LaTeX2e % KOMA-Script bundle. @@ -18,11 +18,10 @@ % % The Current Maintainer and author of this work is Markus Kohm. % -% This work consists of files `scrlfile.dtx', `scrlfile.ins' and -% `scrlogo.dtx' at least. +% This work consists of all files listed in manifest.txt. % ---------------------------------------------------------------------- % scrlfile.dtx -% Copyright (c) Markus Kohm, 2002-2012 +% Copyright (c) Markus Kohm, 2002-2013 % % Diese Datei ist Teil des Werks `scrlfile', das wiederum Teil des % LaTeX2e KOMA-Script Pakets ist. @@ -39,8 +38,7 @@ % % Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm. % -% Dieses Werk besteht mindestens aus den Dateien `scrlfile.dtx', -% `scrlfile.ins' und `scrlogo.dtx'. +% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien. % ====================================================================== % \fi % @@ -61,30 +59,36 @@ % Right brace \} Tilde \~} % % \iffalse -%%% From File: scrlfile.dtx -%<*driver|scrlfile|load> -% \fi -\def\scrlfileversion{2012/06/15 v3.12} -% \iffalse -%</driver|scrlfile|load> +%%% From File: $Id: scrlfile.dtx 1525 2013-11-22 12:57:29Z mjk $ %<*driver> -% \fi +\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi \ProvidesFile{scrlfile.dtx}[% -% \iffalse %</driver> %<*driver|scrlfile> %<scrlfile>\ProvidesPackage{scrlfile}[% -% \fi - \scrlfileversion\space KOMA-Script package (loading files)] -% \iffalse +%!KOMAScriptVersion + package (loading files)] %</driver|scrlfile> +%<*dtx> +\ifx\documentclass\undefined + \input scrdocstrip.tex + \@@input scrkernel-version.dtx + \@@input scrstrip.inc + \KOMAdefVariable{COPYRIGHTFROM}{2002} + \generate{\usepreamble\defaultpreamble + \file{scrlfile.sty}{% + \from{scrlfile.dtx}{scrlfile}% + \from{scrlogo.dtx}{logo}% + }% + } + \@@input scrstrop.inc +\else + \let\endbatchfile\relax +\fi +\endbatchfile +%</dtx> %<*driver> -\IfFileExists{scrdoc.cls}{% - \documentclass[halfparskip-]{scrdoc} -}{% - \documentclass{ltxdoc} -} -\providecommand*{\KOMAScript}{\textsf{KOMA-Script}} +\documentclass[halfparskip-]{scrdoc} \usepackage[german,english]{babel} \CodelineIndex \RecordChanges @@ -144,7 +148,7 @@ % % \changes{v2.95}{2002/06/11}{% % First version split from hugh scrclass.dtx} -% +% \sloppy % % \section[Hook loading files, packages or classes]{% % Hooks loading files, packages or classes\footnote{You'll find a @@ -368,11 +372,21 @@ % Note: To replace classes you have to load \textsf{scrlfile} using % \cs{RequirePackage} before loading the class. % +% \DescribeMacro{\UnReplaceInput}%^^A +% \DescribeMacro{\UnReplacePackage}%^^A +% \DescribeMacro{\UnReplaceClass}%^^A +% After defining a replacement of a input file, package, or class (see the +% previously described commands for information about replacement definition), +% you may un-define this replacement. The commands expect one argument: the +% name of the input file, package, or class. +% % \DescribeMacro{\PreventPackageFromLoading} % \DescribeMacro{\PreventPackageFromLoading*} +% \DescribeMacro{\UnPreventPackageFromLoading} +% \DescribeMacro{\UnPreventPackageFromLoading*} % \DescribeMacro{\ResetPreventPackageFromLoading} % \DescribeMacro{\StorePreventPackageFromLoading} -% The command \cs{PreventPackageFromLoading}\marg{package list} +% The command \cs{PreventPackageFromLoading}\oarg{do instead}\marg{package list} % does not replace a package by another but prevents packages from beeing % loaded even if they should be loaded using \cs{RequirePackage} or % \cs{usepackage}. The \meta{package list} is a comma seperated list of @@ -386,7 +400,17 @@ % The normal version of \cs{PreventPackageFromLoading} with empty argument % results in a warning message. The star version % \cs{PreventPackageFromLoading*} writes only an info into the log-file, if -% the argument is empty. Both commands are not robust! +% the argument is empty. +% +% Both versions have an optional argument with code, that will be executed +% instead of loading the package. +% +% You may also remove packages from beeing prevented from beeing loaded using +% \cs{UnPreventPackageFromLoading}\marg{package list}. The star version also +% cleans the \meta{do instead} code. +% +% All these commands are not robust! +% % % \DescribeMacro{\BeforeClosingMainAux} % The command \cs{BeforeClosingMainAux}\marg{instructions} @@ -583,28 +607,61 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\ReplaceInput} -% \changes{v2.96}{2006/07/19}{new command} +% \begin{macro}{\ReplaceInput} +% \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*{\ReplaceFile}[2]{% +\newcommand*{\ReplaceInput}[2]{% \expandafter\edef\csname #1-@alias\endcsname{#2}% } % \end{macrocode} -% \end{macro} +% \begin{macro}{\ReplaceFile} +% \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}{% + \PackageError{scrlfile}{% + usage of not documented command `\string\ReplaceFile'% + }{% + Command `\string\ReplaceFile' has been implemented accidentally in + KOMA-Script 2.96\MessageBreak + and replaced by `\string\ReplaceInput' in KOMA-Script 3.12.\MessageBreak + You should replace `\string\ReplaceFile' by `\string\ReplaceInput' to + avoid this error\MessageBreak + message% + }% + \ReplaceInput +} +% \end{macrocode} +% \end{macro} +% \end{macro} % -% \begin{macro}{\ReplacePackage} -% \changes{v2.96}{2006/07/19}{new command} -% \begin{macro}{\ReplaceClass} -% \changes{v2.96}{2006/07/19}{new command} -% \begin{macro}{\@replacefilewithext} -% \changes{v2.96}{2006/07/19}{new helper command} +% \begin{macro}{\UnReplaceInput} +% \changes{v3.12}{2013/11/15}{new command} +% Do not longer replace a file. +% \begin{macrocode} +\newcommand*{\UnReplaceInput}[1]{% + \ifcsname #1-@alias\endcsname + \expandafter\let\csname #1-@alias\endcsname\relax + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ReplacePackage} +% \changes{v2.96}{2006/07/19}{new command} +% \begin{macro}{\ReplaceClass} +% \changes{v2.96}{2006/07/19}{new command} +% \begin{macro}{\@replacefilewithext} +% \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} \newcommand*{\@replacefilewithext}[3]{% \expandafter\edef\csname #1.#3-@aliasname\endcsname{#2}% -} + } \newcommand*{\ReplacePackage}[2]{% \@replacefilewithext{#1}{#2}\@pkgextension } @@ -612,9 +669,34 @@ \@replacefilewithext{#1}{#2}\@clsextension } % \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\UnReplacePackage} +% \changes{v3.12}{2013/11/15}{new command} +% \begin{macro}{\UnReplaceClass} +% \changes{v3.12}{2013/11/15}{new command} +% \begin{macro}{\@unreplacefilewithext} +% \changes{v3.12}{2013/11/15}{new helper command}^^A +% Do not nolonger replace a class or package. +% \begin{macrocode} +\newcommand*{\@unreplacefilewithext}[2]{% + \ifcsname #1.#2-@aliasname\endcsname + \expandafter\let\csname #1.#2-@aliasname\endcsname\relax + \fi +} +\newcommand*{\UnReplacePackage}[1]{% + \@unreplacefilewithext{#1}\@pkgextension +} +\newcommand*{\UnReplaceClass}[1]{% + \@unreplacefilewithext{#1}\@clsextension +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % % \begin{macro}{\scr@replacefile@msg} % \changes{v2.96}{2006/07/19}{new helper command} @@ -791,11 +873,15 @@ % \changes{v3.12}{2012/06/15}{new star version allowes empty argument with % info instead of warning} % \begin{macro}{\@PreventPackageFromLoading} -% \changes{v3.12}{2012/06/15}{New (internal)} +% \changes{v3.12}{2012/06/15}{New (internal)}^^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 % \begin{macro}{\scrlfile@excludedpackages} -% \changes{v3.08}{2010/11/04}{New (internal)} +% \changes{v3.08}{2010/11/04}{New (internal)}^^A % \begin{macro}{\scrlfile@saved@RequirePackage} -% \changes{v3.08}{2010/11/04}{New (internal)} +% \changes{v3.08}{2010/11/04}{New (internal)}^^A % \begin{macrocode} \newcommand*{\scrlfile@excludedpackages}{} \let\scrlfile@excludedpackages\@empty @@ -804,15 +890,20 @@ \@ifstar{\@PreventPackageFromLoading\PackageInfo}% {\@PreventPackageFromLoading\PackageWarning}% } -\newcommand*{\@PreventPackageFromLoading}[2]{% +\newcommand*{\@PreventPackageFromLoading}[1]{% + \@ifnextchar [%] + {\@@PreventPackageFromLoading#1}{\@@PreventPackageFromLoading#1[]}% +} +\newcommand*{\@@PreventPackageFromLoading}{} +\def\@@PreventPackageFromLoading#1[#2]#3{% % \end{macrocode} % We do nothing, if the argument was empty: % \begin{macrocode} - \edef\reserved@b{#2}% + \edef\reserved@b{\zap@space#3 \@empty}% \ifx \reserved@b\@empty #1{scrlfile}{% - \string\PreventPackageFromLoading\space with empty argument\MessageBreak - ignored% + \string\PreventPackageFromLoading\space with empty packages\MessageBreak + argument ignored% }% \else % \end{macrocode} @@ -822,7 +913,7 @@ \ifx\scrlfile@excludedpackages\@empty \let\scrlfile@saved@RequirePackage\RequirePackage \let\RequirePackage\scrlfile@RequirePackage - \def\reserved@a#2{% + \def\reserved@a##1##{% \@latex@error {\noexpand \usepackage before \string\documentclass}% {\noexpand \usepackage may only appear in the document @@ -844,12 +935,18 @@ % We have to test, if a package was already loaded. Only not yet loaded % packages will be added to the exclusion list. Empty arguments will be % ignored. -% \changes{v3.11a}{2012/06/11}{missing \cs{scrlfile@excludepackages} at -% redefinition of \cs{scrlfile@excludepackages} added} +% \changes{v3.11a}{2012/06/11}{missing \cs{scrlfile@excludedpackages} at +% redefinition of \cs{scrlfile@excludedpackages} added} % \begin{macrocode} \expandafter\@for \expandafter\reserved@a\expandafter:\expandafter=% \reserved@b\do {% - \ifx\reserved@a\@empty\else + \ifx\reserved@a\@empty + #1{scrlfile}{% + empty package argument for + \string\PreventPackageFromLoading\MessageBreak + ignored% + }% + \else \expandafter\@ifpackageloaded\expandafter{\reserved@a}{% #1{scrlfile}{% package `\reserved@a' already loaded.\MessageBreak @@ -858,6 +955,18 @@ }{% \edef\scrlfile@excludedpackages{\scrlfile@excludedpackages,% \reserved@a}% + \if\relax\detokenize{#2}\relax\else + \@ifundefined{scrlfile@exclude@package@\reserved@a @do}{% + \@namedef{scrlfile@exclude@package@\reserved@a @do}{}% + }{}% + \expandafter\def + \csname scrlfile@exclude@package@\reserved@a + @do\expandafter\expandafter\expandafter\endcsname + \expandafter\expandafter\expandafter{% + \csname scrlfile@exclude@package@\reserved@a @do\endcsname + #2% + }% + \fi }% \fi }% @@ -893,25 +1002,85 @@ } \@onlypreamble\StorePreventPackageFromLoading % \end{macrocode} +% \begin{macro}{\UnPreventPackageFromLoading} +% \changes{v3.12}{2013/11/22}{New}^^A +% \begin{macro}{\@UnPreventPackageFromLoading} +% \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} +\newcommand*{\UnPreventPackageFromLoading}{% + \@ifstar {\@tempswatrue\@UnPreventPackageFromLoading}% + {\@tempswafalse\@UnPreventPackageFromLoading}% +} +\newcommand*{\@UnPreventPackageFromLoading}[1]{% + \edef\reserved@b{\zap@space#1 \@empty}% + \if@tempswa + \@for\reserved@a:=\reserved@b\do {% + \ifx\reserved@a\@empty \else + \ifcsname scrlfile@exclude@package@\reserved@a @do\endcsname + \expandafter\let + \csname scrlfile@exclude@package@\reserved@a @do\endcsname + \undefined + \fi + \fi + }% + \fi + \ifcsname scrlfile@excludedpackages\endcsname + \let\reserved@a\scrlfile@excludedpackages + \let\scrlfile@excludedpackages\@empty + \expandafter\@for\expandafter\reserved@c + \expandafter:\expandafter=\reserved@a + \do{% + \ifx\reserved@c\@empty\else + \@expandtwoargs\in@{,\reserved@c,}{,\reserved@b,}% + \ifin@ + \else + \edef\scrlfile@excludedpackages{% + \scrlfile@excludedpackages,\reserved@c + }% + \fi + \fi + }% + \ifx\scrlfile@excludedpackages\@empty\ResetPreventPackageFromLoading\fi + \fi +} +% \end{macrocode} +% \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 +% \cs{PreventPackageFromLoading}} % This macro will replace \cs{RequirePackage} whenever the exlude list is not % empty % \begin{macrocode} \newcommand*{\scrlfile@RequirePackage}[2][]{% \let\reserved@c\@empty - \@for\reserved@b:=#2\do {% + \let\reserved@d\@empty + \edef\reserved@b{\zap@space#2 \@empty}% + \expandafter\@for\expandafter\reserved@b\expandafter:\expandafter=\reserved@b + \do {% \begingroup \@tempswatrue \@for\reserved@a:=\scrlfile@excludedpackages\do {% \ifx\reserved@a\reserved@b - \PackageInfo{scrlfile}{Excluding package `\reserved@b'\MessageBreak - from loading}% \@tempswafalse \fi }% \if@tempswa \xdef\reserved@c{\reserved@c,\reserved@b}% + \else + \ifx\reserved@b\@empty\else + \PackageInfo{scrlfile}{Excluding package `\reserved@b'\MessageBreak + from loading}% + \@ifundefined{scrlfile@exclude@package@\reserved@b @do}{% + }{% + \expandafter\g@addto@macro\expandafter\reserved@d + \csname scrlfile@exclude@package@\reserved@b @do\endcsname + }% + \fi \fi \endgroup }% @@ -921,6 +1090,7 @@ \edef\reserved@a{\noexpand\scrlfile@saved@RequirePackage[#1]{% \expandafter\@gobble\reserved@c\@empty}}% \fi + \expandafter\reserved@d \reserved@a } % \end{macrocode} @@ -931,6 +1101,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\scr@gobbleopt} % \changes{v3.08}{2010/11/04}{New (internal)} @@ -1090,8 +1261,9 @@ %<*load> % Used at \KOMAScript{} classes. % \begin{macrocode} -\edef\@tempa{\noexpand\RequirePackage{scrlfile}[\scrlfileversion]} -\@tempa +\RequirePackage{scrlfile}[% +%!KOMAScriptVersion +] % \end{macrocode} %</load> % \fi |