Debian Codegraph @

texmf-dist/source/latex/koma-script/scrkernel-version.dtx

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-version.dtx
4 % Copyright (c) Markus Kohm, 2002-2025
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: scrkernel-version.dtx 4261 2026-02-02 09:02:14Z kohm $
22 %
23 % ATTENTION: In this file parts of the code and documentation are before the
24 % driver. This must be, because this part of the code is needed by the driver
25 % in this file and most of the other KOMA-Script dtx-files.
26 %
27 % \fi^^A meta-comment
28 %
29 % \changes{v2.0e}{1994/07/07}{first release of \cls*{scrartcl},
30 % \cls*{scrreprt}, and \cls*{scrbook}}
31 % \changes{v2.95}{2002/06/25}{first version of this file by splitting of
32 % \file{scrclass.dtx}}
33 % \changes{v3.36}{2022/02/11}{switch over from \cls*{scrdoc} to
34 % \cls*{koma-script-source-doc}}
35 % \changes{v3.36}{2022/02/11}{whole implementation documentation in English}
36 % \changes{v3.99}{2022/10/25}{prepared to generate experimental \KOMAScript~4}
37 % \changes{v3.40}{2023/04/17}{guide names changed}
38 %
39 % \GetFileInfo{scrkernel-version.dtx}
40 % \title{The Version of the \href{https://komascript.de}{\KOMAScript} Kernel
41 % and therefore the Classes and most of the Packages}
42 % \author{\href{mailto:[email protected]}{Markus Kohm}}
43 % \date{Version \fileversion{} of \filedate}
44 % \maketitle
45 % \begin{abstract}
46 % \filename{} is not only used for the code of all \KOMAScript{} classes and
47 % most of the \KOMAScript{} packages. It is also used by most of the
48 % installation drivers (\file{ins}-files) for the definition of
49 % \KOMAScript{} version.
50 % \end{abstract}
51 % \tableofcontents
52 %
53 %
54 % \section{User Manual}
55 %
56 % You can find the user documentation of the commands implemented here in the
57 % \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
58 % English \file{scrguide-en.pdf}.
59 %
60 % \MaybeStop{\PrintIndex}
61 %
62 % \section{Implementation of the \KOMAScript{} Kernel Version Information}
63 %
64 % \begin{command}{\KOMAScriptVersion}
65 % \changes{v2.95}{2002/06/25}{added}
66 % The main purpose of this command it to prevent mixture of files of
67 % different \KOMAScript{} versions. But users can also use this command to
68 % detect \KOMAScript{}. It is added to the classes and most of the packages
69 % by the installation drivers. This is done using \file{scrdocstrip.tex} and
70 % additionally loading this file.
71 % \begin{macro}{\@CheckKOMAScriptVersion}
72 % \changes{v2.95}{2002/06/25}{added}
73 % \changes{v3.42}{2024/04/17}{command is defined only once but \pkg{expl3}
74 % hard}
75 % \changes{v3.42}{2024/04/17}{command is no longer defined in \file{clo}
76 % or \file{lco} files}
77 % Depending on \cs{KOMAScriptVersion} already defined or not, the existing
78 % definition is compared with the version here or \cs{KOMAScriptVersion} is
79 % newly and globally defined. This has to work not only in class or package
80 % files, but also in document files. So \cs{makeatletter} inside a group is
81 % needed for the internal macros. Additionally a guard \texttt{ignorethis} is
82 % used, to avoid adding code, that is needed only for the installation driver,
83 % also to classes or packages. Note, the version check is also done in
84 % \file{clo} or \file{lco} files, but the macros \cs{@CheckKOMAScriptVersion}
85 % and \cs{@@CheckKOMAScriptVersion} are not defined in those, because those
86 % files should not always be loaded by \KOMAScript{} classes or packages,
87 % which would already define the command.
88 % \begin{macrocode}
89 %<*ignorethis>
90 \ifx\newcommand\undefined
91 \catcode`\@11\relax
92 \def\@CheckKOMAScriptVersion#1{%
93 \global\KOMAdefVariable{KOMAScriptVersion}{\space\space#1}%
94 \expandafter\ifx\csname ifbeta\endcsname\relax
95 \def\@defbeta##1 ##2 ##3KOMA-Script{%
96 \def\@cmpstrA{##3}\def\@cmpstrB{BETA }%
97 \ifx\@cmpstrA\@cmpstrB
98 \expandafter\expandafter\expandafter\global
99 \expandafter\expandafter\expandafter\let
100 \expandafter\csname ifbeta\expandafter\endcsname
101 \csname iftrue\endcsname
102 \fi
103 }\expandafter\@defbeta\KOMAvar@KOMAScriptVersion
104 \fi
105 % \changes{v3.49.2}{2026/01/31}{version numbers with two dots are not
106 % automatically beta versions}
107 % \expandafter\ifx\csname ifbeta\endcsname\relax
108 % \def\@defbeta##1 ##2.##3.##4 KOMA-Script\@nil{%
109 % \def\@cmpstrA{##4}\def\@cmpstrB{}%
110 % \ifx\@cmpstrA\@cmpstrB\else
111 % \expandafter\expandafter\expandafter\global
112 % \expandafter\expandafter\expandafter\let
113 % \expandafter\csname ifbeta\expandafter\endcsname
114 % \csname iftrue\endcsname
115 % \fi
116 % }\expandafter\@defbeta\KOMAvar@KOMAScriptVersion. KOMA-Script\@nil
117 % \fi
118 \expandafter\ifx\csname ifbeta\endcsname\relax
119 \expandafter\expandafter\expandafter\global
120 \expandafter\expandafter\expandafter\let
121 \expandafter\csname ifbeta\expandafter\endcsname
122 \csname iffalse\endcsname
123 \fi
124 \KOMAifVariable{COPYRIGHTTILL}{}{%
125 \def\@defCOPYRIGHTTILL##1/##2/##3 ##4\@nil{%
126 \def\@tempa{##1}\def\@tempb{}\ifx\@tempa\@tempb
127 \def\@defCOPYRIGHTTILL##1-##2-##3 ##4\@nil{%
128 \def\@tempa{##1}\def\@tempb{}\ifx\@tempa\@tempb
129 \else
130 \global\KOMAdefVariable{COPYRIGHTTILL}{##1}%
131 \fi
132 }%
133 \else
134 \global\KOMAdefVariable{COPYRIGHTTILL}{##1}%
135 \fi
136 }%
137 }\@defCOPYRIGHTTILL#1// \@nil
138 \let\@CheckKOMAScriptVersion\undefined
139 \endinput
140 }%
141 \else
142 \makeatletter
143 %</ignorethis>
144 %<*class|package>
145 \providecommand*{\@CheckKOMAScriptVersion}{%
146 \begingroup
147 \ExplSyntaxOff
148 \@@CheckKOMAScriptVersion
149 }
150 \providecommand*{\@@CheckKOMAScriptVersion}[1]{%
151 \@ifundefined{KOMAScriptVersion}{%
152 \gdef\KOMAScriptVersion{#1}%
153 }{%
154 \def\@tempa{#1}%
155 \ifx\KOMAScriptVersion\@tempa\else
156 \GenericWarning{\space\@spaces\@spaces\@spaces\@spaces}{%
157 Version warning:
158 \noexpand\KOMAScriptVersion is
159 `\csname KOMAScriptVersion\endcsname',\MessageBreak
160 but `#1' was expected!\MessageBreak
161 You should not use classes, packages or files
162 from\MessageBreak
163 different KOMA-Script versions\@gobble
164 }%
165 \fi
166 }%
167 \endgroup
168 }
169 %</class|package>
170 %<*ignorethis>
171 \fi
172 %</ignorethis>
173 % \end{macrocode}
174 % Note: Following line will be patched by \file{makebetaorrelase.sh} and
175 % therefore the syntax or general structure of the line must not be changed!
176 % \begin{macrocode}
177 %<*!v4>
178 \@CheckKOMAScriptVersion{2026/02/02 v3.49.2 KOMA-Script}%
179 %</!v4>
180 %<v4> \@nameuse{@CheckKOMAScriptVersion}{2022/10/25 v3.99 ALPHA KOMA-Script}%
181 % \end{macrocode}
182 % \end{macro}
183 % \end{command}
184 %
185 % \iffalse
186 %<*dtx>
187 \makeatother
188 \ProvidesFile{scrkernel-version.dtx}[\KOMAScriptVersion (versions)]
189 \documentclass[USenglish]{koma-script-source-doc}
190 \usepackage{babel}
191 \begin{document}
192 \DocInput{scrkernel-version.dtx}
193 \end{document}
194 %</dtx>
195 % \fi
196 %
197 % \subsection{Implementation of class and package names and file names}
198 %
199 % \begin{description}
200 % \item[ToDo] Maybe, this should be split in one file for each class. The file
201 % extension code should be moved to \file{scrkernel-miscellaneous.dtx}.
202 % \end{description}
203 %
204 % \begin{macro}{\scr@pkgextension}
205 % \changes{v3.17}{2015/03/17}{added}
206 % \begin{macro}{\scr@clsextension}
207 % \changes{v3.17}{2015/03/17}{added}
208 % \changes{v3.18}{2015/06/17}{fixed}
209 % Last but not least same like \cs{@pkgextension} and \cs{@clsextension} but
210 % still valid after the preamble.
211 % \begin{macrocode}
212 %<*class|package>
213 %<package>\providecommand*{\scr@pkgextension}{\@pkgextension}
214 %<class>\providecommand*{\scr@clsextension}{\@clsextension}
215 \AtBeginDocument{%
216 %<package> \let\scr@pkgextension\@pkgextension
217 %<class> \let\scr@clsextension\@clsextension
218 }
219 %</class|package>
220 % \end{macrocode}
221 % \end{macro}
222 % \end{macro}
223 %
224 % \begin{command}{\KOMAClassFileName}
225 % \changes{v3.17}{2014/03/12}{added}
226 % \begin{command}{\KOMAClassName}
227 % \changes{v2.95}{2004/11/04}{added}
228 % \begin{command}{\KOMALongClassFileName,\KOMALongClassName}
229 % \changes{v3.27}{2019/02/16}{added}
230 % \begin{command}{\ClassName}
231 % \changes{v2.95}{2004/11/04}{added}
232 % We define the name of each \KOMAScript{} class and the name of the
233 % \emph{class} of the class (usually name of the corresponding standard class)
234 % once. This allows to use code, that outputs the name of the class, for
235 % several classes without using always class specific code.
236 % \begin{macrocode}
237 %<*class>
238 %<*!v4>
239 %<article|(letter&long)>\newcommand*{\KOMAClassName}{scrartcl}
240 %<report>\newcommand*{\KOMAClassName}{scrreprt}
241 %<book>\newcommand*{\KOMAClassName}{scrbook}
242 %<letter&!long>\newcommand*{\KOMAClassName}{scrlttr2}
243 %<*!long>
244 \newcommand*{\KOMAClassFileName}{\KOMAClassName.\@clsextension}
245 \edef\KOMAClassFileName{\KOMAClassFileName}
246 %</!long>
247 %</!v4>
248 \newcommand*{\ClassName}{%
249 %<article|(letter&long)> article%
250 %<report> report%
251 %<book> book%
252 %<letter&!long> letter%
253 }
254 %<*long>
255 \newcommand*{\KOMALongClassName}{}
256 %<*!v4>
257 %<!letter>\edef\KOMALongClassName{scr\ClassName}
258 %<letter>\def\KOMALongClassName{scrletter}
259 %</!v4>
260 \newcommand*{\KOMALongClassFileName}{\KOMALongClassName.\@clsextension}
261 \edef\KOMALongClassFileName{\KOMALongClassFileName}
262 %</long>
263 %<*v4>
264 \edef\KOMAClassName{scr\ClassName4}
265 \edef\KOMAClassFileName{\KOMAClassName.\@clsextension}
266 %</v4>
267 % \end{macrocode}
268 % \end{command}
269 % \end{command}
270 % \end{command}
271 % \end{command}
272 % \begin{macrocode}
273 %<!long>\ProvidesClass{\KOMAClassName}[%
274 %<long>\ProvidesClass{\KOMALongClassName}[%
275 %!KOMAScriptVersion
276 document class (\ClassName)%
277 ]
278 %<*long>
279 \let\ClassName\relax
280 %<letter>\providecommand*{\@ptsize}{12}
281 \expandafter\let\expandafter\KOMAClassName\expandafter\relax
282 \expandafter\LoadClassWithOptions\expandafter{\KOMAClassName}
283 %<letter&!v4>\RequirePackage{scrletter}
284 %<letter&v4>\RequirePackage{scrletter4}
285 %</long>
286 %</class>
287 % \end{macrocode}
288 %
289 % \begin{macrocode}
290 %<*package&letter>
291 %<!v4>\ProvidesPackage{scrletter}[%
292 %<v4>\ProvidesPackage{scrletter4}[%
293 %!KOMAScriptVersion
294 letter package extending any KOMA-Script class%
295 ]
296 %</package&letter>
297 % \end{macrocode}
298 %
299 % \Finale
300 % \PrintChanges
301 %
302 \endinput
303 % Local Variables:
304 % mode: doctex
305 % ispell-local-dictionary: "en_US"
306 % eval: (flyspell-mode 1)
307 % TeX-master: t
308 % TeX-engine: luatex-dev
309 % 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"))
310 % End: