summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/koma-script/scrkernel-miscellaneous.dtx
blob: aeac05df9990b2c035c4abce714afd1c596eb519 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
% \iffalse meta-comment
% ======================================================================
% scrkernel-miscellaneous.dtx
% Copyright (c) Markus Kohm, 2002-2022
%
% 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.txt.
% ======================================================================
%%% From File: $Id: scrkernel-miscellaneous.dtx 3743 2022-03-04 16:27:15Z kohm $
%<init>%%%            (run: init)
%<option>%%%            (run: option)
%<execoption>%%%            (run: execoption)
%<body>%%%            (run: body)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
  \filedate$Date: 2022-03-04 17:27:15 +0100 (Fr, 04. Mär 2022) $
  \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
  \filerevision$Revision: 3743 $
  \edef\reserved@a{%
    \noexpand\endgroup
    \noexpand\ProvidesFile{scrkernel-miscellaneous.dtx}%
                          [\filedate\space\filerevision\space
                           KOMA-Script source
                           (miscellaneous, maybe everything or nothing)]
  }%
\reserved@a
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\setcounter{StandardModuleDepth}{2}
\begin{document}
\DocInput{scrkernel-miscellaneous.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v2.95}{2002/07/01}{first version after splitting \file{scrclass.dtx}}
% \changes{v3.36}{2022/03/01}{switch over from \cls*{scrdoc} to
%   \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/03/01}{whole implementation documentation in English}
%
% \GetFileInfo{scrkernel-miscellaneous.dtx}
% \title{All the Code of
%   \href{https://komascript.de}{\KOMAScript} not Fitting into another File}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
%   Currently \file{scrkernel-miscellaneous.dtx} is a mess of miscellaneous
%   code. There is a big, fat \textbf{ToDo} to change this!
% \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} or the English
% \file{scrguien}.
%
% \MaybeStop{\PrintIndex}
%
%
% \section{Implementation of Special Requirements of Package \pkg*{scrletter}}
%
% The \pkg*{scrletter} depends on some features of the \KOMAScript{}
% classes. However, a special user request was to make it work with the
% standard classes too. So we need additional code to detect not using a
% \KOMAScript{} class and to make this work.
% \begin{description}
% \item[ToDo:] Can we move this code into a letter file or use a new file only
%   used for package \pkg*{scrletter}?
% \end{description}
%    \begin{macrocode}
%<*package&letter&init>
\scr@ifundefinedorrelax{KOMAClassName}{%
  \PackageWarningNoLine{scrletter}{%
    Cannot detect any KOMA-Script class.\MessageBreak
    Package `scrletter' is an extension to\MessageBreak
    KOMA-Script classes.\MessageBreak
    Usage with another class is not recommended%
    \@ifclassloaded{article}{}{%
      \@ifclassloaded{report}{}{%
        \@ifclassloaded{book}{}{%
          \MessageBreak and can result in several errors%
        }%
      }%
    }%
  }%
  \RequirePackage{scrextend}%
%    \end{macrocode}
%
% \begin{command}{\setparsizes}
% \changes{v3.23}{2017/02/22}{simple fallback definition}
% \begin{macro}{\par@updaterelative}
% \changes{v3.23}{2017/02/22}{empty fallback definition}
% If \pkg*{scrletter} is not used with a \KOMAScript{} class \cs{setparsizes}
% would not be available. But it is used in \cs{vb@t@z}, \cs{@addrfield},
% \cs{@datefield}, \cs{@makelettertitle}, \cs{@subjfield}, \cs{opening},
% \cs{closing}. Instead of changing the implementation of all these commands
% and macros, we define a very simple version of \cs{setparsizes}. And in case
% of using this simple version \cs{par@updaterelative} would become a
% do-nothing macro. This does work in case of the commands and macros listed
% above. But maybe it does not work in other cases.
% \begin{description}
% \item[ToDo:] Can we move this code into \file{scrkernel-paragraphs.dtx} or
%   use a new file only for package \pkg*{scrletter}?
% \end{description}
%    \begin{macrocode}
  \providecommand*{\setparsizes}[3]{%
    \setlength{\parindent}{#1}%
    \setlength{\parskip}{#2}%
    \setlength{\parfillskip}{#3}%
  }
  \providecommand*{\par@updaterelative}{}
%    \end{macrocode}
% \end{macro}^^A \par@updaterelative
% \end{command}^^A \setparsizes
%    \begin{macrocode}
}{}
%</package&letter&init>
%    \end{macrocode}
%
% \begin{macro}{\scr@renewforletter,\@renewforletter,\do@renewforletter@list,
%               \do@renewforletter}
% \changes{v3.20}{2014/04/10}{added}
% \changes{v3.25}{2017/11/15}{removed}
% \end{macro}
%
%
% \section{Implementation of the Draft Mode}
%
% The \KOMAScript{} classes provide two draft options, the general one and a
% more specific.
% \begin{description}
% \item[ToDo:] Should we move this to \file{scrkernel-paragraphs.dtx}?
% \end{description}
% 
% \begin{option}{draft}
% \changes{v2.95}{2002/12/05}{re-implemented using \pkg{keyval}}
% \changes{v3.17}{2015/03/12}{using internal value storage}
% \changes{v3.25}{2017/11/21}{respect option \opt{overfullrule}}
% \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
% \begin{option}{final}
% \changes{v2.95}{2002/12/05}{obsolete}
% \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by
%   \cs{PackageInfoNoLine}}
% \changes{v3.01a}{2008/11/21}{standard instead of obsolete}
% \changes{v3.02c}{2008/02/17}{explicit optional argument for \pkg*{scrextend}}
% In draft mode classes usually show a rule for overfull boxes. Despite this
% is usually already handled by the class, package \pkg*{scrextend} also
% provides the option, because of correct setting of the internal value
% storage also of option \opt{overfullrule}.
%    \begin{macrocode}
%<*(class|extend)&option>
\KOMA@key{draft}[true]{%
  \KOMA@set@ifkey{draft}{@tempswa}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \if@tempswa
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{draft}{@tempswa}%
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{overfullrule}{@tempswa}%
      \setlength{\overfullrule}{5pt}%
    \else
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{draft}{@tempswa}%
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{overfullrule}{@tempswa}%
      \setlength{\overfullrule}{\z@}%
    \fi
  \fi
}
%<class>\KOMA@kav@add{.\KOMAClassFileName}{draft}{false}
%<*package&extend>
\KOMA@kav@xadd{.scrextend.\scr@pkgextension}{draft}{%
  \ifdim\overfullrule>\z@ true\else false\fi
}
%</package&extend>
\KOMA@DeclareStandardOption
%<package&extend>[scrextend]
{final}{draft=false}
%    \end{macrocode}
% \begin{option}{overfullrule}
% \changes{v3.25}{2017/11/21}{added}
% Because option \opt{draft} can result in unwanted effects I've added a
% new option to explicite only change the overfull rule setting. However for
% \textsf{scrextend} and the \KOMAScript{} classes the result is the same.
%    \begin{macrocode}
\KOMA@key{overfullrule}[true]{%
  \KOMA@set@ifkey{overfullrule}{@tempswa}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \if@tempswa
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{draft}{@tempswa}%
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{overfullrule}{@tempswa}%
      \setlength{\overfullrule}{5pt}%
    \else
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{draft}{@tempswa}%
      \KOMA@kav@replacebool{.%
%<class>        \KOMAClassFileName
%<package&extend>        scrextend.\scr@pkgextension
      }{overfullrule}{@tempswa}%
      \setlength{\overfullrule}{\z@}%
    \fi
  \fi
}
%<class>\KOMA@kav@add{.\KOMAClassFileName}{overfullrule}{false}
%<*package&extend>
\KOMA@kav@xadd{.scrextend.\scr@pkgextension}{overfullrule}{%
  \ifdim\overfullrule>\z@ true\else false\fi
}
%</package&extend>
%</(class|extend)&option>
%    \end{macrocode}
% \end{option}^^A overfullrule
% \end{option}^^A final
% \end{option}^^A draft
%
%
% \section{Implementations for the Math Mode}
%
% \KOMAScript{} does not make something special for the math mode.
% \begin{description}
% \item[ToDo:] Should we move this to the special treatment of \pkg{amsmath}
%   in \file{scrkernel-basics.dtx} or move it with the special treatment of
%   \pkg{amsmath} in \file{scrkernel-basics.dtx} to a new file
%   \file{scrkernel-math.dtx}?
% \end{description}
%
% \begin{option}{leqno,fleqno}
% The \KOMAScript{} classes but \cls*{scrlttr2} do support the standard
% class options \opt{leqno} and \opt{fleqn}.
%    \begin{macrocode}
%<*class&!letter&option>
\DeclareOption{leqno}{\input{leqno.clo}}
\DeclareOption{fleqn}{\input{fleqn.clo}}
%</class&!letter&option>
%    \end{macrocode}
% \end{option}
%
% \begin{command}{\theequation}
% \changes{v2.97e}{2007/11/23}{chapter numbers only in main matter}
% \changes{v3.27}{2022/03/01}{\cs{relax} replaced by percent because of
%   \pkg*{hyperref}}
% The \KOMAScript{} classes \cls*{scrbook} and \cls*{scrreprt} have a special
% treatment for equation numbers. For \cls*{scrreprt} the number just depends
% on the chapter number. But for \cls*{scrbook} it also depends on the active
% matter.
% \begin{description}
% \item[ToDo:] With \cs{counterwidth} the \cls*{scrreprt} code could be very
%   simple. But currently we still support old \LaTeX{} kernels without
%   \cs{counterwithin}.
% \item[ToDo:] Should we also add a definition for \cls*{scrartcl} as done for
%   \cls*{article}, though the same definition is already the default of the
%   \LaTeX{} kernel?
% \end{description}
%    \begin{macrocode}
%<*(book|report)&body>
\renewcommand*{\theequation}{%
%<*book>
  \expandafter\ifnum\scr@v@is@gt{2.97d}%
    \if@mainmatter\thechapter.\fi
  \else
%</book>
    \thechapter.%
%<book>  \fi
  \@arabic\c@equation
}
%</(book|report)&body>
%    \end{macrocode}
% \end{command}
%
% \section{Implementation of Special Handling of Sans-Serif Defaults}
%
% TeX.SX user \texttt{egreg} has stated in comment
% \url{https://tex.stackexchange.com/questions/289853}, that he does not use
% \KOMAScript{} because of the sans-serif defaults for headings. He like the
% ugly, bold fat Antiqua more. Moreover, he is not satisfied in being able to
% change the default using \cs{setkomafont}. So the \KOMAScript{} author has
% defined an option to do the change of all sans-serif defaults at once. As a
% joke the name of this options not only references \texttt{egreg} but is
% cumbersome long.
% \begin{description}
% \item[ToDo:] Should we move this option to \file{scrkernel-fonts.dtx}?
% \item[ToDo:] Should we add a more handy and serious option like
%   \opt{nosfdefaults}?
% \end{description}
%
% \begin{option}{egegdoesnotlikesansseriftitles}
% \changes{v3.20}{2016/01/29}{added}
% \changes{v3.20a}{2016/05/19}{also for \cls*{scrlttr2}}
% \begin{macro}{\@gr@gsffamily}
% \changes{v3.20}{2016/01/29}{added}
% \changes{v3.20a}{2016/05/19}{also for \cls*{scrlttr2}}
% Used to switch on or off all the sans-serif defaults.
%    \begin{macrocode}
%<*!(package&letter)&option>
\KOMA@ifkey{egregdoesnotlikesansseriftitles}{@egregdoesnotlikesansseriftitles}
\newcommand*{\@gr@gsffamily}{%
  \if@egregdoesnotlikesansseriftitles\else\sffamily\fi
}
%</!(package&letter)&option>
%    \end{macrocode}
% \end{macro}^^A \@gr@gsffamily
% \end{option}^^A egregdoesnotlikesansseriftitles
%
%
% \section{Implementation of the Execution and Processing of Options}
%
% After the definition of all options, some defaults have to be executed and
% all options have to be processed.
% \begin{description}
% \item[ToDo:] Can we move the execution of default to the files, where the
%   corresponding options are defined?
% \item[ToDo:] Can we move the processing of options to
%   \file{scrkernel-basics.dtx} where the command itself is defined?
% \end{description}
%
% \changes{v2.97c}{2007/04/19}{using \cs{KOMAExecuteOptions} instead of
%   \cs{KOMAoptions} and \cs{KOMAProcessOptions} instead of
%   \cs{ProcessOptions}}
% \changes{v2.97c}{2007/04/19}{options that are implicit defaults are not set
%   explicitly}
% \changes{v2.97c}{2007/07/18}{removed \opt{twoside} from the default}
% \changes{v2.98c}{2008/03/10}{\opt{headings\quotechar=big} added to the
%   default}
% \changes{v3.11c}{2013/03/04}{\opt{headings\quotechar=big} not with
%   \cls*{scrlttr2}}
%    \begin{macrocode}
%<*execoption>
%<*class>
\KOMAExecuteOptions{%
  parskip=false,%
%<!letter>  headings=big%
}
%</class>
\KOMAProcessOptions\relax
%</execoption>
%    \end{macrocode}
%
%
% \section{Implementation of Temporary Switch to Single Column Mode}
%
% Sometimes we need to temporary switch to single column mode, e.g., to print
% a table of contents or similar. This is not needed for \cls*{scrlttr2} or
% \pkg*{scrletter}.
% \begin{description}
% \item[ToDo:] Should we move this to \file{scrkernel-paragraphs.dtx} or
%   another file? Currently it is used in \file{scrkernel-index.dtx},
%   \file{scrkernel-notepaper.dtx}, and \file{scrkernel-title.dtx} (and also
%   in \file{scrhack.dtx}, which also defines it of needed).
% \end{description}
% 
% \begin{macro}{\@restonecolfalse,\@restonecoltrue,\if@restonecol}
% We need a local switch to be able to restore two column mode after locally
% switching to one column mode (or visa versa). For \pkg*{scrextend} this is a
% little bit complicated, because the switch could already exist in the used
% class.
%    \begin{macrocode}
%<*!letter&body>
%<*!extend>
\newif\if@restonecol
%</!extend>
%<*extend>
\scr@ifundefinedorrelax{if@restonecol}{%
  \expandafter\newif\csname if@restonecol\endcsname
  \@restonecolfalse
}{}
%</extend>
%</!letter&body>
%    \end{macrocode}
% \end{macro}
% 
% \section{Implementation of the Dictum}
%
% Printing a \emph{dictum} is also not supported by letters.
% \begin{description}
% \item[ToDo:] Should we move this to \file{scrkernel-sections.dtx} or to a
%   new file?
% \end{description}
% 
% \begin{command}{\dictum}
% \changes{v2.8q}{2001/20/04}{added}
% \changes{v2.9l}{2003/01/28}{\cs{edef} replaced by \cs{def} ersetzt}
% \changes{v2.9q}{2004/04/19}{group added}
% \begin{command}{\dictumwidth,
%                 \raggeddictum,\raggeddictumtext,\raggeddictumauthor}
% \changes{v2.8q}{2001/20/04}{added}
% \begin{fontelement}{dictum}
% \changes{v2.8q}{2001/20/04}{added}
% \changes{v3.20}{2016/01/29}{\cs{sffamily} replaced by \cs{@gr@gsffamily}}
% \begin{fontelement}{dictumtext,dictumauthor}
% \changes{v2.8q}{2001/20/04}{added}
% \begin{command}{\dictumauthorformat}
% \changes{v2.8q}{2001/20/04}{added}
% \begin{command}{\dictumrule}
% \changes{v3.10}{2011/09/02}{added}
% The \emph{dictum} consist of a text, the dictum, and an optional
% author. Text and author are separated by a horizontal rule.
%    \begin{macrocode}
%<*!letter&body>
\newcommand{\dictum}[2][]{\par%
  \begingroup
    \raggeddictum\parbox{\dictumwidth}{%
      {\@dictumfont{\raggeddictumtext #2\strut\par}%
        \def\@tempa{#1}\ifx\@tempa\@empty\else%
          {\raggeddictumtext\dictumrule}%
          \raggeddictumauthor\@dictumauthorfont\dictumauthorformat{#1}%
          \strut\par%
        \fi%
      }%
    }\par%
  \endgroup
}
\newcommand*{\dictumrule}{\vskip-1ex\hrulefill\par}%
\newcommand*{\dictumwidth}{.3333\textwidth}
\newcommand*{\raggeddictum}{\raggedleft}
\newcommand*{\dictumauthorformat}[1]{(#1)}
\newcommand*{\raggeddictumtext}{\raggedright}
\newcommand*{\raggeddictumauthor}{\raggedleft}
\newkomafont{dictum}{\normalfont\normalcolor\@gr@gsffamily\small}
\newkomafont{dictumauthor}{\itshape}
\aliaskomafont{dictumtext}{dictum}
%</!letter&body>
%    \end{macrocode}
% \end{command}^^A \dictumrule
% \end{command}^^A \dictumauthorformat
% \end{fontelement}^^A dictumtext,dictumauthor
% \end{fontelement}^^A dictum
% \end{command}^^A \dictumwidth,\raggeddictum…\raggeddictumauthor
% \end{command}^^A \dictum
%
%
% \section{Setting Default Lengths of \env{minipage} and Frames}
%
% \begin{description}
% \item[ToDo:] Should we move the default for \len{@mpfootins} to
%   \file{scrkernel-footnotes.dtx}?
% \item[ToDo:] Do we really need to set initial values to \len{fboxsep} and
% \len{fboxrule}? The same defaults using |pt| instead of \cs{p@} are already
% used in the \LaTeX{} kernel. Wouldn't that be enough?
% \end{description}
%
% \begin{length}{@mpfootins}
% \begin{length}{fboxsep,fboxrule}
% We are using the same settings like the standard classes.
%    \begin{macrocode}
%<*class&body>
\setlength{\skip\@mpfootins}{\skip\footins}
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
%</class&body>
%    \end{macrocode}
% \end{length}
% \end{length}
%
%
% \section{Implementation of Detection of Odd and Even Pages}
%
% \begin{description}
% \item[ToDo:] Should this code moved to \file{scrkernel-basics.dtx} or to a
%   new one?
% \end{description}
%
% \begin{command}{\ifthispageodd,\Ifthispageodd}
% \changes{v2.8q}{2001/11/22}{added}
% \changes{v3.28}{2019/11/19}{\cs{ifthispageodd} renamed to \cs{Ifthispageodd}}
% Users often use |\ifodd\value{page}| to test, whether the current page is
% odd or even. But this is dramatically wrong, because of the asynchronous
% output of \TeX. So here we define a command
% \begin{quote}
%   \Ifthispageodd\marg{then code}\marg{else code}
% \end{quote}
% that internally uses a label-like mechanism to do the decision. We do not
% really use \cs{label} and \cs{pageref}, because this would not work with
% Roman or alphabetic page numbers. So we use a direct write to the \file{aux}
% file instead.
%
% \begin{macro}{\new@tpo@label}
% \changes{v2.8q}{2001/11/22}{added}
% \changes{v2.95b}{2006/07/28}{using \cs{@newl@bel}}
% \changes{v3.20}{2016/03/25}{use after definition in the \file{aux}-file}
% Definition of a new \textbf{t}rue-\textbf{p}age-\textbf{o}dd label. To be
% used in the \file{aux} file. A fallback definition is also added to the
% \file{aux} file, so there wouldn't be an error, e.g., after removing package
% \pkg*{scrextend} from a document.
%    \begin{macrocode}
%<*(class|extend)&body>
\newcommand*{\new@tpo@label}{\@newl@bel{tpo}}
\AtBeginDocument{%
  \if@filesw
    \immediate\write\@auxout{%
      \string\providecommand*\string\new@tpo@label[2]{}%
    }%
  \fi
}
%    \end{macrocode}
% \end{macro}^^A \new@tpo@label
%
% \begin{macro}{\scr@tpo}
% \changes{v2.8q}{2001/11/22}{added}
% We need a kind of counter with the actual usage number of
% \cs{Ifthispageodd}.
%    \begin{macrocode}
\newcommand*{\scr@tpo}{0}
%    \end{macrocode}
% \end{macro}^^A \scr@tpo
%
% \begin{macro}{\is@thispageodd}
% \changes{v2.8q}{2001/11/22}{added}
% \changes{v2.9l}{2003/01/28}{renamed \cs{if@thispageodd}}
% \changes{v2.95b}{2006/07/28}{using \cs{@newl@bel}}
% \changes{v3.17}{2015/03/23}{split into two macros}
% \begin{macro}{\is@thispageodd@setlabel}
% \changes{v3.17}{2015/03/23}{added}
% \changes{v3.20}{2016/03/25}{write to \file{aux} file only \cs{if@filesw}}
% \changes{v3.23}{2017/02/23}{empty macro after usage}
% The main workers of \cs{Ifthispageodd}. It is used to set
% \cs{ifthispagewasodd} depending on the information it adds to the \file{aux}
% file.
% \begin{description}
% \item[ToDo:] Why do we use an optional argument here? Are there any
%   circumstances, when the optional argument is not the default
%   \cs{is@thispageodd@setlabel}?
% \end{description}
%    \begin{macrocode}
\newcommand*{\is@thispageodd}[1][\is@thispageodd@setlabel]{%
  \@bsphack
  \begingroup
    \@tempcnta=\scr@tpo
    \advance\@tempcnta by\@ne
    \xdef\scr@tpo{\the\@tempcnta}%
    \expandafter\ifx\csname tpo@\scr@tpo\endcsname\relax
      \protect\G@refundefinedtrue
%<!extend>      \ClassWarning{\KOMAClassName}{%
%<extend>      \PackageWarning{scrextend}{%
        odd/even page label number \scr@tpo\space undefined}%
      \edef\@tempa{\the\value{page}}%
    \else
      \edef\@tempa{\csname tpo@\scr@tpo\endcsname}%
    \fi
    \ifodd\number\@tempa
      \aftergroup\thispagewasoddtrue
    \else
      \aftergroup\thispagewasoddfalse
    \fi
  \endgroup
  \edef\is@thispageodd@setlabel{%
    \if@filesw
      \unexpanded{\protected@write\@auxout{\let\arabic\relax}}{%
        \noexpand\string
        \noexpand\new@tpo@label{\scr@tpo}{\noexpand\arabic{page}}}%
    \fi
    \noexpand\def\noexpand\is@thispageodd@setlabel
    {\unexpanded\expandafter{\is@thispageodd@setlabel}}%
  }%
  #1%
  \@esphack
}
\newcommand*{\is@thispageodd@setlabel}{}
%    \end{macrocode}
% \end{macro}^^A \is@thispageodd@setlabel
% \end{macro}^^A \is@thispageodd
%
% \begin{command}{\thispagewasoddfalse,\thispagewasoddtrue,\ifthispagewasodd}
% \changes{v2.9l}{2003/01/20}{added}
% Rolf Niepraschks asked for the possibility to check for the last decision,
% e.g., inside the \meta{then code} or \meta{else code}. So the definition of
% \cs{Ifthispageodd} has been changed not only to set such a switch, but also
% use it.
%    \begin{macrocode}
\newif\ifthispagewasodd
%    \end{macrocode}
% \end{command}
%
% With all these macros the user command is very easy.
% \changes{v3.31}{2020/04/27}{fixed class and package name in the warning}
% \changes{v3.32}{2020/08/06}{\cs{KOMAClassName} fixed}
%    \begin{macrocode}
\providecommand*{\ifthispageodd}{%
%<class>  \ClassWarning{\KOMAClassName}{%
%<extend>  \PackageWarning{scrextend}{%
    Usage of deprecated command
    `\string\ifthispageodd'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifthispageodd' by `\string\Ifthispageodd'%
  }%
  \Ifthispageodd
}
\newcommand{\Ifthispageodd}{%
  \is@thispageodd
  \ifthispagewasodd
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%</(class|extend)&body>
%    \end{macrocode}
% \end{command}^^A \ifthispageodd,\Ifthispageodd
%
%
% \section{Implementation of Notes to the Margin}
%
% \begin{description}
% \item[ToDo:] This has been moved newly to
%   \file{scrkernel-miscellaneous.dtx}, but maybe we can find another suitable
%   file?
% \end{description}
%
% \begin{command}{\marginline}
% \changes{v2.4l}{1997/02/06}{using the optional argument of \cs{marginpar}}
% \changes{v2.8q}{2001/11/27}{missing brace added}
% \changes{v3.36}{2022/02/22}{moved from \file{scrkernel-floats.dtx} to
%   \file{scrkernel-miscellaneaous.dtx}}
% A very often wanted margin note feature is, to print all such notes in the
% left margin ragged-left and all such notes in the right margin
% ragged-right. So this is a simple shortcut for \cs{marginpar} with using
% almost the same argument twice.
%    \begin{macrocode}
%<*(class|extend)&body>
\newcommand\marginline[1]{%
  \marginpar[\raggedleft{#1}]{\raggedright #1}%
}
%</(class|extend)&body>
%    \end{macrocode}
% \end{command}
%
%
% \section{Implementation of Subscripts}
%
% \begin{command}{\textsubscript}
% \changes{v2.8h}{2001/07/19}{added}
% \changes{v3.25}{2017/11/15}{define only if un-defined because of \LaTeX{}
%   kernel change}
% \begin{macro}{\@textsubscript}
% \changes{v2.8h}{2001/07/19}{added}
% \changes{v3.10}{2011/09/05}{\cs{providecommand} instead of \cs{newcommand}
%   because of \pkg{fixltx2e}}
% The \LaTeX{} kernel has \cs{textsuperscript}. But for several years
% \cs{textsubscript} was missing. For such old \LaTeX{} kernels, we define it
% similar to \cs{textsuperscript}.
%    \begin{macrocode}
%<*(class|extend)&body>
\scr@ifundefinedorrelax{textsubscript}{%
  \DeclareRobustCommand*\textsubscript[1]{%
    \@textsubscript{\selectfont#1}%
  }%
}{%
  \scr@ifundefinedorrelax{textsubscript }{%
    \DeclareRobustCommand*\textsubscript[1]{%
      \@textsubscript{\selectfont#1}%
    }%
  }{}%
}
\providecommand*{\@textsubscript}[1]{%
  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}%
}
%</(class|extend)&body>
%    \end{macrocode}
% \end{macro}
% \end{command}^^A \textsubscript
%
%
% \section{Implementation of an Invisible Strut}
% \label{sec:strut}
%
% \begin{description}
% \item[ToDo:] Maybe \file{scrkernel-basics.dtx} would be a good place for
%   this and maybe is should become a user command and be used at several
%   places, currently \cs{strut} is used.
% \end{description}
%
% \begin{macro}{\scr@endstrut}
% \changes{v3.25}{2017/11/15}{added}
% If we simply add \cs{strut} to the end of material which is assumed to be
% horizontal, white spaces at the end of such material could become relevant,
% even if the would not without the \cs{strut}. We can avoid this by adding
% \cs{unskip} before the \cs{strut}. But in this case, the last work before
% the \cs{strut} will not be hyphenated any more. If we are really in
% horizontal mode, we can use \cs{nobreak} before the \cs{strut} you once
% again allow hyphenation.
% \begin{description}
% \item[ToDo:] Should the \cs{unskip} also be moved behind \cs{ifhmode}?
% \end{description}
%    \begin{macrocode}
%<*(class|letter|extend)&body>
\providecommand*{\scr@endstrut}{\unskip\ifhmode\nobreak\strut\fi}
%</(class|letter|extend)&body>
%    \end{macrocode}
% \end{macro}
%
%
% \section{Warnings for Using Incompatible Packages}
% \label{sec:packagewarning}
%
% \begin{description}
% \item[ToDo:] This should be moved to a new file.
% \end{description}
%
% \changes{v3.12}{2013/07/08}{warnings about several incompatible packages
%   added}
%
% \begin{macro}{\scr@package@not@recommended}
% \changes{v3.12}{2013/07/08}{added}
% \begin{macro}{\class@shoulddisablepackagewarning@list}
% \changes{v3.24}{2017/06/25}{added}
% Loading of several incompatible packages should result in warnings using:
% \begin{quote}
%   \cs{scr@package@not@recommended}\marg{package}\marg{alternatives}
% \end{quote}
% Usually the warning contains information about \meta{alternatives}, but this
% argument can also be empty. Authors of classes can deactivate the warning,
% by adding a \meta{package} to the comma separated list
% \cs{class@shoulddisablepackagewarning@lis}. This has to be done, before
% loading the \KOMAScript{} class. However doing so is not recommended and the
% class author is responsible for the drawbacks.
%    \begin{macrocode}
%<*class&body>
\newcommand*{\scr@package@not@recommended}[2]{%
  \scr@ifundefinedorrelax{class@shoulddisablepackagewarning@list}{%
    \@firstofone
  }{%
    \edef\reserved@a{%
      \noexpand\in@{#1}{\class@shoulddisablepackagewarning@list}}%
    \reserved@a
    \ifin@\expandafter\@gobble\else\expandafter\@firstofone\fi
  }{%
    \BeforePackage{#1}{%
      \ClassWarning{\KOMAClassName}{%
        Usage of package `#1' together\MessageBreak
        with a KOMA-Script class is not recommended.\MessageBreak
        \if\relax\detokenize{#2}\relax\else
          I'd suggest to use #2.\MessageBreak
        \fi
        Nevertheless, using requested\MessageBreak
        package `#1'%
      }%
    }%
  }%
}%
%    \end{macrocode}
% \end{macro}^^A \class@shoulddisablepackagewarning@list
% Here are the not recommended packages and the alternatives:
% \begin{description}
% \item[\pkg{emptypage}:] is not needed, because there are corresponding
% options and features in \KOMAScript.
%    \begin{macrocode}
\scr@package@not@recommended{emptypage}{%
  option\MessageBreak
  `cleardoublepage' with one of it's\MessageBreak
  several values}
%    \end{macrocode}
% \item[\pkg{fancyhdr}:] does not respect font settings of \KOMAScript{} and
%   also breaks some other features.
% \changes{v3.24}{2017/06/25}{improved \pkg{fancyhdr} warning}
%    \begin{macrocode}
\scr@package@not@recommended{fancyhdr}{%
  \MessageBreak
  package `scrlayer' or `scrlayer-scrpage', because\MessageBreak
  they support KOMA-Script classes.\MessageBreak
  With `fancyhdr' several features of class `\KOMAClassName'\MessageBreak
  like options `headsepline', `footsepline' or command\MessageBreak
  `\string\MakeMarkcase' and the commands `\string\setkomafont' and\MessageBreak
  `\string\addtokomafont' for the page style elements need\MessageBreak
  explicite user intervention to work}
%    \end{macrocode}
% \item[\pkg{minitoc}:]
% \changes{v3.23}{2017/02/04}{\pkg{minitoc} is not recommended}
% re-defines, e.g., \cs{@sect} and therefore breaks all the extensions of
% \KOMAScript{} to this command. Currently not all impacts of the package has
% been explored. Currently there is only a workaround for the \cs{@sect}
% issue. See \autoref{sec:packageworkarounds} for more information.
%    \begin{macrocode}
%<*!letter>
\scr@package@not@recommended{minitoc}{}
%</!letter>
%    \end{macrocode}
% \item[\pkg{multitoc}:]
% \changes{v3.26}{2018/07/18}{\pkg{multitoc} not recommended}
% At least up to version 2.01 this breaks all additional lists/tables of
% contents, because the \cs{@starttoc} redefinition does not allow to use
% another extension but \file{toc}, \file{lof}, or \file{lot}. The package is
% also not needed, because the \env{multicols} environment can simply be added
% using \cs{BeforeStartingTOC} and \cs{AfterStartingTOC}.
%    \begin{macrocode}
%<*!letter>
\scr@package@not@recommended{multitoc}{%
  package `multicol' and, e.g.:\MessageBreak
  \space\space
  \string\BeforeStartingTOC{\string\begin{multicols}{2}}\MessageBreak
  \space\space
  \string\AfterStartingTOC{\string\end{multicols}}\MessageBreak
  to make all ToCs two-columned.\MessageBreak
  \@ifpackagelater{2018/07/18}{}{%
    Note, package `multitoc' breaks additional\MessageBreak
    ToCs generated by `\string\DeclareNewTOC' or\MessageBreak
    packages like `listings' or `newcaption' and\MessageBreak
    even the standard table of contents,\MessageBreak
    list of figures or list of tables,\MessageBreak
    if you omit the corresponding options `toc',\MessageBreak
    `lof' or `lot'.%
  }%
}
%</!letter>
%    \end{macrocode}
% \item[\pkg{parskip}:] is an emergency fallback package for classes, that
%   do not support paragraph skips themselves.
%    \begin{macrocode}
\scr@package@not@recommended{parskip}{%
  option\MessageBreak
  `parskip' with one of it's several values}
%    \end{macrocode}
% \item[\pkg{titleps}:]
% \changes{v3.16}{2015/01/21}{\pkg{titleps} not recommended}
% does not respect several font settings and other features of the
% \KOMAScript{} classes.
%    \begin{macrocode}
\scr@package@not@recommended{titleps}{%
  package `scrlayer-scrpage'}
%    \end{macrocode}
% \item[\pkg{titlesec}:]
% \changes{v3.36}{2022/03/01}{bring back \pkg{titlesec} warning}
%   breaks several \KOMAScript{} features and needs a lot
%   of workarounds to not result in errors. Note, these workarounds have been
%   removed from \KOMAScript{}, because they are very fragile and use internal
%   macros of \pkg{titlesec}.
%    \begin{macrocode}
%<*!letter>
\scr@package@not@recommended{titlesec}{%
  KOMA-Script features\MessageBreak
  like \string\setkomafont, \string\RedeclareSectionCommand,
  \string\sectionlinesformat\MessageBreak
  and several others to re-configure section\MessageBreak
  headings}
%</!letter>
%    \end{macrocode}
% \item[\pkg{sectsty}:]
% \changes{v3.27}{2019/07/24}{\pkg{sectsty} up to v2.0.2 is incompatible}
% uses up to version 2.0.2 internal commands of
% \KOMAScript{}, that has been removed already 2001 in \KOMAScript{} 2.8e. So
% it was never compatible with \KOMAScript~3.
%    \begin{macrocode}
%<*!letter>
\AfterPackage*{sectsty}{%
  \@ifpackagelater{sectsty}{2002/02/26}{%
    \ClassInfo{\KOMAClassName}{Unknown `sectsty' release.\MessageBreak
      Cross your fingers, that is compatible%
    }%
  }{%
    \ClassWarning{\KOMAClassName}{%
      Incompatible package `sectsty' loaded!\MessageBreak
      Package `sectsty' up to version 2.0.2 is incompatible\MessageBreak
      with KOMA-Script from version 2.8e released in 2001.\MessageBreak
      You should avoid that package and configure the\MessageBreak
      section titles of your document using the KOMA-Script\MessageBreak
      user interface, e.g., \string\chapterlinesformat,\MessageBreak
      \string\RedeclareSectionCommand\space etc. or you should ask\MessageBreak
      the `sectsty' maintainer for a more compatible release.\MessageBreak
      Ignoring this warning could result in several error\MessageBreak
      messages and formatting issues after loading package\MessageBreak
      `sectsty'%
    }%
  }%
}
%</!letter>
%    \end{macrocode}
% \item[\pkg{tocbibind}:]
% \changes{v3.25}{2017/11/21}{Usage of \pkg{tocbibind} not recommended}
% \pkg{tocbibind} does several things, that break \KOMAScript, i.e.:
% \begin{itemize}
% \item usage of \cs{MakeUppercase} within running heads,
% \item usage of hard codes \texttt{toc} for the ToC entries,
% \item hard redefinition of \env{thebibliography},
% \item hard redefinition of \env{theindex},
% \item hard redefinition of \cs{tableofcontents},
% \item hard redefinition of \cs{listoftables},
% \item hard redefinition of \cs{listoffigures},
% \item hard redefinition of \cs{@makechapterhead}
% \end{itemize}
%    \begin{macrocode}
%<*!letter>
\scr@package@not@recommended{tocbibind}{%
  options like `listof=totoc'\MessageBreak
  or `bibliography=totoc', or commands like\MessageBreak
  `\string\setuptoc{toc}{totoc}' instead of this package,\MessageBreak
  because it breaks several KOMA-Script features of\MessageBreak
  the list of figures, list of tables, bibliography,\MessageBreak
  index and the running head%
}
%</!letter>
%    \end{macrocode}
% \item[\pkg{tocloft}:] 
% \changes{v3.26}{2018/07/18}{Usage of \textsf{tocloft} not recommended}
% redefines \cs{tableofcontents}, \cs{listoffigures},
% \cs{listoftables}, \cs{l@part} \dots{} \cs{l@subparagraph} and breaks
% \KOMAScript, i.e.:
% \begin{itemize}
% \item commands \cs{BeforeTOCHead}, \cs{AfterTOCHead},
%   \cs{BeforeStartingTOC}, \cs{AfterStartingTOC},
% \item almost all TOC features,
% \item options \opt{listof=totoc}, \opt{listof=numbered},
% \item option \opt{listof=flat},
% \item option \opt{listof=entryprefix},
% \item all options of \cs{DeclareTOCEntryStyle},
% \end{itemize}
%    \begin{macrocode}
%<*!letter>
\scr@package@not@recommended{tocloft}{%
  options like `listof=entryprefix',\MessageBreak
  commands like `\string\listoflofentryname' or\MessageBreak
  `\string\listoflotentryname',
  and `\string\DeclareTOCStyleEntry' or\MessageBreak
  `\string\RedeclareSectionCommand'
  instead of this package,\MessageBreak
  because it breaks several KOMA-Script features of\MessageBreak
  the list of figures, list of tables and table of\MessageBreak
  contents, i.e., options like `listof=numbered',\MessageBreak
  `listof=flat or `toc=flat', commands like\MessageBreak
  `\string\BeforeTOCHead{...}' and
  `\string\AfterTOCHead{...}',\MessageBreak
  `\string\BeforeStartingTOC{...}' and
  \string\AfterStartingTOC{...}',\MessageBreak
  all features of  `\string\DeclareTOCStyleEntry',\MessageBreak
  and the ToC entry features of `\string\DeclareSecionCommand'\MessageBreak
  and `\string\RedeclareSectionCommand' of levels\MessageBreak
  `part',
%<article> `chapter',
  `section', `subsection',\MessageBreak
  `subsubsection', `paragraph' and `subparagraph'%
}
%</!letter>
%</class&body>
%    \end{macrocode}
% \end{description}
% \end{macro}^^A \scr@package@not@recommended
%
% \section{Workarounds for Incompatible Packages}
% \label{sec:packageworkarounds}
%
% \begin{description}
% \item[ToDo:] The code should be moved to the same file as the code of
%   \autoref{sec:packagewarning} or maybe even to \pkg{scrhack}.
% \end{description}
%
% For some packages can be made compatible, patching some internal macros of
% these packages:
% \begin{description}
% \item[\pkg{minitoc}:]
%   \changes{v3.23}{2017/02/04}{\pkg{minitoc} is incompatible}
%   has some serious issues. The first issue is the hard re-definition of
%   \cs{@sect} without respecting the changes the \KOMAScript{} classes
%   already made. Here I'll try a ugly workaround for this, but is can
%   break. So not using the package with a \KOMAScript{} class would be the
%   better choice.
%    \begin{macrocode}
%<*class&body>
%<*!letter>
\BeforePackage{minitoc}{%
  \let\scr@mt@saved@sect\@sect
}
\AfterPackage{minitoc}{%
  \def\@tempa#1#2#3#4#5#6[#7]#8{%
    \ifnum #2<1 \relax 
      \addtocontents{toc}{\protect\sectbegin}
    \fi 
    \stc@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}]{#8}%
  }%
  \ifx\@sect\@tempa
%    \end{macrocode}
% Note: There are several bugs in this definition (e.g. missing
% \cs{expandafter} and spurious spaced). Nevertheless its the original one
% from \pkg{minitoc} 61 and 62 and so I have to use it.
%    \begin{macrocode}
    \def\@tempa#1#2#3#4#5#6[#7]#8{
      \expandafter
      \ifx\csname #1\endcsname\section\relax
        \addcontentsline{lof}{xsect}{#7}%
        \addcontentsline{lot}{xsect}{#7}%
      \fi
      \ifx\csname #1\endcsname\starsection\relax
        \addcontentsline{lof}{xsect}{#7}%
        \addcontentsline{lot}{xsect}{#7}%
      \fi
      \ifnum #2>\c@secnumdepth\relax
        \let\@svsec\@empty
      \else
        \refstepcounter{#1}%
        \edef\@svsec{\csname the#1\endcsname\hskip 1em}%
      \fi
      \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}%
          {\interlinepenalty \@M #8\par}%
        \endgroup
        \csname #1mark\endcsname{#7}%
        \addcontentsline{toc}{#1}{%
          \ifnum #2>\c@secnumdepth\relax
          \else
            \protect\numberline{\csname the#1\endcsname}%
          \fi
          #7%
        }%
      \else
        \def\@svsechd{#6\hskip #3\relax
          \@svsec #8\csname #1mark\endcsname{#7}%
          \addcontentsline{toc}{#1}{%
            \ifnum #2>\c@secnumdepth\relax
            \else
              \protect\numberline{\csname the#1\endcsname}
            \fi
            #7}%
        }%
      \fi
      \@xsect{#5}%
    }%
    \ifx\stc@sect\@tempa
      \ClassWarning{\KOMAClassName}{%
        Redefining minitoc's internal command
        `\string\stc@sect'\MessageBreak
        to prevent minitoc to destroy several features\MessageBreak
        of KOMA-Script%
      }%
      \let\stc@sect\scr@mt@saved@sect
    \else
      \ClassInfo{\KOMAClassName}{%
        Deactivating the `minitoc' workaround,\MessageBreak
        because of unexpected definition of\MessageBreak
        `\string\stc@sect'%
      }%
      \let\scr@mt@saved@sect\relax
    \fi
  \else
    \ifx\@sect\scr@mt@saved@sect
      \ClassInfo{\KOMAClassName}{%
        Deactivating the `minitoc' workaround for
        `\string\@sect',\MessageBreak
        because it is not needed%
      }%
    \else
      \ClassInfo{\KOMAClassName}{%
        Deactivating the `minitoc' workaround,\MessageBreak
        because of unexpected definition of\MessageBreak
        `\string\@sect'%
      }%
    \fi
    \let\scr@mt@saved@sect\relax
  \fi
}
%</!letter>
%</class&body>
%    \end{macrocode}
% \item[\pkg{titlesec}:]
%   \changes{v3.13a}{2014/10/09}{\pkg{titlesec} is hardly incompatible}
%   \changes{v3.27}{2019/07/23}{\pkg{titlesec} does not support
%     KOMA-Script classes}%
%   After several years \textsf{titlesec} still does not really support
%   \KOMAScript{} classes and \KOMAScript{} would still need an ugly hack
%   using internal \texttt{titlesec} macros and deactivating several features
%   of \KOMAScript{} to make the package work. So IMO the better solution is
%   to remove such hacks from the \KOMAScript{} classes. Maybe the
%   \pkg{titlesec} author will support the \KOMAScript{} classes in some
%   future, maybe not. If you really need to \pkg{titlesec} with a
%   \KOMAScript{} class, see the ugly \texttt{standardsection} hack in
%   \pkg*{scrhack}.
% \end{description}
%
%
% \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: