% \iffalse meta-comment % ====================================================================== % scrextend.dtx % Copyright (c) Markus Kohm, 2002-2023 % % This file is part of the LaTeX2e KOMA-Script bundle. % % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, version 1.3c of the license. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later and of this work. % % This work has the LPPL maintenance status "author-maintained". % % The Current Maintainer and author of this work is Markus Kohm. % % This work consists of all files listed in MANIFEST.md. % ====================================================================== %%% From File: $Id: scrextend.dtx 4032 2023-04-17 09:45:11Z kohm $ %%%% (run: preidentify) %%%% (run: prepare) % % \end{macrocode} % % % \subsection{Package identification} % % We use the major \KOMAScript{} version for this package, because it uses % several main parts of the classes of the same version. % % \begin{macrocode} %<*identify> \ProvidesPackage{scrextend}[% %!KOMAScriptVersion package (extend other classes with features of KOMA-Script classes)% ] % % \end{macrocode} % % % \subsection{Preparation of options} % % The preparation state is used before the option handling. To allow % definition of optional features. Such definitions are used in other parts of % the \KOMAScript{} classes. For example \file{scrkernel-title.dtx} defines % the \optvalue{title} \opt{feature}. % % Note: The method used here is very fragile, i.\,e., the definition of % feature code with arguments needs to be adapted for \pkg{scrextend}. So % there is a big fat % \begin{description} % \item[ToDo:] Reimplementation of the optional features should simplify the % definition of such features a lot in other files. Best would be to have a % kind of start command and a kind of end command without the need to change % anything in between, if the package instead of a class is defined. But % this is hard to reach, because of usage of \cs{ClassError} % vs. \cs{PackageError}, \cs{ClassWarning} vs. \cs{PackageWarning}. So at % least these commands have to be dependent. Nevertheless the need to % change, e.g., |#1| into |##1|, |#2| into |##2| etc. for \pkg{scrextend} is % annoying. Moreover the whole usage of \cs{scr@extend@activate@\dots} and % \cs{sr@extend@immediate@\dots} is very complicated and currently I'm even % not sure, that is always works as expected. Maybe a less complicated % feature implementation could be found. % \end{description} % % \begin{macro}{\scr@ext@activate,\scr@ext@activateable, % \scr@ext@addto@activateable} % One special feature of this package is, to provide some \KOMAScript{} % features only, if they have been activated explicitly. To do so % \begin{quote} % \cs{scr@ext@activateable}\marg{feature}\marg{definition} % \end{quote} % is used. This macro defines \cs{scr@ext@activate@\meta{feature}}. There is % also a % \begin{quote} % \cs{scr@ext@addto@activateable}\marg{feature}\marg{definition} % \end{quote} % that does append \meta{definition} to the already existing code of % \cs{scr@act@activate@\meta{feature}}, if it already exists, or define it % new, if is does not exist already. % \begin{quote} % \cs{scr@ext@activate}\marg{feature} % \end{quote} % is used to \emph{activate} a \meta{feature}. That means: If there is a % \cs{scr@ext@activate@\meta{feature}} it is executed and afterwards % \cs{scr@ext@activate@\meta{feature}} is destroyed making it \cs{relax}. But % if there is not yet a \cs{scr@ext@activate@\meta{feature}} a % \cs{scr@ext@immediate@\meta{feature}} is defined. The definition of this % is, to redefine itself to be \cs{scr@ext@activate@\meta{feature}}. % \begin{macrocode} %<*prepare> \newcommand*{\scr@ext@activate}[1]{% \scr@ifundefinedorrelax{scr@ext@activate@#1}{% \@namedef{scr@ext@immediate@#1}{% \expandafter\let\csname scr@ext@immediate@#1\endcsname\relax \csname scr@ext@activate@#1\endcsname }% }{% \csname scr@ext@activate@#1\endcsname \expandafter\let\csname scr@ext@activate@#1\endcsname\relax }% } \newcommand*{\scr@ext@activateable}[1]{% \expandafter\newcommand\expandafter*\csname scr@ext@activate@#1\endcsname } \newcommand*{\scr@ext@addto@activateable}[1]{% \scr@ifundefinedorrelax{scr@ext@activate@#1}{% \expandafter\newcommand\expandafter*\csname scr@ext@activate@#1\endcsname }{% \expandafter\g@addto@macro\csname scr@ext@activate@#1\endcsname }% } % % \end{macrocode} % \end{macro} % % % \subsection{Options} % % Now, after the preparation, the universal option that enables optional % features can defined. This option can be used while loading the package % only. Later activation of features is currently not supported. % % \begin{option}{extendedfeature} % \changes{v3.12}{2013/03/05}{using state signaling with \cs{FamilyKeyState}} % \changes{v3.17}{2015/03/09}{internal value storage} % \changes{v3.39}{2022/11/11}{initial dot in member argument of option storage % commands removed} % \begin{macrocode} %<*option> \KOMA@key{extendedfeature}{% \scr@ext@activate{#1}% \AtEndOfPackage{% \scr@ifundefinedorrelax{scr@ext@immediate@#1}{}{% \PackageWarningNoLine{unkown extended feature `#1'\MessageBreak You have used option `extendedfeature' to\MessageBreak activate an extended feature `#1',\MessageBreak but there is no such extended feature.\MessageBreak See the KOMA-Script manual for more\MessageBreak information about known activatable\MessageBreak extended features% }% }% }% \FamilyKeyStateProcessed \KOMA@kav@xadd{scrextend.sty}{extendedfeature}{#1}% } \AtEndOfPackage{% \KOMA@key{extendedfeature}{% \def\FamilyKeyState{Option `extendedfeature' too late}% }% } % % \end{macrocode} % \end{option} % % \begin{macrocode} % % \end{macrocode} % % \Finale % \PrintChanges % \endinput % Local Variables: % mode: doctex % ispell-local-dictionary: "en_US" % eval: (flyspell-mode 1) % TeX-master: t % TeX-engine: luatex-dev % 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")) % End: