1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
% \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 $
%<preidentify>%%% (run: preidentify)
%<prepare>%%% (run: prepare)
%<option>%%% (run: option)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
\filedate$Date: 2023-04-17 11:45:11 +0200 (Mo, 17. Apr 2023) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 4032 $
\endgroup
\ProvidesFile{scrextend.dtx}[\filedate\space\filerevision\space
KOMA-Script package source
(extend other classes)]
\documentclass{koma-script-source-doc}
\usepackage[USenglish]{babel}
\setcounter{StandardModuleDepth}{2}
\begin{document}
\DocInput{scrextend.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v3.00}{2008/05/01}{new package}
% \changes{v3.36}{2022/01/31}{switched from \cls*{scrdoc} to
% \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/01/31}{whole implementation documentation in English}
% \changes{v3.40}{2023/04/17}{guide names changed}
%
% \GetFileInfo{scrextend.dtx}
% \title{Extending Non-\href{https://komascript.de}{\KOMAScript} Classes by
% some \href{https://komascript.de}{\KOMAScript} Class Features using
% \href{https://komascript.de}{\KOMAScript} Package \pkg*{scrextend}}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
% The purpose of this package is to provide \KOMAScript{} class features to
% other classes, i.\,e., the standard classes too. On the other hand it does
% not make sense to nor should you load this package, if you are using a
% \KOMAScript{} class.
% \end{abstract}
%
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user manual of \pkg{scrextend} in the \KOMAScript{} manual,
% either the German \file{scrguide-de.pdf} or the English
% \file{scrguide-en.pdf}.
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation}
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \subsection{Before the identification of the package}
%
% Just before the identification of the package, we have to take care, that it
% is not loaded with a \KOMAScript{} class. If so, we output a warning an
% terminate.
%
% \changes{v3.30}{2020/02/25}{Using \cs{PackageWarningNoLine} instead of
% \cs{PackageWarning} with final \cs{@gobble}}
% \begin{macrocode}
%<*preidentify>
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname KOMAClassName\endcsname\relax\else
\PackageWarningNoLine{scrextend}{%
This package was made to extend other classes but\MessageBreak
KOMA-Script classes by some features of the\MessageBreak
KOMA-Script classes.\MessageBreak
It should never be used with a KOMA-Script class.\MessageBreak
Loading of the package will be aborted%
}%
\expandafter\endinput
\fi
%</preidentify>
% \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)%
]
%</identify>
% \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
}%
}
%</prepare>
% \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}%
}%
}
%</option>
% \end{macrocode}
% \end{option}
%
% \begin{macrocode}
%</package>
% \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:
|