| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scrextend.dtx |
| 4 |
% Copyright (c) Markus Kohm, 2002-2023 |
| 5 |
% |
| 6 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the conditions of |
| 9 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 10 |
% The latest version of this license is in |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 13 |
% version 2005/12/01 or later and of this work. |
| 14 |
% |
| 15 |
% This work has the LPPL maintenance status "author-maintained". |
| 16 |
% |
| 17 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 18 |
% |
| 19 |
% This work consists of all files listed in MANIFEST.md. |
| 20 |
% ====================================================================== |
| 21 |
%%% From File: $Id: scrextend.dtx 4032 2023-04-17 09:45:11Z kohm $ |
| 22 |
%<preidentify>%%% (run: preidentify) |
| 23 |
%<prepare>%%% (run: prepare) |
| 24 |
%<option>%%% (run: option) |
| 25 |
%<*dtx> |
| 26 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 27 |
\begingroup |
| 28 |
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} |
| 29 |
\filedate$Date: 2023-04-17 11:45:11 +0200 (Mo, 17. Apr 2023) $ |
| 30 |
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} |
| 31 |
\filerevision$Revision: 4032 $ |
| 32 |
\endgroup |
| 33 |
\ProvidesFile{scrextend.dtx}[\filedate\space\filerevision\space |
| 34 |
KOMA-Script package source |
| 35 |
(extend other classes)] |
| 36 |
\documentclass{koma-script-source-doc} |
| 37 |
\usepackage[USenglish]{babel} |
| 38 |
\setcounter{StandardModuleDepth}{2} |
| 39 |
\begin{document} |
| 40 |
\DocInput{scrextend.dtx} |
| 41 |
\end{document} |
| 42 |
%</dtx> |
| 43 |
% \fi |
| 44 |
% |
| 45 |
% \changes{v3.00}{2008/05/01}{new package} |
| 46 |
% \changes{v3.36}{2022/01/31}{switched from \cls*{scrdoc} to |
| 47 |
% \cls*{koma-script-source-doc}} |
| 48 |
% \changes{v3.36}{2022/01/31}{whole implementation documentation in English} |
| 49 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 50 |
% |
| 51 |
% \GetFileInfo{scrextend.dtx} |
| 52 |
% \title{Extending Non-\href{https://komascript.de}{\KOMAScript} Classes by |
| 53 |
% some \href{https://komascript.de}{\KOMAScript} Class Features using |
| 54 |
% \href{https://komascript.de}{\KOMAScript} Package \pkg*{scrextend}} |
| 55 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 56 |
% \date{Revision \fileversion{} of \filedate} |
| 57 |
% \maketitle |
| 58 |
% \begin{abstract} |
| 59 |
% The purpose of this package is to provide \KOMAScript{} class features to |
| 60 |
% other classes, i.\,e., the standard classes too. On the other hand it does |
| 61 |
% not make sense to nor should you load this package, if you are using a |
| 62 |
% \KOMAScript{} class. |
| 63 |
% \end{abstract} |
| 64 |
% |
| 65 |
% \tableofcontents |
| 66 |
% |
| 67 |
% \section{User Manual} |
| 68 |
% |
| 69 |
% You can find the user manual of \pkg{scrextend} in the \KOMAScript{} manual, |
| 70 |
% either the German \file{scrguide-de.pdf} or the English |
| 71 |
% \file{scrguide-en.pdf}. |
| 72 |
% |
| 73 |
% \MaybeStop{\PrintIndex} |
| 74 |
% |
| 75 |
% \section{Implementation} |
| 76 |
% |
| 77 |
% \begin{macrocode} |
| 78 |
%<*package> |
| 79 |
% \end{macrocode} |
| 80 |
% |
| 81 |
% \subsection{Before the identification of the package} |
| 82 |
% |
| 83 |
% Just before the identification of the package, we have to take care, that it |
| 84 |
% is not loaded with a \KOMAScript{} class. If so, we output a warning an |
| 85 |
% terminate. |
| 86 |
% |
| 87 |
% \changes{v3.30}{2020/02/25}{Using \cs{PackageWarningNoLine} instead of |
| 88 |
% \cs{PackageWarning} with final \cs{@gobble}} |
| 89 |
% \begin{macrocode} |
| 90 |
%<*preidentify> |
| 91 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 92 |
\expandafter\ifx\csname KOMAClassName\endcsname\relax\else |
| 93 |
\PackageWarningNoLine{scrextend}{% |
| 94 |
This package was made to extend other classes but\MessageBreak |
| 95 |
KOMA-Script classes by some features of the\MessageBreak |
| 96 |
KOMA-Script classes.\MessageBreak |
| 97 |
It should never be used with a KOMA-Script class.\MessageBreak |
| 98 |
Loading of the package will be aborted% |
| 99 |
}% |
| 100 |
\expandafter\endinput |
| 101 |
\fi |
| 102 |
%</preidentify> |
| 103 |
% \end{macrocode} |
| 104 |
% |
| 105 |
% |
| 106 |
% \subsection{Package identification} |
| 107 |
% |
| 108 |
% We use the major \KOMAScript{} version for this package, because it uses |
| 109 |
% several main parts of the classes of the same version. |
| 110 |
% |
| 111 |
% \begin{macrocode} |
| 112 |
%<*identify> |
| 113 |
\ProvidesPackage{scrextend}[% |
| 114 |
%!KOMAScriptVersion |
| 115 |
package (extend other classes with features of KOMA-Script classes)% |
| 116 |
] |
| 117 |
%</identify> |
| 118 |
% \end{macrocode} |
| 119 |
% |
| 120 |
% |
| 121 |
% \subsection{Preparation of options} |
| 122 |
% |
| 123 |
% The preparation state is used before the option handling. To allow |
| 124 |
% definition of optional features. Such definitions are used in other parts of |
| 125 |
% the \KOMAScript{} classes. For example \file{scrkernel-title.dtx} defines |
| 126 |
% the \optvalue{title} \opt{feature}. |
| 127 |
% |
| 128 |
% Note: The method used here is very fragile, i.\,e., the definition of |
| 129 |
% feature code with arguments needs to be adapted for \pkg{scrextend}. So |
| 130 |
% there is a big fat |
| 131 |
% \begin{description} |
| 132 |
% \item[ToDo:] Reimplementation of the optional features should simplify the |
| 133 |
% definition of such features a lot in other files. Best would be to have a |
| 134 |
% kind of start command and a kind of end command without the need to change |
| 135 |
% anything in between, if the package instead of a class is defined. But |
| 136 |
% this is hard to reach, because of usage of \cs{ClassError} |
| 137 |
% vs. \cs{PackageError}, \cs{ClassWarning} vs. \cs{PackageWarning}. So at |
| 138 |
% least these commands have to be dependent. Nevertheless the need to |
| 139 |
% change, e.g., |#1| into |##1|, |#2| into |##2| etc. for \pkg{scrextend} is |
| 140 |
% annoying. Moreover the whole usage of \cs{scr@extend@activate@\dots} and |
| 141 |
% \cs{sr@extend@immediate@\dots} is very complicated and currently I'm even |
| 142 |
% not sure, that is always works as expected. Maybe a less complicated |
| 143 |
% feature implementation could be found. |
| 144 |
% \end{description} |
| 145 |
% |
| 146 |
% \begin{macro}{\scr@ext@activate,\scr@ext@activateable, |
| 147 |
% \scr@ext@addto@activateable} |
| 148 |
% One special feature of this package is, to provide some \KOMAScript{} |
| 149 |
% features only, if they have been activated explicitly. To do so |
| 150 |
% \begin{quote} |
| 151 |
% \cs{scr@ext@activateable}\marg{feature}\marg{definition} |
| 152 |
% \end{quote} |
| 153 |
% is used. This macro defines \cs{scr@ext@activate@\meta{feature}}. There is |
| 154 |
% also a |
| 155 |
% \begin{quote} |
| 156 |
% \cs{scr@ext@addto@activateable}\marg{feature}\marg{definition} |
| 157 |
% \end{quote} |
| 158 |
% that does append \meta{definition} to the already existing code of |
| 159 |
% \cs{scr@act@activate@\meta{feature}}, if it already exists, or define it |
| 160 |
% new, if is does not exist already. |
| 161 |
% \begin{quote} |
| 162 |
% \cs{scr@ext@activate}\marg{feature} |
| 163 |
% \end{quote} |
| 164 |
% is used to \emph{activate} a \meta{feature}. That means: If there is a |
| 165 |
% \cs{scr@ext@activate@\meta{feature}} it is executed and afterwards |
| 166 |
% \cs{scr@ext@activate@\meta{feature}} is destroyed making it \cs{relax}. But |
| 167 |
% if there is not yet a \cs{scr@ext@activate@\meta{feature}} a |
| 168 |
% \cs{scr@ext@immediate@\meta{feature}} is defined. The definition of this |
| 169 |
% is, to redefine itself to be \cs{scr@ext@activate@\meta{feature}}. |
| 170 |
% \begin{macrocode} |
| 171 |
%<*prepare> |
| 172 |
\newcommand*{\scr@ext@activate}[1]{% |
| 173 |
\scr@ifundefinedorrelax{scr@ext@activate@#1}{% |
| 174 |
\@namedef{scr@ext@immediate@#1}{% |
| 175 |
\expandafter\let\csname scr@ext@immediate@#1\endcsname\relax |
| 176 |
\csname scr@ext@activate@#1\endcsname |
| 177 |
}% |
| 178 |
}{% |
| 179 |
\csname scr@ext@activate@#1\endcsname |
| 180 |
\expandafter\let\csname scr@ext@activate@#1\endcsname\relax |
| 181 |
}% |
| 182 |
} |
| 183 |
\newcommand*{\scr@ext@activateable}[1]{% |
| 184 |
\expandafter\newcommand\expandafter*\csname scr@ext@activate@#1\endcsname |
| 185 |
} |
| 186 |
\newcommand*{\scr@ext@addto@activateable}[1]{% |
| 187 |
\scr@ifundefinedorrelax{scr@ext@activate@#1}{% |
| 188 |
\expandafter\newcommand\expandafter*\csname scr@ext@activate@#1\endcsname |
| 189 |
}{% |
| 190 |
\expandafter\g@addto@macro\csname scr@ext@activate@#1\endcsname |
| 191 |
}% |
| 192 |
} |
| 193 |
%</prepare> |
| 194 |
% \end{macrocode} |
| 195 |
% \end{macro} |
| 196 |
% |
| 197 |
% |
| 198 |
% \subsection{Options} |
| 199 |
% |
| 200 |
% Now, after the preparation, the universal option that enables optional |
| 201 |
% features can defined. This option can be used while loading the package |
| 202 |
% only. Later activation of features is currently not supported. |
| 203 |
% |
| 204 |
% \begin{option}{extendedfeature} |
| 205 |
% \changes{v3.12}{2013/03/05}{using state signaling with \cs{FamilyKeyState}} |
| 206 |
% \changes{v3.17}{2015/03/09}{internal value storage} |
| 207 |
% \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage |
| 208 |
% commands removed} |
| 209 |
% \begin{macrocode} |
| 210 |
%<*option> |
| 211 |
\KOMA@key{extendedfeature}{% |
| 212 |
\scr@ext@activate{#1}% |
| 213 |
\AtEndOfPackage{% |
| 214 |
\scr@ifundefinedorrelax{scr@ext@immediate@#1}{}{% |
| 215 |
\PackageWarningNoLine{unkown extended feature `#1'\MessageBreak |
| 216 |
You have used option `extendedfeature' to\MessageBreak |
| 217 |
activate an extended feature `#1',\MessageBreak |
| 218 |
but there is no such extended feature.\MessageBreak |
| 219 |
See the KOMA-Script manual for more\MessageBreak |
| 220 |
information about known activatable\MessageBreak |
| 221 |
extended features% |
| 222 |
}% |
| 223 |
}% |
| 224 |
}% |
| 225 |
\FamilyKeyStateProcessed |
| 226 |
\KOMA@kav@xadd{scrextend.sty}{extendedfeature}{#1}% |
| 227 |
} |
| 228 |
\AtEndOfPackage{% |
| 229 |
\KOMA@key{extendedfeature}{% |
| 230 |
\def\FamilyKeyState{Option `extendedfeature' too late}% |
| 231 |
}% |
| 232 |
} |
| 233 |
%</option> |
| 234 |
% \end{macrocode} |
| 235 |
% \end{option} |
| 236 |
% |
| 237 |
% \begin{macrocode} |
| 238 |
%</package> |
| 239 |
% \end{macrocode} |
| 240 |
% |
| 241 |
% \Finale |
| 242 |
% \PrintChanges |
| 243 |
% |
| 244 |
\endinput |
| 245 |
% Local Variables: |
| 246 |
% mode: doctex |
| 247 |
% ispell-local-dictionary: "en_US" |
| 248 |
% eval: (flyspell-mode 1) |
| 249 |
% TeX-master: t |
| 250 |
% TeX-engine: luatex-dev |
| 251 |
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) |
| 252 |
% End: |
| 253 |
|