summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/scrkernel-basics.dtx
blob: 6c9a8c0302f05e1742f32768de212e12673a3748 (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
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
% \iffalse meta-comment
% ======================================================================
% scrkernel-basics.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-basics.dtx 3773 2022-03-29 06:27:55Z kohm $
%<prepare>%%%            (run: prepare)
%<option>%%%            (run: option)
%<body>%%%            (run: body)
%<load>%%%            (run: load)
%<package&prepare>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\def\filedate{#2/#3/#4}}
  \filedate$Date: 2022-03-29 08:27:55 +0200 (Tue, 29 Mar 2022) $
  \def\filerevision$#1: #2 ${\def\filerevision{r#2}}
  \filerevision$Revision: 3773 $
  \edef\reserved@a{%
    \noexpand\endgroup
    \noexpand\ProvidesFile{scrkernel-basics.dtx}%
                          [\filedate\space\filerevision\space
                           KOMA-Script
  }
\reserved@a
%</dtx>
%<*dtx|(package&prepare)>
%<package>\ProvidesPackage{%
%<package&base>  scrbase%
%<package&koma>  scrkbase%
%<package>}[%
%!KOMAScriptVersion
  package 
%<*dtx>
  source
%</dtx>
  (%
%<base>    KOMA-Script-independent
%<koma>    KOMA-Script-dependent
  basics and keyval usage)]
%</dtx|(package&prepare)>
%<*dtx>
\ifx\documentclass\undefined
  \input scrdocstrip.tex
  \@@input scrkernel-version.dtx
  \@@input scrstrip.inc
  \KOMAdefVariable{COPYRIGHTFROM}{2002}
  \generate{\usepreamble\defaultpreamble
    \file{scrbase.sty}{%
      \from{scrkernel-version.dtx}{package,scrbase}%
      \from{scrkernel-basics.dtx}{package,prepare,base}%
      \from{scrkernel-basics.dtx}{package,option,base}%
      \from{scrkernel-language.dtx}{package,option,base}%
      \from{scrkernel-basics.dtx}{package,body,base}%
      \from{scrkernel-language.dtx}{package,body,base}%
      \from{scrlogo.dtx}{logo}%
    }%
  }
  \@@input scrstrop.inc
\else
  \let\endbatchfile\relax
\fi
\endbatchfile
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\usepackage{hvlogos}
\setcounter{StandardModuleDepth}{2}
\begin{document}
\DocInput{scrkernel-basics.dtx}
\end{document}
%</dtx>
% \fi^^A meta-comment
%
% \changes{v1.0}{2002/07/06}{starting implementation}
% \changes{v3.12}{203/03/05}{usage of \cs{@tempa}, \cs{@tempb}, \cs{@tempc}
%   eliminated}
% \changes{v3.36}{2022/02/16}{switch over from \cls*{scrdoc} to
%   \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/21}{whole implementation documentation in English}
%
% \GetFileInfo{scrkernel-basics.dtx}
% \title{Basic Funktionality Used by Almost all
%   \href{https://komascript.de}{\KOMAScript} Classes and Packages}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
%   New versions of \KOMAScript{} make increasing use of the \pkg{keyval}
%   package. The \pkg{keyval} package is part of the \pkg{graphics} package
%   and as such must be included on all \TeX{} systems with \LaTeX{}. However,
%   it does not meet the requirements of \KOMAScript{} in some
%   respects. Therefore, extensions are made here which can be used by
%   \KOMAScript classes and \KOMAScript packages.
%
%   In addition, more and more parts of \KOMAScript{} are used by more than
%   one package or by packages and classes. These basic things have therefore
%   been split into two packages, \pkg*{scrbase} (for things that can also be
%   used by other classes and packages) and \pkg*{scrkbase} (for things that
%   are reserved for \pkg*{scrkbase}). This makes the packages and classes
%   themselves smaller and they can still be used independently. Of course you
%   can also use this package without the rest of \KOMAScript{}.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user documentation of package \pkg*{scrbase} and the
% commands implemented in \file{scrkernel-basics.dtx} in the \KOMAScript{}
% manual, either the German \file{scrguide} or the English \file{scrguien}.
% 
%
% \subsection{Functions not yet in the Manual}
%
% Some user commands are not documented in the \KOMAScript{} manuals, e.g.,
% because they are not stable enough to be used by average users or more or
% less for internal usage only. Some are only not documented in the
% \KOMAScript{} manual, because nobody has done it yet.
%
% \DescribeCommand\IfLTXAtLeastTF
% \marginpar{\raggedleft\tiny Added: 2021-01-31}%
% This is the same like \cs{IfFormatAtLeast} of \LaTeX{} from 2020/10/01, but
% works also with older \LaTeX{} kernels.
%
% \DescribeCommand\Ifislengthprimitive
% \marginpar{\raggedleft\tiny Added: 2015/10/19\\Renamed: 2022/02/17}%
% \cs{Ifislengthprimitive}\marg{macro}\marg{then code}\marg{else code}
% expands the \meta{macro} and tests if the result can be used as a length
% primitive. If this is the case the \meta{then code} is executed, otherwise
% the \meta{else code}. Note, that this command can be false negative,
% because, i.e., with \LuaLaTeX{} there can be primitives, that are like length,
% but that are not known by \cs{Ifislengthprimitive}.
%
% \DescribeCommand\Ifisdefchar
% \marginpar{\raggedleft\tiny Added: 2015/10/19\\Renamed: 2022/02/17}%
% \cs{Ifislengthprimitive}\marg{macro}\marg{then code}\marg{else code}
% expands the \meta{macro} and tests if the result is a \cs{char}. If this is
% the case the \meta{then code} is executed, otherwise the \meta{else code}.
% Note, that this command can be false positive, if the \cs{char} value is
% incorrect.
%
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of \pkg*{scrbase} and \pkg*{scrkbase}}
%
% \subsection{Loading \pkg*{scrkbase}}
% Who ever loads ths package, always wants the same version of the already
% used \KOMAScript version.
%    \begin{macrocode}
%<*load>
\RequirePackage{scrkbase}[\KOMAScriptVersion]
%</load>
%    \end{macrocode}
%
%
% \subsection{\eTeX{} test}
% \changes{v3.02c}{2009/02/19}{error message without \eTeX}
%
%    \begin{macrocode}
%<*prepare>
%<*base>
\begingroup
  \def\reserved@b{}%
  \def\reserved@a#1{%
    \PackageError{scrbase}{seems you are not running e-TeX#1}{%
      Since 2004 the LaTeX team recommends to use e-TeX.\MessageBreak
      KOMA-Script since version 2.95 uses several e-TeX features.\MessageBreak
      At actual systems `latex' should already use e-TeX.\MessageBreak
      At deprecated systems it may be called `elatex'.\MessageBreak
      Use either unsupported KOMA-Script up to version 2.9u or\MessageBreak
      ask you administrator for LaTeX using e-TeX#1.\MessageBreak
      Not using e-TeX#1 is a fatal error!\MessageBreak
      Processing cannot be continued!}%
    \endgroup
    \batchmode \errmessage{}\csname @@end\endcsname\end\relax
    \csname endinput\endcsname
  }%
  \expandafter\ifx\csname eTeXversion\endcsname\relax\else
    \ifnum\eTeXversion <2
      \def\reserved@b{ V 2}%
    \else
      \let\reserved@a\endgroup
    \fi
  \fi
\expandafter\reserved@a\expandafter{\reserved@b}
%</base>
%    \end{macrocode}
%
%
% \subsection{The \KOMAScript-only package loads the universal package}
%
% Once again the same version is wanted.
%    \begin{macrocode}
%<koma>\RequirePackage{scrbase}[\KOMAScriptVersion]
%    \end{macrocode}
%
% \subsection{Package  \pkg*{scrlfile}}
%
% We need to react on the loading other packages like \pkg{polyglossia}. For
% this we use \pkg*{scrlfile}. But we can use any version.
%
%    \begin{macrocode}
%<base>\RequirePackage{scrlfile}
%    \end{macrocode}
%
% \subsection{Package \pkg*{keyval}}
%
% The \KOMAScript{} key handling bases on package \pkg{keyval}.
%    \begin{macrocode}
%<base>\RequirePackage{keyval}
%    \end{macrocode}
%
%
% \subsection{Using protected kernel macros}
% Some package like \pkg{amsgen} redefine internal \LaTeX{} kernel macros, but
% break them for other purposes than the own. So I have to make them work
% again. The \KOMAScript{} classes have less problems with this, because most
% of these packages cannot be loaded before a class. So the classes can simply
% copy the original macro, before it is redefined. But I do not know, when a
% package is loaded. So I have to implement the whole macro again with another
% name (and can only hope, that such packages do not damage them also).
%
% \begin{macro}{\kernel@ifstar}
% \changes{v3.20}{2016/04/12}{added}
% I hope, the \LaTeX{} kernel will define this in future and other packages do
% not redefine like they do with \cs{@ifstar}. So I use \cs{providecommand} to
% not redefine the kernel macro, if it does exist.
%    \begin{macrocode}
%<base>\providecommand*\kernel@ifstar[1]{\kernel@ifnextchar*{\@firstoftwo{#1}}}
%    \end{macrocode}
% \end{macro}^^A \kernel@ifstar
%
%
% \subsection{Improved \LaTeX{} kernel commands}
% The \LaTeX{} kernel already provides some useful commands, but some can be
% improved.
%
% \begin{command}{\rloop}
% \changes{v3.30}{2020/03/07}{added}
% The \cs{loop} \dots \cs{repeat} of the \LaTeX{} kernel cannot be used inside
% a \cs{loop} \dots \cs{repeat} without extra code for preserving
% \cs{iterate}. So here is a re-entrant version that is also long. This
% version can be used even inside a \cs{loop} \dots \cs{repeat}. However you
% should not use \cs{loop} \dots \cs{repeat} inside \cs{rloop} \dots
% \cs{repeat}.
%    \begin{macrocode}
%<*base>
\newcommand{\rloop}[1]{}
\long\def\rloop#1\repeat{%
  \ifdefined\iterate
    \edef\iterate{\unexpanded{#1\relax\expandafter\iterate\fi\def\iterate}%
      {\unexpanded\expandafter{\iterate}}}%
  \else
    \def\iterate{#1\relax\expandafter\iterate\fi\let\iterate\relax}%
  \fi
  \iterate
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\IfLTXAtLeastTF}
% \changes{v3.33}{2021/01/21}{new}
% This is the same like \cs{IfFormatAtLeastTF} of the current \LaTeX{} kernel,
% but does also work, if \cs{IfFormatAtLeastTF} is not defined because of
% very old \LaTeX{} kernel.
%    \begin{macrocode}
%<*base>
\newcommand*{\IfLTXAtLeastTF}{\@ifl@t@r\fmtversion}
\ifcsname IfFormatAtLeastTF\endcsname
  \let\IfLTXAtLeastTF\IfFormatAtLeastTF
\fi
\@onlypreamble\IfLTXAtLeastTF
%</base>
%    \end{macrocode}
% \end{command}
%
%
% \subsection{Testing macros}
%
% \begin{macro}{\scr@ifundefinedorrelax}
% \changes{v2.95c}{2006/08/12}{added}
% \changes{v2.97b}{2007/03/08}{broken logic fixed}
% \changes{v2.97c}{2007/04/18}{broken functionality fixed}
% \changes{v2.97c}{2007/04/18}{\cs{scr@ifundefined} renamed}
% \changes{v3.02c}{2009/02/19}{special treatment of \eTeX{} removed}
% This macro is like \cs{@ifundefined}, but does not define the test macro
% \cs{relax} if it was undefined before. Note: With up-to-date \LaTeX{} this
% is the same with the original \cs{@ifundefined}.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ifundefinedorrelax}[1]{%
  \ifcsname #1\endcsname
    \expandafter\ifx\csname #1\endcsname\relax
      \expandafter\expandafter\expandafter\@firstoftwo
    \else
      \expandafter\expandafter\expandafter\@secondoftwo
    \fi
  \else
    \expandafter\@firstoftwo
  \fi
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifundefinedorrelax
%
%
% \subsection{Extending messages}
%
% \begin{command}{\PackageErrorNoLine}
% \changes{v3.12}{2013/09/19}{added}
% \changes{v3.28}{2019/11/23}{nonsense command removed}
% Falk correctly stated, that \cs{PackageError} already does not show a line
% number. So we do not need this command.
% \end{command}
%
%
% \subsection{Definition of the \KOMAScript{} \pkg*{keyval} basis}
%
% \KOMAScript{} could use \pkg{keyval} keys with the same set of keywords
% ``\texttt{KOMA}'' to make it possible, that packages can redefine keys of
% classes and other packages. However this would be dangerous and can easily
% break. So we split the set of keywords in an family of keywords and family
% member of keywords and define commands to process the keywords either of a
% member or a whole family.
%
% \begin{command}{\DefineFamily,\DefineFamilyMember,\DefineFamilyKey}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}}
% \begin{macro}{\scr@if@family}
% \changes{v3.00}{2008/04/30}{added}
% \begin{macro}{\scr@if@familymember}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.27}{2019/07/19}{the empty member exists by default}
% \begin{macro}{\scr@define@family@key}
% \changes{v3.00}{2008/04/30}{added}
% \begin{macro}{\scr@define@family@key@nodefault}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.18a}{2015/07/03}{missing \% added}
% Family, member of a family and \pkg{keyval} key for a member of a
% family. The default of the member of a family is always the file name of a
% class or package (while reading the file).
%    \begin{macrocode}
%<*base>
\newcommand*{\DefineFamily}[1]{%
  \scr@ifundefinedorrelax{#1@key@familylist}{%
    \@namedef{#1@key@familylist}{}%
  }{}%
}
\newcommand*{\scr@if@family}[2]{%
  \scr@ifundefinedorrelax{#1@key@familylist}{%
    \PackageError{scrbase}{%
      unknown family `#1'%
    }{%
      You've tried to #2 for family `#1'.\MessageBreak
      This my be done only for previous defined families.\MessageBreak
      You should call `\string\DefineFamily{#1}' first.%
    }%
  }%
}
\newcommand*{\DefineFamilyMember}[2][.\@currname.\@currext]{%
  \scr@if@family{#2}{define a family member}{%
    \edef\reserved@a{%
      \noexpand\in@{#2#1,}{\csname #2@key@familylist\endcsname}}%
    \reserved@a
    \ifin@\else
      \expandafter\edef\csname #2@key@familylist\endcsname{%
        \@nameuse{#2@key@familylist}#2#1,}%
    \fi
  }%
}
\newcommand*{\scr@if@familymember}[3]{%
  \scr@if@family{#2}{#3}{%
    \IfArgIsEmpty{#1}{%
      \@firstofone
    }{%
      \edef\reserved@a{%
        \noexpand\in@{#2#1,}{\csname #2@key@familylist\endcsname}}%
      \reserved@a
      \ifin@
        \expandafter\@firstofone
      \else
        \PackageError{scrbase}{%
          unknown member `#1' at family `#2'%
        }{%
          You've tried to #3 for member `#1' of family `#2'.\MessageBreak
          This my be done only for previous defined family members.\MessageBreak
          You should call `\string\DefineFamilyMember[{#1}]{#2}' first.%
        }%
        \expandafter\@gobble
      \fi
    }%
  }%
}
\newcommand*{\DefineFamilyKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar[%]
  {%
    \edef\reserved@a{#1}%
    \expandafter\scr@define@family@key
    \expandafter{\reserved@a}{#2}{#3}%
  }{%
    \edef\reserved@a{#1}%
    \expandafter\scr@define@family@key@nodefault
    \expandafter{\reserved@a}{#2}{#3}%
  }%
}
\newcommand{\scr@define@family@key}{}
\long\def\scr@define@family@key#1#2#3[#4]#5{%
  \scr@if@familymember{#1}{#2}{define a key}{%
    \define@key{#2#1}{#3}[{#4}]{%
      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
      \FamilyKeyStateUnknown
      #5%
      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
    }%
  }%
}
\newcommand{\scr@define@family@key@nodefault}[4]{%
  \scr@if@familymember{#1}{#2}{define a key}{%
    \define@key{#2#1}{#3}{%
      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
      \FamilyKeyStateUnknown
      #4%
      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
    }%
    \@namedef{KV@#2#1@#3@default}{%
      \def\FamilyOfKey{#2}\def\FamilyMemberOfKey{#1}%
      \FamilyKeyStateNeedValue
    }%
  }%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@define@family@key@nodefault
% \end{macro}^^A \scr@define@family@key
% \end{macro}^^A \scr@if@familymember
% \end{macro}^^A \scr@if@family
% \end{command}^^A \DefineFamily,\DefineFamilyMember,\DefineFamilyKey
%
%
% \begin{command}{\RelaxFamilyKey}
% \changes{v3.15}{2014/12/03}{added}
% Sometimes it is useful to be able to \emph{un-define} a key. This will not
% un-define all helper macros but only the key and a default value will become
% \cs{relax}.
%    \begin{macrocode}
%<*base>
\newcommand*{\RelaxFamilyKey}[3][.\@currname.\@currext]{%
  \scr@ifundefinedorrelax{KV@#2#1@#3}{}{%
    \expandafter\let\csname KV@#2#1@#3\endcsname\relax
  }%
  \scr@ifundefinedorrelax{KV@#2#1@#3@default}{}{%
    \expandafter\let\csname KV@#2#1@#3@default\endcsname\relax
  }%
}
%</base>
%    \end{macrocode}
% \end{command}^^A \RelaxFamilyKey
%
% \begin{command}{\FamilyKeyState,\FamilyKeyStateProcessed,\FamilyKeyStateUnknown,
%                 \FamilyKeyStateUnknownValue,\FamilyKeyStateNeedValue}
% \changes{v3.12}{2013/03/04}{added}
% \cs{FamilyKeyState} is the state of processing a key. The initial state is
% \cs{FamilyKeyStateUnknown}, so the state is indeed unknown. If a key has
% been processed by the definition code and everything is OK, you should run
% \cs{FamilyKeyStateProcessed}. This will set \cs{FamilyKeyState} also to
% \cs{FamilyKeyStateProcessed} to indicate, the key has been processed
% successfully. If the value assigned to the key is unknown, you should run
% \cs{FamilyKeyStateUnknownValue}. And if the value is needed but no value has
% been assigned, \cs{FamilyKeyStateNeedValue} is the correct choice. Note:
% \cs{FamilyKeyState} is valid only immediately after processing a key.
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyKeyState}{}
\newcommand*{\FamilyKeyStateUnknown}{%
  \let\FamilyKeyState\FamilyKeyStateUnknown
}
\newcommand*{\FamilyKeyStateUnknownValue}{%
  \let\FamilyKeyState\FamilyKeyStateUnknownValue
}
\newcommand*{\FamilyKeyStateNeedValue}{%
  \let\FamilyKeyState\FamilyKeyStateNeedValue
}
\newcommand*{\FamilyKeyStateProcessed}{%
  \let\FamilyKeyState\FamilyKeyStateProcessed
}
\let\FamilyKeyState\FamilyKeyStateUnknown
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilyKeyState … \FamilyKeyStateNeedValue
%
% \begin{command}{\FamilyOfKey,\FamilyMemberOfKey}
% \changes{v3.12}{2013/03/04}{added}
% While processing a key, this is the family and the member of family.
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyOfKey}{}
\newcommand*{\FamilyMemberOfKey}{}
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilyOfKey,\FamilyMemberOfKey
%
% \begin{macro}{\KOMA@key}
% \changes{v2.97c}{2007/04/19}{optional argument added}
% \changes{v3.17}{2015/02/24}{rudimentary value storage}
% \pkg{keyval} keys of \KOMAScript{} are defined with \cs{KOMAkey} to setup
% the family to ``\texttt{KOMA}'' automatically. Additionally the value
% storage is initialized.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@key}[1][.\@currname.\@currext]{%
  \DefineFamilyMember[{#1}]{KOMA}%
  \@ifundefined{scr@kav@KOMA#1}{\@namedef{scr@kav@KOMA#1}{}}{}%
  \DefineFamilyKey[{#1}]{KOMA}%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@add}
% \changes{v3.17}{2015/02/24}{added}
% This macro stores a \texttt{\meta{key}=\meta{value}} pair in a internal
% list. The first argument is the family member, the second the \meta{key} and
% the third the \meta{value}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@add}[3]{%
  \@ifundefined{scr@kav@KOMA#1}{%
    \KOMA@internal@error\KOMA@kav@add{#1}%
  }{%
    \expandafter\l@addto@macro\csname scr@kav@KOMA#1\endcsname{\do{{#2}{#3}}}%
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@xadd}
% \changes{v3.17}{2015/02/24}{added}
% This macro stores a \texttt{\meta{key}=\meta{value}} pair in a internal
% list after expanding both, the \meta{key} and the \meta{value}. The first
% argument is the family member, the second the \meta{key} and the third the
% \meta{value}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@xadd}[3]{%
  \@ifundefined{scr@kav@KOMA#1}{%
    \KOMA@internal@error\KOMA@kav@xadd{#1}%
  }{%
    \protected@edef\reserved@a{{#2}{#3}}%
    \expandafter\l@addto@macro\csname scr@kav@KOMA#1\expandafter\endcsname
    \expandafter{\expandafter\do\expandafter{\reserved@a}}%
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@remove}
% \changes{v3.17}{2015/02/24}{added}
% This macro removes a \texttt{\meta{key}=\meta{value}} pair from the internal
% list. The first argument is the family member, the second the \meta{key} and
% the third the \meta{value}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@remove}[3]{%
  \@ifundefined{scr@kav@KOMA#1}{%
    \KOMA@internal@error\KOMA@kav@remove{#1}%
  }{%
    \begingroup
      \def\reserved@a{\endgroup\@namedef{scr@kav@KOMA#1}{}}%
      \edef\reserved@b{\detokenize{{#2}{#3}}}%
      \def\do##1{%
        \edef\reserved@c{\detokenize{##1}}%
        \ifx\reserved@b\reserved@c\else
          \l@addto@macro\reserved@a{%
            \expandafter\l@addto@macro\csname scr@kav@KOMA#1\endcsname{%
              \do{##1}%
            }%
          }%
        \fi
      }%
      \@nameuse{scr@kav@KOMA#1}%
    \reserved@a
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@removekey}
% \changes{v3.17}{2015/02/24}{added}
% This macro removes all \texttt{\meta{key}=\meta{value}} pairs of a given
% \meta{key} from the internal list. The first argument is the family member,
% the second the \meta{key}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@removekey}[2]{%
  \@ifundefined{scr@kav@KOMA#1}{%
    \KOMA@internal@error\KOMA@kav@removekey{#1}%
  }{%
    \begingroup
      \def\reserved@a{\endgroup\@namedef{scr@kav@KOMA#1}{}}%
      \edef\reserved@b{\detokenize{#2}}%
      \def\reserved@d##1##2{\edef\reserved@c{\detokenize{##1}}}%
      \def\do##1{%
        \reserved@d##1\relax
        \ifx\reserved@b\reserved@c\else
          \l@addto@macro\reserved@a{%
            \expandafter\l@addto@macro\csname scr@kav@KOMA#1\endcsname{%
              \do{##1}%
            }%
          }%
        \fi
      }%
      \@nameuse{scr@kav@KOMA#1}%
    \reserved@a
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@replacevalue,\KOMA@kav@xreplacevalue}
% \changes{v3.17}{2015/02/25}{added}
% If \cs{FamilyKeyState} is \cs{FamilyKeyStateProcessed},
% these macros replace a \texttt{\meta{key}=\meta{value}} pair in the internal list.
% The first argument is the family member, the second the \meta{key} and the
% third is the new \meta{value}. \cs{KOMA@kav@xreplacevalue} expands both, the
% \meta{key} and the \meta{value}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@replacevalue}[3]{%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \@ifundefined{scr@kav@KOMA#1}{%
      \KOMA@internal@error\KOMA@kav@replacevalue{#1}%
    }{%
      \KOMA@kav@removekey{#1}{#2}%
      \KOMA@kav@add{#1}{#2}{#3}%
    }%
  \fi
}
\newcommand*{\KOMA@kav@xreplacevalue}[3]{%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \@ifundefined{scr@kav@KOMA#1}{%
      \KOMA@internal@error\KOMA@kav@replacevalue{#1}%
    }{%
      \KOMA@kav@removekey{#1}{#2}%
      \KOMA@kav@xadd{#1}{#2}{#3}%
    }%
  \fi
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@replacebool}
% \changes{v3.17}{2015/02/24}{added}
% If \cs{FamilyKeyState} is \cs{FamilyKeyStateProcessed},
% this macro replaces the value of a if key in the internal list.
% The first argument is the family member, the second the \meta{key} and the
% third is the boolean switch (\cs{if\dots} statement) representing the new value.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@replacebool}[3]{%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \@ifundefined{scr@kav@KOMA#1}{%
      \KOMA@internal@error\KOMA@kav@replacebool{#1}%
    }{%
      \KOMA@kav@remove{#1}{#2}{false}%
      \KOMA@kav@remove{#1}{#2}{true}%
      \expandafter\ifx\csname if#3\expandafter\endcsname
                      \csname iftrue\endcsname
        \KOMA@kav@xadd{#1}{#2}{true}%
      \else
        \KOMA@kav@xadd{#1}{#2}{false}%
      \fi
    }%
  \fi
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@defall}
% \changes{v3.17}{2015/02/24}{added}
% This macro defines a macro/command with the \texttt{\meta{key}=\meta{value}}
% list of all stored pairs. The first argument is the macro/command to be
% defined with the list. The second is the family member.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@defall}[2]{%
  \@ifundefined{scr@kav@KOMA#2}{%
    \KOMA@internal@error\KOMA@kav@defall{#1}%
  }{%
    \begingroup
      \let\reserved@a\@empty
      \def\reserved@b##1##2{\l@addto@macro\reserved@a{,{##1=##2}}}%
      \def\do##1{\reserved@b##1}%
      \@nameuse{scr@kav@KOMA#2}%
      \ifx\reserved@a\@empty
        \def\reserved@b{\endgroup\let#1\@empty}%
      \else
        \edef\reserved@b{%
          \unexpanded{\endgroup\def#1}{%
            \unexpanded
            \expandafter\expandafter\expandafter{%
              \expandafter\@gobble\reserved@a}}}%
      \fi
    \reserved@b
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@kav@defone}
% \changes{v3.17}{2015/02/25}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% This macro defines a macro/command with all stored values of a \meta{key}
% from the internal list of \texttt{\meta{key}=\meta{value}} pairs.
% The first argument is the macro/command to be defined. The second is the
% family member and the third is the \meta{key}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@kav@defone}[3]{%
  \@ifundefined{scr@kav@KOMA#2}{%
    \KOMA@internal@error\KOMA@kav@defall{#1}%
  }{%
    \begingroup
      \let\reserved@a\@empty
      \def\reserved@b##1##2{%
        \Ifstr{##1}{#3}{\l@addto@macro\reserved@a{,{##2}}}{}%
      }%
      \def\do##1{\reserved@b##1}%
      \@nameuse{scr@kav@KOMA#2}%
      \ifx\reserved@a\@empty
        \def\reserved@b{\endgroup\let#1\@empty}%
      \else
        \edef\reserved@b{%
          \unexpanded{\endgroup\def#1}{%
            \unexpanded
            \expandafter\expandafter\expandafter{%
              \expandafter\@gobble\reserved@a}}}%
      \fi
    \reserved@b
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@internal@error}
% \changes{v3.17}{2015/02/24}{added}
% General internal error message with the recommendation to report a bug.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@internal@error}[2]{%
  \PackageError{scrkbase}{internal error using \string#1{#2}}{%
    You've found an internal error either in KOMA-Script or a third
    party\MessageBreak
    definition, that uses KOMA-Script internal macros.\MessageBreak
    Please send a bug report with a minimal but complete example,
    that\MessageBreak
    shows this error, to komascript at gmx dot info or report it
    at\MessageBreak 
    <http://www.komascript.de/forum/20> (you need an account to do so).%
  }%
}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Options}
%
% From version 2.97c \KOMAScript{} processes all options in the order they
% have been set and no longer in the order they have been defined. This is
% much more intuitive for users. Packages first process the global options
% then the local options.
%
% \begin{macro}{\@globaloptionslist}
% \changes{v2.96}{2006/11/26}{added}
% \changes{v2.96}{2006/11/26}{process class options}
% \changes{v3.20}{2016/02/06}{delay decisions}
% The lost of global options is sometimes needed. But because \pkg{xkeyval}
% has the opinion it should remove all options with equal char from the list
% of class options, we define out own macro with a copy of the class
% options. Until \KOMAScript{} 3.19a the copy has been done here. But if
% \pkg*{scrbase} is loaded before \cs{documentclass} this is too early. From
% \KOMAScript{} 3.20 the assignment has been moved to
% \cs{FamilyProcessOptions}. And from \KOMAScript{} 3.33 the normal class
% option list is only used if the raw option list is not available.
%    \begin{macrocode}
%<*base>
\newcommand*{\@globaloptionslist}{}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scr@removeunused,\scr@optiontest,\scr@pti@ntest}
% \changes{v2.97c}{2007/04/18}{added}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \scr@removeunused,\scr@optiontest,\scr@pti@ntest
%
% \begin{command}{\FamilyProcessOptions}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.11a}{2012/06/11}{classes do not report errors for unknown values}
% \changes{v3.12}{2013/03/04}{error handling}
% \changes{v3.33}{2021/03/02}{new version using raw options lists of \LaTeX{}
%   2021/05/01}
% Note: Wrong values should not result in errors or warnings and only seldom
% in information. The best is to signal all kind of errors via
% \cs{FamilyKeyState}. Only values, that cannot be handled by any family
% member have to be reported. This is done inside \cs{FamilyProcessOptions}
% depending on \cs{FamilyKeyState} of each member.
% Note also: This command is not re-entrant. So it cannot be used while
% processing another option.
% Note also: We use 2021/05/01 instead of the official \LaTeX{} release date,
% to detect a \LaTeX{} kernel version with raw option lists, because there
% were relevant earlier \LaTeX{} developer releases with that date.
%    \begin{macrocode}
%<*base>
\IncludeInRelease{2021/05/01}{\FamilyProcessOptions}%
                             {Usage of raw or classic option list}
\newcommand*{\FamilyProcessOptions}[2][.\@currname.\@currext]{%
%    \end{macrocode}
% Before processing of the options we have to execute an initialise several
% hooks:
%    \begin{macrocode}
  \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
    \PackageError{scrbase}{nested \string\FamilyProcessOptions\space
      detected\MessageBreak}{%
      \string\FamilyProcessOptions\space has been used while processing or
      setting options.\MessageBreak
      This is currently not allowed. You should contact the author of the
      causing\MessageBreak
      code.\MessageBreak
      This error is fatal. You should not continue.%
    }%
  \fi
  \scr@ifundefinedorrelax{scr@before@process@options@#2@hook}{}{%
    \@nameuse{scr@before@process@options@#2@hook}%
  }%
  \scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{}{%
    \@nameuse{scr@before@process@options@#2#1@hook}%
    \expandafter\let\csname scr@before@process@options@#2#1@hook\endcsname
    \relax
  }%
  \scr@ifundefinedorrelax{scr@after@options@#2@hook}{%
    \@namedef{scr@after@options@#2@hook}{%
      \@namedef{scr@after@options@#2@hook}{}%
    }%
  }{%
    \expandafter\edef\csname scr@after@options@#2@hook\endcsname{%
      \noexpand\@namedef{scr@after@options@#2@hook}{%
        \unexpanded\expandafter\expandafter\expandafter
        {\csname scr@after@options@#2@hook\endcsname}%
      }%
    }%
  }%
  \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
    \@namedef{scr@after@options@#2@hook@topmost}{%
      \@namedef{scr@after@options@#2@hook@topmost}{}%
    }%
    \expandafter\l@addto@macro\csname scr@after@options@#2@hook\endcsname{%
      \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
      \@nameuse{scr@after@options@#2@hook@topmost}%
    }%
    \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
  \fi
  \let\ds@\@empty
%    \end{macrocode}
% Here we set up \cs{@curroptions} to the raw options of the current class or
% package or empty if the options are not defined.
%    \begin{macrocode}
  \@ifundefined{@raw@opt@\@currname.\@currext}{%
    \let\@curroptions\@empty
  }{%
    \expandafter\let\expandafter\@curroptions
    \csname @raw@opt@\@currname.\@currext\endcsname
  }%
%    \end{macrocode}
% If this is not a class, we first have to process all raw class options.
% \changes{v3.33}{2021/03/12}{switched to fast test like \LaTeX{} 2021/06/01}
% \changes{v3.34}{2021/05/30}{use \cs{@raw@classoptionslist} only, if defined}
% Note, if \pkg*{scrbase} or a depending package is loaded before the class,
% \cs{@raw@classoptionslist} should not be processed.
%    \begin{macrocode}
  \ifx\@currext\@clsextension\else
    \@ifundefined{@raw@classoptionslist}{}{%
      \@for\CurrentOption:=\@raw@classoptionslist\do{%
        \scr@trim@spaces\CurrentOption
        \ifx\CurrentOption\@empty\else
          \@ifundefined{ds@\CurrentOption}{%
            \scr@ifprocess@curroption{#1}{#2}{%
              \@expandtwoargs\@removeelement{%
                \expandafter\@remove@eq@value\CurrentOption=\@nil}%
              \@unusedoptionlist\@unusedoptionlist
            }{}%
          }{%
            \@use@ption
            \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
          }%
        \fi
      }%
    }%
  \fi
%    \end{macrocode}
% \changes{v3.34}{2021/06/05}{extra test because of \LaTeX{} raw option issue}
% Afterwards we have to process the current options. Unfortunately there is an
% issue with the raw option list of the \LaTeX{} kernel, that could result in
% \cs{CurrentOption} in the option list instead of the one step expansion of
% \cs{CurrentOption} (see
% \url{https://sourceforge.net/p/koma-script/tickets/10/}). This would result
% in an infinite loop using the usual loop:
%    \begin{macrocode}
%<*dontusethis>
  \@for\CurrentOption:=\@curroptions\do{%
    \scr@trim@spaces\CurrentOption
    \@ifundefined{ds@\CurrentOption}{%
      \@use@ption
      \scr@ifprocess@curroption{#1}{#2}{}\default@ds
    }\@use@ption
  }%
%</dontusethis>
%    \end{macrocode}
% So for a little more rosbustnes we do an extra test.
%    \begin{macrocode}
  \@for\reserved@a:=\@curroptions\do{%
    \scr@trim@spaces\reserved@a
    \def\reserved@b{\CurrentOption}%
    \ifx\reserved@a\reserved@b
      \PackageError{scrbase}{%
        \string\CurrentOption\space loop detected\MessageBreak
        Perhaps someone uses:\MessageBreak\space\space
        \ifx\@currext\@clsextension
          \string\PassOptionsToClass
        \else
          \string\PassOptionsToPackage
        \fi
        {\string\CurrentOption}{…}.\MessageBreak
        With LaTeX 2020/10/01 or 2021/06/01 this results in
        \string\CurrentOption\MessageBreak
        in the raw option list and therefore is not allowed.\MessageBreak
        Please ask the class or package author to use:\MessageBreak\space\space
        \string\expandafter
        \ifx\@currext\@clsextension
          \string\PassOptionsToClass
        \else
          \string\PassOptionsToPackage
        \fi
        \MessageBreak\space\space\space
        \string\expandafter{\string\CurrentOption}{…}\MessageBreak
        instead or update LaTeX (if possible)%
      }%
      \let\CurrentOption\@empty
    \else
      \let\CurrentOption\reserved@a
    \fi
    \@ifundefined{ds@\CurrentOption}{%
      \@use@ption
      \scr@ifprocess@curroption{#1}{#2}{}\default@ds
    }\@use@ption
  }%
%    \end{macrocode}
% Clear all the definitions for declared options and the current option. Then
% reset the marker macro, initiate emptying the unprocessed options list of
% the current file and execute the exit hook.
%    \begin{macrocode}
  \@for\CurrentOption:=\@declaredoptions\do{%
    \expandafter\let\csname ds@\CurrentOption\endcsname\relax}%
  \let\CurrentOption\@empty
  \let\@fileswith@pti@ns\@@fileswith@pti@ns
  \AtEndOfPackage{\expandafter\let
    \csname unprocessedoptions-\@currname.\@currext\endcsname
    \relax}%
  \@nameuse{scr@after@options@#2@hook}%
}
\EndIncludeInRelease
%    \end{macrocode}
% And here the old version for old \LaTeX{} kernel version:
%    \begin{macrocode}
\IncludeInRelease{0000/00/00}{\FamilyProcessOptions}%
                             {Usage of raw or classic option list}
\newcommand*{\FamilyProcessOptions}[2][.\@currname.\@currext]{%
  \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
    \PackageError{scrbase}{nested \string\FamilyProcessOptions\space
      detected\MessageBreak}{%
      \string\FamilyProcessOptions\space has been used while processing or
      setting options.\MessageBreak
      This is currently not allowed. You should contact the author of the
      causing\MessageBreak
      code.\MessageBreak
      This error is fatal. You should not continue.%
    }%
  \fi
%    \end{macrocode}
% \changes{v3.18}{2015/06/17}{new hooks before processing the options}
% From version 3.18 we execute two hooks. The first one is valid for all
% classes and packages of a family. This is multi-time hook, not deleting
% itself. The second one is valid only one time for one member.
%    \begin{macrocode}
  \scr@ifundefinedorrelax{scr@before@process@options@#2@hook}{}{%
    \@nameuse{scr@before@process@options@#2@hook}%
  }%
  \scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{}{%
    \@nameuse{scr@before@process@options@#2#1@hook}%
    \expandafter\let\csname scr@before@process@options@#2#1@hook\endcsname
    \relax
  }%
%    \end{macrocode}
% \changes{v3.23}{2017/02/16}{fix: the after hook uses the family instead of
% the member}
% Initialization of \cs{AtEndOfFamilyOptions} inclusive hook.
%    \begin{macrocode}
  \scr@ifundefinedorrelax{scr@after@options@#2@hook}{%
    \@namedef{scr@after@options@#2@hook}{%
%    \end{macrocode}
% The first hook action is to delete the hook.
%    \begin{macrocode}
      \@namedef{scr@after@options@#2@hook}{}%
    }%
  }{%
    \expandafter\edef\csname scr@after@options@#2@hook\endcsname{%
%    \end{macrocode}
% The first action in the hook is to reactivate the current hook.
%    \begin{macrocode}
      \noexpand\@namedef{scr@after@options@#2@hook}{%
        \unexpanded\expandafter\expandafter\expandafter
        {\csname scr@after@options@#2@hook\endcsname}%
      }%
    }%
  }%
%    \end{macrocode}
% \changes{v3.23}{2017/02/16}{new hook added for \cs{AtEndOfFamilyOptions*}}
% From version 3.23 there is one more hook before \cs{AtEndOfFamilyOptions*}
% to be initialized and executed. We can detect the topmost level comparing
% the definition of \cs{AtEndOfFamilyOptions}. This is faster than by the
% definition of the hook itself (we have to do so in \cs{FamilyOptions}).
%    \begin{macrocode}
  \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
    \@namedef{scr@after@options@#2@hook@topmost}{%
%    \end{macrocode}
% The hook definitions also contains the hook deletion. This is important for
% recursive calls, to distinguish lower levels from the topmost level.
%    \begin{macrocode}
      \@namedef{scr@after@options@#2@hook@topmost}{}%
    }%
%    \end{macrocode}
% The top hook is added to the hook of the (topmost) level, while resetting
% the definition of \cs{AtEndOfFamilyOptions}.
%    \begin{macrocode}
    \expandafter\l@addto@macro\csname scr@after@options@#2@hook\endcsname{%
      \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
      \@nameuse{scr@after@options@#2@hook@topmost}%
    }%
%    \end{macrocode}
% Don't forget to change the command to fill one of the hooks from immediate
% execution to adding code to the corresponding hook.
%    \begin{macrocode}
    \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
  \fi
%    \end{macrocode}
% Continue the adaption of code from \cs{ProcessOptions}.
%    \begin{macrocode}
  \let\ds@\@empty
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}%
  \ifx\@currext\@clsextension\else
%    \end{macrocode}
% Within classes the current option list is same like the global option
% list. So classes are not allowed to process the global option list
% additionally to the local one. But packages do process the global option
% list, but do not report errors or warnings about these options.
% \changes{v3.18}{2015/06/17}{handling of not defined \cs{@globaloptionslist}}
% \changes{v3.20}{2016/02/06}{\cs{@globaloptionslist} assignment always}
%    \begin{macrocode}
    \let\@globaloptionslist\@classoptionslist
    \scr@ifundefinedorrelax{XKV@classoptionslist}{%
%<trace>    \PackageInfo{scrbase}{Using \string\@classoptionslist}%
    }{%
      \ifx\XKV@classoptionslist\@empty
%<trace>        \PackageInfo{scrbase}{Using \string\@classoptionslist}%
      \else
%<trace>        \PackageInfo{scrbase}{Using \string\XKV@classoptionslist}%
        \let\@globaloptionslist\XKV@classoptionslist
      \fi
    }%
    \scr@ifundefinedorrelax{@globaloptionslist}{}{%
      \@for\CurrentOption:=\@globaloptionslist\do{%
%    \end{macrocode}
% The options are processed in the order they have been set into the global
% option list. But only these options are processed, that are not empty and
% that are known by the current package. So these are only classic options not
% \pkg{keyval} options.
%    \begin{macrocode}
        \ifx\CurrentOption\@empty\else
          \@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}%
          \ifin@
            \@use@ption
            \expandafter\let\csname ds@\CurrentOption\endcsname\@empty
          \else
%    \end{macrocode}
% But if they are not classic options, they could be \pkg{keyval} options. In
% this case we test, if member (\texttt{\#1}) of family (\texttt{\#2}) has
% such an option. If this is the case, the options is executed once with
% member and once again with member. In case of an unknown key or value
% nothing else happens.
%    \begin{macrocode}
            \scr@ifprocess@curroption{#1}{#2}{%
              \@expandtwoargs\@removeelement\CurrentOption
              \@unusedoptionlist\@unusedoptionlist
            }{}%
          \fi
        \fi
      }%
    }%
  \fi
%    \end{macrocode}
% Now, processing local options of classes and packages follows. In this case
% unknown options (keys) or values of packages immediately can result in error
% messages. But in classes they are only added to the list of unused global
% options.
%    \begin{macrocode}
  \@for\CurrentOption:=\@curroptions\do{%
%    \end{macrocode}
% \changes{v3.26}{2018/10/22}{options are not fully expanded for the tests}
% \changes{v3.26}{2018/10/22}{\cs{@use@ption} is not used for
%   \texttt{\meta{key}\quotechar=\meta{value}} options}
% From \KOMAScript~3.26 the options are not fully expanded to test, if it is a
% classic option. The essential expansion already has been done. So removing
% the full expansion avoids errors because of missing
% \cs{endcsname}. Additionally using \cs{@use@option} hat been removed for all
% \texttt{\meta{key}=\meta{value}} options, because this would result in the
% same error because of the |\csname ds@\CurrentOption\endcsname|, that is
% used inside \cs{@use@option}. Instead of \cs{@use@option} we just remove the
% option from the list of unused options.
%    \begin{macrocode}
    \edef\reserved@a{\expandafter\detokenize\expandafter{\CurrentOption}}%
    \scr@ifundefinedorrelax{ds@\reserved@a}{%
      \@expandtwoargs\@removeelement\CurrentOption
      \@unusedoptionlist\@unusedoptionlist
      \scr@ifprocess@curroption{#1}{#2}{}\default@ds
    }\@use@ption
  }%
%    \end{macrocode}
% Almost at the end we delete the options code of all declared options. This
% is the same as with the \LaTeX{} kernel command
% \cs{ProcessOptions*}. Additionally at the end of the package (not
% \pkg*{tocbasic} but the package, that is using the command) all unprocessed
% options are processed.
% \changes{v3.33}{2021/02/15}{prepared for \LaTeX{} 2020/10/01}
%    \begin{macrocode}
  \@for\CurrentOption:=\@declaredoptions\do{%
    \expandafter\let\csname ds@\CurrentOption\endcsname\relax}%
  \let\CurrentOption\@empty
  \let\@fileswith@pti@ns\@@fileswith@pti@ns
  \IfLTXAtLeastTF{2020/10/01}{%
    \AtEndOfPackage{\expandafter\let
      \csname unprocessedoptions-\@currname.\@currext\endcsname
      \relax}%
  }{%
    \AtEndOfPackage{\let\@unprocessedoptions\relax}%
  }%
%    \end{macrocode}
% Last but not least the hook has to be executed and (self-)deleted.
% \changes{v3.23}{2017/02/16}{fix using family instead of member}
%    \begin{macrocode}
  \@nameuse{scr@after@options@#2@hook}%
}
\EndIncludeInRelease
\@onlypreamble\FamilyProcessOptions
%    \end{macrocode}
% \begin{command}{\BeforeFamilyProcessOptions}
% \changes{v3.18}{2015/06/17}{added}
% Add code to the hook used immediately before executing the options via
% \cs{FamilyProcessOptions}. Neither the family nor the member need to
% exist. So you are able to already add code to the hook before the class or
% package has been loaded.
%    \begin{macrocode}
\newcommand*{\BeforeFamilyProcessOptions}[3][.\@currname.\@currext]{%
  \scr@ifundefinedorrelax{scr@before@process@options@#2#1@hook}{%
    \@namedef{scr@before@process@options@#2#1@hook}{#3}%
  }{%
    \expandafter\g@addto@macro
    \csname scr@before@process@options@#2#1@hook\endcsname{#3}%
  }%
}
%    \end{macrocode}
% \end{command}^^A \BeforeFamilyProcessOptions
% \begin{command}{\AtEndOfFamilyOptions}
% \changes{v3.12}{2013/03/04}{added}
% \changes{v3.23}{2017/02/16}{star variant added}
% Inside the code of an option you can delay execution of code till the end of
% the current \cs{FamilyProcessOptions}, \cs{FamilyExecuteOptions},
% \cs{FamilyOptions} or \cs{FamilyOption}. The only argument is the code. The
% argument is delegated to \cs{l@addto@macro} (instead of reading it
% directly). The non-star variant delays only till the end of the current
% level. The star-variant delays till the end of all levels.
% \begin{macro}{\scr@AtEndOfFamilyOptions}
% \changes{v3.12}{2013/05/29}{added}
% \begin{macro}{\scr@@AtEndOfFamilyOptions,\scr@AtEndOfFamilyOptions@immediate}
% \changes{v3.23}{2017/02/16}{added}
%    \begin{macrocode}
\newcommand*{\scr@AtEndOfFamilyOptions}{%
  \kernel@ifstar {\scr@@AtEndOfFamilyOptions{@topmost}}%
                 {\scr@@AtEndOfFamilyOptions\@empty}%
}
\newcommand*{\scr@@AtEndOfFamilyOptions}[1]{%
  \expandafter
  \l@addto@macro\csname scr@after@options@\FamilyOfKey @hook#1\endcsname
}
\newcommand*{\scr@AtEndOfFamilyOptions@immediate}{%
  \kernel@ifstar {\@firstofone}{\@firstofone}%
}
\newcommand*{\AtEndOfFamilyOptions}{}
\let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
%    \end{macrocode}
% \end{macro}^^A \scr@@AtEndOfFamilyOptions,\scr@AtEndOfFamilyOptions@immediate
% \end{macro}^^A \scr@AtEndOfFamilyOptions
% \end{command}^^A \AtEndOfFamilyOptions
% \begin{macro}{\scr@ifprocess@curroption}
% \changes{v3.13}{2014/01/04}{brackets around \cs{CurrentOption} inside \cs{setkeys}}
% This macro executes the current \pkg{keyval} option for member
% \texttt{\#1} of family \texttt{\#2}. If the option does not know the value,
% the forth argument is used. Otherwise it is ignored. Note, before the member
% option the family option is executed. If this is successful the member does
% not need to know the option.
%    \begin{macrocode}
\newcommand*\scr@ifprocess@curroption[2]{%
%    \end{macrocode}
% \changes{v3.26}{2018/10/22}{using \cs{scr@sp@def} instead of \cs{def} for
%   splitting the key}
% Because white spaces are not always and forever removed from the option
% list, here \cs{scr@sp@def} is used to eliminate unwanted white spaces before
% the key, before and after the equal sign and at the end of the value.
%    \begin{macrocode}
  \def\reserved@a##1=##2\@nil{\scr@sp@def\reserved@a{##1}}%
  \expandafter\reserved@a\CurrentOption=\@nil
  \scr@ifundefinedorrelax{KV@#2@\reserved@a}{%
    \scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{%
      \let\FamilyKeyState\OptionNotUsed
    }{%
      \protected@edef\reserved@b{\noexpand\setkeys{#2#1}{{\CurrentOption}}%
        \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
      \reserved@b
      \ifx\FamilyKeyState\FamilyKeyStateUnknown
        \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
          Processing option `\CurrentOption'\MessageBreak
          of member `#1' of family\MessageBreak
          `#2' doesn't set\MessageBreak
          a valid state. This will be interpreted\MessageBreak
          as \string\FamilyKeyStateProcessed
        }%
        \FamilyKeyStateProcessed
      \fi
    }{%
      \let\FamilyKeyState\OptionNotUsed
    }%
  }{%
    \protected@edef\reserved@b{\noexpand\setkeys{#2}{{\CurrentOption}}%
      \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
    \reserved@b
    \ifx\FamilyKeyState\FamilyKeyStateUnknown
      \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
        Processing option `\CurrentOption'\MessageBreak
        of family `#2'\MessageBreak
        doesn't set a valid state.\MessageBreak
        This will be interpreted\MessageBreak
        as \string\FamilyKeyStateProcessed
      }%
      \FamilyKeyStateProcessed
    \fi
    \def\reserved@a##1=##2\@nil{\scr@sp@def\reserved@a{##1}}%
    \expandafter\reserved@a\CurrentOption=\@nil
    \scr@ifundefinedorrelax{KV@#2#1@\reserved@a}{}{%
      \protected@edef\reserved@b{\noexpand\setkeys{#2#1}{{\CurrentOption}}%
        \noexpand\def\noexpand\CurrentOption{\CurrentOption}}%
      \ifx\FamilyKeyState\FamiliyKeyStateProcessed
        \reserved@b
        \FamilyKeyStateProcessed
      \else
        \reserved@b
        \ifx\FamilyKeyState\FamilyKeyStateUnknown
          \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
            Processing option `\CurrentOption'\MessageBreak
            of member `#1' of family\MessageBreak
            `#2' doesn't set\MessageBreak
            a valid state. This will be interpreted\MessageBreak
            as \string\FamilyKeyStateProcessed
          }%
          \FamilyKeyStateProcessed
        \fi
      \fi
    }%
  }%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%    \end{macrocode}
% \begin{macro}{\scr@sp@d,\scr@sp@b,\scr@sp@c,\scr@sp@def}
% \changes{v3.26}{2018/08/29}{moved from \file{tocbasic.dtx} to
%   \file{scrkernel-basics.dtx} and renamed}
% \changes{v3.26b}{2019/01/17}{\cs{long}}
% The helper macro \cs{scr@sp@def} defines a macro (\texttt{\#1}) to contain a
% token list (\texttt{\#2}) and removes tailing spaces at the beginning an the
% end. The original definition was from \pkg{keyval}. The other macros are
% helpers to realize \cs{scr@sp@def}.
%    \begin{macrocode}
\def\@tempa#1{%
  \long\def\scr@sp@def##1##2{%
    \futurelet\scr@sp@tempa\scr@sp@d##2\@nil\@nil#1\@nil\relax##1}%
  \def\scr@sp@d{%
    \ifx\scr@sp@tempa\@sptoken
      \expandafter\scr@sp@b
    \else
      \expandafter\scr@sp@b\expandafter#1%
    \fi}%
  \long\def\scr@sp@b#1##1 \@nil{\scr@sp@c##1}%
}
\@tempa{ }
\long\def\scr@sp@c#1\@nil#2\relax#3{\@temptokena{#1}\edef#3{\the\@temptokena}}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@sp@d,\scr@sp@b,\scr@sp@c,\scr@sp@def
% \end{macro}^^A \scr@process@curroption
% \end{command}^^A \FamilyProcessOptions
%
% \begin{command}{\KOMAProcessOptions}
% \changes{v2.97c}{2007/04/18}{added}
% \changes{v3.00}{2008/04/30}{no optional argument}
% This command executes all options, not only classic declared by
% \cs{DeclareOption} or \cs{DeclareOption*}, but also \pkg{keyval} options in
% the order these options have been used (not declared). For packages first
% the global options, than the local options. For classes global and local
% options are the same and only local options are processed. This is similar
% to the \LaTeX{} kernel command \cs{ProcessOptions*} (with the difference of
% processing \pkg{keyval} options too). Family options are always executed
% before member options.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAProcessOptions}{\FamilyProcessOptions{KOMA}}
\@onlypreamble\KOMAProcessOptions
%</koma>
%    \end{macrocode}
% \end{command}
%
% \begin{macro}{\scr@trim@spaces}
% \changes{v3.12}{2013/11/06}{added}
% \changes{v3.26}{2018/08/29}{moved from \file{scrkernel-language.dtx} to
%   \file{scrkernel-basics.dtx}}
% \changes{v3.33}{2021/03/02}{moved to preparation section}
% Helper macro to remove white spaces from the beginning or the end. This is
% useful for list processing with \cs{@for} to remove spaces before or after
% commas. The argument is a macro with the string to be trimmed and the result
% is stored again in this macro.
%    \begin{macrocode}
%<*base>
\newcommand\scr@trim@spaces[1]{%
  \expandafter\scr@sp@def\expandafter#1\expandafter{#1}%
}
%</base>
%</prepare>
%    \end{macrocode}
% \end{macro}^^A \scr@trim@space
%
%
% \begin{option}{internalonly}
% \changes{v2.96}{2006/11/26}{added}
% \changes{v2.97c}{2007/06/20}{no argument needed}
% \changes{v3.27a}{2019/11/04}{\cs{FamilyKeyStateProcessed} added}
% \changes{v3.27a}{2019/11/04}{defined only inside the package}
% \changes{v3.27a}{2019/11/04}{defined temporary inside the classes}
% \changes{v3.28}{2019/11/18}{deprecated}
% \begin{macro}{\dont@let@as@internal@defined}
% \changes{v2.96}{2006/11/26}{added}
% \changes{v3.28}{2019/11/18}{removed}
% \end{macro}
%    \begin{macrocode}
%<*option>
%<*base>
\DefineFamily{KOMA}
\DefineFamilyMember{KOMA}
\DefineFamilyKey{KOMA}{internalonly}[\relax]{%
  \PackageInfo{scrbase}{Ignoring deprecated option `internalonly'}%
  \FamilyKeyStateProcessed
}
\AtEndOfPackage{%
  \RelaxFamilyKey[.scrbase.sty]{KOMA}{internalonly}%
}
%</base>
%    \end{macrocode}
% If \pkg*{scrbase} has been loaded before the class, the option will be
% reported as unused, despite it already has been processed. We could solve
% this using a dummy option inside the classes. However, because the option is
% deprecated the following code should never been used.
%    \begin{macrocode}
%</option>
%<*load&class&neveruse>
\KOMA@key{internalonly}[\relax]{%
  \FamilyKeyStateProcessed
}
\AtEndOfClass{\RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{internalonly}}%
%</load&class&neveruse>
%<*option>
%    \end{macrocode}
% \end{option}
%
%
% \changes{v2.96}{2006/08/20}{processing options}
% \changes{v2.97c}{2007/04/18}{using \cs{KOMAProcessOptions} for processing options}
%    \begin{macrocode}
%<koma>\KOMAProcessOptions\relax
%<base>\FamilyProcessOptions{KOMA}\relax
%</option>
%<*body>
%    \end{macrocode}
%
%
% \subsection{Some additional math missing from \eTeX}
%
% \begin{command}{\XdivY}
% \changes{v3.05a}{2010/03/10}{added}
% \meta{X} divided by \meta{Y} and rounded to the lower integer.
%    \begin{macrocode}
%<*base>
\newcommand*{\XdivY}[2]{%
  \numexpr ( #1 + #2 / 2 ) / #2 - 1\relax
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\XmodY}
% \changes{v3.05a}{2010/03/10}{added}
% \meta{X} modulo \meta{Y} (rest of integer division \meta{X} divided by \meta{Y}).
%    \begin{macrocode}
%<*base>
\newcommand*{\XmodY}[2]{%
  \numexpr #1 - #2 * \XdivY{#1}{#2}\relax
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \subsection{Often needed commands and macros}
%
% \begin{macro}{\scr@ForEachTrimmedListElement}
% \changes{v3.27}{2019/04/16}{new (internal)}
% Executes \cs{\#2\{\meta{element}\}} for each \meta{element} of the comma
% separated list \#1. Spaces before for after \meta{element} are eliminated
% and empty elements are ignored.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ForEachTrimmedListElement}[2]{%
  \begingroup
    \def\reserved@a{\endgroup}%
    \@for \reserved@b:=#1 \do {%
      \scr@trim@spaces\reserved@b
      \ifx\reserved@b\@empty\else
        \edef\reserved@a{%
          \unexpanded\expandafter{\reserved@a#2}%
          {\unexpanded\expandafter{\reserved@b}}%
        }%
      \fi
    }%
  \reserved@a
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ForEachTrimmedListElement
%
% \begin{macro}{\@atdocumenttrue,\@atdocumentfalse,\if@atdocument}
% \changes{v2.95}{2002/12/05}{added}
% The boolean switch becomes true while |\begin{document}|. \KOMAScript{} uses
% it for commands and macros, which are different in the document preamble and
% the document body.
%    \begin{macrocode}
%<*base>
\newif\if@atdocument
\AtBeginDocument{\@atdocumenttrue}
\@onlypreamble\@atdocumentrue
\@onlypreamble\@atdocumentfalse
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\let@as@internal@defined}
% \changes{v2.95}{2002/08/19}{added}
% \changes{v2.95c}{2006/08/12}{warning while redefining}
% \changes{v2.96}{2006/11/26}{making user commands from internal macros can
%   be banned for single macros}
% \changes{v2.97c}{2007/06/20}{making user commands from internal macros can
% generally banned}
% \changes{v3.10}{2010/10/26}{\cs{ignorespaces} at \cs{document} patch added}
% \changes{v3.13a}{2014/08/13}{unwanted white spaces removed}
% \changes{v3.28}{2019/11/18}{removed}
% \end{macro}
%
% \begin{command}{\ifundefined,\ifundefinedorrelax,\Ifundefinedorrelax}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v2.95c}{2006/08/12}{using an internal macro to define it}
% \changes{v2.97c}{2007/06/20}{\cs{ifundefinedorrelax} replaces \cs{ifundefined}}
% \changes{v3.28}{2019/11/18}{\cs{ifundefinedorrelax} renamed to
%   \cs{Ifundefinedorrelax}}
% \changes{v3.29}{2020/01/17}{fix of missing backslash}
% Same as \cs{scr@ifundefinedorrelax} but at user level.
%    \begin{macrocode}
%<*base>
\newcommand*{\Ifundefinedorrelax}{\scr@ifundefinedorrelax}%
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\ifnotundefined,\Ifnotundefined}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v2.95c}{2006/08/12}{using \eTeX{} if possible}
% \changes{v3.02c}{2009/02/19}{\eTeX{} is mandatory}
% \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} renamed to \cs{Ifnotundefined}}
% This is the opposite to \cs{Ifundefinedorrelax}. Sometimes it is useful.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifnotundefined}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifnotundefined'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifnotundefined' by `\string\Ifnotundefined'%
  }%
  \Ifnotundefined
}
\newcommand{\Ifnotundefined}[1]{%
  \ifcsname #1\endcsname
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\ifstr,\Ifstr}
% \changes{v2.95}{2004/07/20}{\meta{if code} and \meta{then code} delegated
%   after the command execution}
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr} (but still
% available as deprecated command)}
% This command compares two fully expanded token lists. So an alternative name
% would be \cs{Ifxequal}.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifstr}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifstr'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifstr' by `\string\Ifstr'%
  }%
  \Ifstr
}
\newcommand\Ifstr[2]{%
  \begingroup\protected@edef\reserved@a{#1}\protected@edef\reserved@b{#2}%
  \ifx\reserved@a\reserved@b
    \endgroup\expandafter\@firstoftwo
  \else
    \endgroup\expandafter\@secondoftwo
  \fi
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\ifstrstart,\Ifstrstart}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart} (but
%   still available as deprecated command)}
% If the expansion of the first argument starts with expansion of the second
% one use the third argument, otherwise the fourth.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifstrstart}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifstrstart'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifstrstart' by `\string\Ifstrstart'%
  }%
  \Ifstrstart
}
\newcommand*{\Ifstrstart}[2]{%
  \begingroup
    \edef\reserved@a{\noexpand\@ifstrstart{#1}{#2}}%
    \reserved@a{\aftergroup\@firstoftwo}{\aftergroup\@secondoftwo}%
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\@ifstrstart}
% \changes{v3.12}{2013/11/05}{added}
% Helper.
%    \begin{macrocode}
\newcommand*{\@ifstrstart}[2]{%
  \def\reserved@a ##1#2##2\@nil{%
    \if\relax\detokenize{##1}\relax
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
  }%
  \reserved@a#1#2\@nil
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \@ifstrstart
% \end{command}^^A \ifstrstart,\Ifstrstart
%
% \begin{command}{\IfArgIsEmpty}
% \changes{v3.19}{2015/08/29}{added}
% \changes{v3.27}{2019/03/11}{\cs{long}}
% \changes{v3.27}{2019/07/19}{needed already to process options}
% If the first argument is absolutely empty execute the second one, otherwise
% the third one.
%</body>
%<*prepare>
%<*base>
%    \begin{macrocode}
\newcommand{\IfArgIsEmpty}[1]{%
  \if\relax\detokenize{#1}\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%    \end{macrocode}
%</base>
%</prepare>
%<*body>
% \end{command}^^A \IfArgIsEmpty
%
%
% \begin{command}{\ifislengthprimitive,\Ifislengthprimitive}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.36}{2022/02/17}{\cs{ifislengthprimitive} renamed to
%   \cs{Ifislengthprimitive} (but still defined as deprecated)}
% If the first argument expands to a primitive, that can be used as a length,
% execute the second argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifislengthprimitive}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifislengthprimitive'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifislengthprimitive' by `\string\Ifislengthprimitive'%
  }%
  \Ifislengthprimitive
}
\newcommand*{\Ifislengthprimitive}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifislengthprimitive#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifislengthprimitive}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Helper macro to test against several length like \TeX{} primitives.
%    \begin{macrocode}
\newcommand*{\scr@ifislengthprimitive}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifislengthprimitive
    }{%
      \def\reserved@c{\aftergroup\scr@secondoftwoAfterNil}%
      \@for\reserved@a:=\baselineskip,\dp,\hsize,\ht,\lineskip,%
                        \parindent,\parskip,\pdfpageheight,\pdfpagewidth,%
                        \wd,\vsize \do {%
        \expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{%
          \meaning #1%
        }{%
          \def\reserved@c{\aftergroup\scr@TestDimenAssignTillNil}%
        }%
      }%
      \reserved@c
    }%
  \endgroup
  #1%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifislengthprimitive
% \end{command}^^A \ifislengthprimitive,\Ifislengthprimitive
%
%
% \begin{command}{\ifisdimen,\Ifisdimen}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisdimen} renamed to \cs{Ifisdimen} (but
%   still defined as deprecated command)}
% If the first argument expands to a \cs{dimen} register (and nothing else),
% execute the second argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisdimen}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisdimen'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisdimen' by `\string\Ifisdimen'%
  }%
  \Ifisdimen
}
\newcommand*{\Ifisdimen}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimen#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisdimen}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{dimen} register.
%    \begin{macrocode}
\newcommand*{\scr@ifisdimen}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisdimen
    }{%
      \Ifstrstart{\meaning #1}{\string\dimen}{%
        \aftergroup\scr@TestDimenAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%    \end{macrocode}
% \end{macro}^^A \scr@ifisdimen
% \begin{macro}{\scr@TestDimenAssignTillNil}
% \changes{v3.20}{2015/10/19}{added}
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary
% length. If this uses the argument completely, the argument \texttt{\#2} behind
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case
% \texttt{\#1} will removed from the input totally.
%    \begin{macrocode}
\newcommand*\scr@TestDimenAssignTillNil{}
\def\scr@TestDimenAssignTillNil#1\@nil{%
  \begingroup
    \afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil
    \@tempdima=#1\relax\@nnil
}
%    \end{macrocode}
% \begin{macro}{\scr@IfAfterEndgroupArgIsRelaxTillNnil,\scr@IfArgIsRelaxAfterRelaxTillNnil}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% The helper macros read an argument delimited by \cs{@nnil}. If this
% arguments consists of a number of \cs{relax} only, the second argument (first
% behind \cs{@nnil}) will be execute, otherwise the third (second behind \cs{@nnil}).
%    \begin{macrocode}
\newcommand*\scr@AfterEndGroupIfArgIsRelaxTillNnil{}
\def\scr@AfterEndGroupIfArgIsRelaxTillNnil#1\@nnil{%
  \endgroup
  \Ifstr{\detokenize{#1}}{\detokenize{\relax}}{\@firstoftwo}{%
    \Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{%
      \scr@IfArgIsRelaxAfterRelaxTillNnil #1\@nnil
    }{\@secondoftwo}%
  }%
}
\newcommand*\scr@IfArgIsRelaxAfterRelaxTillNnil{}
\def\scr@IfArgIsRelaxAfterRelaxTillNnil \relax#1\@nnil{%
  \Ifstr{\detokenize{#1}}{\detokenize{\relax}}{\@firstoftwo}{%
    \Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{%
      \scr@IfArgIsRelaxAfterRelaxTillNnil #1\@nnil
    }{\@secondoftwo}%
  }%
}
%    \end{macrocode}
% \end{macro}^^A \scr@IfArgIsRelaxTillNnil,\scr@IfArgIsRelaxAfterRelaxTillNnil
% \end{macro}^^A \scr@TestSkipAssignTillNil
% \begin{macro}{\scr@@secondoftwoAfterNil,\scr@secondoftwoAfterNil}
% \changes{v3.20}{2015/10/19}{added}
% The helper macros reads arguments \texttt{\#1} delimited by \cs{@nil} and
% executes \texttt{\#3}. We have to take care for the case of an empty first
% argument, which would make \cs{@nil} to be the argument. Because of this we
% need two helpers.
%    \begin{macrocode}
\newcommand*{\scr@secondoftwoAfterNil}{\scr@@secondoftwoAfterNil\@empty}
\newcommand*{\scr@@secondoftwoAfterNil}{}
\def\scr@@secondoftwoAfterNil#1\@nil{\@secondoftwo}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@@secondoftwoAfterNil,\scr@secondoftwoAfterNil
% \end{command}^^A \ifisdimen,\Ifisdimen
%
% \begin{command}{\ifisskip,\Ifisskip}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.18a}{2015/07/07}{\cs{baselineskip} and \cs{parskip} are skips}
% \changes{v3.20}{2015/10/19}{\cs{baselineskip} and \cs{parskip} are not skips}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisskip} renamed to \cs{Ifisskip}}
% If the first argument expands to a \cs{skip} register (and nothing else),
% execute the second argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisskip}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisskip'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisskip' by `\string\Ifisskip'%
  }%
  \Ifisskip
}
\newcommand*{\Ifisskip}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisskip#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisskip}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{skip} register.
%    \begin{macrocode}
\newcommand*{\scr@ifisskip}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisskip
    }{%
      \Ifstrstart{\meaning #1}{\string\skip}{%
        \aftergroup\scr@TestSkipAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%    \end{macrocode}
% \end{macro}^^A \scr@ifisskip
% \begin{macro}{\scr@TestSkipAssignTillNil}
% \changes{v3.20}{2015/10/19}{added}
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary
% \cs{skip}. If this uses the argument completely, the argument \texttt{\#2} behind
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case
% \texttt{\#1} will removed from the input totally.
%    \begin{macrocode}
\newcommand*\scr@TestSkipAssignTillNil{}
\def\scr@TestSkipAssignTillNil#1\@nil{%
  \begingroup
    \afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil
    \@tempskipa=#1\relax\@nnil
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@TestSkipAssignTillNil
% \end{command}^^A \ifiskip,\Ifisskip
%
% \begin{command}{\ifiscount,\Ifiscount}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifiscount} renamed to \cs{Ifiscount}}
% If the first argument expands to a \cs{count} register (and nothing else),
% execute the second argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifiscount}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifiscount'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifiscount' by `\string\Ifiscount'%
  }%
  \Ifiscount
}
\newcommand*{\Ifiscount}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifiscount#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifiscount}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{count} register.
%    \begin{macrocode}
\newcommand*{\scr@ifiscount}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifiscount
    }{%
      \Ifstrstart{\meaning #1}{\string\count}{%
        \aftergroup\scr@TestCountAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%    \end{macrocode}
% \end{macro}^^A \scr@ifiscount
% \begin{macro}{\scr@TestSkipCountTillNil}
% \changes{v3.20}{2015/10/19}{added}
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary
% counter. If this uses the argument completely, the argument \texttt{\#2} behind
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case
% \texttt{\#1} will removed from the input totally.
%    \begin{macrocode}
\newcommand*\scr@TestCountAssignTillNil{}
\def\scr@TestCountAssignTillNil#1\@nil{%
  \begingroup
    \afterassignment\scr@AfterEndGroupIfArgIsRelaxTillNnil
    \@tempcnta=#1\relax\@nnil
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@TestCountAssignTillNil
% \end{command}^^A \ifiscount,\Ifiscount
%
%
% \begin{command}{\ifisdimexpr,\Ifisdimexpr}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisdimexpr} renamed to \cs{Ifisdimexpr}}
% If the first argument expands to a \cs{dimexpr},
% execute the second argument, otherwise the third one. There is an important
% difference to \cs{Ifisdimen}: If the argument begins with \cs{dimexpr} but
% is not a valid \emph{dimension expression} \cs{Ifisdimexpr} detects a
% \cs{dimexpr}, but using this expression later will result in an error.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisdimexpr}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisdimexpr'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisdimexpr' by `\string\Ifisdimexpr'%
  }%
  \Ifisdimexpr
}
\newcommand*{\Ifisdimexpr}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimexpr#1\relax\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisdimexpr}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{dimexpr}.
%    \begin{macrocode}
\newcommand*{\scr@ifisdimexpr}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisdimexpr
    }{%
      \Ifstrstart{\meaning #1}{\string\dimexpr}{%
        \aftergroup\scr@TestDimenAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifisdimexpr
% \end{command}^^A \ifisdimexpr,\Ifisdimexpr
%
%
% \begin{command}{\ifisglueexpr,\Ifisglueexpr}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisglueexpr} renamed to \cs{Ifisglueexpr}}
% If the first argument expands to a \cs{glueexpr},
% execute the second argument, otherwise the third one. There is an important
% difference to \cs{Ifisskip}: If the argument begins with \cs{glueexpr} but
% is not a valid \emph{glue expression} \cs{Ifisglueexpr} detects a
% \cs{göueexpr}, but using this expression later will result in an error.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisglueexpr}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisglueexpr'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisglueexpr' by `\string\Ifisglueexpr'%
  }%
  \Ifisglueexpr
}
\newcommand*{\Ifisglueexpr}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisglueexpr#1\relax\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisglueexpr}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{glueexpr}.
%    \begin{macrocode}
\newcommand*{\scr@ifisglueexpr}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisglueexpr
    }{%
      \Ifstrstart{\meaning #1}{\string\glueexpr}{%
        \aftergroup\scr@TestSkipAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifisglueexpr
% \end{command}^^A \ifisglueexpr,\Ifisglueexpr
%
%
% \begin{command}{\ifisnumexpr,\Ifisnumexpr}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisnumexpr} renamed to \cs{Ifisnumexpr}}
% If the first argument expands to a \cs{numexpr},
% execute the second argument, otherwise the third one. There is an important
% difference to \cs{Ifiscount}: If the argument begins with \cs{numexpr} but
% is not a valid \emph{numerical expression} \cs{Ifisnumexpr} detects a
% \cs{numexpr}, but using this expression later will result in an error.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisnumexpr}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisnumexpr'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisnumexpr' by `\string\Ifisnumexpr'%
  }%
  \Ifisnumexpr
}
\newcommand*{\Ifisnumexpr}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisnumexpr#1\relax\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisnumexpr}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{numexpr}.
%    \begin{macrocode}
\newcommand*{\scr@ifisnumexpr}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisnumexpr
    }{%
      \Ifstrstart{\meaning #1}{\string\numexpr}{%
        \aftergroup\scr@TestCountAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifisnumexpr
% \end{command}^^A \ifisnumexpr,\Ifisnumexpr
%
%
% \begin{command}{\ifisdefchar,\Ifisdefchar}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.36}{2022/02/17}{\cs{ifisdefchar} renamed to \cs{Ifisdefchar}}
% If the first argument expands to a value defined using \cs{chardef},
% execute the second argument, otherwise the third one. Note: If the expanded
% argument begins with \verb|\char"| but is not a valid \emph{character value}
% \cs{Ifisdefchar} detects a valid value, but using this value later will
% result in an error.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisdefchar}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisdefchar'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisdefchar' by `\string\Ifisdefchar'%
  }%
  \Ifisdefchar
}
\newcommand*{\Ifisdefchar}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdefchar#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisdefchar}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro, that tests a macro recursive to expand to a \cs{char}.
%    \begin{macrocode}
\newcommand*{\scr@ifisdefchar}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisdefchar
    }{%
      \Ifstrstart{\meaning #1}{\string\char\string"}{%
        \aftergroup\scr@TestCountAssignTillNil
      }{%
        \aftergroup\scr@secondoftwoAfterNil
      }%
    }%
  \endgroup
  #1%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifisdefchar
% \end{command}^^A \ifisdefchar,\Ifisdefchar
%
%
% \begin{command}{\ifiscounter,\Ifiscounter}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.28}{2019/11/19}{\cs{ifiscounter} renamed to \cs{Ifiscounter}}
% If the first argument expands to a \LaTeX{} counter, execute the second
% argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifiscounter}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifiscounter'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifiscounter' by `\string\Ifiscounter'%
  }%
  \Ifiscounter
}
\newcommand*{\Ifiscounter}[1]{%
  \begingroup
    \scr@ifundefinedorrelax{c@#1}{%
      \aftergroup\@secondoftwo
    }{%
      \aftergroup\@firstoftwo
    }%
  \endgroup
}
%</base>
%    \end{macrocode}
% \end{command}^^A \ifiscounter,\Ifiscounter
%
%
% \begin{command}{\ifisinteger,\Ifisinteger}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.12a}{2014/01/24}{white space removed}
% \changes{v3.20}{2015/10/19}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisinteger} renamed to \cs{Ifisinteger}}
% If the first argument expands to a (positive or negative) integer, execute
% the second argument, otherwise the third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisinteger}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisinteger'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisinteger' by `\string\Ifisinteger'%
  }%
  \Ifisinteger
}
\newcommand*{\Ifisinteger}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisinteger#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisinteger}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Helper macro to test recursive to a algebraic sign or a number without sign.
%    \begin{macrocode}
\def\scr@ifisinteger#1{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisinteger\aftergroup#1%
    }{%
      \Ifstrstart{\meaning #1}{\detokenize{the character}}{%
        \if #1-\aftergroup\scr@ifisinteger
        \else
          \if #1+\aftergroup\scr@ifisinteger
          \else
            \ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else
                      \if #14\else\if #15\else\if #16\else\if #17\else
                      \if #18\else\if #19\else 1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
                      \relax
              \aftergroup\scr@TestCountAssignTillNil
              \aftergroup#1%
            \else
              \aftergroup\scr@secondoftwoAfterNil
              \aftergroup#1%
            \fi
          \fi
        \fi
      }{%
        \Ifstrstart{\meaning #1}{\string\char\string"}{%
          \aftergroup\scr@TestCountAssignTillNil
        }{%
          \def\reserved@c{%
            \aftergroup\scr@secondoftwoAfterNil
          }%
          \@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,%
                            \adjdemerits,%
                            \baselineskip,\belowdisplayskip,%
                            \belowdisplayshortskip,\binoppenalty,\boxmaxdepth,%
                            \brokenpenalty,%
                            \clubpenalty,\count,%
                            \dimen,\dimexpr,\doublehyphendemerits,\dp,%
                            \emergenystretch,\exhyphenpenalty,%
                            \finalhyphendemerits,%
                            \glueexpr,%
                            \hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,%
                            \lastskip,\lastpenalty,\linepenalty,%
                            \lineskip,\lineskiplimit,%
                            \maxdepth,\numexpr,%
                            \overfullrule,%
                            \parfillskip,\parindent,\parskip,%
                            \pdfpageheight,\pdfpagewidth,%
                            \predisplaypenalty,\pretolerance,%
                            \relpenalty,\widowpenalty,%
                            \skip,\splitmaxdepth,\splittopskip,%
                            \tolerance,\topskip,%
                            \wd,\vbadness,\vfuzz,\vsize 
          \do {%
            \expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{%
              \meaning #1%
            }{%
              \def\reserved@c{\aftergroup\scr@TestCountAssignTillNil}%
            }%
          }%
          \reserved@c
        }%
        \aftergroup#1%
      }%
    }%
  \endgroup
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@ifisinteger
% \end{command}^^A \ifisinteger,\Ifisinteger
%
%
% \begin{macro}{\scr@ifrelax@to@nnil}
% \changes{v3.12}{2013/11/05}{added}
% Helper macro to be used after an assignment. If everything until the first
% \cs{@nnil} is exactly one \cs{relax}, the second argument (first after the
% \cs{@nnil}) will be executed, otherwise the third argument (second after the
% \cs{@nnil}).
%    \begin{macrocode}
%<*base>
\newcommand*{\scr@ifrelax@to@nnil}{}
\def\scr@ifrelax@to@nnil#1\@nnil{%
  \begingroup
    \def\reserved@a{#1}\def\reserved@b{\relax}%
    \ifx\reserved@a\reserved@b
      \aftergroup\@firstoftwo
    \else
      \aftergroup\@secondoftwo
    \fi
  \endgroup
}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\ifisdimension,\Ifisdimension}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.12a}{2014/01/24}{white space removed}
% \changes{v3.20}{2015/10/20}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisdimension} renamed to \cs{Ifisdimension}}
% If the step by step expansion of the first argument results in a (positive
% or negative) length, the second argument will be executed, otherwise the
% third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisdimension}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisdimension'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisdimension' by `\string\Ifisdimension'%
  }%
  \Ifisdimension
}
\newcommand*{\Ifisdimension}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisdimension#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisdimension}
% \changes{v3.20}{2015/10/20}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% \changes{v3.28}{2019/11/23}{arithmetic plus sign fixed}
% To make this command absolutely correct without false positive and false
% negative results, it would be very complicated. Instead we use a heuristic:
% If the argument consists of a arbitrary number of arithmetic signs followed
% by at most one dot, comma or digit or followed by something, that is a valid
% lengths primitive, we try an assignment. Invalid assignments can result in
% errors. This is not the best solution but makes things a lot easier.
%    \begin{macrocode}
\newcommand*{\scr@ifisdimension}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisdimension\aftergroup#1%
    }{%
      \Ifstrstart{\meaning #1}{\detokenize{the character}}{%
        \if #1-\aftergroup\scr@ifisdimension
        \else
          \if #1+\aftergroup\scr@ifisdimension
          \else
            \if #1.%
              \aftergroup\scr@TestDimensionAssignTillNil
              \aftergroup#1%
            \else
              \if #1,%
                \aftergroup\scr@TestDimensionAssignTillNil
                \aftergroup#1%
              \else
                \ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else
                          \if #14\else\if #15\else\if #16\else\if #17\else
                          \if #18\else\if #19\else 1\fi\fi
                          \fi\fi\fi\fi
                          \fi\fi\fi\fi
                          \relax
                  \aftergroup\scr@TestDimensionAssignTillNil
                  \aftergroup#1%
                \else
                  \aftergroup\scr@secondoftwoAfterNil
                  \aftergroup#1%
                \fi
              \fi
            \fi
          \fi
        \fi
      }{%
        \Ifstrstart{\meaning #1}{\string\char\string"}{%
          \aftergroup\scr@TestDimensionAssignTillNil
        }{%
          \def\reserved@c{%
            \aftergroup\scr@secondoftwoAfterNil
            \aftergroup\@empty
          }%
          \@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,%
                            \adjdemerits,%
                            \baselineskip,\belowdisplayskip,%
                            \belowdisplayshortskip,\binoppenalty,\boxmaxdepth,%
                            \brokenpenalty,%
                            \clubpenalty,\count,%
                            \dimen,\dimexpr,\doublehyphendemerits,\dp,%
                            \emergenystretch,\exhyphenpenalty,%
                            \finalhyphendemerits,%
                            \glueexpr,%
                            \hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,%
                            \lastskip,\lastpenalty,\linepenalty,%
                            \lineskip,\lineskiplimit,%
                            \maxdepth,\numexpr,%
                            \overfullrule,%
                            \parfillskip,\parindent,\parskip,%
                            \pdfpageheight,\pdfpagewidth,%
                            \predisplaypenalty,\pretolerance,%
                            \relpenalty,\widowpenalty,%
                            \skip,\splitmaxdepth,\splittopskip,%
                            \tolerance,\topskip,%
                            \wd,\vbadness,\vfuzz,\vsize 
          \do {%
            \expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{%
              \meaning #1%
            }{%
              \def\reserved@c{\aftergroup\scr@TestDimensionAssignTillNil}%
            }%
          }%
          \reserved@c
        }%
        \aftergroup#1%
      }%
    }%
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\scr@TestDimenionAssignTillNil}
% \changes{v3.20}{2015/10/19}{added}
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary
% length. If this uses the argument completely, the argument \texttt{\#2} behind
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case
% \texttt{\#1} will removed from the input totally. The difference to
% \cs{scr@TestDimenAssignTillNil} is the \texttt{pt} test.
%    \begin{macrocode}
\newcommand*\scr@TestDimensionAssignTillNil{}
\def\scr@TestDimensionAssignTillNil#1\@nil{%
  \begingroup
    \afterassignment\scr@AfterEndGroupIfArgIsRelaxTillptNnil
    \@tempdima=#1pt\@nnil
}
%    \end{macrocode}
% \begin{macro}{\scr@IfArgIsRelaxAfterRelaxTillptNnil,\scr@IfAfterEndgroupArgIsRelaxTillptNnil}
% \changes{v3.20}{2015/10/19}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% Die Hilfsmakros lesen ein durch \cs{@nnil} begrenztes Argument. Falls dieses
% Argument nur aus einer Folge von \cs{relax} besteht, wird das erste Argument
% nach \cs{@nnil} ausgeführt, sonst das zweite.
%    \begin{macrocode}
\newcommand*\scr@AfterEndGroupIfArgIsRelaxTillptNnil{}
\def\scr@AfterEndGroupIfArgIsRelaxTillptNnil#1\@nnil{%
  \endgroup
  \Ifstr{\detokenize{#1}}{\detokenize{pt}}{\@firstoftwo}{%
    \Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{%
      \scr@IfArgIsRelaxAfterRelaxTillptNnil #1\@nnil
    }{\@secondoftwo}%
  }%
}
\newcommand*\scr@IfArgIsRelaxAfterRelaxTillptNnil{}
\def\scr@IfArgIsRelaxAfterRelaxTillptNnil \relax#1pt\@nnil{%
  \Ifstr{\detokenize{#1}}{\detokenize{pt}}{\@firstoftwo}{%
    \Ifstrstart{\detokenize{#1}}{\detokenize{\relax}}{%
      \scr@IfArgIsRelaxAfterRelaxTillptNnil #1\@nnil
    }{\@secondoftwo}%
  }%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@IfArgIsRelaxAfterRelaxTillptNnil,\scr@IfAfterEndgroupArgIsRelaxTillptNnil
% \end{macro}^^A \scr@DimensionSkipAssignTillNil
% \end{macro}^^A \scr@ifisdimension
% \end{command}^^A \ifisdimension,\Ifisdimension
%
%
% \begin{command}{\ifisglue}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.12a}{2014/01/24}{white space removed}
% \changes{v3.20}{2015/10/21}{re-implemented}
% \changes{v3.28}{2019/11/19}{\cs{ifisglue} renamed to \cs{Ifisglue}}
% If the step-by-step expansion of the first argument results in a (positive
% or negativ) length with glue, the second argument is executed, otherwise the
% third one.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifisglue}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifisglue'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifisglue' by `\string\Ifisglue'%
  }%
  \Ifisglue
}
\newcommand*{\Ifisglue}[1]{%
  \IfArgIsEmpty{#1}{\@secondoftwo}{\scr@ifisglue#1\@nil}%
}
%    \end{macrocode}
% \begin{macro}{\scr@ifisglue}
% \changes{v3.20}{2015/10/21}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstrstart} renamed to \cs{Ifstrstart}}
% \changes{v3.28}{2019/11/23}{arithmetic plus sign fixed}
% \changes{v3.28}{2019/11/23}{in plus case \cs{ifisdimension} replaced by
% \cs{ifisglue}}
% To make this command absolutely correct without false positive and false
% negative results, it would be very complicated. Instead we use a heuristic:
% If the argument consists of a arbitrary number of arithmetic signs followed
% by at most one dot, comma or digit or followed by something, that is a valid
% primitive for skips, we try an assignment. Invalid assignments can result in
% errors. This is not the best solution but makes things a lot easier.
%    \begin{macrocode}
\newcommand*{\scr@ifisglue}[1]{%
  \begingroup
    \Ifstrstart{\meaning #1}{\detokenize{macro:}}{%
      \aftergroup\expandafter\aftergroup\scr@ifisglue\aftergroup#1%
    }{%
      \Ifstrstart{\meaning #1}{\detokenize{the character}}{%
        \if #1-\aftergroup\scr@ifisglue
        \else
          \if #1+\aftergroup\scr@ifisglue
          \else
            \if #1.%
              \aftergroup\scr@TestGlueAssignTillNil
              \aftergroup#1%
            \else
              \if #1,%
                \aftergroup\scr@TestGlueAssignTillNil
                \aftergroup#1%
              \else
                \ifnum 0=0\if #10\else\if #11\else\if #12\else\if #13\else
                          \if #14\else\if #15\else\if #16\else\if #17\else
                          \if #18\else\if #19\else 1\fi\fi
                          \fi\fi\fi\fi
                          \fi\fi\fi\fi
                          \relax
                  \aftergroup\scr@TestGlueAssignTillNil
                  \aftergroup#1%
                \else
                  \aftergroup\scr@secondoftwoAfterNil
                  \aftergroup#1%
                \fi
              \fi
            \fi
          \fi
        \fi
      }{%
        \Ifstrstart{\meaning #1}{\string\char\string"}{%
          \aftergroup\scr@TestGlueAssignTillNil
        }{%
          \def\reserved@c{%
            \aftergroup\scr@secondoftwoAfterNil
            \aftergroup\@empty
          }%
          \@for\reserved@a:=\abovedisplayskip,\abovedisplayshortskip,%
                            \adjdemerits,%
                            \baselineskip,\belowdisplayskip,%
                            \belowdisplayshortskip,\binoppenalty,\boxmaxdepth,%
                            \brokenpenalty,%
                            \clubpenalty,\count,%
                            \dimen,\dimexpr,\doublehyphendemerits,\dp,%
                            \emergenystretch,\exhyphenpenalty,%
                            \finalhyphendemerits,%
                            \glueexpr,%
                            \hbadness,\hfuzz,\hsize,\ht,\hyphenpenalty,%
                            \lastskip,\lastpenalty,\linepenalty,%
                            \lineskip,\lineskiplimit,%
                            \maxdepth,\numexpr,%
                            \overfullrule,%
                            \parfillskip,\parindent,\parskip,%
                            \pdfpageheight,\pdfpagewidth,%
                            \predisplaypenalty,\pretolerance,%
                            \relpenalty,\widowpenalty,%
                            \skip,\splitmaxdepth,\splittopskip,%
                            \tolerance,\topskip,%
                            \wd,\vbadness,\vfuzz,\vsize 
          \do {%
            \expandafter\Ifstr\expandafter{\expandafter\string\reserved@a}{%
              \meaning #1%
            }{%
              \def\reserved@c{\aftergroup\scr@TestGlueAssignTillNil}%
            }%
          }%
          \reserved@c
        }%
        \aftergroup#1%
      }%
    }%
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\scr@TestGlueAssignTillNil}
% \changes{v3.20}{2015/10/21}{added}
% Argument \texttt{\#1} delimited by \cs{@nil} is assigned to a temporary
% \cs{skip}. If this uses the argument completely, the argument \texttt{\#2} behind
% \cs{@nil} will executed, otherwise argument \texttt{\#3}. In any case
% \texttt{\#1} will removed from the input totally. The difference to
% \cs{scr@TestSkipAssignTillNil} is the \texttt{pt} test.
%    \begin{macrocode}
\newcommand*\scr@TestGlueAssignTillNil{}
\def\scr@TestGlueAssignTillNil#1\@nil{%
  \begingroup
    \afterassignment\scr@AfterEndGroupIfArgIsRelaxTillptNnil
    \@tempskipa=#1pt\@nnil
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@TestGlueAssignTillNil
% \end{macro}^^A \scr@ifisglue
% \end{command}^^A \ifisglue,\Ifisglue
%
%
% \begin{command}{\ifnumber,\Ifnumber}
% \changes{v3.12}{2013/10/30}{using \cs{aftergroup} instead of
%   \cs{endgroup}\cs{expandafter}}
% \changes{v3.12a}{2014/01/24}{white space removed}
% \changes{v3.27}{2019/08/26}{empty arguments fixed}
% \changes{v3.28}{2019/11/18}{\cs{ifnumber} renamed to \cs{Ifnumber}}
% If the first argument is a positive integer, the second argument is
% executed, otherwise the third.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifnumber}{%
%    \end{macrocode}
% Note: We must not output the warning if package \pkg{babelbib} has been
% loaded, because the package defines the same command but only, if it has not
% been defined already. Unfortunately and against all conventions, it even
% defines internal macros of \pkg*{scrbase} with prefix \cs{scr@}. This is
% very dangerous and would result in errors, if \pkg{babelbib} is loaded
% before \pkg*{scrbase}. Maybe I will remove this special treatment of
% \pkg{babelbib} after switching over to \pkg{biblatex} for the \KOMAScript{}
% manuals.
%    \begin{macrocode}
  \scr@ifundefinedorrelax{ver@babelbib.sty}{%
    \PackageWarning{scrbase}{Usage of deprecated command
      `\string\ifnumber'.\MessageBreak
      The command has been renamed because of a\MessageBreak
      recommendation of The LaTeX Project Team.\MessageBreak
      Please replace `\string\ifnumber' by `\string\Ifnumber'%
    }%
  }{}%
  \Ifnumber
}
\newcommand\Ifnumber[1]{%
  \begingroup\@tempswafalse\let\scr@next\scr@test@number
    \IfArgIsEmpty{#1}{}{\expandafter\scr@next#1\scr@next}%
    \if@tempswa
      \aftergroup\@firstoftwo
    \else
      \aftergroup\@secondoftwo
    \fi
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\test@number,\scr@test@number}
% \changes{v3.36}{2022/02/17}{\cs{test@number} renamed to \cs{scr@test@number}}
% For the real test scan the first argument token by token.
%    \begin{macrocode}
\newcommand*{\scr@test@number}[1]{%
  \ifx \scr@next#1%
    \let\scr@next\relax
  \else
    \@tempcnta=\expandafter\expandafter\expandafter\number
    \expandafter`#1\relax
    \ifnum \@tempcnta>47
      \ifnum \@tempcnta<58
        \@tempswatrue
      \else\@tempswafalse\fi
    \else\@tempswafalse\fi
%    \end{macrocode}
% Remove the rest, if a non-digit has been found.
%    \begin{macrocode}
    \if@tempswa\else\let\scr@next\gobble@till@scr@next\fi
  \fi
  \scr@next
}
%    \end{macrocode}
% \begin{macro}{\gobble@tillscr@@next}
% Use a delimited \emph{empty} macro.
%    \begin{macrocode}
\newcommand*{\gobble@till@scr@next}{}
\def\gobble@till@scr@next#1\scr@next{}
%</base>
%    \end{macrocode}
% \end{macro}^^A \gobble@tillscr@next
% \end{macro}^^A \test@number, \scr@test@number
% \end{command}^^A \ifnumber,\Ifnumber
%
% \begin{command}{\ifintnumber,\Ifintnumber}
% \changes{v3.12}{2013/10/30}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifintnumber} renamed to
%   \cs{Ifintnumber}}
% If the first argument is a positive or negative integer, execute the second
% argument, otherwise the third one. There are multiple arithmetic signs allowed.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifintnumber}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifintnumber'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifintnumber' by `\string\Ifintnumber'%
  }%
  \Ifintnumber
}
\newcommand\Ifintnumber[1]{%
  \begingroup\@tempswafalse\let\scr@next\scr@test@sign
    \expandafter\scr@next#1\scr@next
    \if@tempswa
      \aftergroup\@firstoftwo
    \else
      \aftergroup\@secondoftwo
    \fi
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\scr@test@sign}
% \changes{v3.12}{2013/10/30}{added}
%    \begin{macrocode}
\newcommand*{\scr@test@sign}[1]{%
  \ifx \scr@next#1
    \let\scr@next\relax
  \else
    \if #1-%
    \else
      \ifx #1+%
      \else
        \def\scr@next{\let\scr@next\scr@test@number\scr@next #1}%
      \fi
    \fi
  \fi
  \scr@next
}       
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@test@sign
% \end{command}^^A \ifintnumber,\Ifintnumber
%
% \begin{command}{\ifdimen,\Ifdimen}
% \changes{v3.28}{2019/11/18}{renamed to \cs{Ifdimen}}
% If the first argument is a dimension number, the second argument will be
% executed, otherwise the third.
%    \begin{macrocode}
%<*base>
\providecommand*{\ifdimen}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifdimen'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifdimen' by `\string\Ifdimen'%
  }%
  \Ifdimen
}
\newcommand{\Ifdimen}[1]{%
  \begingroup\@tempswatrue\let\scr@next\scr@test@posdimen
  \expandafter\scr@test@dimen#1\scr@next
  \if@tempswa
    \endgroup\expandafter\@firstoftwo
  \else
    \endgroup\expandafter\@secondoftwo
  \fi
}
%    \end{macrocode}
% \begin{macro}{\test@dimen,\scr@test@dimen}
% \changes{v3.36}{2022/02/17}{\cs{test@dimen} renamed to \cs{scr@test@dimen}}
% We have to remove the arithmetic signs.
%    \begin{macrocode}
\newcommand*{\scr@test@dimen}[1]{%
  \ifx -#1\else\ifx +#1\else
      \def\scr@next{\let\scr@next\scr@test@posdimen\scr@next#1}\fi\fi
  \scr@next
}
%    \end{macrocode}
% \begin{macro}{\test@posdimen,\scr@test@posdimen}
% \changes{v3.36}{2022/02/17}{\cs{test@posdimen} renamed to \cs{scr@test@posdimen}}
% Is the rest a dimension. Despite this is not correct, we allow more than one
% decimal point or decimal comma. Should this be changed?
%    \begin{macrocode}
\newcommand*{\scr@test@posdimen}[1]{%
  \ifx \scr@next#1%
    \@tempswafalse\let\scr@next\relax
  \else
    \if .#1\else\if ,#1\else
        \@tempcnta=%
        \expandafter\expandafter\expandafter\number\expandafter`#1\relax
        \ifnum \@tempcnta>47
          \ifnum \@tempcnta<58
          \else\def\scr@next{\scr@test@dimunt#1}\fi
        \else\def\scr@next{\scr@test@dimunt#1}\fi
    \fi\fi
  \fi
  \scr@next
}
%    \end{macrocode}
% \begin{macro}{\test@dimunt,\test@trueunt,\scr@test@dimunt,\scr@test@trueunt}
% Last but not least the unit has to be tested. We have standard units and
% true units. So we first cut of a ``\texttt{true}''.
%    \begin{macrocode}
\newcommand*{\scr@test@dimunt}{}
\def\scr@test@dimunt#1\scr@next{%
  \expandafter\scr@test@trueunt#1truetrue\scr@test@trueunt
}
\newcommand*{\scr@test@trueunt}{}
\def\scr@test@trueunt#1true#2true#3\scr@test@trueunt{%
  \edef\reserved@a{#1}%
  \ifx\reserved@a\@empty\scr@test@@dimunt{#2}\else\scr@test@@dimunt{#1}\fi
}
%    \end{macrocode}
% \begin{macro}{\test@@ifdimunt,\scr@test@@dimunt}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Currently we know eleven or twelve units. Unit \texttt{px} is only valid
% with PDF output.
%    \begin{macrocode}
\newcommand*\scr@test@@dimunt[1]{%
  \@tempswafalse
  \Ifstr{#1}{pt}{\@tempswatrue}{%
    \Ifstr{#1}{pc}{\@tempswatrue}{%
      \Ifstr{#1}{in}{\@tempswatrue}{%
        \Ifstr{#1}{bp}{\@tempswatrue}{%
          \Ifstr{#1}{cm}{\@tempswatrue}{%
            \Ifstr{#1}{mm}{\@tempswatrue}{%
              \Ifstr{#1}{dd}{\@tempswatrue}{%
                \Ifstr{#1}{cc}{\@tempswatrue}{%
                  \Ifstr{#1}{sp}{\@tempswatrue}{%
                    \Ifstr{#1}{ex}{\@tempswatrue}{%
                      \Ifstr{#1}{em}{\@tempswatrue}{%
                        \scr@ifpdfoutput{%
                          \Ifstr{#1}{px}{\@tempswatrue}{}%
                        }{}%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \test@@ifdimunt,\scr@test@@dimunt
% \end{macro}^^A \test@dimunt,\test@trueunt,\scr@test@dimunt,\scr@test@trueunt
% \end{macro}^^A \scr@test@posdimen
% \end{macro}^^A \scr@test@dimen
% \end{command}^^A \ifdimen,\Ifdimen
%
%
% \begin{command}{\ifpdftex}
% \changes{v2.95}{2002/08/19}{added}
% \changes{v3.28}{2019/11/18}{removed}
% \end{command}
% \begin{macro}{\scr@ifpdftex}
% \changes{v2.95}{2002/08/19}{added}
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}}
% If \pdfTeX{} is used, execute the first argument, otherwise the
% second. Note, we do not read the arguments but delegate them to
% \cs{Ifnotundefined}.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ifpdftex}{\Ifnotundefined{pdftexversion}}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scr@ifluatex}
% \changes{v3.21}{2016/05/27}{added}
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}}
% If \LuaTeX{} is used, execute the first argument, otherwise the
% second. Note, we do not read the arguments but delegate them to
% \cs{Ifnotundefined}.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ifluatex}{\Ifnotundefined{luatexversion}}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scr@ifpdforluatex}
% \changes{v3.21}{2016/05/27}{added}
% If either \LuaTeX{} or \pdfTeX{} is used, execute the first argument,
% otherwise the second. Note, we do not read the arguments but delegate them
% to \cs{@firstoftwo} and \cs{@secondoftwo}.
%    \begin{macrocode}
%<*base>
\newcommand*{\scr@ifpdforluatex}{%
  \scr@ifpdftex{\@firstoftwo}{\scr@ifluatex{\@firstoftwo}{\@secondoftwo}}%
}
%</base>
%    \end{macrocode}
% \end{macro}
%  
% \begin{command}{\ifvtex,\ifVTeX}
% \changes{v2.95}{2002/08/19}{added}
% \changes{v2.97c}{2007/06/20}{\cs{ifvtex} renamed to \cs{ifVTeX}}
% \changes{v3.28}{2019/11/18}{removed}
% \end{command}
% \begin{macro}{\scr@ifvtex,\scr@ifVTeX}
% \changes{v2.95}{2002/08/19}{added}
% \changes{v2.97c}{2007/06/20}{\cs{scr@ifvtex} renamed to \cs{scr@ifVTeX}}
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}}
% If \VTeX{} is used, execute the first argument, otherwise the
% second. Note, we do not read the arguments but delegate them to
% \cs{Ifnotundefined}.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ifVTeX}{\Ifnotundefined{VTeXversion}}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\ifpdfoutput,\Ifpdfoutput}
% \changes{v2.7g}{2001/04/17}{added}
% \changes{v2.8q}{2001/10/19}{\cs{pdfoutput} does not become \cs{relax} if it
%   was undefined before}
% \changes{v2.8q}{2001/10/19}{\cs{ifpdfoutput} is only defined if new}
% \changes{v2.8q}{2001/10/19}{usage of \cs{scr@ifpdfoutput}}
% \changes{v3.28}{2019/11/18}{\cs{ifpdfoutput} renamed to \cs{Ifpdfoutput}}
% \begin{macro}{\scr@ifpdfoutput}
% \changes{v2.8q}{2001/10/19}{added}
% \changes{v2.8q}{2001/11/13}{full functional}
% \changes{v2.95}{2002/08/21}{knowing \VTeX}
% \changes{v2.95}{2004/07/20}{expandable}
% \changes{v3.21}{2016/05/27}{works for \LuaTeX{} after version 0.85}
% If the output (currently) produces a PDF, the first argument is executed,
% otherwise the second one. This macro is used inside the implementation of
% option \opt{pagesize}, so we cannot remove it or declare it as deprecated.
%    \begin{macrocode}
%<*base>
\newcommand{\scr@ifpdfoutput}{%
  \scr@ifundefinedorrelax{pdfoutput}{%
    \scr@ifundefinedorrelax{outputmode}{%
      \scr@ifundefinedorrelax{OpMode}{%
        \expandafter\@secondoftwo%
      }{%
        \ifnum\OpMode=1
          \expandafter\@firstoftwo
        \else
          \expandafter\@secondoftwo
        \fi
      }%
    }{%
      \ifnum\outputmode>0
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
    }%
  }{%
    \ifnum\pdfoutput>0 
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
  }%
}%
\providecommand*{\ifpdfoutput}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifpdfoutput'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifpdfoutput' by `\string\Ifpdfoutput'%
  }%
  \Ifpdfoutput
}
\newcommand*{\Ifpdfoutput}{\scr@ifpdfoutput}
%</base>
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\ifpsoutput,\Ifpsoutput}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v3.28}{2019/11/18}{renamed to \cs{Ifpsoutput}}
% \begin{macro}{\scr@ifpsoutput}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v2.95}{2004/07/20}{expandable}
% \changes{v3.30}{2020/03/06}{\cs{ifnotundefined} replaced by \cs{Ifnotundefined}}
% If the output is (currently) expected to be PS some time, the first argument
% is executed, otherwise the second one. This macro is used inside the
% implementation of option \opt{pagesize}, so we cannot remove it or declare
% it as deprecated.
%    \begin{macrocode}
%<*base>
\newcommand*{\scr@ifpsoutput}{%
  \Ifnotundefined{if@dvips}{%
    \if@dvips 
      \expandafter\@firstoftwo
    \else 
      \expandafter\@secondoftwo
    \fi
  }{%
    \Ifnotundefined{OpMode}{%
      \ifnum\OpMode=2
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
    }{%
      \expandafter\@secondoftwo
    }%
  }%
}
\providecommand*{\ifpsoutput}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifpsoutput'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifpsoutput' by `\string\Ifpsoutput'%
  }%
  \Ifpsoutput
}
\newcommand*{\Ifpsoutput}{\scr@ifpsoutput}
%</base>
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\ifdvioutput,\Ifdvioutput}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifdvioutput} renamed to \cs{Ifdvioutput}}
% \begin{macro}{\scr@ifdvioutput}
% \changes{v2.95}{2002/08/21}{added}
% \changes{v2.95}{2004/07/20}{expandable}
% \changes{v3.23}{2017/02/14}{works for \LuaTeX{} after version 0.85}
% If the output (currently) produces a DVI, the first argument is executed,
% otherwise the second one. This macro is used inside the implementation of
% option \opt{pagesize}, so we cannot remove it or declare it as deprecated.
%    \begin{macrocode}
%<*base>
\newcommand*{\scr@ifdvioutput}{%
  \scr@ifundefinedorrelax{pdfoutput}{%
    \scr@ifundefinedorrelax{outputmode}{%
      \scr@ifundefinedorrelax{OpMode}{%
        \expandafter\@firstoftwo
      }{%
        \ifnum\OpMode=0
          \expandafter\@firstoftwo
        \else
          \expandafter\@secondoftwo
        \fi
      }%
    }{%
      \ifnum\outputmode>0
        \expandafter\@secondoftwo
      \else
        \expandafter\@firstoftwo
      \fi
    }%
  }{%
    \ifnum\pdfoutput=0
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
  }%
}
\providecommand*{\ifdvioutput}{%
  \PackageWarning{scrbase}{Usage of deprecated command
    `\string\ifdvioutput'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifdvioutput' by `\string\Ifdvioutput'%
  }%
  \Ifdvioutput
}
\newcommand*{\Ifdvioutput}{\scr@ifdvioutput}
%</base>
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{macro}{\scr@smashdp}
% \changes{v2.97c}{2007/09/17}{added}
% \changes{v3.02a}{2009/01/23}{using own definition instead of \cs{smash}}
% \changes{v3.36}{2022/02/18}{as robust as \cs{smash}}
% Generate a box and output it with height and width but no depth. Note: Using
% internal macros \cs{finsm@sh}, \cs{mathsm@sh} and \cs{makesm@ash} from the
% \LaTeX{} kernel is a very ugly hack and dangerous. Using \cs{smash} itself
% would be problematic, because \pkg{amsmath} redefines it and the new
% definition is not fully compatible. But maybe a better definition could be
% found depending on, whether \pkg{amsmath} has been loaded or not.
%    \begin{macrocode}
%<*base>
\DeclareRobustCommand{\scr@smashdp}[1]{%
  \relax
  \begingroup
    \def\finsm@sh{\dp\z@\z@ \leavevmode\box\z@}%
    \ifmmode
      \expandafter\mathpalette\expandafter\mathsm@sh
    \else
      \expandafter\makesm@sh
    \fi
    {#1}%
  \endgroup
}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\IfRTL}
% \changes{v3.24}{2017/05/04}{added}
% \changes{v3.36}{2022/02/18}{white space removed}
% If we are in the right-to-left mode of a package like \pkg{bidi} the first
% argument will be used otherwise the second one.
%    \begin{macrocode}
%<*base>
\newcommand*{\IfRTL}{%
  \scr@ifundefinedorrelax{if@RTL}{\@secondoftwo}{%
    \expandafter\ifx\csname if@RTL\expandafter\endcsname
                    \csname iftrue\endcsname
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
  }%
}
%</base>
%    \end{macrocode}
% \end{command}^^A \IfRTL
% \begin{command}{\IfLTR}
% \changes{v3.24}{2017/05/04}{added}
% \changes{v3.36}{2022/02/18}{white space removed}
% If we are not in the right-to-left mode of a package like \pkg{bidi} any
% kind of left-to-right mode is assumed and the first argument is used,
% otherwise the second one.
%    \begin{macrocode}
%<*base>
\newcommand*{\IfLTR}{%
  \scr@ifundefinedorrelax{if@RTL}{\@firstoftwo}{%
    \expandafter\ifx\csname if@RTL\expandafter\endcsname
                    \csname iftrue\endcsname
      \expandafter\@secondoftwo
    \else
      \expandafter\@firstoftwo
    \fi
  }%
}
%</base>
%    \end{macrocode}
% \end{command}^^A \IfLTR
%
% \begin{command}{\PackageInfoNoLine}
% \changes{v2.97d}{2007/10/03}{added}
% Like \cs{PackageInfo} but without output of line number at the end.
%    \begin{macrocode}
%<*base>
\providecommand*{\PackageInfoNoLine}[2]{%
  \PackageInfo{#1}{#2\@gobble}%
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\ClassInfoNoLine}
% \changes{v2.98c}{2008/02/15}{added}
% Like \cs{ClassInfo} but without output of line number at the end.
%    \begin{macrocode}
%<*base>
\providecommand*{\ClassInfoNoLine}[2]{%
  \ClassInfo{#1}{#2\@gobble}%
}
%</base>
%    \end{macrocode}
% \end{command}
%
% \begin{macro}{\@removefromreset}
% \changes{v3.15}{2014/11/21}{added}%
% For \LaTeX{} releases before 2018/04/01 and without using a package like
% \pkg{remreset} or \pkg{chngcntr} we still need \cs{@removefromreset}.
%    \begin{macrocode}
%<*base>
\providecommand*\@removefromreset[2]{%
  {%
    \expandafter\let\csname c@#1\endcsname\@removefromreset
    \def\@elt##1{%
      \expandafter\ifx\csname c@##1\endcsname\@removefromreset
      \else\noexpand\@elt{##1}\fi
    }%
    \expandafter\xdef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
  }%
}
%</base>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\IfActiveMkBoth}
% \changes{v3.26}{2018/09/03}{added}
% \begin{macro}{\if@scrActiveMkBoth}
% \changes{v3.26}{2018/09/03}{added}
% \changes{v3.27}{2019/07/26}{handling for \cs{marks}}
% This command test, whether or not \cs{@mkboth} does change a mark or not.
%    \begin{macrocode}
%<*base>
\newif\ifscr@ActiveMkBoth
\def\scr@ActiveMkBothfalse{\global\let\ifscr@ActiveMkBoth\iffalse}
\def\scr@ActiveMkBothtrue {\global\let\ifscr@ActiveMkBoth\iftrue}
\newcommand*{\IfActiveMkBoth}{%
  \begingroup
    \def\markboth##1##2{\scr@ActiveMkBothtrue}%
    \def\markright##1{\scr@ActiveMkBothtrue}%
    \def\markleft##1{\scr@ActiveMkBothtrue}%
    \def\markboth##1{\scr@ActiveMkBothtrue}%
    \def\markdouble##1{\scr@ActiveMkBothtrue}%
    \def\mark##1{\scr@ActiveMkBothtrue}%
    \def\marks##1##2{\scr@ActiveMkBothtrue}%
    \scr@ActiveMkBothfalse
    \setbox\@tempboxa\vbox{\@mkboth{}{}}%
  \endgroup
  \ifscr@ActiveMkBoth
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \if@scrActiveMkBoth
% \end{command}^^A \IfActiveMkBoth
%
%
% \subsection{Definition of the \KOMAScript{} \pkg*{keyval} main handling}
% 
% \begin{command}{\FamilyExecuteOptions}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}}
% \changes{v3.04b}{2010/02/02}{prevent overwriting of \cs{scr@key@atlist} and
%   \cs{scr@key@name} in \cs{setkeys}}
% \changes{v3.12}{2013/03/04}{re-implemented}
% \changes{v3.12}{2013/03/04}{can be used after document preamble}
% \changes{v3.14}{2014/10/17}{third argument is \cs{long}}
% \begin{macro}{\@FamilyExecuteOptions}
% \changes{v3.14}{2014/10/17}{new}
% \changes{v3.23}{2017/02/16}{fix: hook after uses family instead of member}
% \changes{v3.27}{2019/10/02}{improved error message}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Similar to \cs{ExecuteOptions} but with \pkg{keyval} options. The command
% also is re-entrant. Note: The hooks are local to every usage.
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyExecuteOptions}[2][.\@currname.\@currext]{%
  \@FamilyExecuteOptions[{#1}]{#2}%
}
\newcommand{\@FamilyExecuteOptions}[3][.\@currname.\@currext]{%
  \scr@ifundefinedorrelax{scr@after@options@#2@hook}{%
    \@namedef{scr@after@options@#2@hook}{%
      \@namedef{scr@after@options@#2@hook}{}%
    }%
  }{%
    \expandafter\edef\csname scr@after@options@#2@hook\endcsname{%
      \noexpand\@namedef{scr@after@options@#2@hook}{%
        \unexpanded\expandafter\expandafter\expandafter
        {\csname scr@after@options@#2@hook\endcsname}%
      }%
    }%
  }%
  \@for\scr@key@atlist:=#3\do{%
    \expandafter\scr@key@split@name@value\scr@key@atlist==\@nil
    \ifx\scr@key@name\@empty\else
      \ifx\scr@key@name\space\else
        \scr@ifundefinedorrelax{KV@#2@\scr@key@name}{%
          \scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{%
%    \end{macrocode}
% \changes{v3.20}{2015/11/18}{special treatment of \opt{@else@} option}
% Neither family nor member option found. But maybe special option
% \opt{@else@} exists. In this case the current option is set as value of
% \opt{@else@}.
%    \begin{macrocode}
            \scr@ifundefinedorrelax{KV@#2#1@@else@}{%
              \PackageError{scrbase}{%
                unknown option
                `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
              }{%
                Member `#1' of family `#2'\MessageBreak
                cannot handle option `\scr@key@name'.\MessageBreak
                So it cannot be set%
                \ifx\scr@key@value\@empty\else
                  \space to value
                  `\expandafter\detokenize\expandafter{\scr@key@value}'%
                \fi.%
              }%
            }{%
              \scr@execute@elseoption{#2#1}%
%    \end{macrocode}
% In difference to other options, for \opt{@else@} all states different from
% \cs{FamilyKeyStateProcessed} have to be reported as error of the
% current/original option.
%    \begin{macrocode}
              \ifx\FamilyKeyState\FamilyKeyStateProcessed\else
                \PackageError{scrbase}{%
                  unknown option
                  \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
                    value at
                  \fi
                  `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
                }{%
                  Member `#1' of family `#2'\MessageBreak
                  cannot handle option `\scr@key@name'.\MessageBreak
                  So it cannot be set%
                  \ifx\scr@key@value\@empty\else
                    \space to value
                    `\expandafter\detokenize\expandafter{\scr@key@value}'%
                  \fi.%
                }%
              \fi
            }%
          }{%
            \scr@execute@option{#2#1}%
          }%
        }{%
          \scr@execute@option{#2}%
          \Ifstr{#1}{}{}{%
%    \end{macrocode}
% \changes{v3.20}{2015/11/18}{member option test after execution of family
%   option fixed}
% If a family option has been found and executed an existing member option
% still has to be executed. If no member option exists, also an existing
% \opt{@else@} option of the member has to been used. But in this case, the
% states different from \cs{FamilyKeyStateProcessed} are not errors.
%    \begin{macrocode}
            \scr@ifundefinedorrelax{KV@#2#1@\scr@key@name}{%
              \scr@ifundefinedorrelax{KV@#2#1@@else@}{}{%
                \scr@execute@elseoption{#2#1}%
              }%
            }{%
              \ifx\FamilyKeyState\FamilyKeyStateProcessed
                \scr@execute@option{#2#1}%
                \FamilyKeyStateProcessed
              \else
                \scr@execute@option{#2#1}%
              \fi
            }%
          }%
        }%
        \scr@show@key@state@error
      \fi
    \fi
  }%
  \@nameuse{scr@after@options@#2@hook}%
}
%</base>
%    \end{macrocode}
% \begin{macro}{\scr@show@key@state@error}
% \changes{v3.12}{2013/03/04}{added}
% \changes{v3.27}{2019/10/02}{improved error message}
% Show depending on \cs{FamilyKeyState} a error message. All information to
% the error has to be set to \cs{FamilyMemberOfKey} (member or \cs{@empty}),
% \cs{FamilyOfKey} (family or \cs{@empty}), \cs{scr@key@atlest} (option as it
% was in the option list), \cs{scr@key@name} (\meta{key} of the option), and
% \cs{scr@key@value} (\meta{value} of the option). Note: \cs{scr@key@atlist}
% and \cs{scr@key@value} can contain macros and will be output using
% \cs{detokenize}.
%    \begin{macrocode}
%<*base>
\newcommand*{\scr@show@key@state@error}{%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed\else
    \PackageError{scrbase}{%
      unknown option
      \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
        value at
      \fi
      `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
    }{%
      Option
      `\expandafter\detokenize\expandafter{\scr@key@name}'\MessageBreak
      \ifx\FamilyMemberOfKey\@empty\else
        of member `\FamilyMemberOfKey'\MessageBreak
      \fi
      \ifx\FamilyOfKey\@empty\else
        of family `\FamilyOfKey'\MessageBreak
      \fi
      \ifx\FamilyKeyState\FamilyKeyStateNeedValue
        expects a value, but has been used without any value.%
      \else
        cannot handle value\MessageBreak
        `\expandafter\detokenize\expandafter{\scr@key@value}',%
        \MessageBreak
        \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
          because this is an unsupported value.%
        \else
          because \FamilyKeyState.
        \fi
      \fi
    }%
  \fi
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@show@key@state@error
% \end{macro}^^A \@FamilyExecuteOptions
% \end{command}^^A \FamilyExecuteOptions
%
% \begin{command}{\KOMAExecuteOptions}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.00}{2008/04/30}{no optional argument}
% \changes{v3.12}{2013/03/04}{can be used after the document preamble}
% Executes a \meta{list of options} (\texttt{\#3}) of a \meta{member} (optional
% \texttt{\#1}) of a \meta{family} (\texttt{\#2}). The default for the
% \meta{member} is \file{.\cs{@currname}.\cs{@currext}}. Note: If
% \cs{KOMAExcuteOptions} is not used while loading a class or package, the
% optional first argument is not optional, but has to be set correctly! And
% because filenames can be changed, it is recommended to \emph{always} use the
% optional argument to set a definite \meta{member}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAExecuteOptions}[1][.\@currname.\@currext]{%
  \FamilyExecuteOptions[#1]{KOMA}%
}
%</koma>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\FamilyOptions}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.12}{2013/03/02}{re-implemented}
% \changes{v3.12}{2013/03/02}{\cs{scr@after@options@\#1@hook}}
% \changes{v3.14}{2014/10/17}{second argument is \cs{long}}
% \begin{macro}{\@FamilyOptions}
% \changes{v3.14}[2014/10/17]{added}
% \changes{v3.27}{2019/10/02}{improved error message}
% \begin{macro}{\Family@Options}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \Family@Options
% Used to set the options of a family. The first argument (\texttt{\#1}) is
% the \meta{family} and the second (\texttt{\#2}) a \meta{list of options}. If
% a \meta{key} or a \meta{value} to a \meta{key} in the \meta{list of options}
% does not exist, an error is reported. The command itself is re-entrant, so
% it can be used inside the definition of an option. But in this case the hook
% is local to the local usage of the command.
%    \begin{macrocode}
%<*base>
\newcommand{\FamilyOptions}[1]{\@FamilyOptions{#1}}
\newcommand{\@FamilyOptions}[2]{%
  \scr@ifundefinedorrelax{scr@after@options@#1@hook}{%
    \@namedef{scr@after@options@#1@hook}{%
      \@namedef{scr@after@options@#1@hook}{}%
    }%
  }{%
    \expandafter\edef\csname scr@after@options@#1@hook\endcsname{%
      \noexpand\@namedef{scr@after@options@#1@hook}{%
        \unexpanded\expandafter\expandafter\expandafter
        {\csname scr@after@options@#1@hook\endcsname}%
      }%
    }%
  }%
%    \end{macrocode}
% \changes{v3.23}{2017/02/16}{\cs{AtEndOfFamilyOptions*} hook added}
% From version 3.23 the new hook before \cs{AtEndOfFamilyOptions*} has to be
% initialized. First step is a kind of pre-initialization: The hook is
% defined empty, if it does not already exist. So if the hook exists empty we
% can now recognize the top level of using \cs{FamilyOptions}.
%    \begin{macrocode}
  \scr@ifundefinedorrelax{scr@after@options@#1@hook@topmost}{%
    \@namedef{scr@after@options@#1@hook@topmost}{}%
  }{}%
%    \end{macrocode}
% Now, if we recognize the top level, because of an empty hook, the execution
% of the hook to the normal level hook (which is the top level hook in this
% case) is added. Additionally the self destruction code is added to the very
% beginning of the hook. Because of the self destruction hook the hook itself
% it no longer empty. So deeper levels distinguish from the top level. Because
% the hook is not empty any longer.
%    \begin{macrocode}
  \expandafter\ifx\csname scr@after@options@#1@hook@topmost\endcsname\@empty
    \expandafter\l@addto@macro\csname scr@after@options@#1@hook\endcsname{%
      \@nameuse{scr@after@options@#1@hook@topmost}%
    }%
    \@namedef{scr@after@options@#1@hook@topmost}{%
      \@namedef{scr@after@options@#1@hook@topmost}{}%
    }%
  \fi
%    \end{macrocode}
% \begin{description}
% \item[Note:] We do not use \pkg{xkeyval} and its \cs{setkeys+}, because this
%   would not execute the options in the order of the options but in the order
%   of the families, which is not intuitive and therefore not what we want.
% \end{description}
% We use a loop over all \meta{option}s in the \meta{list of options} to
% split each \meta{option} into \meta{key} and \meta{value}.
%    \begin{macrocode}
  \@for\scr@key@atlist:=#2\do{%
%    \end{macrocode}
% \changes{v3.08}{2010/11/05}{empty options in the list are ignored}
% Despite they do not make any sense empty \emph{options} are allowed and
% ignored. This would at first mean two consecutive commas.
%    \begin{macrocode}
    \ifx\scr@key@atlist\@empty\else
%    \end{macrocode}
% But there also can be white spaces between the commas.
%    \begin{macrocode}
      \ifx\scr@key@atlist\space\else
        \expandafter\scr@key@split@name@value\scr@key@atlist==\@nil
%    \end{macrocode}
% The third possibility would be a single equal sign. But in my opinion this
% would be a mistake and therefore an error. So now, we have an \opt{option}
% splitted into a \meta{key} and a \meta{value} (which can be empty).
% \changes{v3.12}{2013/03/04}{storing the overall state}
% Now, we are storing the overall state by emptying the error storage. If the
% error storage is \cs{relax} it is not needed any longer. Both, \cs{relax}
% and \cs{@empty} means no error. All other cases the error storage contains
% all the errors to be reported.
%    \begin{macrocode}
        \let\scr@key@run@errors\@empty
%    \end{macrocode}
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}}
% \changes{v3.09a}{2011/06/07}{less number of expansions by improved usage of
%   \cs{unexpanded}}
% Next a loop over the members is used, to detect members, that have the
% \meta{key}. In this case the member option is executed. Note: The execution
% of an option must not change any of the internal macros with the \meta{key},
% \meta{value}, \meta{option} or \meta{list of options}
% information. Additionally the states and the resulting messages have to been
% collected. Here it is useful to have \cs{\meta{family}@key@familylist}, a
% list of family + member and not only of members.
% \changes{v3.27}{2019/07/19}{family options are executed first}
%    \begin{macrocode}
        \scr@key@found@false
        \edef\reserved@a{#1,\csname #1@key@familylist\endcsname}%
        \@for\reserved@a:=\reserved@a\do{%
          \scr@ifundefinedorrelax{KV@\reserved@a @\scr@key@name}{%
%    \end{macrocode}
% \changes{v3.27}{2019/07/19}{treatment of \opt{@else@} options}
% If a family member does not have the current option, there still may be a
% \opt{@else@} option. In this case the \opt{@else@} option gets the current
% \meta{option} as value and is executed. But this changes the error storage
% only, if it was successful. In this case, the error storage has to become
% empty. But the \opt{@else@} must not be executed here, if the current member
% is the empty one, which represents the family itself. This will be done
% later and only, if no one of the members have had the option itself or a
% \opt{@else@} option. So the family \opt{@else@} option is only used, if the
% option has not been successfully processed by any member in any kind.
%    \begin{macrocode}
            \Ifstr{\reserved@a}{#1}{}{%
              \scr@ifundefinedorrelax{KV@\reserved@a @@else@}{}{%
                \expandafter\scr@execute@elseoption\expandafter{\reserved@a}%
                \ifx\FamilyKeyState\FamilyKeyStateProcessed
                  \scr@key@found@true
                  \let\scr@key@run@errors\relax
                \fi
              }%
            }%
          }{%
%    \end{macrocode}
% If the option has been found for a member, it is executed and the error
% storage is updated.
%    \begin{macrocode}
            \expandafter\scr@execute@option\expandafter{\reserved@a}%
            \scr@key@found@true
            \ifx\scr@key@run@errors\relax\else
              \ifx\FamilyKeyState\FamilyKeyStateProcessed
                \let\scr@key@run@errors\relax
              \else
                \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
                  \edef\scr@key@run@errors{%
                    \unexpanded\expandafter{\scr@key@run@errors}%
                    \noexpand\MessageBreak
                    \space\space- `\FamilyMemberOfKey': unkown value
                    `\expandafter\detokenize\expandafter{\scr@key@value}'%
                  }%
                \else
                  \ifx\FamilyKeyState\FamilyKeyStateNeedValue
                    \edef\scr@key@run@errors{%
                      \unexpanded\expandafter{\scr@key@run@errors}%
                      \noexpand\MessageBreak
                      \space\space- `\FamilyMemberOfKey': value expected
                    }%
                  \else
                    \edef\scr@key@run@errors{%
                      \unexpanded\expandafter{\scr@key@run@errors}%
                      \noexpand\MessageBreak
                      \space\space- `\FamilyMemberOfKey': \FamilyKeyState
                    }%
                  \fi
                \fi
              \fi
            \fi
          }%
        }%
        \ifscr@key@found@
          \ifx\scr@key@run@errors\relax\else
            \ifx\scr@key@run@errors\@empty\else
%    \end{macrocode}
% \changes{v3.28}{2019/11/23}{error messages and info fixed}
% Now, an existing \opt{@else@} option has to be used and either an error or
% info has to be shown.
%    \begin{macrocode}
              \scr@ifundefinedorrelax{KV@#1@@else@}{%
                \PackageError{scrbase}{%
                  unknown option
                  `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
                }{%
                  The members of family `#1' cannot set option
                  `\scr@key@name'
                  \ifx\scr@key@value\@empty\else
                    \MessageBreak
                    to value
                    `\expandafter\detokenize\expandafter{\scr@key@value}'%
                  \fi.\MessageBreak
                  Here's what each member says:
                  \scr@key@run@errors
                }%
              }{%
                \scr@execute@elseoption{#1}%
                \ifx\FamilyKeyState\FamilyKeyStateProcessed
                  \PackageInfo{scrbase}{%
                    option
                    `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
                    \MessageBreak
                    processed by `@else@' option of family\MessageBreak
                    `#1', after the members said:
                    \scr@key@run@errors\MessageBreak
                    o\expandafter\@gobble
                  }%
                  \let\scr@key@run@errors\relax
                \else
                  \PackageError{scrbase}{%
                    unknown option
                    \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
                      value at
                    \fi
                    `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
                  }{%
                    The members of family `#1' cannot set option
                    `\scr@key@name'
                    \ifx\scr@key@value\@empty\else
                      \MessageBreak
                      to value
                      `\expandafter\detokenize\expandafter{\scr@key@value}'%
                    \fi.\MessageBreak
                    Here's what each member says:
                    \scr@key@run@errors
                  }%
                \fi
              }%  
            \fi
          \fi
        \else
          \scr@ifundefinedorrelax{KV@#1@@else@}{%
            \PackageError{scrbase}{%
              unknown option
              `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
            }{%
              No one of the members of family `#1'\MessageBreak
              can handle option `\scr@key@name'.\MessageBreak
              So it cannot be set%
              \ifx\scr@key@value\@empty\else
                \space to value
                `\expandafter\detokenize\expandafter{\scr@key@value}'%
              \fi.%
            }%
          }{%
            \scr@execute@elseoption{#1}%
            \ifx\FamilyKeyState\FamilyKeyStateProcessed
            \else
              \PackageError{scrbase}{%
                unknown option
                \ifx\FamilyKeyState\FamilyKeyStateUnknownValue
                  value at
                \fi
                `\expandafter\detokenize\expandafter{\scr@key@atlist}'%
              }{%
                No one of the members of family `#1'\MessageBreak
                can handle option `\scr@key@name'.\MessageBreak
                So it cannot be set%
                \ifx\scr@key@value\@empty\else
                  \space to value
                  `\expandafter\detokenize\expandafter{\scr@key@value}'%
                \fi.%
              }%
            \fi
          }%  
        \fi
      \fi
    \fi
  }%
  \@nameuse{scr@after@options@#1@hook}%
}
%    \end{macrocode}
% \begin{macro}{\scr@execute@option}
% \changes{v3.12}{2013/03/04}{added}
% \changes{v3.13}{2014/06/30}{missing \cs{expandafter} in \cs{PackageInfo} added}
% \changes{v3.13a}{2014/08/13}{white spaces removed}
% \changes{v3.23}{2017/02/16}{it does not help to save the
%   \cs{AtEndOfFamilyOptions} hook}
% A split \opt{option} is executed, without changing any relevant macros (but
% \cs{reserved@a}). The first argument is the complete set in \pkg{keyval} syntax.
%    \begin{macrocode}
\newcommand*{\scr@execute@option}[1]{%
  \protected@edef\reserved@a{%
    \noexpand\let\noexpand\KV@err\noexpand\scr@KV@err
    \noexpand\setkeys{#1}{%
      \unexpanded\expandafter{\scr@key@atlist}}%
    \noexpand\def\noexpand\scr@key@atlist{%
      \unexpanded\expandafter{\scr@key@atlist}}%
    \noexpand\def\noexpand\scr@key@name{%
      \unexpanded\expandafter{\scr@key@name}}%
    \noexpand\def\noexpand\scr@key@value{%
      \unexpanded\expandafter{\scr@key@value}}%
    \ifx\scr@key@run@errors\relax
      \noexpand\let\noexpand\scr@key@run@errors\relax
    \else
      \noexpand\def\noexpand\scr@key@run@errors{%
        \unexpanded\expandafter{\scr@key@run@errors}}%
    \fi
    \ifx\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions@immediate
      \noexpand\let\noexpand\AtEndOfFamilyOptions
      \noexpand\scr@AtEndOfFamilyOptions@immediate
    \fi
  }%
  \let\AtEndOfFamilyOptions\scr@AtEndOfFamilyOptions
  \reserved@a
  \ifx\FamilyKeyState\FamilyKeyStateUnknown
    \PackageInfo{scrbase}{Unknown processing state.\MessageBreak
      Processing option 
      `\expandafter\detokenize\expandafter{\scr@key@atlist}'\MessageBreak
      \ifx\FamilyMemberOfKey\@empty\else
        of member `\FamilyMemberOfKey'\MessageBreak
      \fi
      of family `\FamilyOfKey'\MessageBreak
      doesn't set a valid state.\MessageBreak
      This will be interpreted\MessageBreak
      as \string\FamilyKeyStateProcessed
    }%
    \FamilyKeyStateProcessed
  \fi
}
%    \end{macrocode}
% \begin{macro}{\scr@KV@err}
% \changes{v3.12a}{2013/03/04}{missing internal command added}
% We just have to signal, that the option needs a value, that is missing.
%    \begin{macrocode}
\newcommand*{\scr@KV@err}[1]{%
  \FamilyKeyStateNeedValue
}
%    \end{macrocode}
% \end{macro}^^A \scr@KV@err
% \begin{macro}{\scr@key@run@errors}
% \changes{v3.12}{2013/03/04}{added}
% Needed by \cs{FamilyOptions} to collect the error messages, but report the
% error only, if no member has successfully processed the option. We define it
% here to make the re-definition in the previous code does work without error.
%    \begin{macrocode}
\newcommand*{\scr@key@run@errors}{}
%    \end{macrocode}
% \end{macro}^^A \scr@key@run@errors}
% \end{macro}^^A \scr@execute@option
% \begin{macro}{\scr@execute@elseoption}
% \changes{v3.20}{2015/11/18}{added}
% \changes{v3.25}{2017/11/16}{group added}
% \changes{v3.25}{2017/11/16}{\cs{scr@key@name@else} and
%   \cs{scr@key@value@else} added}
% \changes{v3.27}{2019/03/10}{missing percent added to avoid spaces}
% If a special option \opt{@else@} has been defined, it is executed by
% \cs{FamilyExecuteOptions} if and only if no other suitable option has been
% found. This is done by \cs{scr@execute@elseoption}. The argument and
% resulting state are exactly the same as with \cs{scr@execute@option}. It
% also have to do the same, but it does not call the option, but the
% \opt{@else@} option. The option itself is used as \meta{value} of the
% \opt{@else@} option. So temporary \cs{scr@key@atlist}, \cs{scr@key@name} and
% \cs{scr@key@value} have to be changed, before calling
% \cs{scr@execute@option}. To avoid once again splitting the \meta{value} into
% an internal \meta{key} and \meta{value} the original \cs{scr@key@name} and
% \cs{scr@key@value} are copied to \cs{scr@key@name@else} and
% \cs{scr@key@value@else}. These can be used inside the code of the
% \opt{@else@} option.
%    \begin{macrocode}
\newcommand*{\scr@execute@elseoption}[1]{%
  \begingroup
  \protected@edef\reserved@a{%
    \unexpanded{%
      \endgroup
      \let\scr@key@name@else\scr@key@name
      \let\scr@key@value@else\scr@key@value
      \def\scr@key@name{@else@}%
    }%
    \noexpand\def\noexpand\scr@key@value{%
      \unexpanded\expandafter{\scr@key@atlist}}%
    \noexpand\def\noexpand\scr@key@atlist{%
      @else@={\unexpanded\expandafter{\scr@key@atlist}}}%
    \noexpand\scr@execute@option{#1}%
    \noexpand\def\noexpand\scr@key@atlist{%
      \unexpanded\expandafter{\scr@key@atlist}}%
    \noexpand\def\noexpand\scr@key@name{%
      \unexpanded\expandafter{\scr@key@name}}%
    \noexpand\def\noexpand\scr@key@value{%
      \unexpanded\expandafter{\scr@key@value}}%
    \scr@ifundefinedorrelax{scr@key@name@else}{%
      \unexpanded{\let\scr@key@name@else\relax}%
    }{%
      \noexpand\def\noexpand\scr@key@name@else{%
        \unexpanded\expandafter{\scr@key@name@else}%
      }%
    }%
    \scr@ifundefinedorrelax{scr@key@value@else}{%
      \unexpanded{\let\scr@key@value@else\relax}%
    }{%
      \noexpand\def\noexpand\scr@key@value@else{%
        \unexpanded\expandafter{\scr@key@value@else}%
      }%
    }%
  }\reserved@a
}
%    \end{macrocode}
% \end{macro}^^A \scr@execute@elseoption
% \begin{macro}{\KOMA@key@foundtrue,\KOMA@key@foundfalse,\ifKOMA@key@found,
%               \scr@key@found@true,\scr@key@found@false,\ifscr@key@found@}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.00}{2008/04/30}{\cs{ifKOMA@key@found} renamed to \cs{ifscr@key@found}}
% \begin{macro}{\KOMA@key@at@list,\scr@key@atlist}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@atlist} renamed to \cs{scr@key@atlist}}
% \begin{macro}{\KOMA@key@name,\scr@key@name}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@name} renamed to \cs{scr@key@name}}
% \begin{macro}{\KOMA@key@value,\scr@key@value}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@value} renamed to \cs{scr@key@value}}
% \begin{macro}{\KOMA@key@split@name@value,\scr@key@split@name@value}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v2.97e}{2007/11/10}{using \cs{KV@@sp@def} to remove white spaces}
% \changes{v3.00}{2008/04/30}{\cs{KOMA@key@split@name@value} renamed to
%   \cs{scr@key@split@name@value}}
% \changes{v3.13}{2014/10/17}{\cs{long}}
% \changes{v3.26}{2018/08/29}{using \cs{scr@sp@def} instead of \cs{KV@@sp@def}}
%    \begin{macrocode}
\newif\ifscr@key@found@
\newcommand*{\scr@key@atlist}{}
\newcommand*{\scr@key@name}{}
\newcommand*{\scr@key@value}{}
\newcommand*{\scr@key@split@name@value}{}
\long\def\scr@key@split@name@value#1=#2=#3\@nil{%
  \scr@sp@def\scr@key@name{#1}%
  \scr@sp@def\scr@key@value{#2}%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \scr@key@split@name@value
% \end{macro}^^A \scr@key@value
% \end{macro}^^A \scr@key@name
% \end{macro}^^A \scr@key@atlist
% \end{macro}^^A \@FamilyOptions
% \end{macro}^^A \ifscr@key@found@
% \end{command}^^A \FamilyOptions
%
% \begin{command}{\FamilyOption}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.26b}{2019/01/09}{handling of typical user mistakes}
% \begin{macro}{\@FamilyOptions}
% \changes{v3.14}[2014/10/17]{added}
% \changes{v3.26}{2018/08/29}{using \cs{scr@sp@def} instead of \cs{KV@@sp@def}}
% \begin{macro}{\Family@Option}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \Family@Option
% \changes{v3.04b}{2010/01/29}{\cs{edef} replaced by \cs{protected@edef}}
% In opposite to \cs{FamilyOptions} this command sets only one \meta{option}
% (\texttt{\#2}) of a \meta{family} (\texttt{\#1}). But you can set it to a
% \meta{list of values} (\texttt{\#3}). The values are set in the order of the
% \meta{list of values}.
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyOption}[2]{%
  \begingroup
    \def\reserved@a##1,##2\@nil{\IfArgIsEmpty{##2}{}{\@tempswatrue}}%
    \@tempswafalse\expandafter\reserved@a#2,\@nil
    \if@tempswa
      \PackageError{scrbase}{%
        syntax error in key `\detokenize{#2}'%
      }{%
        You've used `\string\...Option' to set the key
        `\detokenize{#2}'\MessageBreak
        to new value(s), but `,' is not allowed in the key of
        an option\MessageBreak
        (and `\string\...Option' does not use `,' to separate several
        keys).\MessageBreak
        Maybe you've meant \string\...Options\space instead of
        \string\...Option.\MessageBreak
        If you'll continue, I'll give it a try, but you should expect
        further\MessageBreak
        and even strange error messages.%
      }%
    \else
      \def\reserved@a##1=##2\@nil{%
        \IfArgIsEmpty{##2}{}{\@tempswatrue\def\reserved@a{=}}}%
      \expandafter\reserved@a#2=\@nil
      \if@tempswa
        \PackageError{scrbase}{%
          syntax error in key `\detokenize{#2}'%
        }{%
          You've used `\string\...Option' to set the key
          `\detokenize{#2}'\MessageBreak
          to new value(s), but `=' is not allowed in the key of
          an option\MessageBreak
          (and `\string\...Option' does not use `=' to separate key and
          value).\MessageBreak
          Maybe you've meant \string\...Options\space instead of
          \string\...Option.\MessageBreak
          If you'll continue, I'll give it a try, but you should expect
          further\MessageBreak
          and even strange error messages.%
        }%
      \fi
    \fi
  \endgroup
  \@FamilyOption{#1}{#2}%
}
\newcommand{\@FamilyOption}[3]{%
  \expandafter\scr@sp@def\expandafter\scr@key@name\expandafter{#2}%
%    \end{macrocode}
% The most simply solution is to walk through the \meta{list of values} and
% generate a \meta{list of options} for \cs{FamilyOptions}.
%    \begin{macrocode}
  \let\reserved@a\@empty
  \@for\reserved@b:=#3\do{%
%    \end{macrocode}
% \changes{v3.08}{2010/11/05}{allow empty values}
% Empty elements in the \meta{list of values} are ignored. Note: This is not
% really the correct solution but several users expect it. So for a real empty
% value you need to use |{}|.
%    \begin{macrocode}
    \ifx\reserved@b\@empty\else
%    \end{macrocode}
% \changes{v3.12}{2012/03/04}{ignore white space values}
% The same for white space values.
%    \begin{macrocode}
      \ifx\reserved@b\space\else
        \edef\reserved@a{\unexpanded\expandafter{\reserved@a},%
          \scr@key@name=\unexpanded\expandafter{\reserved@b}}%
      \fi
    \fi
  }%
  \def\reserved@b{\FamilyOptions{#1}}%
  \expandafter\reserved@b\expandafter{\reserved@a}%
}
%</base>
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\KOMAoptions}
% \changes{v2.96}{2006/08/20}{hook after options added}
% \changes{v2.97c}{2007/04/19}{process options of all members}
% \changes{v3.12}{2013/03/04}{using hooks of \cs{FamilyOptions}}
% Nice little shortcut.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAoptions}{\FamilyOptions{KOMA}}
%</koma>
%    \end{macrocode}
% \begin{macro}{\KOMA@options}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \KOMA@options
% \end{command}^^A \KOMAoptions
%
% \begin{command}{\KOMAoptionsOf}
% \changes{v3.17}{2015/02/25}{added}
% Ask for the currently set options of a supporting \KOMAScript{} class or
% package. The optional first argument (\texttt{\#1}) is a command or macro,
% that will be execute with the list of options as an argument. The second
% argument (\texttt{\#2}) is the filename of a \KOMAScript{} class or package
% (with extension). Without optional argument, the \meta{list of options} are
% be printed.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAoptionsOf}[2][\@firstofone]{%
  \scr@ifundefinedorrelax{scr@kav@KOMA.#2}{%
    \PackageError{scrkbase}{\string\KOMAoptionsOf\space not supported}{%
      #2 is not the name of a KOMA-Script package or\MessageBreak
      KOMA-Script class, that supports \string\KOMAoptionsOf.}%
  }{%
    \begingroup
      \def\reserved@a{#1}%
      \KOMA@kav@defall\reserved@b{.#2}%
    \expandafter\expandafter\expandafter\endgroup
    \expandafter\reserved@a\expandafter{\reserved@b}%
  }%
}
%</koma>
%    \end{macrocode}
% \end{command}^^A \KOMAoptionsOf
%
% \begin{command}{\KOMAoptionOf}
% \changes{v3.17}{2015/02/26}{added}
% Ask for the current values of one option of a supporting \KOMAScript{} class
% or package. Again the optional first argument (\texttt{\#1}) is a command or
% macro, that will be execute with the list of values as an argument. The second
% argument (\texttt{\#2}) is the filename of a \KOMAScript{} class or package
% (with extension). The third argument (\texttt{\#3}) is the name of an
% option of the class resp. package. Without optional argument, the \meta{list of
% values} are be printed.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAoptionOf}[3][\@firstofone]{%
  \scr@ifundefinedorrelax{scr@kav@KOMA.#2}{%
    \PackageError{scrkbase}{\string\KOMAoptionOf\space not supported}{%
      #2 is not the name of a KOMA-Script package or\MessageBreak
      KOMA-Script class, that supports \string\KOMAoptionOf.}%
  }{%
    \begingroup
      \def\reserved@a{#1}%
      \KOMA@kav@defone\reserved@b{.#2}{#3}%
      \ifx\reserved@b\@empty
        \PackageWarning{scrkbase}{option `#3' for `#2' unset}%
        \endgroup
      \else
      \expandafter\expandafter\expandafter\endgroup
      \expandafter\reserved@a\expandafter{\reserved@b}%
    \fi
  }%
}
%</koma>
%    \end{macrocode}
% \end{command}
%
% \begin{macro}{\post@kopt@hook}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \post@kopt@hook
% \begin{command}{\AfterKOMAoptions}
% \changes{v3.12}{2013/03/04}{using \cs{AtEndOfFamilyOptions}}
% \changes{v3.23}{2017/02/16}{\cs{newcommand} instead of \cs{let}}
% An option can process code after executing all options of the current
% \cs{KOMAoptions}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\AfterKOMAoptions}{\AtEndOfFamilyOptions}
%</koma>
%    \end{macrocode}
% \end{command}^^A \AfterKOMAoptions
%
% \begin{macro}{\l@addto@macro}
% \changes{v2.8p}{2001/09/22}{added} 
% \changes{v2.95}{2006/06/02}{changed to handle macros with arguments same
%   like \cs{g@addto@macro}}
% \changes{v3.12}{2013/04/20}{removed non-\eTeX{} implementation}
% \changes{v3.12}{2013/04/20}{warn, if \cs{l@addto@macro} is already defined
% different from our definition}
% \changes{v3.23}{2017/02/16}{moved to \texttt{prepare}}
% We need a local variant of \cs{g@addto@macro}.
%    \begin{macrocode}
%</body>
%<*base&prepare>
\@ifundefined{l@addto@macro}{}{%
  \begingroup
    \long\def\reserved@a#1#2{%
      \edef#1{\unexpanded\expandafter{#1#2}}%
    }%
    \ifx\reserved@a\l@addto@macro\else
      \PackageWarning{scrbase}{%
        Someone also uses macro name \string\l@addto@macro.\MessageBreak
        When KOMA-Script author decided to use macro name\MessageBreak
        \string\l@addto@macro\space first, there was no other
        free\MessageBreak
        LaTeX package using this macro name.\MessageBreak
        In the meantime other package authers decided to use\MessageBreak
        same macro name, but unfortunatly not all of those\MessageBreak
        are compatible with KOMA-Script's definition, e.g.,\MessageBreak
        while adding definitions with arguments to macros.\MessageBreak
        Because of such potentially incompatible definitions,\MessageBreak
        KOMA-Script will redefine the command now.\MessageBreak
        Please ask the author of the other package to\MessageBreak
        rename his macro, if a problem results in the\MessageBreak
        redefinition%
      }%
    \fi
  \endgroup
}
\long\def\l@addto@macro#1#2{%
  \edef#1{\unexpanded\expandafter{#1#2}}%
}%
%</base&prepare>
%<*body>
%    \end{macrocode}
% \end{macro}^^A \l@addto@macro
%
% \begin{macro}{\l@addto@macro@a}
% \changes{v3.20}{2015/11/20}{added}
% I also need a version for macros with exactly one argument. Note: This macro
% is dangerous. Sometimes it does not work correctly, so there is not an will
% not be an official documentation.
%    \begin{macrocode}
%<*base>
\begingroup
  \catcode`\^^A=\catcode`\#
  \@makeother\#
  \gdef\l@addto@macro@a^^A1{%
    \begingroup
      \@makeother\#
      \def\l@addto@macro@a@cmd{^^A1}%
      \l@addto@macro@a@
  }
  \gdef\l@addto@macro@a@^^A1{%
    \def\l@addto@macro@a@add{^^A1}%
    \l@addto@macro@a@@
  }
\endgroup
\begingroup
  \@makeother\#
  \gdef\l@addto@macro@a@@{%
    \@makeother\#
    \edef\reserved@a{%
      \detokenize{\endgroup\def}%
      \detokenize\expandafter{\l@addto@macro@a@cmd#1}%
      {%
        \expandafter\detokenize%
        \expandafter\expandafter\expandafter{\l@addto@macro@a@cmd{#1}}%
        \expandafter\detokenize\expandafter{\l@addto@macro@a@add}%
      }%
    }%
    \expandafter\scantokens\expandafter{\reserved@a}%
  }%
\endgroup
%</base>
%    \end{macrocode}
% \end{macro}^^A \l@addto@macro@a
%
% \begin{macro}{\l@preto@macro}
% \changes{v3.20}{2015/11/25}{added}
% Similar to \cs{l@addto@macro} but adds code at the very beginning instead of
% appending it a the end.
%    \begin{macrocode}
%<*base>
\newcommand\l@preto@macro[2]{%
  \edef#1{\unexpanded{#2}\unexpanded\expandafter{#1}}%
}%
%</base>
%    \end{macrocode}
% \end{macro}^^A \l@preto@macro
%
% \begin{macro}{\l@preto@macro@a}
% \changes{v3.20}{2015/11/25}{added}
% I also need a version for macros with exactly one argument. Note: This macro
% is dangerous. Sometimes it does not work correctly, so there is not an will
% not be an official documentation.
%    \begin{macrocode}
%<*base>
\begingroup
  \catcode`\^^A=\catcode`\#
  \@makeother\#
  \gdef\l@preto@macro@a^^A1{%
    \begingroup
      \@makeother\#
      \def\l@preto@macro@a@cmd{^^A1}%
      \l@preto@macro@a@
  }
  \gdef\l@preto@macro@a@^^A1{%
    \def\l@preto@macro@a@add{^^A1}%
    \l@preto@macro@a@@
  }
\endgroup
\begingroup
  \@makeother\#
  \gdef\l@preto@macro@a@@{%
    \@makeother\#
    \edef\reserved@a{%
      \detokenize{\endgroup\def}%
      \detokenize\expandafter{\l@preto@macro@a@cmd#1}%
      {%
        \expandafter\detokenize\expandafter{\l@preto@macro@a@add}%
        \expandafter\detokenize%
        \expandafter\expandafter\expandafter{\l@preto@macro@a@cmd{#1}}%
      }%
    }%
    \expandafter\scantokens\expandafter{\reserved@a}%
  }%
\endgroup
%</base>
%    \end{macrocode}
% \end{macro}^^A \l@preto@macro@a
%
% \begin{command}{\KOMAoption}
% \changes{v2.98c}{2008/03/12}{added}
% \changes{v3.12}{2013/03/04}{using \cs{FamilyOption}}
% Simple little shortcut.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMAoption}{\FamilyOption{KOMA}}
%</koma>
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\FamilyUnknownKeyValue}
% \changes{v3.10}{2011/09/12}{no error while processing global options}
% \changes{v3.11a}{2012/05/28}{prevent remove from list of unused global
%   options globally}
% \changes{v3.14}{2014/10/17}{\cs{long}}
% \changes{v3.30}{2020/02/25}{spurious space in warning message removed}
% Used to report an error because of unknown values. Arguments are
% \marg{family}\marg{key}\marg{valid values}.
%    \begin{macrocode}
%<*base>
\newcommand{\FamilyUnknownKeyValue}[4]{%
  \FamilyKeyStateUnknownValue
  \ifx\FamilyElseValues\@empty\else
    \PackageWarning{scrbase}{non empty \string\FamilyElseValue
      ignored.\MessageBreak
      Setting this command to a non empty\MessageBreak
      value for option `#2' of\MessageBreak
      family `#1' is deprecated,\MessageBreak
      but has been found%
    }%
  \fi
}
%</base>
%    \end{macrocode}
% \begin{command}{\FamilyElseValues}
% \changes{v3.00}{2008/05/02}{added}
% \changes{v3.12}{2013/03/04}{deprecated and not used internally}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyElseValues}{}
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilyUnknownKeyValue
% \end{command}^^A \FamilyElseValue
%
% \begin{command}{\FamilyBoolKey}
% \changes{v3.00}{2008/04/30}{added}
% Defining a new boolean key:
% \begin{quote}
%   \cs{FamilyBoolKey}\oarg{member}\marg{family}\marg{key}\marg{switch}
% \end{quote}
% The default \meta{member} is (once again)
% \file{.\cs{@currname}.\cs{@currext}} and it is recommended to always use it!
% \cs{if\meta{switch}} is automatically defined, if it was undefined. In this
% case the initial value is \opt{false}. The default for using the \meta{key}
% without argument would be \opt{true}. For other allowed values see
% \cs{FamilySetBool}.
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyBoolKey}[4][.\@currname.\@currext]{%
  \@ifundefined{if#4}{%
    \expandafter\newif\csname if#4\endcsname
  }{}%
  \DefineFamilyKey[{#1}]{#2}{#3}[true]{\FamilySetBool{#2}{#3}{#4}{##1}}%
}
%    \end{macrocode}
% \begin{command}{\FamilySetBool}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.11a}{2012/05/25}{error message fixed}
% \changes{v3.27}{2019/07/08}{empty argument is \texttt{true}}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Setting a boolean key:
% \begin{quote}
%   \cs{FamilySetBool}\marg{family}\marg{key}\marg{switch}\marg{value}
% \end{quote}
% The \meta{family} and the \meta{key} are used for reporting unknown values using
% \cs{FamilyUnknownKeyValue}. The \meta{switch} is used to use either
% \cs{\meta{switch}true} or \cs{\meta{switch}false}. It is ignored, if these
% are not defined, so have to take care, that \cs{if\meta{switch}} already has
% been defined, e.g., using \cs{FamilyBoolKey}. The \meta{value} can either be
% \opt{true}, \opt{on} or \opt{yes} for \cs{\meta{switch}true} or
% \opt{false}, \opt{off} or \opt{no} for \cs{\meta{switch}false}.
%    \begin{macrocode}
\newcommand*{\FamilySetBool}[4]{%
  \Ifstr{#4}{}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
    \Ifstr{#4}{true}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
      \Ifstr{#4}{on}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
        \Ifstr{#4}{yes}{\@nameuse{#3true}\FamilyKeyStateProcessed}{%
          \Ifstr{#4}{false}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
            \Ifstr{#4}{off}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
              \Ifstr{#4}{no}{\@nameuse{#3false}\FamilyKeyStateProcessed}{%
                \FamilyUnknownKeyValue{#1}{#2}{#4}{%
                  `true', `on', `yes', `false', `off', `no'%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }%
  \let\FamilyElseValues\@empty
}
%</base>
%    \end{macrocode}
% \end{command}
% \end{command}
% \begin{command}{\FamilyInverseBoolKey,\FamilySetInverseBool}
% \changes{3.27}{2019/07/08}{added}
% These are similar to \cs{FamilyBoolKey} and \cs{FamilySetBoolKey} but use
% inverse logic (true sets false and false sets true).
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyInverseBoolKey}[4][.\@currname.\@currext]{%
  \@ifundefined{if#4}{%
    \expandafter\newif\csname if#4\endcsname
    \@nameuse{#4true}%
  }{}%
  \DefineFamilyKey[{#1}]{#2}{#3}[true]{\FamilySetInverseBool{#2}{#3}{#4}{##1}}%
}
\newcommand*{\FamilySetInverseBool}[4]{%
  \FamilySetBool{#1}{#2}{#3}{#4}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \expandafter\ifx\csname if#3\expandafter\endcsname\csname iftrue\endcsname
      \@nameuse{#3false}%
    \else
      \@nameuse{#3true}%
    \fi
  \fi
}
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilyInverseBoolKey,\FamilySetInverseBool
%
% \begin{macro}{\KOMA@unknown@keyval}
% Version of \cs{FamilyUnknownKeyValue} with static family |KOMA|.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@unknown@keyval}{\FamilyUnknownKeyValue{KOMA}}
%</koma>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\KOMA@ifkey}
% \changes{v3.02c}{2009/02/04}{defines the member if needed}
% \changes{v3.17}{2015/03/02}{replaces the value in the storage}
% This is an extended version of \cs{FamilyBoolKey} with static family
% |KOMA|. So the syntax is:
% \begin{quote}
%   \cs{KOMA@ifkey}\oarg{member}\marg{key}\marg{switch}
% \end{quote}
% The default \meta{member} is (once again)
% \file{.\cs{@currname}.\cs{@currext}} and it is recommended to always use it!
% \cs{if\meta{switch}} is automatically defined, if it was undefined. The
% default for using the \meta{key} without argument would be \opt{true}. Note:
% \meta{member} and \meta{key} are always fully expanded. Depending on a
% already existing \cs{if\meta{key}} either \opt{\meta{key}=true} or
% \opt{\meta{key}=false} is added to the value storage. If \cs{if\meta{key}}
% was not defined, the initialized value is \opt{false}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@ifkey}[2][.\@currname.\@currext]{%
  \begingroup\edef\reserved@a{\noexpand\KOMA@@ifkey{#1}{#2}}%
  \expandafter\endgroup\reserved@a
}
\newcommand*{\KOMA@@ifkey}[3]{%
  \@ifundefined{if#3}{%
    \expandafter\newif\csname if#3\endcsname
  }{}%
  \KOMA@key[{#1}]{#2}[true]{%
    \KOMA@set@ifkey{#2}{#3}{##1}%
    \KOMA@kav@replacebool{#1}{#2}{#3}%
  }%
  \csname if#3\endcsname
    \KOMA@kav@xadd{#1}{#2}{true}%
  \else
    \KOMA@kav@xadd{#1}{#2}{false}%
  \fi
}
%</koma>
%    \end{macrocode}
% \begin{macro}{\KOMA@set@ifkey}
% Simple a shortcut for |\FamilySetBool{KOMA}|. So the syntax is:
% \begin{quote}
%   \cs{KOMA@set@ifkey}\marg{key}\marg{switch}\marg{value}
% \end{quote}
% But all arguments are delegated.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@set@ifkey}{\FamilySetBool{KOMA}}
%</koma>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{command}{\FamilyCounterKey}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2014/12/03}{optional default value}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% Defining a \meta{key} that sets a \LaTeX{} counter to a \meta{value}.
% \begin{quote}
%   \cs{FamilyCounterKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{\LaTeX{} counter}
% \end{quote}
% \meta{default} and the \meta{value} of the option has to be (almost) any
% kind of value, that can be assigned to a \LaTeX{} counter. The
% \meta{counter} is automatically defined, if it was undefined. In this case
% the initial value is 0.
% \begin{macro}{\Family@@Counter@@Key,\Family@Counter@Key}
% \changes{v3.15}{2014/12/03}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyCounterKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@Counter@@Key{#1}{#2}{#3}}%
    {\Family@Counter@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@Counter@@Key}{}
\def\Family@@Counter@@Key#1#2#3[#4]#5{%
  \@ifundefined{c@#5}{\newcounter{#5}}{}%
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetCounter{#2}{#3}{#5}{##1}}%
}
\newcommand*{\Family@Counter@Key}[4]{%
  \@ifundefined{c@#4}{\newcounter{#4}}{}%
  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounter{#2}{#3}{#4}{##1}}%
}
%    \end{macrocode}
% \end{macro}
% \begin{command}{\FamilySetCounter}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.18a}{2015/07/06}{using \cs{FamilyKeyStateProcessed}}
% \changes{v3.23}{2017/02/23}{white space replaced by \cs{relax}}
% Set the value of a \meta{key} defined by \cs{FamilyCounterKey}:
% \begin{quote}
%   \cs{FamilySetCounter}\marg{family}\marg{key}\marg{counter}\marg{value}
% \end{quote}
% Note: Before assigning the \meta{value} to the \meta{counter} tests are
% done, if the \meta{value} can be used to be assigned to a \LaTeX{}
% counter. If this fails a unknown value is reported.
%    \begin{macrocode}
\newcommand*{\FamilySetCounter}[4]{%
  \begingroup
    \protected@edef\reserved@a{#4}%
    \def\reserved@b{\endgroup\value{#3}=#4\relax\FamilyKeyStateProcessed}%
    \expandafter\Ifiscount\expandafter{\reserved@a}{}{%
      \expandafter\Ifisdimen\expandafter{\reserved@a}{}{%
        \expandafter\Ifisskip\expandafter{\reserved@a}{}{%
          \expandafter\Ifisnumexpr\expandafter{\reserved@a}{}{%
            \expandafter\Ifisdimexpr\expandafter{\reserved@a}{}{%
              \expandafter\Ifisinteger\expandafter{\reserved@a}{}{%
                \expandafter\Ifiscounter\expandafter{\reserved@a}{%
                  \def\reserved@b{%
                    \endgroup\value{#3}=\value{#4}\FamilyKeyStateProcessed
                  }%
                }{%
                  \def\reserved@b{%
                    \endgroup
                    \FamilyUnknownKeyValue{#1}{#2}{#4}{%
                      integer numbers, counters, lengths, skips, dimens
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  \reserved@b
}
%</base>
%    \end{macrocode}
% \end{command}
% \end{command}
%
% \begin{command}{\FamilyCounterMacroKey}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2014/12/03}{support for optional default}
% Similar to \cs{FamilyCounterKey}, but it does not use a \LaTeX{} counter to
% store the value but a macro (or command):
% \begin{quote}
%   \cs{FamilyCounterMacroKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro}
% \end{quote}
% The \meta{value} will be assigned to a counter (\cnt{page}) locally and the
% \meta{macro} is defined using the value of the counter. The \meta{macro}
% is automatically set to \cs{z@} if it was not already defined. If it was
% defined, the user is responsible for that it has to be a number.
% \begin{macro}{\Family@@Counter@@Macro@@Key,\Family@Counter@Macro@Key}
% \changes{v3.15}{2014/12/03}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyCounterMacroKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@Counter@@Macro@@Key{#1}{#2}{#3}}%
    {\Family@Counter@Macro@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@Counter@@Macro@@Key}{}
\def\Family@@Counter@@Macro@@Key#1#2#3[#4]#5{%
  \ifdefined#4\else\let#4\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetCounterMacro{#2}{#3}{#5}{##1}}%
}
\newcommand*{\Family@Counter@Macro@Key}[4]{%
  \ifdefined#4\else\let#4\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetCounterMacro{#2}{#3}{#4}{##1}}%
}
%    \end{macrocode}
% \end{macro}^^A \Family@@Counter@@Macro@@Key,\Family@Counter@Macro@Key
% \begin{command}{\FamilySetCounterMacro}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2014/12/17}{\cs{aftergroup} before \cs{FamilyKeyStateProcessed}}
% \changes{v3.18a}{2015/07/06}{fixed usage of \cs{FamilyKeyStateProcessed}}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% Similar to \cs{FamilySetCounter} but using a macro (or command) instead of a
% \LaTeX{} counter:
% \begin{quote}
%   \cs{FamilySetCounterMacro}\marg{family}\marg{key}\marg{macro}\marg{value}
% \end{quote}
% Note, that the \meta{value} is locally assigned to a counter (\cnt{page})
% before defining the \meta{macro} using the value of the counter.
%    \begin{macrocode}
\newcommand*{\FamilySetCounterMacro}[4]{%
  \begingroup
    \FamilySetCounter{#1}{#2}{page}{#4}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \edef\reserved@a{%
        \unexpanded{\endgroup\def#3}%
        {\the\value{page}}%
        \noexpand\FamilyKeyStateProcessed
      }%
    \else
      \def\reserved@a{%
        \endgroup
        \FamilyUnknownKeyValue{#1}{#2}{#4}{%
          integer numbers, counters, lengths, skips, dimens
        }%
      }%
    \fi
  \reserved@a
}    
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilySetCounterMacro
% \end{command}^^A \FamilyCounterMacroKey
%
% \begin{command}{\FamilyLengthKey}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2014/12/03}{optional default value}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
% \cs{kernel@ifnextchar}}
% Defining a \meta{key} that sets a \LaTeX{} length to a \meta{value}.
% \begin{quote}
%   \cs{FamilyLengthKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{\LaTeX{} length}
% \end{quote}
% \meta{default} and the \meta{value} of the option has to be (almost) any
% kind of value, that can be assigned to a \LaTeX{} length, a \TeX{} dimension
% or a \TeX{} skip. The \meta{\LaTeX{} length} is automatically defined, if it
% was undefined. In this case the initial value is 0.
% \begin{macro}{\Family@@Length@@Key,\Family@Length@Key}
% \changes{v3.15}{2014/12/03}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyLengthKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@Length@@Key{#1}{#2}{#3}}%
    {\Family@Length@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@Length@@Key}{}
\def\Family@@Length@@Key#1#2#3[#4]#5{%
  \ifdefined#5\else\newlength{#5}\fi
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetLength{#2}{#3}{#5}{##1}}%
}
\newcommand*{\Family@Length@Key}[4]{%
  \ifdefined#4\else\newlength{#4}\fi
  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLength{#2}{#3}{#4}{##1}}%
}
%    \end{macrocode}
% \begin{command}{\FamilySetLength}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2015/01/02}{\cs{ifglueexpr} added}
% \changes{v3.18a}{2015/07/06}{usage of \cs{FamilyKeyStateProcessed} fixed}
% \changes{v3.20}{2016/04/27}{expansion before testing}
% Set the value of a \meta{key} defined by \cs{FamilyLengthKey}:
% \begin{quote}
%   \cs{FamilySetLength}\marg{family}\marg{key}\marg{\LaTeX{} length}\marg{value}
% \end{quote}
% Note: Before assigning the \meta{value} to the \meta{\LaTeX{} length} it is
% fully expanded and tests are done, if the \meta{value} can be used to be
% assigned to a \LaTeX{} length. If this fails a unknown value is reported. If
% the expansion or the assignment fails a \TeX{} error happens.
%    \begin{macrocode}
\newcommand*{\FamilySetLength}[4]{%
  \begingroup
  \protected@edef\reserved@a{#4}%
%    \end{macrocode}
% Together with \cs{@defaultsunits} (see below) following code, could be used:
%    \begin{macrocode}
%<*neveruse>
    \expandafter\Ifiscount\expandafter{\reserved@a}{%
      \aftergroup\@firstoftwo
    }{%
%</neveruse>
%    \end{macrocode}
% But currently we don't use it!
%    \begin{macrocode}
    \expandafter\Ifisdimen\expandafter{\reserved@a}{%
      \aftergroup\@firstoftwo
    }{%
      \expandafter\Ifisskip\expandafter{\reserved@a}{%
        \aftergroup\@firstoftwo
      }{%
%    \end{macrocode}
% Together with \cs{@defaultsunits} (see below) following code, could be used:
%    \begin{macrocode}
%<*neveruse>
        \expandafter\Ifisnumexpr\expandafter{\reserved@a}{%
          \aftergroup\@firstoftwo
        }{%
%</neveruse>
%    \end{macrocode}
% But currently we don't use it!
%    \begin{macrocode}
          \expandafter\Ifisdimexpr\expandafter{\reserved@a}{%
            \aftergroup\@firstoftwo
          }{%
            \expandafter\Ifisglueexpr\expandafter{\reserved@a}{%
              \aftergroup\@firstoftwo
            }{%
              \expandafter\Ifisglue\expandafter{\reserved@a}{%
                \aftergroup\@firstoftwo
              }{%
                \aftergroup\@secondoftwo
              }%
            }%
          }%
%<*neveruse>
        }%
%</neveruse>
      }%
    }%
%<*neveruse>
  }%
%</neveruse>
  \endgroup
%    \end{macrocode}
% \begin{description}
% \item[ToDo:] Maybe something like:
%    \begin{macrocode}
%<*neveruse>
  {\@defaultunits#3=#4pt\relax\@nnil\FamilyKeyStateProcessed}
%</neveruse>
%    \end{macrocode}
%   would be nice. But there are reasons I've decided not to use
%   this. Unfortunately I cannot remember the reason (and because of this I've 
%   added the code as \texttt{neveruse}). So the simple assignment is used
%   instead:
% \end{description}
%    \begin{macrocode}
  {#3=#4\FamilyKeyStateProcessed}%
  {%
    \FamilyUnknownKeyValue{#1}{#2}{#4}{%
      length values,
%<*neveruse>
      counters,
%</neveruse>
      lengths, skips, dimens
    }%
  }%
}
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilySetLength
% \end{macro}^^A \Family@@Leng{\FamilyLengthKey}th@@Key,\Family@Length@Key
% \end{command}^^A FamilyLengthKey
%
% \begin{command}{\FamilyLengthMacroKey}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.15}{2014/12/03}{support for optional default}
% \begin{command}{\FamilySetLengthMacro}
% \changes{v3.12}{2013/11/05}{added}
% \changes{v3.14a}{2014/11/24}{fix: \cs{@tempskipa} instead of \cs{@temskipa}}
% \changes{v3.15}{2014/12/17}{\cs{aftergroup} before
%   \cs{FamilyKeyStateProcessed}}
% \changes{v3.15}{2015/01/02}{\cs{ifglueexpr} added}
% \changes{v3.18a}{2015/07/06}{usage of \cs{FamilyKeyStateProcessed} fixed}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% \changes{v3.20}{2016/04/27}{using \cs{FamilySetLength}}
% Similar to \cs{FamilyLengthKey}, but it does not use a \LaTeX{} counter to
% store the value but a macro (or command):
% \begin{quote}
%   \cs{FamilyLength MacroKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro}
% \end{quote}
% The \meta{value} will be assigned to a length (\len{@tempskipa}) locally and
% the \meta{macro} is defined using the value of the length. The \meta{macro}
% is automatically set to \cs{z@} if it was not already defined. If it was
% defined, the user is responsible for that it has to be a valid length. Usage
% of \cs{dimexpr} is recommended for such a definition.
% \begin{macro}{\Family@@Length@@Macro@@Key,\Family@Length@Macro@Key}
% \changes{v3.15}{2014/12/03}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyLengthMacroKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@Length@@Macro@@Key{#1}{#2}{#3}}%
    {\Family@Length@Macro@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@Length@@Macro@@Key}{}
\def\Family@@Length@@Macro@@Key#1#2#3[#4]#5{%
  \ifdefined#5\else\let#5\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\FamilySetLengthMacro{#2}{#3}{#5}{##1}}%
}
\newcommand*{\Family@Length@Macro@Key}[4]{%
  \ifdefined#4\else\let#4\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetLengthMacro{#2}{#3}{#4}{##1}}%
}
\newcommand*{\FamilySetLengthMacro}[4]{%
  \begingroup
    \FamilySetLength{#1}{#2}{\@tempskipa}{#4}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \edef\reserved@a{%
        \unexpanded{\endgroup\def#3}%
        {\the\@tempskipa}%
        \noexpand\FamilyKeyStateProcessed
      }%
    \else
      \def\reserved@a{%
        \endgroup
        \FamilyUnknownKeyValue{#1}{#2}{#4}{%
          length values, counters, lengths, skips, dimens
        }%
      }%
    \fi
  \reserved@a
}    
%</base>
%    \end{macrocode}
% \end{macro}^^A \Family@@Length@@Macro@@Key,\Family@Length@Macro@Key
% \end{command}^^A \FamilySetLengthMacro
% \end{command}^^A \FamilyLengthMacroKey
%
%
% \begin{command}{\FamilyUseLengthMacroKey,\FamilySetUseLengthMacro}
% \changes{v3.20}{2016/04/27}{added}
% These are almost the same like \cs{FamilyLengthMacroKey} and
% \cs{FamilySetLengthMacro}. But there is one important difference: Instead of
% setting the \meta{macro} to the value of the temporary length, that has been
% used for a test assignment, the \meta{macro} is defined as \meta{value}. So
% later changes valid for the expansion and value of \meta{value} will indeed
% change the value of \meta{macro}, when it is used.
% \begin{macro}{\Family@@UseLength@@Macro@@Key,\Family@USeLength@Macro@Key}
% \changes{v3.20}{2016/04/27}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyUseLengthMacroKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@UseLength@@Macro@@Key{#1}{#2}{#3}}%
    {\Family@UseLength@Macro@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@UseLength@@Macro@@Key}{}
\def\Family@@UseLength@@Macro@@Key#1#2#3[#4]#5{%
  \ifdefined#5\else\let#5\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{%
    \FamilySetUseLengthMacro{#2}{#3}{#5}{##1}%
  }%
}
\newcommand*{\Family@UseLength@Macro@Key}[4]{%
  \ifdefined#4\else\let#4\z@\fi
  \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetUseLengthMacro{#2}{#3}{#4}{##1}}%
}
\newcommand*{\FamilySetUseLengthMacro}[4]{%
  \begingroup
    \FamilySetLength{#1}{#2}{\@tempskipa}{#4}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \def\reserved@a{%
        \endgroup\def#3{#4}%
        \FamilyKeyStateProcessed
      }%
    \else
      \def\reserved@a{%
        \endgroup
        \FamilyUnknownKeyValue{#1}{#2}{#4}{%
          length values, counters, lengths, skips, dimens
        }%
      }%
    \fi
  \reserved@a
}    
%</base>
%    \end{macrocode}
% \end{macro}^^A \Family@@UseLength@@Macro@@Key,\Family@USeLength@Macro@Key
% \end{command}^^A \FamilyUseLengthMacroKey,\FamilySetUseLengthMacro
%
%
% \begin{command}{\FamilyNumericalKey}
% \changes{v3.00}{2008/04/30}{added}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%     \cs{kernel@ifnextchar}}
% This is a mapping of symbolic values to numerical values:
% \begin{quote}
%   \cs{FamilyNumericalKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro}\marg{mapping list}
% \end{quote}
% The \meta{mapping list} is:
% \begin{quote}
% \texttt{\marg{symbol$_1$}\marg{value$_1$},\marg{symbol$_2$}\marg{value$_2$}\dots}
% \end{quote}
% There is no need for \meta{value$_n$} and \meta{value$_m$} to be mutual
% exclusive. So several symbols can be mapped to the same value.
% \begin{macro}{\Family@Numerical@Key}
% \changes{v3.00}{2008/05/28}{added}
% \changes{v3.08b}{2011/03/31}{fixed: missing argument to \cs{ifundefined}}
% The internal macro is used to handle the optional \meta{default} (because
% currently we are not using \pkg{xparse}).
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyNumericalKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@Numerical@Key{#1}{#2}{#3}}{\Family@Numerical@Key{#1}{#2}{#3}[]}%
}
\newcommand*{\Family@Numerical@Key}{}
\def\Family@Numerical@Key#1#2#3[#4]#5#6{%
  \@ifundefined{#5}{\@namedef{#5}{0}}{}%
  \ifx\relax#4\relax
    \DefineFamilyKey[{#1}]{#2}{#3}{\FamilySetNumerical{#2}{#3}{#5}{#6}{##1}}%
  \else
    \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{%
      \FamilySetNumerical{#2}{#3}{#5}{#6}{##1}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \begin{command}{\FamilySetNumerical}
% \changes{v3.11a}{2012/05/28}{call of \cs{FamilyUnknownKeyValue} outside of
%   local group}
% \changes{v3.25}{2017/12/04}{handling of completely empty list elements}
% Set the value of \meta{key} defined by \cs{FamilyNumericalKey}:
% \begin{quote}
%   \cs{FamilySetNumerical}\marg{family}\marg{key}\marg{macro}\marg{mapping list}\marg{value}
% \end{quote}
%    \begin{macrocode}
\newcommand*{\FamilySetNumerical}[5]{%
  \begingroup
    \edef\@searched{#5}%
    \let\reserved@a=\@empty
    \let\reserved@b=\@empty
    \@tempswafalse
    \@for\@valuelist:=#4\do{%
      \ifx\@valuelist\@empty\else
        \if@tempswa\else
          \edef\reserved@c{\expandafter\@firstoftwo\@valuelist}%
          \edef\reserved@a{\reserved@a\reserved@b`\reserved@c'}%
          \edef\reserved@b{, }%
          \ifx\reserved@c\@searched
            \@tempswatrue
            \edef\reserved@a{\expandafter\@secondoftwo\@valuelist}%
          \fi
        \fi
      \fi
    }%
    \if@tempswa
      \edef\reserved@a{\endgroup
        \noexpand\@namedef{#3}{\reserved@a}%
        \noexpand\FamilyKeyStateProcessed
      }%
    \else
      \edef\reserved@a{\endgroup
        \noexpand\FamilyUnknownKeyValue{#1}{#2}{#5}{\reserved@a}%
      }%
    \fi
  \reserved@a
  \let\FamilyElseValues\@empty
}
%</base>
%    \end{macrocode}
% \end{command}^^A \FamilySetNumerical
% \end{command}^^A \FamilyNumericalKey
%
% \begin{macro}{\KOMA@ncmdkey}
% \changes{v3.02c}{2009/02/04}{defining the member (if needed)}
% \changes{v3.17}{2015/03/16}{re-implemented with value storage and optional default}
% \begin{macro}{\KOMA@@@ncmdkey,\KOMA@@ncmdkey}
% \changes{v3.17}{2015/03/16}{added}
% Like \cs{FamilyNumericalKey} with two important differences:
% \begin{itemize}
% \item The family is not an argument but always |KOMA|.
% \item The values will in the internal value storage is replaced (on success).
% \end{itemize}
% Important: Don't forget to add the default to the internal value storage,
% e.g., using \cs{KOMA@kav@add}.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@ncmdkey}[2][.\@currname.\@currext]{%
  \begingroup\edef\reserved@a{\noexpand\KOMA@@ncmdkey{#1}{#2}}%
  \expandafter\endgroup\reserved@a
}
\newcommand*{\KOMA@@ncmdkey}[2]{%
  \kernel@ifnextchar [%]
    {\KOMA@@@ncmdkey{#1}{#2}}{\KOMA@@@ncmdkey{#1}{#2}[]}
}
\newcommand*{\KOMA@@@ncmdkey}{}
\def\KOMA@@@ncmdkey#1#2[#3]#4#5{%
  \@ifundefined{#4}{\@namedef{#4}{0}}{}%
  \ifx\relax#3\relax
    \KOMA@key[{#1}]{#2}{%
      \KOMA@set@ncmdkey{#2}{#4}{#5}{##1}%
      \KOMA@kav@replacevalue{#1}{#2}{##1}%
    }%
  \else
    \KOMA@key[{#1}]{#2}[{#3}]{%
      \KOMA@set@ncmdkey{#2}{#4}{#5}{##1}%
      \KOMA@kav@replacevalue{#1}{#2}{##1}%
    }%
  \fi
}
%</koma>
%    \end{macrocode}
% \begin{macro}{\KOMA@set@ncmdkey}
% The corresponding set command similar to \cs{FamilySetNumerical} but again
% the family is not an argument but always |KOMA|.
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@set@ncmdkey}{\FamilySetNumerical{KOMA}}
%</koma>
%    \end{macrocode}
% \end{macro}^^A \KOMA@set@ncmdkey
% \end{macro}^^A \KOMA@@@ncmdkey,\KOMA@@ncmdkey
% \end{macro}^^A \KOMA@ncmdkey
%
%
% \begin{command}{\FamilyStringKey}
% \changes{v3.08}{2010/11/05}{added}
% \changes{v3.08b}{2011/03/31}{\cs{Family@String@Key} and
%   \cs{Family@@String@@Key} switched}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% Defining a \meta{key} that defines a \meta{macro} to be a \meta{value}.
% \begin{quote}
%   \cs{FamilyStringKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{macro}
% \end{quote}
% \meta{default} and the \meta{value} of the option should be a string (but
% currently every value is accepted). The definition is done using
% \cs{def}. So it doesn't matter whether the \meta{macro} is already defined.
% \begin{macro}{\Family@String@Key,\Family@@String@@Key}
% \changes{v3.08}{2010/11/05}{added}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyStringKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@String@@Key{#1}{#2}{#3}}{\Family@String@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@String@@Key}{}
\long\def\Family@@String@@Key#1#2#3[#4]#5{%
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\def#5{##1}}%
}
\newcommand{\Family@String@Key}[4]{%
  \DefineFamilyKey[{#1}]{#2}{#3}{\def#4{##1}\FamilyKeyStateProcessed}%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \Family@String@Key,\Family@@String@@Key
% \end{command}^^A \FamilyStringKey
%
%
% \begin{command}{\FamilyCSKey}
% \changes{v3.25}{2017/12/08}{added}
% This is similar to \cs{FamilyStringKey} but instead of a \meta{macro} a
% \meta{command sequence} is used:
% \begin{quote}
%   \cs{FamilyCSKey}\oarg{member}\marg{family}\marg{key}\oarg{default}\marg{command sequence}
% \end{quote}
% Because of this, \cs{@namedef} instead of \cs{def} is used to define the
% corresponding \cs{\meta{command sequence}}.
% \begin{macro}{\Family@CS@Key}
% \changes{v3.25}{2017/12/08}{added}
% \begin{macro}{\Family@@CS@@Key}
% \changes{v3.25}{2017/12/08}{added}
% \changes{v3.26}{2018/11/06}{fix: don't overwrite \cs{Family@@String@@Key}}
%    \begin{macrocode}
%<*base>
\newcommand*{\FamilyCSKey}[3][.\@currname.\@currext]{%
  \kernel@ifnextchar [%]
    {\Family@@CS@@Key{#1}{#2}{#3}}{\Family@CS@Key{#1}{#2}{#3}}%
}
\newcommand*{\Family@@CS@@Key}{}
\long\def\Family@@CS@@Key#1#2#3[#4]#5{%
  \DefineFamilyKey[{#1}]{#2}{#3}[{#4}]{\@namedef{#5}{##1}}%
}
\newcommand{\Family@CS@Key}[4]{%
  \DefineFamilyKey[{#1}]{#2}{#3}{\@namedef{#4}{##1}\FamilyKeyStateProcessed}%
}
%</base>
%    \end{macrocode}
% \end{macro}^^A \Family@@CS@@Key
% \end{macro}^^A \Family@CS@Key
% \end{command}^^A \FamilyCSKey
%
%
% \begin{macro}{\KOMA@DeclareDeprecatedOption}
% \changes{v3.01a}{2008/11/20}{added}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% Used to define a deprecated \meta{classic option} by an up-to-date
% \meta{\pkg*{keyval} option}.
% \begin{quote}
%   \cs{KOMA@DeclareDeprecatedOption}\oarg{package name}\marg{classic
%   option}\marg{\pkg*{keyval} option}
% \end{quote}
% If the \meta{package name} is omitted, \cs{KOMAClassName} is used to report
% a class warning instead of a package warning.
% \begin{macro}{\KOMA@@DeclareDeprecatedOption,\KOMA@@@DeclareDeprecatedOption}
% \changes{v3.01a}{2008/11/20}{added}
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@DeclareDeprecatedOption}{%
  \kernel@ifnextchar [%]
  {\KOMA@@DeclareDeprecatedOption}%
  {\KOMA@@@DeclareDeprecatedOption{\ClassWarningNoLine{\KOMAClassName}}}%
}
\newcommand*{\KOMA@@DeclareDeprecatedOption}[1][]{%
  \KOMA@@@DeclareDeprecatedOption{\PackageWarningNoLine{#1}}%
}
\newcommand*{\KOMA@@@DeclareDeprecatedOption}[3]{%
  \DeclareOption{#2}{\KOMA@UseDeprecatedOption{#1}{#2}{#3}}%
}
%    \end{macrocode}
% \begin{macro}{\KOMA@UseDeprecatedOption}
% \changes{v3.01a}{2008/11/20}{added}
% \changes{v3.12}{2013/03/04}{test to use \opt{version\quotechar=first}}
% \changes{v3.12a}{2014/01/22}{test fixed}
% \changes{v3.22}{2016/07/29}{added several \cs{detokenize}}
% One more helper:
% \begin{quote}
%   \cs{KOMA@UseDeprecatedOption}\marg{warning command}\marg{classic
%   option}\marg{\pkg*{keyval} option}
% \end{quote}
% Note: \meta{warning command} should either be
% |\ClassWarningNoLine{\KOMAClassName}| or
% \cs{PackageWarningNoLine}\marg{package name}. But you could also use
% \cs{ClassInfoNoLine} or \cs{PackageInfoNoLine}.
%    \begin{macrocode}
\newcommand*{\KOMA@UseDeprecatedOption}[3]{%
  \begingroup
    \scr@ifundefinedorrelax{KV@KOMA.\@currname.\@currext @version}{%
      \edef\reserved@a{\noexpand\endgroup
        \noexpand#1{%
          You've used obsolete option `\detokenize{#2}'.\noexpand\MessageBreak
          Usage of this option is deprecated.\noexpand\MessageBreak
          You should simply replace `\detokenize{#2}'\noexpand\MessageBreak
          by `\detokenize{#3}'%
        }%
        \noexpand\KOMAExecuteOptions{#3}%
        \noexpand\def\noexpand\CurrentOption{\CurrentOption}%
      }%
    }{%
      \edef\reserved@a{\noexpand\endgroup
        \noexpand#1{%
          You've used obsolete option `\detokenize{#2}'.\noexpand\MessageBreak
          Usage of this option indicates an old document\noexpand\MessageBreak
          and changes compatibility level using\noexpand\MessageBreak
          `\detokenize{#3},version=first,\noexpand\MessageBreak
          enabledeprecatedfontcommands' that may result\noexpand\MessageBreak
          in further warnings.\noexpand\MessageBreak
          If you don't want this, you should simply\noexpand\MessageBreak
          replace option `\detokenize{#2}' by `\detokenize{#3}'%
        }%
        \noexpand\KOMAExecuteOptions{%
          #3,version=first}%
        \noexpand\ExecuteOptions{enabledeprecatedfontcommands}%
        \noexpand\def\noexpand\CurrentOption{\CurrentOption}%
      }%
    }%
  \reserved@a
}
%</koma>
%    \end{macrocode}
% \end{macro}^^A \KOMA@UseDeprecatedOption
% \end{macro}^^A \KOMA@@DeclareDeprecatedOption,\KOMA@@@DeclareDeprecatedOption
% \end{macro}^^A \KOMA@DeclareDeprecatedOption
%
%
% \begin{macro}{\KOMA@DeclareStandardOption}
% \changes{v3.01a}{2008/11/21}{added}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% This is similar to \cs{KOMA@DeclareDeprecatedOption} but is used for
% standard options, which means options known by the standard classes.
% \begin{quote}
%   \cs{KOMA@DeclareStandardOption}\oarg{package name}\marg{classic
%   option}\marg{\pkg*{keyval} option}
% \end{quote}
% For compatibility these options are not reported as deprecated, but an info
% is added to the \file{log} file about the usage and how it could be replaced
% by a \pkg*{keyval} option.
% \begin{macro}{\KOMA@@DeclareStandardOption,\KOMA@@@DeclareStandardOption,
%               \KOMA@UseStandardOption}
% \changes{v3.01a}{2008/11/21}{added}
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@DeclareStandardOption}{%
  \kernel@ifnextchar [%]
  {\KOMA@@DeclareStandardOption}%
  {\KOMA@@@DeclareStandardOption{\ClassInfoNoLine{\KOMAClassName}}}%
}
\newcommand*{\KOMA@@DeclareStandardOption}[1][]{%
  \KOMA@@@DeclareStandardOption{\PackageInfoNoLine{#1}}%
}
\newcommand*{\KOMA@@@DeclareStandardOption}[3]{%
  \DeclareOption{#2}{\KOMA@UseStandardOption{#1}{#2}{#3}}%
}
\newcommand*{\KOMA@UseStandardOption}[3]{%
  \begingroup
    \edef\reserved@a{\noexpand\endgroup
      \noexpand#1{%
        You've used standard option `#2'.\noexpand\MessageBreak
        This is correct!\noexpand\MessageBreak
        Internally I'm using `#3'.\noexpand\MessageBreak
        If you'd like to set the option with \string\KOMAoptions,%
        \noexpand\MessageBreak
        you'd have to use `#3' there\noexpand\MessageBreak
        instead of `#2', too%
      }%
      \noexpand\KOMAExecuteOptions{#3}%
      \noexpand\def\noexpand\CurrentOption{\CurrentOption}%
    }%
  \reserved@a
}
%</koma>
%    \end{macrocode}
% \begin{macro}{\scr@sr@co}
% \changes{v2.96}{2006/08/20}{added}
% \changes{v3.12a}{2014/01/22}{removed}
% \end{macro}^^A \scr@sr@co
% \end{macro}^^A \KOMA@@@DeclareStandardOption … \KOMA@UseStandardOption
% \end{macro}^^A \KOMA@DeclareStandardOption
%
%
% \begin{macro}{\KOMA@DeclareObsoleteOption}
% \changes{v2.96}{2006/08/20}{\cs{CurrentOption} protected}
% \changes{v3.12}{2013/03/04}{removed}
% \begin{macro}{\KOMA@@DeclareObsoleteOption,\KOMA@@@DeclareObsoleteOption,
%               \KOMA@iv@DeclareObsoleteOption,\KOMA@UseObsoleteOption}
% \changes{v2.98c}{2008/02/18}{added}
% \changes{v3.12}{2013/03/04}{removed}
% \end{macro}^^A \KOMA@@DeclareObsoleteOption … \KOMA@UseObsoleteOption
% \end{macro}^^A \KOMA@DeclareObsoleteOption
%
%
% \begin{macro}{\KOMA@newobsoletecommand,\KOMA@newdeprecatedcommand}
% \changes{v3.12}{2013/03/04}{\cs{KOMA@newobsoletecommand} renamed to
%   \cs{KOMA@newdeprecatedcommand}}
% Defines a deprecated command or \meta{macro}, represented by a
% \meta{\pkg*{keyval} option}:
% \begin{quote}
%   \cs{KOMA@newdeprecatedcommand}\oarg{warning
%   command}\marg{macro}\marg{\pkg*{keyval} option}
% \end{quote}
% Note: This can be used only for macros and commands, that behave as a
% selector. Macros or commands with arguments are not supported.
% \begin{macro}{\KOMA@UseDeprecatedCommand,\KOMA@UseDeprecatedCommand}
% \changes{v2.97c}{2007/04/19}{added}
% \changes{v3.12}{2013/03/04}{\cs{KOMA@UseObsoleteCommand} renamed to
%   \cs{KOMA@UseDeprecatedCommand}}
%    \begin{macrocode}
%<*koma>
\newcommand*{\KOMA@newdeprecatedcommand}[3][\@gobbletwo]{%
  \newcommand*{#2}{\KOMA@UseDeprecatedCommand{#1}{\string#2}{#3}}%
}
\newcommand*{\KOMA@UseDeprecatedCommand}[3]{%
  #1{%
    scrkbase%
  }{%
    You've used deprecated command `#2'.\MessageBreak
    \protect\KOMAoptions{#3} will be used instead.\MessageBreak
    You should also replace `#2' by `\protect\KOMAoptions{#3}'%
  }%
  \KOMAoptions{#3}%
}
%</koma>
%    \end{macrocode}
% \end{macro}^^A \KOMA@UseDeprecatedCommand
% \end{macro}^^A \KOMA@newdeprecatedcommand
%
%
% \subsection{Do hook mechanism}
% \label{sec:dohook}
%
% \changes{v3.27}{2019/02/02}{Do hook mechanism added}
% From \KOMAScript~v3.27 there is a new general hook mechanism called ``do
% hook mechanism''. This mechanism is mentioned to provide extended hooks for
% package authors. All hooks newly implemented in \KOMAScript{} \emph{should}
% use this new mechanism.
%
% 
% \begin{command}{\ForDoHook}
% \changes{v3.27}{2019/02/05}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% \changes{v3.30}{2020/03/07}{\cs{loop}\dots\cs{repeat} inside group}
% \changes{v3.30}{2020/03/07}{using \cs{rloop} instead of \cs{loop}}
% Arguments:
% \begin{description}
% \item[\meta{specificator}:]
%   \meta{string} or \meta{string}\texttt{/}\meta{specificator}
% \item[\meta{code}:] \LaTeX{} code
% \end{description}
% Executes \meta{code} for earch level of a do-hook. This is a helper command
% normally not interesting for users or package authors. However, I define it
% in the user context to be consistent with the other do-hook commands. Note,
% there will be two arguments appended to the \meta{code}. The first one is
% the name of the hook, the second one the hook argument.
% See \cs{ExecuteDoHook} as an example.
%    \begin{macrocode}
%<*base>
\newcommand*{\ForDoHook}[2]{%
  \Ifstr{#1}{}{%
    \PackageError{scrbase}{empty do-hook specificator}{%
      You've tried to use an empty do-hook specificator,\MessageBreak
      but do-hook specificators must not be empty.%
    }%
  }{%
    \begingroup
      \def\scr@hookrun{\endgroup}%
      \let\scr@hookname\relax
      \edef\scr@hookargument{#1}%
      \rloop
        \scr@hooksplit@specificator\scr@hookname\scr@hookargument
                                   \scr@hookargument
        \edef\scr@hookrun{%
          \unexpanded\expandafter{\scr@hookrun}%
          \unexpanded{#2}{\scr@hookname}{\scr@hookargument}%
        }%
      \ifx\scr@hookargument\@empty\else
      \repeat
    \scr@hookrun
  }%
}
%    \end{macrocode}
% \begin{command}{\SplitDoHook}
% \changes{v3.27}{2019/02/04}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Arguments:
% \begin{description}
% \item[\meta{specificator}:]
%   \meta{string} or \meta{string}\texttt{/}\meta{specificator}
% \item[\meta{prefix command}:] \LaTeX{} macro
% \item[\meta{postfix command}:] \LaTeX{} macro 
% \end{description}
% Splits of the \emph{last} element of the \meta{specificator}. The
% \meta{postfix command} is defined to be that last element, the \meta{prefix
% command} is defined to be the rest.
%    \begin{macrocode}
\newcommand*{\SplitDoHook}[3]{%
  \Ifstr{#1}{}{%
    \PackageWarning{scrbase}{empty do-hook specificator}%
    \let#2\@empty\let#3\@empty
  }{%
    \let#2\relax
    \edef\reserved@a{%
      \unexpanded{\scr@hooksplit@specificator{#2}{#3}}{#1}%
    }\reserved@a
  }%
}
%    \end{macrocode}
% \begin{macro}{\scr@hooksplit@specificator}
% \changes{v3.27}{2019/02/02}{added}
% Split of the first string of the specificator argument, append it to
% \cs{scr@hookname} and store the rest in \cs{scr@hookargument}. The argument
% must not be empty!
% \begin{macro}{\scr@@hooksplit@specificator}
% \changes{v3.27}{2019/02/02}{added}
%    \begin{macrocode}
\newcommand*{\scr@hooksplit@specificator}[3]{%
  \expandafter\scr@@hooksplit@specificator\expandafter#1\expandafter#2#3/\@nil
}
\newcommand*{\scr@@hooksplit@specificator}{}
\def\scr@@hooksplit@specificator#1#2#3/#4\@nil{%
  \scr@ifundefinedorrelax{scr@hookname}{\def#1{#3}}{%
    \edef#1{#1/#3}%
  }%
  \def#2{#4}%
  \ifx#2\@empty\else \scr@@hookargument#2#4\@nil\fi
}
\newcommand*{\scr@@hookargument}{}
\def\scr@@hookargument#1#2/\@nil{\def#1{#2}}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{command}
% \end{command}
%
% \begin{command}{\ExecuteDoHook}
% \changes{v3.27}{2019/02/02}{added}
% Arguments:
% \begin{description}
% \item[\meta{specificator}:]
%   \meta{string} or \meta{string}\texttt{/}\meta{specificator}
% \end{description}
% Each string of the \meta{specificator} defines a hook subgroup. The
% execution is done in a loop, first all hook elements of the first
% \meta{string} of the \meta{specificator} are executed with the rest of the
% \meta{specificator} as an argument. Then the hook elements of the
% composition of the first and the second \meta{string} are executed again
% with the rest of the \meta{specificator} as an agument and so on until the
% hook elements of the whole \meta{specificator} has been executed with an
% empty argument. So every hook element has to expect an argument that is
% itself a \meta{specificator}. At each loop level the one-time hooks
% are executed after the permanent hooks.
%    \begin{macrocode}
\newcommand*{\ExecuteDoHook}[1]{%
  \@ifundefined{scr@execute@dohook}{%
    \def\scr@execute@dohook##1##2{%
      \def\scr@hook@do####1{####1{##2}}%
      \@nameuse{scr@dohook@##1}%
      \@nameuse{scr@otdohook@##1}%
      \expandafter\global\expandafter\let
      \csname scr@otdohook@##1\endcsname\@empty
      \let\scr@hook@do\relax
    }%
    \ForDoHook{#1}{\scr@execute@dohook}%
    \let\scr@execute@dohook\relax
  }{%
    \PackageWarning{scrbase}{cascaded do-hook detected.\MessageBreak
      It seems, that the do-hook `\detokenize{#1}'\MessageBreak
      is be executed, while another do-hook is active.\MessageBreak
      This is not allowed and therefore ignored%
    }%
  }%
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\AddtoDoHook}
% \changes{v3.27}{2019/02/02}{added}
% Arguments:
% \begin{description}
% \item[\meta{specificator}:]
%   \meta{string} or \meta{string}\texttt{/}\meta{specificator}
% \item[\meta{element}:]
%   a \LaTeX command, that expects exactly one argument.
% \end{description}
% For the \meta{specificator} see \cs{ExecuteDoHook}. Here you can add an
% \meta{element} to a hook defined by the \meta{specificator}. Adding a hook
% is local to the current group.
%    \begin{macrocode}
\newcommand*{\AddtoDoHook}[2]{%
  \Ifstr{#1}{}{%
    \PackageError{scrbase}{empty hook specificator}{%
      As hook specificators can never be empty, the first argument\MessageBreak
      of \string\AddtoDoHook\space must expand to an not empty string.%
    }%
  }{%
    \scr@ifundefinedorrelax{scr@dohook@#1}{\@namedef{scr@dohook@#1}{}}{}%
    \expandafter\l@addto@macro\csname scr@dohook@#1\endcsname{%
      \scr@hook@do{#2}%
    }%
  }%
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\AddtoOneTimeDoHook}
% \changes{v3.27}{2019/02/02}{added}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Arguments:
% \begin{description}
% \item[\meta{specificator}:]
%   \meta{string} or \meta{string}\texttt{/}\meta{specificator}
% \item[\meta{element}:]
%   a \LaTeX command, that expects exactly one argument.
% \end{description}
% This is almost the same as \cs{AddtoDoHook} but a hook added by this command
% is executed only once.
%    \begin{macrocode}
\newcommand*{\AddtoOneTimeDoHook}[2]{%
  \Ifstr{#1}{}{%
    \PackageError{scrbase}{empty hook specificator}{%
      As hook specificators can never be empty, the first argument\MessageBreak
      of \string\AddtoDoHook\space must expand to an not empty string.%
    }%
  }{%
    \scr@ifundefinedorrelax{scr@otdohook@#1}{\@namedef{scr@otdohook@#1}{}}{}%
    \expandafter\l@addto@macro\csname scr@otdohook@#1\endcsname{%
      \scr@hook@do{#2}%
    }%
  }%
}
%</base>
%</body>
%    \end{macrocode}
% \end{command}
%
%
% \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: