-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrkernel-sections.dtx
More file actions
7084 lines (7078 loc) · 270 KB
/
Copy pathscrkernel-sections.dtx
File metadata and controls
7084 lines (7078 loc) · 270 KB
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
% ======================================================================
% ======================================================================
%
% This is a modified version of scrkernel-sections.dtx, explicitly
% permitted by Markus Kohm. Maintainer of this modified version is
% Marei Peischl.
%
% This file is based on revision 4267 of the repository:
% https://sourceforge.net/p/koma-script/.
% The copyright notice below is left unchanged to simplify
% the integration of this project into KOMA-Script
%
% ======================================================================
% ======================================================================
% scrkernel-sections.dtx
% Copyright (c) Markus Kohm, 2002-2025
%
% 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: scrkernel-sections.dtx 4253 2025-12-31 12:09:32Z kohm $
% The runs of run-time file generation:
%<preidentify>%%% (run: preidentify)
% - everything that is needed before selfidentification of resulting files
% (unused)
%<identify>%%% (run: identify)
% - everything that is needed for selfidentification of resulting files
% (unused)
%<prepare>%%% (run: prepare)
% - everything that is needed to define options
%<option>%%% (run: option)
% - definition of options
%<execoption>%%% (run: execoption)
% - initial option executions up to \KOMAProcessOptions
%<body>%%% (run: body)
% - everything, that should be done after \KOMAProcessOptions
%<exit>%%% (run: exit)
% - everything, that should be done immediately before leaving the file
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
\filedate$Date: 2025-12-31 13:09:32 +0100 (Wed, 31 Dec 2025) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 4253 $
\edef\reserved@a{%
\noexpand\endgroup
\noexpand\ProvidesFile{scrkernel-sections.dtx}%
[\filedate\space\filerevision\space
KOMA-Script source (disposition)]
}%
\reserved@a
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\setcounter{StandardModuleDepth}{3}
\begin{document}
\DocInput{scrkernel-sections.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v2.3h}{1996/01/20}{configurable font sized for headings}
% \changes{v2.95}{2002/06/26}{first version after splitting \file{scrclass.dtx}}
% \changes{v3.15}{2014/12/09}{reordered code in \file{scrkernel-sections.dtx}}
% \changes{v3.36}{2022/03/08}{switch over from \cls*{scrdoc} to
% \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/03/21}{the whole implementation documentation in English}
% \changes{v3.40}{2023/04/17}{guide names changed}
%
% \GetFileInfo{scrkernel-sections.dtx}
% \title{The Code for Parts, Chapters, Sections etc.\@ of
% \href{https://komascript.de}{\KOMAScript} Classes}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
% \file{scrkernel-sections.dtx} implements all the options, macros and user
% commands used for the sectioning of documents.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user documentation the commands implemented here in the
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
% English \file{scrguide-en.pdf}.
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of Parts, Chapters, Section etc.}
%
% The letter class does not provide sectioning.
% \begin{macrocode}
%<*class&!letter>
% \end{macrocode}
% tagging: empty module to avoid conflicts
% \begin{macrocode}
%<@@=>
% \end{macrocode}
%
% \begin{macro}{@maybeasf}
% \changes{v2.8e}{2001/07/10}{removed}
% \end{macro}
%
% \subsection{Interleaf pages}
%
% With \cls*{scrbook} and \cls*{scrreprt} chapters can optionally (or by
% default) start automatically on a odd page. So if the last page before
% already was an odd page, we have to insert a so called interleaf page. The
% main handling of interleaf pages is already defined in
% \file{scrkernel-pagestyles.dtx} (but there is a ToDo note to move is to a
% new file). Here we only support the optional selection of the start page of
% a chapter.
%
% \begin{option}{open}
% \changes{v2.98c}{2008/03/06}{added}
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
% \changes{v3.17}{2015/03/09}{using internal value storage}
% \changes{v3.18}{2015/05/22}{initialization using \opt{headings}}
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
% option storage commands}
% \begin{macro}{\@openrighttrue,\@openrightfalse,\if@openright}
% The option supports three values:
% \begin{center}
% \begin{tabular}{llll}
% \opt{open} & \cs{if@openright} & \cs{cleardoublestandardpage} &
% meaning\\\hline
% \opt{=any} & \cs{iffalse} & \cs{cleardoubleoddstandardpage} &
% chapters on any page\\
% \opt{=right} & \cs{iftrue} & \cs{cleardoubleoddstandardpage} &
% chapters on odd pages\\
% \opt{=left} & \cs{iftrue} & \cs{cleardoubleevenstandardpage} &
% chapters on even pages\\
% \end{tabular}
% \end{center}
% \begin{macrocode}
%<*book|report>
%<*prepare>
\newif\if@openright
%<report>\@openrightfalse
%<book>\@openrighttrue
%</prepare>
%<*option>
\KOMA@key{open}{%
\KOMA@set@ncmdkey{open}{@tempa}{%
{any}{0},%
{right}{1},%
{left}{2}%
}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\KOMA@kav@xreplacevalue{\KOMAClassFileName}{open}{#1}%
\KOMA@kav@remove{\KOMAClassFileName}{headings}{openany}%
\KOMA@kav@remove{\KOMAClassFileName}{headings}{openright}%
\KOMA@kav@remove{\KOMAClassFileName}{headings}{openleft}%
\ifcase \@tempa\relax
\KOMA@kav@add{\KOMAClassFileName}{headings}{openany}%
\@openrightfalse
\renewcommand*{\cleardoublestandardpage}{\cleardoubleoddstandardpage}%
\or
\KOMA@kav@add{\KOMAClassFileName}{headings}{openright}%
\@openrighttrue
\renewcommand*{\cleardoublestandardpage}{\cleardoubleoddstandardpage}%
\or
\KOMA@kav@add{\KOMAClassFileName}{headings}{openleft}%
\@openrighttrue
\renewcommand*{\cleardoublestandardpage}{\cleardoubleevenstandardpage}%
\fi
\fi
}
%</option>
%<*execoption>
%<book>\KOMAExecuteOptions{headings=openright}
%<report>\KOMAExecuteOptions{headings=openany}
%</execoption>
% \end{macrocode}
% \end{macro}^^A \if@openright
% \end{option}^^A open
%
% \begin{option}{openright,openany}
% \changes{v2.98c}{2008/03/05}{obsolete}
% \changes{v3.01a}{2008/11/21}{standard instead of obsolete}
% Two deprecated options of \KOMAScript{} 2.
% \begin{macrocode}
%<*option>
\KOMA@DeclareStandardOption{openright}{open=right}
\KOMA@DeclareStandardOption{openany}{open=any}
%</option>
%</book|report>
% \end{macrocode}
% \end{option}^^A openright,openany
%
%
% \subsection{Numbers and the auto dot feature}
%
% Not only parts, chapter, section etc.\@ are numbered. But several other
% numbers are related to these numbers. The feature we define here is also
% known as the auto dot feature.
%
% \begin{option}{numbers}
% \changes{v2.98c}{2008/03/07}{added}
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
% \changes{v3.17}{2015/03/09}{using internal value storage}
% \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
% option storage commands}
% \begin{macro}{\scr@dotchangeatdocument}
% \changes{v2.98c}{2008/03/07}{added}
% The \opt{numbers} option provides several settings for the dot at the end of
% such numbers. But because the setting is always document global, this option
% cannot be changed inside the document, but in the document preamble only. If
% you try to change it inside the document, the error of
% \cs{scr@dotchangedatdocument} will be raised. Currently following values to
% the option are supported:
% \begin{center}
% \begin{tabular}{ll}
% \opt{numbers} & meaning\\\hline
% \opt{=auto} & automatically detect, if the dot has to be added\\
% \opt{=enddot} & always use a dot at the end\\
% \opt{=noenddot}& don't use a dot at the end\\
% \end{tabular}
% \end{center}
% The criterion for automatically adding a dot is: Does any sectioning number
% contain something else but an Arabic number for a number portion?
% \begin{macrocode}
%<*prepare>
\newcommand*{\scr@dotchangeatdocument}[1]{%
\ClassError{\KOMAClassName}{%
change of end dot feature after \string\begin{document}%
}{%
You've tried to set `numbers=#1' after \string\begin{document},\MessageBreak
but this option is only allowed at the document preamble.\MessageBreak
See KOMA-Script manual for more information about.%
}%
}
%</prepare>
%<*option>
\KOMA@key{numbers}{%
\KOMA@set@ncmdkey{numbers}{@tempa}{%
{autoendperiod}{0},{autoenddot}{0},{auto}{0},%
{endperiod}{1},{withendperiod}{1},{periodatend}{1},%
{enddot}{1},{withenddot}{1},{dotatend}{1},%
{noendperiod}{2},{noperiodatend}{2},%
{noenddot}{2},{nodotatend}{2}%
}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\KOMA@kav@xreplacevalue{\KOMAClassFileName}{numbers}{#1}%
\ifcase \@tempa\relax
\if@atdocument\scr@dotchangeatdocument{#1}\else
\let\scr@altsecnumhook\@empty
\fi
\or
\if@atdocument\scr@dotchangeatdocument{#1}\else
\let\scr@altsecnumhook\scr@altsecnumhooktrue
\fi
\or
\if@atdocument\scr@dotchangeatdocument{#1}\else
\let\scr@altsecnumhook\scr@altsecnumhookfalse
\fi
\fi
\fi
}
%</option>
%<execoption>\KOMAExecuteOptions{numbers=autoendperiod}
% \end{macrocode}
% \end{macro}^^A \scr@dotchangeatdocument
% \end{option}^^A numbers
%
% \begin{option}{pointednumbers,pointlessnumbers}
% \changes{v2.3h}{1995/01/19}{added}
% \changes{v2.4g}{1996/11/04}{option name fixed}
% \changes{v2.4g}{1996/11/04}{immediate setting \cs{@altsecnumformatfalse}
% to \cs{@altsecnumformattrue}}
% \changes{v2.98c}{2008/03/07}{obsolete}
% \changes{v3.01a}{2008/11/20}{deprecated}
% \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
% Two deprecated options.
% \begin{macrocode}
%<*option&!v4>
\KOMA@DeclareDeprecatedOption{pointednumbers}{numbers=enddot}
\KOMA@DeclareDeprecatedOption{pointlessnumbers}{numbers=noenddot}
%</option&!v4>
% \end{macrocode}
% \end{option}^^A pointednumbers,pointlessnumbers
%
% \begin{command}{\autodot}
% \changes{v2.7}{2001/01/03}{added}
% \begin{macro}{\@altsecnumformattrue,\@altsecnumformatfalse,\if@altsecnumformat}
% \changes{v2.3c}{1995/08/06}{added}
% \begin{macro}{\@autodottrue,\@autodotfalse,\if@autodot}
% \changes{v2.8e}{2001/07/10}{added}
% \changes{v2.9k}{2003/01/12}{write to \cs{@mainaux}}
% \changes{v2.95}{2004/01/15}{write to \cs{@mainaux} just before closing the
% file}
% \changes{v2.96a}{2006/12/07}{using \cs{immediate}}
% \changes{v3.00}{2008/10/07}{global}
% \changes{v3.20}{2016/03/25}{using \cs{csname}\dots\cs{endcsname}}
% Depending on \cs{if@altsecnumformat} \cs{autodot} shows a dot or nothing.
% \begin{description}
% \item[ToDo:] Add an optional look forward feature to also not add a dot, if
% the next character is a punctuation character, e.g. a dot, semicolon,
% comma etc.
% \end{description}
% \cs{if@autodot} is the current result of the inspection of all sectioning
% numbers. If it is \cs{iftrue}, switching on the dot will be written to the
% main \file{aux}-file.
% \begin{macrocode}
%<*prepare>
\newif\if@altsecnumformat\@altsecnumformatfalse
\newif\if@autodot
\renewcommand*{\@autodottrue}{\global\let\if@autodot\iftrue}
\renewcommand*{\@autodotfalse}{\global\let\if@autodot\iffalse}
\@autodotfalse
%</prepare>
%<*body>
\BeforeClosingMainAux{%
\if@autodot\if@filesw\immediate\write\@mainaux{%
\string\global\string\csname\space @altsecnumformattrue\string\endcsname}%
\fi\fi}
%</body>
% \end{macrocode}
% \end{macro}^^A \if@autodot
% \end{macro}^^A \if@altsecnumformat
%
% \begin{macro}{\scr@altsecnumhook,\scr@altsecnumhooktrue,\scr@altsecnumhookfalse}
% \changes{v2.98c}{2008/03/07}{added}
% Used by option \opt{numbers} for (de-)activation of the dot in the document
% preamble and to overwrite the setting found in the \file{aux}-file.
% \begin{description}
% \item[Note:] The hook is executed after reading the main \file{aux}-file. So
% the overwriting of the setting does work. It is needed as long a boolean
% switch is used, because otherwise option \opt{numbers=auto} would not be
% able to reset option \opt{numbers=enddot} ot \opt{numbers=noenddot}. With
% this code we simply can use an empty \cs{scr@altsecnumhook} for
% \opt{numbers=auto} and two compellent definitions for the other cases.
% \end{description}
% \begin{macrocode}
%<*prepare>
\newcommand*{\scr@altsecnumhook}{}
\AtBeginDocument{\scr@altsecnumhook}
\newcommand*{\scr@altsecnumhooktrue}{%
\@altsecnumformattrue\global\let\@altsecnumformatfalse\@altsecnumformattrue
}
\newcommand*{\scr@altsecnumhookfalse}{%
\@altsecnumformatfalse\global\let\@altsecnumformattrue\@altsecnumformatfalse
}
%</prepare>
% \end{macrocode}
% \end{macro}^^A \scr@altsecnumhook,\scr@altsecnumhooktrue,\scr@altsecnumhookfalse
%
% \begin{macro}{\@maybeautodot,\@@maybeautodot}
% \changes{v2.8e}{2001/07/10}{added}
% \changes{v3.00}{2008/10/07}{not any longer needed \cs{aftergroup} removed}
% We scan a \cs{the\meta{counter}} command to decide, if the automatic dot has
% to be added (later). It sets \cs{@autodottrue}, if there is any kind of
% alphabetic or Roman numbering command inside the one time expansion of the
% \cs{the\meta{counter}} given as argument.
% \begin{description}
% \item[Note:] This is a heuristic only. It would, e.g., fail, if you are
% using another macro, that expands to the output of the counter, e.g.,
%\begin{verbatim}
% \def\myalph{\alph}\def\thesection{\myalph{section}}
%\end{verbatim}
% However, it seems that the heuristic is so good, that in more than twenty
% years nobody has complained about.
% \end{description}
% \begin{macrocode}
%<*body>
\newcommand{\@maybeautodot}[1]{\if@autodot\else\begingroup%
\expandafter\@@maybeautodot #1\@stop\endgroup\fi
}
\newcommand*{\@@maybeautodot}[1]{%
\ifx #1\@stop\let\@@maybeautodot\relax
\else
\ifx #1\Alph \@autodottrue\fi
\ifx #1\alph \@autodottrue\fi
\ifx #1\Roman \@autodottrue\fi
\ifx #1\roman \@autodottrue\fi
\ifx #1\@Alph \@autodottrue\fi
\ifx #1\@alph \@autodottrue\fi
\ifx #1\@Roman \@autodottrue\fi
\ifx #1\@roman \@autodottrue\fi
\ifx #1\romannumeral \@autodottrue\fi
\fi
\@@maybeautodot
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@maybeautodot,\@@maybeautodot
%
% \begin{macrocode}
%<*body>
\newcommand*\autodot{\if@altsecnumformat.\fi}
%</body>
% \end{macrocode}
% \end{command}^^A \autodot
%
%
% \subsection{Definition and handling of sectioning commands}
%
% Some of the \LaTeX{} kernel features are used here too. But almost none of
% these features is enough to implement all the functionality of \KOMAScript{}
% classes. So we redefine several of the \LaTeX{} kernel macros to extend them
% and define several new features.
% \begin{description}
% \item[ToDo:] Don't redefine \LaTeX{} kernel macros, but define new macros
% for the interface. Maybe this should also be swapped to a new package used
% by the classes.
% \end{description}
%
% \begin{counter}{secnumdepth}
% The counter rules down to which section level the headings should be
% numbered.
% \begin{description}
% \item[ToDo:] Move this behind the declaration of the section levels to be
% able to use symbolic value \cs{subsectionnumdepth}. It is not related to
% the auto dot feature.
% \end{description}
% \begin{macrocode}
%<*body>
%<book|report>\setcounter{secnumdepth}{2}
%<article>\setcounter{secnumdepth}{3}
%</body>
% \end{macrocode}
% \end{counter}
%
%
% \begin{command}{\ifnumbered,\Ifnumbered}
% \changes{v3.12}{2013/12/16}{added}
% \changes{v3.28}{2019/11/19}{\cs{ifnumbered} renamed to \cs{Ifnumbered}}
% \begin{command}{\ifunnumbered,\Ifunnumbered}
% \changes{v3.12}{2013/12/16}{added}
% \changes{v3.28}{2019/11/19}{\cs{ifunnumbered} renamed to \cs{Ifunnumbered}}
% Commands
% \begin{quote}\raggedright
% \cs{Ifnumbered}\marg{section level name}\marg{numbered}\marg{not numbered}\\
% \cs{Ifunnumbered}\marg{section level name}\marg{not numbered}\marg{numbered}\\
% \end{quote}
% If \meta{section level name} has to be numbered, execute code \meta{numbered}
% otherwise execute code \meta{not numbered}.
% \begin{macrocode}
%<*body>
\providecommand*{\ifnumbered}{%
\ClassWarning{\KOMAClassName}{Usage of deprecated command
`\string\ifnumbered'.\MessageBreak
The command has been renamed because of a\MessageBreak
recommendation of The LaTeX Project Team.\MessageBreak
Please replace `\string\ifnumbered' by `\string\Ifnumbered'%
}%
\Ifnumbered
}
\newcommand*{\Ifnumbered}[1]{%
\if@currentusenumber
\scr@ifundefinedorrelax{#1numdepth}{%
\expandafter\@secondoftwo
}{%
\expandafter\ifnum \@nameuse{#1numdepth}>\c@secnumdepth
\expandafter\expandafter\expandafter\@secondoftwo
\else
\expandafter\expandafter\expandafter\@firstoftwo
\fi
}%
\else
\expandafter\@secondoftwo
\fi
}
\providecommand*{\ifunnumbered}{%
\ClassWarning{\KOMAClassName}{Usage of deprecated command
`\string\ifunnumbered'.\MessageBreak
The command has been renamed because of a\MessageBreak
recommendation of The LaTeX Project Team.\MessageBreak
Please replace `\string\ifunnumbered' by `\string\Ifunnumbered'%
}%
\Ifunnumbered
}
\newcommand*{\Ifunnumbered}[1]{%
\Ifnumbered{#1}{\@secondoftwo}{\@firstoftwo}%
}
%</body>
% \end{macrocode}
% \end{command}^^A \Ifunnumbered
% \end{command}^^A \ifnumbered
%
%
% \begin{macro}{\scr@activate@xsection,\scr@osectarg}
% \changes{v3.10}{2011/08/30}{added}
% Option \opt{headings=optiontotocandhead}, \opt{headings=optiontotoc} and
% \opt{headings=optiontohead} used
% \begin{quote}
% \cs{scr@activate@xsection}\marg{value}
% \end{quote}
% with the values 3, 2 and 1 to activate the extended optional argument. This
% sets \cs{scr@osectarg} to the corresponding value. The initial value 0
% deactivates the extended optional argument.
% \begin{description}
% \item[ToDo:] Do we really need \cs{scr@activate@xsection}, that is used
% inside option \opt{headings} only?
% \end{description}
% \begin{macrocode}
%<*prepare>
\newcommand*{\scr@osectarg}{0}
\newcommand*{\scr@activate@xsection}[1]{%
\renewcommand*{\scr@osectarg}{#1}%
}
%</prepare>
% \end{macrocode}
% \end{macro}^^A \scr@activate@xsection,\scr@osectarg
%
%
% \begin{macro}{\@startsection}
% \changes{v3.13a}{2014/09/11}{re-definition for extended optional argument}
% \changes{v3.49}{2025/09/11}{no longer redefined or used}
% \changes{v3.49}{2025/09/11}{warning message added if used}
% \changes{v3.50}{2025/12/31}{improved workaround for \pkg{babel} catcode
% issues}
% We add a warning message to the very beginning of \cs{@startsection}. So
% if a package or any other preamble code or the user himself uses
% \cs{@startsection} there will be an information about the caveats.
% \begin{macrocode}
%<*body>
\ExplSyntaxOn
\msg_new:nnnn { \KOMAClassName } { sectioning-features-not-available }
{
Usage~of~\token_to_str:N #1 detected.\\
Note,~the~sectioning~of~\KOMAClassName\ does~neither~use~nor~
support~the~usage~of~\token_to_str:N #1 command.\\
This~means,~that~none~of~the~KOMA-Script~features~
for~headings~is~available~for~the~heading~\msg_line_context:.\\
If~you~need~additional~sectioning~commands,~
you~should~define~them~using~\token_to_str:N \DeclareNewSectionCommand\
instead.
}
{ See~the~KOMA-Script~user~manual~for~more~information. }
\cctab_new:c { c_ \KOMAClassName _cmdhook_cctab }
\cctab_gsave_current:c { c_ \KOMAClassName _cmdhook_cctab }
\hook_gput_code:nnn { begindocument / end } { . }
{
\cctab_begin:c { c_ \KOMAClassName _cmdhook_cctab }
\exp_args:Nne
\hook_gput_code:nnn { cmd / @startsection / before } { \KOMAClassName }
{
\msg_warning:nnn { \KOMAClassName }
{ sectioning-features-not-available }
{ \@startsection }
}
\cctab_end:
}
\hook_gset_rule:nnnn { begindocument / end } { . } < { babel }
\ExplSyntaxOff
%</body>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scr@saved@startsection}
% \changes{v3.13a}{2014/09/11}{added}
% \changes{v3.20}{2016/04/12}{supporting \pkg{amsgen}}
% \changes{v3.49}{2025/09/11}{removed}
% \end{macro}
%
% \begin{macro}{\@sect}
% \changes{v3.49}{2025/09/11}{\cs{@sect} replaced by \cs{scr@sect}}
% \end{macro}^^A \@sect
% \begin{macro}{\scr@latex@sect}
% \changes{v3.27}{2019/07/24}{added to be used by \pkg*{scrhack}}
% \changes{v3.49}{2025/09/11}{removed}
% \end{macro}^^A \@scr@latex@sect
%
% \begin{macro}{\@ssect}
% \changes{v3.49}{2025/09/11}{\cs{@ssect} replaced by \cs{scr@ssect}}
% \end{macro}
% \begin{macro}{\scr@latex@ssect}
% \changes{v3.27}{2019/07/24}{added to be used by \pkg*{scrhack})}
% \changes{v3.30}{2020/02/25}{orphan space removed}
% \changes{v3.49}{2025/09/11}{removed}
% \end{macro}
%
% \begin{macro}{\@xsect}
% \changes{v3.49}{2025/09/11}{\cs{@xsect} replaced by \cs{scr@xsect}}
% \end{macro}
% \begin{macro}{\scr@latex@xsect}
% \changes{v3.27}{2019/07/24}{added to be used by \pkg*{scrhack}}
% \changes{v3.49}{2025/09/11}{removed}
% \end{macro}
%
% \begin{macro}{\scr@startsection}
% \changes{v3.13a}{2014/09/11}{added}
% \changes{v3.18}{2015/05/22}{using \cs{numexpr} for argument 2}
% \changes{v3.18}{2015/05/22}{using \cs{glueexpr} for arguments 3--5}
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \changes{v3.26}{2018/09/18}{supporting \opt{afterindent}}
% \begin{macro}{\startsection@sectionname,\startsection@secnumdepth,
% \startsection@indent,\startsection@beforeskip,
% \startsection@afterskip,\startsection@afterindent,
% \@startsection@runintrue,\@startsection@runinfalse,
% \if@startsection@runin}
% \changes{v3.26}{2018/05/14}{added}
% The \cs{@startsection} of the \LaTeX{} kernel does not provide all the
% features we need for \KOMAScript. And the generic hooks of \LaTeX{} do not
% allow to change it wide enough. So we either have to use \pkg{xparse} to
% patch it very much or we have to define our own version. In this case
% patching is too fragile, so we define and use \cs{scr@startsection}.
% \begin{description}
% \item[Note:] Package \pkg{amsgen} redefines \cs{@ifstar}. The new version
% does not ignore white spaces. So testing the original definition using
% \cs{@ifstar} may fail. It is better to use \cs{kernel@ifstar}.
% \item[ToDo:] All the testing here doesn't make much sense, because we are
% inside a class and packages like \pkg{amsgen} should not yet have been
% loaded. So the test only needs to test, if the \LaTeX{} kernel has been
% changed.
% \item[ToDo:] Because we now use our own command, we do not need to use
% argument \#2-\#6. Instead of these we can just use the properties
% depending on argument \#1 and the style of the sectioning
% command. Changing this would simplify the code a lot! So this should be
% the next step in development of the sectioning commands.
% \item[Note:] In our own \cs{scr@startsection} the macros
% \cs{startsection@sectionname}, \cs{startsection@secnumdepth},
% \cs{startsection@indent}, \cs{startsection@beforeskip},
% \cs{startsection@afterskip}, \cs{if@afterindent},
% \cs{if@startsection@runin}, and \cs{startsection@afterindent} are valid
% from executing the do hook \dhook{heading/postinit}. So they can be used
% inside all the hooks.
% \item[Note:] \cs{startsection@indent}, \cs{startsection@beforeskip},
% \cs{startsection@afterskip} and \cs{startsection@afterindent} are either
% skips or \cs{glueexpr}, that can be used like skips.
% \item[Note:] \cs{startsection@beforeskip} and \cs{startsection@afterskip}
% are effective values already. Not special treatment for negative or
% positive values must be done.
% \item[Note:] \cs{if@startsection@runin}
% are either \cs{iftrue} or \cs{iffalse}.
% \item[Note:] \cs{if@startsection@indentafter} does not exist and is not
% needed, because \cs{if@afterindent} is already valid and also either
% \cs{iftrue} or \cs{iffalse}.
% \item[Note:] Using one of the \cs{startsection@\dots}
% resp. \cs{if@startsection@\dots} macros outside \cs{scr@startsection} is
% not allowed and the result is unspecified. Inside \cs{scr@startsection}
% they have to be interpreted as constants, so changing them is not allowed!
% \end{description}
% tagging: We need this definition to be able to remove the warning when the testphase key is used.
% \begin{macrocode}
%</class&!letter>
%<*class&!letter|workarounds>
%<*body|workarounds>
\newcommand*{\scr@startsection}[6]{%
\ExecuteDoHook{heading/preinit/#1}%
\if@noskipsec \leavevmode \fi
\par
\@tempskipa \glueexpr #4\relax
\@ifundefined{scr@#1@afterindent}{%
\def\startsection@afterindent##1##2##3{##3}%
}{%
\expandafter\let\expandafter\startsection@afterindent
\csname scr@#1@afterindent\endcsname
}%
\startsection@afterindent{\@afterindenttrue}{\@afterindentfalse}{%
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
}%
\def\startsection@sectionname{#1}%
\def\startsection@secnumdepth{\numexpr #2\relax}%
\def\startsection@indent{\glueexpr #3\relax}%
\let\startsection@beforeskip\@tempskipa
\@ifundefined{scr@#1@runin}{%
\def\scr@sect@runin##1##2##3{##3}%
}{%
\expandafter\let\expandafter\scr@sect@runin
\csname scr@#1@runin\endcsname
}%
\scr@sect@runin{%
\def\startsection@afterskip{\glueexpr #3\relax}%
\expandafter\let\csname if@startsection@runin\expandafter\endcsname
\csname iftrue\endcsname
}{%
\def\startsection@afterskip{\glueexpr #3\relax}%
\expandafter\let\csname if@startsection@runin\expandafter\endcsname
\csname iffalse\endcsname
}{%
\ifdim \glueexpr #5\relax <\z@
\def\startsection@afterskip{\glueexpr (#3)*\m@ne\relax}%
\expandafter\let\csname if@startsection@runin\expandafter\endcsname
\csname iftrue\endcsname
\else
\def\startsection@afterskip{\glueexpr #3\relax}%
\expandafter\let\csname if@startsection@runin\expandafter\endcsname
\csname iffalse\endcsname
\fi
}%
\ExecuteDoHook{heading/postinit/#1}%
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
% \end{macrocode}
% tagging: latex-lab is starting the section here.
% As we have the hook directly after the test scr-tagging-lab is using the hook instead.
% \begin{macrocode}
\kernel@ifstar {%
\ExecuteDoHook{heading/branch/star/#1}%
\def\scr@s@ct@@nn@m@{#1}%
\scr@ssect{\glueexpr #3\relax}{\glueexpr #4\relax}{\glueexpr #5\relax}{#6}%
}{%
\ExecuteDoHook{heading/branch/nostar/#1}%
\scr@section@dblarg{%
\scr@sect{#1}{\numexpr #2\relax}{\glueexpr #3\relax}{\glueexpr #4\relax}%
{\glueexpr #5\relax}{#6}%
}%
}%
}
% \end{macrocode}
% \begin{macro}{\scr@sect@runin}
% \changes{v3.26}{2018/09/18}{added}
% Depending on sectioning feature \opt{runin} the macro expands to the first
% argument, if a in-text heading aka run-in heading has to used, the second
% argument, if a free-standing heading has to be used, or the third argument,
% of run-in or free-standing depends on the sign of \opt{afterskip}. The
% initial definition is depending on the sign of \opt{afterskip}. This initial
% definition is also done inside \cs{@xsect}. \cs{scr@startsection} also
% redefines \cs{scr@sect@runin}. So it should always be the currently valid
% definition, even if \cs{scr@startsection} is used with a section command,
% that does not provide all the variable of \KOMAScript.
% \begin{macrocode}
\newcommand*{\scr@sect@runin}[3]{#3}
% \end{macrocode}
% \end{macro}^^A \scr@sect@runin
% \begin{macro}{\scr@startsection@ulm@error}
% \changes{v3.26}{2018/05/14}{added}
% This is the initial error message for using one of the internal macros
% before \cs{scr@startsection}. This should never happen.
% \begin{macrocode}
\newcommand*{\scr@startsection@ulm@error}[1]{%
\ClassError{\KOMAClassName}{%
\string#1 undefined outside of \string\scr@startsection
}{%
A KOMA-Script macro for package authors have been used outside
the\MessageBreak
specified definition scope.\MessageBreak
See `scrkernel-sections.dtx' for more information.%
}%
}
\newcommand*\startsection@sectionname{%
\scr@startsection@ulm@error\startsection@sectionname}
\newcommand*\startsection@secnumdepth{%
\scr@startsection@ulm@error\startsection@secnumdepth}
\newcommand*\startsection@indent{%
\scr@startsection@ulm@error\startsection@indent}
\newcommand*\startsection@beforeskip{%
\scr@startsection@ulm@error\startsection@beforeskip}
\newcommand*\startsection@afterskip{%
\scr@startsection@ulm@error\startsection@afterskip}
\newcommand*{\if@startsection@runin}{%
\scr@startsection@ulm@error\if@startsection@runin}
\newif\if@startsection@runin
\newcommand*\startsection@afterindent{%
\scr@startsection@ulm@error\startsection@afterindent}
% \end{macrocode}
% \end{macro}^^A \scr@startsection@ulm@error
% \end{macro}^^A \startsection@sectionname … \scr@startsection@runin
% \begin{macro}{\At@startsection}
% \changes{v3.14}{2014/09/11}{added}
% \changes{v3.27}{2019/02/04}{using \cs{AddtoDoHook}}
% \changes{v3.27}{2019/02/04}{deprecated}
% This is deprecated now. You should use the corresponding
% \dhook{heading/postinit} do hook. However the do hooks are command specific,
% but the argument of \cs{At@startsection} is style specific.
% \begin{macrocode}
\newcommand*{\At@startsection}[1]{%
\ClassInfo{\KOMAClassName}{%
Usage of deprecated command `\string\At@startsection'
mapped to\MessageBreak
`\string\AddtoDoHook{heading/postinit}
{...\string\@gobble}'%
}%
\AddtoDoHook{heading/postinit}{\scr@doonlyifstyleofargis{#1}{section}}%
}
% \end{macrocode}
% \begin{macro}{\scr@doonlyifstyleofargis}
% \changes{v3.27}{2019/02/04}{added}
% Execute the first argument only, of the style of the third argument is the
% second argument.
% \begin{macrocode}
\newcommand*{\scr@doonlyifstyleofargis}[3]{%
\IfSectionCommandStyleIs{#3}{#2}{#1}{}%
}
% \end{macrocode}
% \end{macro}^^A \scr@doonlyifstyleofargis
% \end{macro}^^A \At@startsection
% \begin{macro}{\Before@ssect}
% \changes{v3.14}{2014/09/11}{added}
% \changes{v3.27}{2019/02/04}{using \cs{AddtoDoHook}}
% \changes{v3.27}{2019/02/04}{deprecated}
% \changes{v3.35}{2021/10/15}{\cs{ClassWarning} instead of \cs{ClassInfo}}
% \changes{v3.35}{2021/10/15}{Usage of \cs{scr@doonlyifstyleofargis} fixed}
% This is deprecated now. You should use the corresponding
% \dhook{heading/branch/star} do hook. However the do hooks are command
% specific, but the argument of \cs{Before@ssect} is style specific.
% \begin{macrocode}
\newcommand*{\Before@ssect}[1]{%
\ClassWarning{\KOMAClassName}{%
Usage of deprecated command `\string\Before@ssect'
mapped to\MessageBreak
`\string\AddtoDoHook{heading/branch/star}%
{...\string\@gobble}'%
}%
\AddtoDoHook{heading/branch/star}{\scr@doonlyifstyleofargis{#1}{section}}%
}
% \end{macrocode}
% \end{macro}^^A \Before@ssect
% \begin{macro}{\Before@sect}
% \changes{v3.14}{2014/09/11}{added}
% \changes{v3.27}{2019/02/04}{using \cs{AddtoDoHook}}
% \changes{v3.27}{2019/02/04}{deprecated}
% \changes{v3.35}{2021/10/15}{\cs{ClassWarning} instead of \cs{ClassInfo}}
% \changes{v3.35}{2021/10/15}{Usage of \cs{scr@doonlyifstyleofargis} fixed}
% This is deprecated now. You should use the corresponding
% \dhook{heading/branch/nostar} do hook. However the do hooks are command
% specific, but the argument of \cs{Before@sect} is style specific.
% \begin{macrocode}
\newcommand*{\Before@sect}[1]{%
\ClassWarning{\KOMAClassName}{%
Usage of deprecated command `\string\Before@sect'
mapped to\MessageBreak
`\string\AddtoDoHook{heading/branch/nostar}%
{...\string\@gobble}'%
}%
\AddtoDoHook{heading/branch/nostar}{\scr@doonlyifstyleofargis{#1}{section}}%
}
% \end{macrocode}
% \end{macro}^^A \Before@sect
% \begin{macro}{\scr@section@dblarg,\scr@section@xdblarg}
% \changes{v3.13a}{2014/09/11}{added}
% Similar to the \LaTeX{} kernel macros \cs{@dblarg} and \cs{@xdblarg} but
% preserve the definition of \cs{scr@osectarg}. So changes of
% \cs{scr@osectarg} inside the definition of the command of the first
% argument, are locally to the execution of that command.
% \begin{macrocode}
\newcommand{\scr@section@dblarg}[1]{%
\kernel@ifnextchar[%]
{#1}%
{\scr@section@xdblarg{#1}}%
}
\newcommand{\scr@section@xdblarg}[2]{%
\begingroup
\edef\reserved@a{%
\unexpanded{\endgroup\let\scr@osectarg\z@#1[{#2}]{#2}\def\scr@osectarg}%
{\scr@osectarg}}%
\reserved@a
}
%</body|workarounds>
% \end{macrocode}
% \end{macro}^^A \scr@section@dblarg,\scr@section@xdblarg
% \end{macro}^^A \scr@startsection
%
% \begin{command}{\UseNumberUsageError}
% \changes{v3.27}{2019/02/02}{added}
% \begin{command}{\IfUseNumber}
% \changes{v3.27}{2019/02/02}{error if used outside sectioning command}
% Command \cs{IfUseNumner} is defined only inside sectioning commands. Using
% it outside is not specified. To report an error in this case, it should be
% set to \cs{UseNumberUsageError} outside a sectioning command.
% \begin{macrocode}
%<*body>
\newcommand*{\UseNumberUsageError}[2]{%
\ClassError{\KOMAClassName}{%
\string\IfUseNumber\space not allowed%
}{%
You cannot use \string\IfUseNumber\space outside a heading.\MessageBreak
If you'd continue, I'll ignore both arguments, because I do not
know\MessageBreak
whether to use the first or the second argument.%
}%
}
\newcommand*{\IfUseNumber}[2]{}%
\let\IfUseNumber\UseNumberUsageError
%</body>
% \end{macrocode}
% \end{command}^^A \IfUseNumnr
% \end{command}^^A \UseNumberUsageError
%
%
% \begin{command}{\SecDef}
% \changes{v3.13a}{2014/09/11}{added}
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{command}{\secdef}
% \changes{v3.13a}{2014/09/11}{re-definition because of extended optional argument}
% \begin{macrocode}
%<*body>
\newcommand*{\SecDef}[2]{\kernel@ifstar{#2}{\scr@section@dblarg{#1}}}
\CheckCommand*{\secdef}[2]{\@ifstar{#2}{\@dblarg{#1}}}
\let\secdef\SecDef
%</body>
% \end{macrocode}
% \end{command}^^A \secdef
% \end{command}^^A \SecDef
%
% \begin{macro}{\scr@sect}
% \changes{v3.10}{2011/08/30}{re-definition because of extended optional argument}
% \changes{v3.10}{2011/08/30}{using
% \cs{csname}\texttt{add\#1tocentry}\cs{endcsname}
% resp. \cs{addtocentrydefault}}
% \changes{v3.18}{2015/05/20}{defines \cs{IfUsePrefixLine} locally}
% \changes{v3.18}{2015/05/22}{using \cs{numexpr} for argument 2}
% \changes{v3.18}{2015/05/22}{using \cs{gluexpr} for arguments 3--5}
% \changes{v3.19}{2015/07/17}{using \cs{sectionlinesformat} and
% \cs{sectioncatchphraseformat}}
% \changes{v3.27}{2019/07/08}{new optional \opt{nonumber}}
% \changes{v3.30}{2020/02/25}{orphan spaces removed}
% \changes{v3.49}{2025/09/11}{\cs{@sect} replaced by \cs{scr@sect}}
% Because we want to support the extended optional argument for all commands
% defined using \cs{@startsection} we also have to redefine \cs{@sect}. Once
% again several security tests are done, before redefining an internal
% \LaTeX{} kernel macro.
% \begin{description}
% \item[ToDo:] It would be better not to redefine an internal \LaTeX{} kernel
% macro, but use a own definition in our own \cs{scr@startsection}. But in
% this case packages, that use \cs{@sect} would not automatically support
% several \KOMAScript{} features.
% \item[Note:] \cs{chapter} and \cs{part} do not use \cs{@sect} but
% \cs{SecDef}.
% \end{description}
% tagging: We need this definition to be able to remove the warning when the testphase key is used.
% \begin{macrocode}
%</class&!letter|workarounds>
%<*(class&!letter)|tagging-lab|workarounds>
%<*body|tagging-lab>
%<trace>\ClassInfo{\KOMAClassName}{redefining LaTeX kernel macro \string\@sect}
%<!tagging-lab>\def\scr@sect#1#2#3#4#5#6[#7]#8{%
%<tagging-lab>\def\scrlab@sect#1#2#3#4#5#6[#7]#8{%
\ifnum \scr@osectarg=\z@
\@scr@tempswafalse
\else
\scr@istest#7=\@nil
\fi
\@currentusenumbertrue
\if@scr@tempswa
\setkeys{KOMAarg.section}{tocentry={#8},head={#8},reference={#8},#7}%
\else
\ifcase \scr@osectarg\relax
\setkeys{KOMAarg.section}{tocentry={#7},head={#7},reference={#7}}%
\or
\setkeys{KOMAarg.section}{tocentry={#8},head={#7},reference={#8}}%
\or
\setkeys{KOMAarg.section}{tocentry={#7},head={#8},reference={#7}}%
\or
\setkeys{KOMAarg.section}{tocentry={#7},head={#7},reference={#7}}%
\fi
\fi
% \end{macrocode}
% \changes{v3.23}{2017/02/04}{support for \pkg{minitoc}}
% \changes{v3.23}{2017/03/24}{usage of \cs{ext@figure} and \cs{ext@table}
% instead of \texttt{lof} and \texttt{lot}}
% Add the \texttt{xsect} entries to \texttt{lof} and \texttt{lot}. Note, that
% the original \cs{starsection} tests of \pkg{minitoc} has a bug and so
% does not work. And the original code of \pkg{minitoc} has hard coded
% \texttt{lot} and \texttt{lof} instead of \cs{ext@figure} and
% \cs{ext@table}. This is a fixed one:
% \begin{macrocode}
\scr@ifundefinedorrelax{scr@mt@saved@sect}{}{%
\expandafter\ifx\csname #1\endcsname\section
\addcontentsline{\ext@figure}{xsect}{\@currenttocentry}%
\addcontentsline{\ext@table}{xsect}{\@currenttocentry}%
\fi
\expandafter\ifx\csname #1\endcsname\starsection\relax
\addcontentsline{\ext@figure}{xsect}{\@currenttocentry}%
\addcontentsline{\ext@table}{xsect}{\@currenttocentry}%
\fi
}%
\let\IfUsePrefixLine\@secondoftwo
\ifcase
\if@currentusenumber
\ifnum \numexpr #2\relax>\c@secnumdepth \z@\else \@ne\fi
\else
\z@
\fi
% \end{macrocode}
% tagging: The following line was changed to match the change between the Kernel and the Testphase version of \cs{@svsec}.
% As we also define \cs{@svsec} if the section is not numberes we use a local boolean for the test.
% \begin{macrocode}
%<tagging-lab> \@tempswatrue%% not numbered instead of ifx @svsec @empty
%<!tagging-lab> \let\@svsec\@empty
% \end{macrocode}
% \changes{v3.31}{2020/06/02}{execute counter reset list}
% Even for not numbered sections, the reset list für the section counter has
% to be executed.
% \begin{macrocode}
%<!v4> \expandafter\ifnum\scr@v@is@ge{3.31}\relax
\begingroup
\let\@elt\@stpelt