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
|
% \iffalse^^A meta-comment
% ======================================================================
% scrlayer.dtx
% Copyright (c) Markus Kohm, 2012-2021
%
% 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 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.
% ----------------------------------------------------------------------
% scrlayer.dtx
% Copyright (c) Markus Kohm, 2012-2021
%
% Diese Datei ist Teil der LaTeX2e KOMA-Script-Sammlung.
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c.
% Die neuste Version dieser Lizenz ist
% http://www.latex-project.org/lppl.txt
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
% Version 2005/12/01 und dieses Werks.
%
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
% (allein durch den Autor verwaltet).
%
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
%
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
%
%%% From File: $Id: scrlayer.dtx 3560 2021-02-15 13:20:12Z kohm $
%<identify>%%% (run: identify)
%<init>%%% (run: init)
%<options>%%% (run: options)
%<body>%%% (run: body)
%<final>%%% (run: final)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
\filedate$Date: 2021-02-15 14:20:12 +0100 (Mon, 15 Feb 2021) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 3560 $
\edef\reserved@a{%
\noexpand\endgroup
\noexpand\ProvidesFile{scrlayer.dtx}%
[\filedate\space\filerevision\space
KOMA-Script package source
}%
\reserved@a
%</dtx>
%<*identify|doc>
%<package>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<package>\ProvidesPackage{scrlayer}[%
%<doc>\ProvidesFile{scrlayer.tex}[%
%!KOMAScriptVersion
%<package> package
%</identify|doc>
%<*dtx|identify|doc>
(defining layers and page styles)]
%</dtx|identify|doc>
%<*dtx>
\ifx\documentclass\undefined
\input scrdocstrip.tex
\@@input scrkernel-version.dtx
\@@input scrstrip.inc
\KOMAdefVariable{COPYRIGHTFROM}{2012}
\generate{\usepreamble\defaultpreamble
\file{scrlayer.sty}{%
\from{scrlayer.dtx}{package,trace,scrlayer,identify}%
\from{scrlayer.dtx}{package,trace,scrlayer,init}%
\from{scrlayer.dtx}{package,trace,scrlayer,options}%
\from{scrlayer.dtx}{package,trace,scrlayer,body}%
\from{scrlayer.dtx}{package,trace,scrlayer,final}%
\from{scrlogo.dtx}{logo}%
}%
}
\batchinput{scrlayer-scrpage.dtx}
\batchinput{scrlayer-notecolumn.dtx}
\@@input scrstrop.inc
\else
\let\endbatchfile\relax
\fi
\endbatchfile
\documentclass{scrdoc}
\addtolength{\textwidth}{-1em}
\addtolength{\marginparwidth}{2em}
\addtolength{\oddsidemargin}{2em}
\usepackage[ngerman,english]{babel}
\usepackage{url,babelbib}\bibliographystyle{babalpha-fl}
\usepackage{listings}
\usepackage{scrhack}
\usepackage{etoolbox}
\pretocmd\DescribeMacro{\ifhmode\else\bigskip\noindent\fi}{}{}
\pretocmd\DescribeEnv{\ifhmode\else\bigskip\noindent\fi}{}{}
\pretocmd\DescribeOption{\ifhmode\else\bigskip\noindent\fi}{}{}
\CodelineIndex
\RecordChanges
\GetFileInfo{scrlayer.dtx}
\title{The \KOMAScript{} package \texttt{scrlayer}%
\footnote{This is version \fileversion\ of file \texttt{\filename}.}}
\date{\filedate}
\author{Markus Kohm}
\newenvironment{Explain}{\par}{\par}
\newcommand*{\length}{}
\let\length\Length
\let\endlength\endLength
\let\Macro\cs
\let\Length\Macro
\let\Package\textsf
\let\Class\Package
\let\File\texttt
\let\Option\texttt
\newcommand*{\KOption}[1]{\Option{#1}\texttt{=}}
\newcommand*{\OptionValue}[2]{\Option{#1}\texttt{=}\PValue{#2}}
\let\Counter\texttt
\let\Environment\texttt
\let\ShowOutput\quote
\let\endShowOutput\endquote
\let\Pagestyle\texttt
\newcommand*{\Parameter}[1]{\texttt{\marg{#1}}\linebreak[1]}
\newcommand*{\OParameter}[1]{\texttt{\oarg{#1}}\linebreak[1]}
\newcommand*{\MParameter}[2]{\texttt{(\meta{#1},\meta{#2})}\linebreak[1]}
\providecommand\PParameter[1]{\mbox{\texttt{\{#1\}}}\linebreak[1]}
\let\PName\meta
\let\PValue\texttt
\providecommand*{\autoref}[1]{\expandafter\AUTOREF#1:}
\providecommand*{\AUTOREF}{}
\makeatletter
\def\AUTOREF#1:#2:{%
\edef\@tempa{#1}%
\edef\@tempb{tab}\ifx\@tempa\@tempb table~\fi
\edef\@tempb{sec}\ifx\@tempa\@tempb section~\fi
\ref{#1:#2}%
}
\providecommand*{\IndexCmd}[2][]{}
\providecommand*{\textnote}[2][]{}
\providecommand*\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
\providecommand*\NTS{%
\leavevmode\hbox{$\cal N\kern-0.35em\lower0.5ex\hbox{$\cal T$}%
\kern-0.2emS$}}
\lstnewenvironment{lstcode}{\lstset{language=[LaTeX]TeX}}{}
\makeatother
\sloppy% YOU SHOULD NOT DO THIS!!!
\begin{document}
\maketitle
\DocInput{\filename}
\DocInput{scrlayer-scrpage.dtx}
\DocInput{scrlayer-notecolumn.dtx}
\bibliography{guide}
\PrintChanges
\PrintIndex
\end{document}
%</dtx>
% \fi^^A meta-comment
%
% \selectlanguage{english}
%
% \changes{v0.0}{2012/01/01}{Start of new package}%^^A
% \changes{v0.9}{2014/07/25}{User documentation removed}%^^A
%
% \StopEventually{}
%
%
% \section{Implementation of \Package{scrlayer}}
%
% This section if for developers only.
%
% \iffalse
%<*package>
%<*identify>
% \fi
%
%\iffalse^^A meta-comment
%</identify>
%</package>
%<*package|interface|class>
%\fi^^A meta-comment
%
% \subsection{Initialising some Values before the Options}
%
% \iffalse^^A meta-comment
%<*init>
% \fi^^A meta-comment
%
% Initialisation before all options.
%
% \begin{macro}{\scrlayer@@inherited@options@cslist}
% \changes{v3.33}{2021/02/15}{new (internal)}
% \begin{macro}{\scrlayer@@add@inherited@option}
% \changes{v3.33}{2021/02/15}{new (internal)}
% \begin{macro}{\scrlayer@do@inherited@options}
% \changes{v3.33}{2021/02/15}{new (interface command)}
% \begin{macro}{\scrlayer@inherit@option}
% \changes{v3.33}{2021/02/15}{new (interface command)}
% The options of \textsf{scrlayer} should be passed to \textsf{scrlayer} while
% loading an interface package. We use the comma-separated-list
% \cs{scrlayer@@inherited@options@cslist} to store all of them, so the
% interface packages are able to process them via
% \cs{scrlayer@do@inherited@options} which has an optional command, the
% \texttt{KOMA} member defined by the interface package. The default of the
% optional argument is (as usual)
% ``\texttt{.}\cs{@currname}\texttt{.}\cs{currext}''. This option is passed to
% the command, that is used a second argument, which is the first mandatory
% argument.
% Last but not least \cs{scrlayer@inherit@option} is the usual inheritance
% function. It adds a new \texttt{KOMA} option and also removes it at the end
% of the package. It should be used \emph{before} \cs{KOMAProcessOptions}. It
% has three arguments: the \texttt{KOMA} member and the option name.
%
% With this the usual execution order of an interface package would be:
% \begin{verbatim}
% \RequirePackage{scrlayer}[2021/02/15]
% \scrlayer@do@inherited@options{\scrlayer@inherit@option}
% \end{verbatim}
% \begin{macrocode}
%<*package>
\newcommand*{\scrlayer@@inherited@options@cslist}{}
\newcommand*{\scrlayer@@add@inherited@option}[1]{%
\ifx\scrlayer@@inherited@options@cslist\@empty
\g@addto@macro\scrlayer@@inherited@options@cslist{#1}%
\else
\g@addto@macro\scrlayer@@inherited@options@cslist{,#1}%
\fi
}
\newcommand*{\scrlayer@do@inherited@options}[2][.\@currname.\@currext]{%
\@for \reserved@a:=\scrlayer@@inherited@options@cslist \do {%
\edef\reserved@a{\unexpanded{#2}{#1}{\reserved@a}}%
\reserved@a
}%
}
\newcommand*{\scrlayer@inherit@option}[2]{%
%<trace> \typeout{TRACE: Define key `#2' of member `#1'}%
\DefineFamilyMember[#1]{KOMA}%
\expandafter\let\csname KV@KOMA#1@#2\expandafter\endcsname
\csname KV@KOMA.scrlayer.sty@#2\endcsname
\expandafter\let\csname KV@KOMA#1@#2@default\expandafter\endcsname
\csname KV@KOMA.scrlayer.sty@#2@default\expandafter\endcsname
\AtEndOfPackage{%
\RelaxFamilyKey[{#1}]{KOMA}{#2}%
}%
}
\@onlypreamble\scr@do@inherited@options
\@onlypreamble\scr@inherit@option
%</package>
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% While there are \KOMAScript{} options, we need \Package{scrkbase} to declare
% them, but the interfaces also needs \Package{scrlayer} which already
% includes \Package{scrkbase}.
% \begin{macrocode}
%<package>\RequirePackage{scrkbase}[2013/03/05]
%<interface>\RequirePackage{scrlayer}
% \end{macrocode}
%
%
% \begin{macro}{\scrlayer@AtEndOfPackage}
% Initial \Macro{AtEndOfPackage}, but after end of package
% \Macro{@firstofone}.
% \begin{macrocode}
\scr@ifundefinedorrelax{scrlayer@AtEndOfPackage}{%
\AtEndOfPackage{\let\scrlayer@AtEndOfPackage\@firstofone}%
}{%
\ifx\scrlayer@AtEndOfPackage\@firstofone
\AtEndOfPackage{\let\scrlayer@AtEndOfPackage\@firstofone}%
\fi
}
\let\scrlayer@AtEndOfPackage\AtEndOfPackage
% \end{macrocode}
% \end{macro}%^^A \sls@AtEndOfPackage
%
% \begin{macro}{\scrlayer@testunexpectedarg}
% We'll have several \KOMAScript{} options, that didn't expect an
% value. So we use this general helper to test the value and report an error
% if it is not empty (or \Macro{relax}).
% \begin{macrocode}
%<*package>
\newcommand*{\scrlayer@testunexpectedarg}[2]{%
\ifx\relax#2\relax\else
\PackageError{scrlayer}{unexpected value to `#1'}{%
Option `#1' doesn't expect any value.\MessageBreak
If you'll continue, the value `#2' will be ignored.%
}%
\fi
}
%</package>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@testunexpectedarg
%
% \begin{macro}{\if@chapter}
% We need this later. But it is something general. So we initialise it as
% early as possible.
% \begin{macrocode}
%<*package>
\scr@ifundefinedorrelax{if@chapter}{%
\newif\if@chapter
\scr@ifundefinedorrelax{chapter}{\@chapterfalse}{\@chaptertrue}%
}{}
% \end{macrocode}
% \end{macro}%^^A \if@chapter
%
% \begin{macro}{\if@mainmatter}
% Some classes define \Macro{frontmatter} or \Macro{mainmatter}, but do not
% define \Macro{if@mainmatter}. But we nee some information about the matter,
% so in that case, we add it.
% \begin{macrocode}
\scr@ifundefinedorrelax{if@mainmatter}{%
\scr@ifundefinedorrelax{mainmatter}{%
\newif\if@mainmatter\@mainmattertrue
}{%
\PackageWarningNoLine{scrlayer}{%
\string\mainmatter\space defined without
\string\if@mainmatter!\MessageBreak
Note, that several packages need
\string\if@mainmatter\space\MessageBreak
to detect whether or no the main matter has been\MessageBreak
entered. So does scrlayer. Because of this\MessageBreak
it will extend \string\mainmatter, now%
}%
\newif\if@mainmatter\@mainmattertrue
\expandafter\def\expandafter\mainmatter\expandafter{%
\expandafter\@mainmattertrue\mainmatter}%
\scr@ifundefinedorrelax{frontmatter}{}{%
\expandafter\def\expandafter\frontmatter\expandafter{%
\expandafter\@mainmatterfalse\frontmatter}
}%
\scr@ifundefinedorrelax{backmatter}{}{%
\expandafter\def\expandafter\backmatter{%
\expandafter\@mainmatterfalse\backmattter}%
}%
}%
}{}
%</package>
% \end{macrocode}
% \end{macro}%^^A \if@mainmatter
%
% \iffalse^^A meta-comment
%</init>
% \fi^^A meta-comment
%
%
% \subsection{Process Options}
%
% \iffalse^^A meta-comment
%<*body>
% \fi^^A meta-comment
%
% The very first thing at the body is processing the options:
% \begin{macrocode}
%<*package|interface>
\KOMAProcessOptions\relax
%</package|interface>
% \end{macrocode}
%
% \subsection{Body Initialisation}
%
% Currently not needed.
%
% \iffalse
%</body>
% \fi
%
%
% \subsection{Extended Running Heads}
%
% Package \Package{scrpage2} changes and extends the running head mechanisms
% of \LaTeX{} and the classes. Most of this are basic features an therefore
% done already by \Package{scrlayer}. But not the deprecated options.
%
% \begin{option}{markcase}
% \begin{description}
% \item[\texttt{=\meta{setting}}] one of: \texttt{upper}, \texttt{lower},
% \texttt{used}, or \texttt{ignoreuppercase}.
% \end{description}\noindent
% The two options \Option{markuppercase} and \Option{markusedcase} become
% deprecated and are replace be the single option \Option{markcase}. Note,
% that interface \Package{scrlayer-scrpage} has to delay this option to
% overload case setting of option \Option{pagestyleset}.
% \begin{macrocode}
%<*options>
\KOMA@key{markcase}{%
%<interface&scrpage>\scrlayer@AtEndOfPackage{%
\begingroup
\KOMA@set@ncmdkey{markcase}{reserved@a}{%
{upper}{0},{lower}{1},{used}{2},%
{ignoreuppercase}{3},{nouppercase}{3},%
{ignoreupper}{3},{noupper}{3}%
}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\aftergroup\FamilyKeyStateProcessed
\ifnum \reserved@a>\m@ne
\aftergroup\let\aftergroup\MakeMarkcase
\ifcase \reserved@a
\aftergroup\MakeUppercase
\aftergroup\scrlayer@forceignoreuppercasefalse
\or
\aftergroup\MakeLowercase
\aftergroup\scrlayer@forceignoreuppercasefalse
\or
\aftergroup\@firstofone
\aftergroup\scrlayer@forceignoreuppercasefalse
\else
\aftergroup\scrlayer@ignoreuppercase
\aftergroup\scrlayer@forceignoreuppercasetrue
\fi
\fi
\else
\aftergroup\FamilyKeyStateUnknownValue
\fi
\endgroup
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\KOMA@kav@removekey{.scrlayer.sty}{markcase}%
\KOMA@kav@xadd{.scrlayer.sty}{markcase}{#1}%
\fi
%<interface&scrpage>}%
}
%<package>\scrlayer@@add@inherited@option{markcase}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @markcase\endcsname\relax
%</interface&body>
% \end{macrocode}
% \begin{macro}{\MakeMarkcase}
% We use this instead of, e.g., \Macro{MakeUppercase} for every layer! So the
% name seams to be wrong, but it is common, so we use it here.
% \begin{macrocode}
%<*package&options>
\@ifundefined{MakeMarkcase}{\let\MakeMarkcase\@firstofone}{}
\ifx\MakeMarkcase\@firstofone
\KOMA@kav@replacevalue{.scrlayer.sty}{markcase}{used}%
\else\ifx\MakeMarkcase\MakeUppercase
\KOMA@kav@replacevalue{.scrlayer.sty}{markcase}{upper}%
\else\ifx\MakeMarkcase\MakeLowercase
\KOMA@kav@replacevalue{.scrlayer.sty}{markcase}{lower}%
\else\ifx\MakeMarkcase\scr@ignoreuppercase
\KOMA@kav@replacevalue{.scrlayer.sty}{markcase}{ignoreuppercase}%
\fi\fi\fi\fi
% \end{macrocode}
% \begin{macro}{\scrlayer@ignoreuppercase}
% We span a group and set \Macro{uppercase} and \Macro{MakeUppercase} to
% \Macro{@firstofone}.
% \begin{macrocode}
\DeclareRobustCommand*{\scrlayer@ignoreuppercase}[1]{%
\begingroup
\let\uppercase\@firstofone
\let\MakeUppercase\@firstofone
\expandafter\let\csname MakeUppercase \endcsname\@firstofone
#1%
\endgroup
}
% \end{macrocode}
% This is almost enough, but standard classes still would show upper-case
% letters at table of contents, list of figures, list of tables, index and
% bibliography. So we need an additional workaround.
% \begin{macro}{\ifscrlayer@forceignoreuppercase}
% \begin{macrocode}
\newif\ifscrlayer@forceignoreuppercase
%</package&options>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@forceignoreuppercase
% \end{macro}%^^A \scrlayer@ignoreuppercase
% \end{macro}%^^A \MakeMarkcase
% \end{option}%^^A markcase
%
% \begin{macro}{\rightfirstmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \begin{macro}{\rightbotmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \begin{macro}{\righttopmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \Macro{rightfirstmark} is simply the same like the \Macro{rightmark} of the
% \LaTeX{} kernel. \Macro{rightbotmark} uses \Macro{botmark} instead of
% \Macro{firstmark} and \Macro{righttopmark} uses \Macro{topmark}.
% \begin{macrocode}
%<*package&body>
\newcommand*{\rightfirstmark}{\expandafter\@rightmark\firstmark\@empty\@empty}
\newcommand*{\rightbotmark}{\expandafter\@rightmark\botmark\@empty\@empty}
\newcommand*{\righttopmark}{\expandafter\@rightmark\topmark\@empty\@empty}
% \end{macrocode}
% \end{macro}%^^A \righttopmark
% \end{macro}%^^A \rightbotmark
% \end{macro}%^^A \rightfirstmark
%
% \begin{macro}{\leftfirstmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \begin{macro}{\leftbotmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \begin{macro}{\lefttopmark}
% \changes{v3.16}{2015/01/14}{new}%^^A
% \Macro{leftbotmark} is simply the same like the \Macro{leftmark} of the
% \LaTeX{} kernel. \Macro{leftfirstmark} uses \Macro{firstmark} instead of
% \Macro{botmark} and \Macro{lefttopmark} uses \Macro{topmark}.
% \begin{macrocode}
\newcommand*{\leftfirstmark}{\expandafter\@leftmark\firstmark\@empty\@empty}
\newcommand*{\leftbotmark}{\expandafter\@leftmark\botmark\@empty\@empty}
\newcommand*{\lefttopmark}{\expandafter\@leftmark\topmark\@empty\@empty}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \lefttopmark
% \end{macro}%^^A \leftbotmark
% \end{macro}%^^A \leftfirstmark
%
% \begin{macro}{\headmark}
% Inside a page style, this macro is either \Macro{rightmark} or
% \Macro{leftmark}. Outside its \LaTeX-undefined and therefore it's not an
% interface command, but has to be undefined:
% \begin{macrocode}
%<*package&body>
\@ifundefined{headmark}{}{%
\PackageWarningNoLine{scrlayer}{%
\string\headmark\space detected!\MessageBreak
\string\headmark\space will either be set to
\string\rightmark\MessageBreak
or \string\leftmark inside of page styles.\MessageBreak
This means, that \string\headmark\space will be overwritten\MessageBreak
at every page layer usage!\MessageBreak
Nevertheless it will stay unchanged outside\MessageBreak
of page layers.\MessageBreak
I hope, this won't break your document%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \headmark
%
% \begin{macro}{\pagemark}
% The page number together with its font setting. It's robust and will never
% be part of the interface.
% \begin{macrocode}
%<*package&body>
\@ifundefined{pagemark}{%
\DeclareRobustCommand\pagemark{{\pnumfont{\thepage}}}%
}{}%
% \end{macrocode}
% \begin{macro}{\pnumfont}
% \begin{macro}{\scr@fnt@pagenumber}
% The low-level page number font command. It is deprecated to redefine or use
% this and it may already be defined. These commands will not become part of
% the interface!
% \begin{macrocode}
\@ifundefined{pnumfont}{%
\newcommand{\pnumfont}{\normalfont}%
}{}
\@ifundefined{scr@fnt@pagenumber}{%
\newcommand{\scr@fnt@pagenumber}{\pnumfont}%
}{}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scr@fnt@pagenumber
% \end{macro}%^^A \pnumfont
% \end{macro}%^^A \pagemark
%
% \begin{macro}{\partmarkformat}
% \begin{macro}{\chaptermarkformat}
% \begin{macro}{\sectionmarkformat}
% \begin{macro}{\GenericMarkFormat}
% All the \Macro{\dots markformat} macros of \KOMAScript{} are also
% supported by \Package{scrlayer} and it uses them actively. The generic
% definition has been moved from \Macro{@seccntmarkformat} to
% \Macro{GenericMarkFormat}. This is one more difference to
% \Package{scrpage2}. The defaults are compatible to the standard
% classes. These commands will not become part of the interface and other
% interfaces should redefine them only, if they are not already defined.
% \begin{macrocode}
%<*package&body>
\providecommand*{\partmarkformat}{\partname\ \thepart. \ }%
\if@chapter
\providecommand*{\@chapapp}{\chaptername}%
\providecommand*{\chaptermarkformat}{\@chapapp\ \thechapter. \ }%
\providecommand*{\sectionmarkformat}{\thesection. \ }%
\else
\providecommand*{\sectionmarkformat}{\GenericMarkFormat{section}}%
\fi
\scr@ifundefinedorrelax{@seccntmarkformat}{%
\providecommand*{\GenericMarkFormat}{\@seccntformat}%
}{%
\providecommand*{\GenericMarkFormat}[1]{\@seccntmarkformat{#1}}%
}
%</package&body>
% \end{macrocode}
% Note, that the other \Macro{\dots markformat} will be defined by
% \Macro{scrlayer@level@init}.
% \end{macro}%^^A \GenericMarkFormat
% \end{macro}%^^A \sectionmarkformat
% \end{macro}%^^A \chaptermarkformat
% \end{macro}%^^A \partmarkformat
%
% \begin{macro}{\@mkleft}
% \changes{v3.25}{2017/10/13}{added to the \KOMAScript{} classes}%^^A
% \begin{macro}{\@mkright}
% \changes{v3.25}{2017/10/13}{added to the \KOMAScript{} classes}%^^A
% \begin{macro}{\@mkdouble}
% \changes{v3.25}{2017/10/13}{added to the \KOMAScript{} classes}%^^A
% \changes{v3.27a}{2019/10/17}{long definition}%^^A
% These are new in \Package{scrlayer}. They may be updated, whenever
% \Macro{@mkboth} will be updated. Otherwise they get a working default
% definition. These commands will not become part of the interface and other
% interfaces should redefine them only, if they are not already defined.
% \begin{macrocode}
%<*(package|class)&body>
\providecommand*{\@mkleft}{%
\IfActiveMkBoth{\markleft}{\@gobble}%
}%
\providecommand*{\@mkright}{%
\IfActiveMkBoth{\markright}{\@gobble}%
}%
\providecommand{\@mkdouble}[1]{%
\@mkboth{#1}{#1}%
}
%</(package|class)&body>
% \end{macrocode}
% \end{macro}%^^A \@mkdouble
% \end{macro}%^^A \@mkright
% \end{macro}%^^A \@mkleft
%
% \begin{macro}{\markleft}
% \changes{v3.27a}{2019/10/17}{robust and long definition}%^^A
% \begin{macro}{\@markleft}
% \LaTeX{} itself provides \Macro{markboth} and \Macro{markright} but not
% \Macro{markleft}. So we add it.
% \begin{macrocode}
%<*package&body>
\@ifundefined{markleft}{%
\DeclareRobustCommand{\markleft}[1]{%
\begingroup
\let\label\relax \let\index\relax \let\glossary\relax
\expandafter\@markleft\@themark {#1}%
\@temptokena \expandafter{\@themark}%
\mark{\the\@temptokena}%
\endgroup
\if@nobreak\ifvmode\nobreak\fi\fi
}%
\providecommand{\@markleft}[3]{%
\@temptokena {#2}%
\unrestored@protected@xdef\@themark{{#3}{\the\@temptokena}}%
}%
}{}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@markleft
% \end{macro}%^^A \markleft
%
% \begin{macro}{\markdouble}
% \changes{v3.28}{2019/10/17}{new}%^^A
% This is easier, because it uses \cs{markboth}. So we do not need to declare
% it robust and we can use \cs{providecommand}.
% \begin{macrocode}
%<*package&body>
\providecommand{\markdouble}[1]{\markboth{#1}{#1}}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \markdouble
%
% \begin{option}{autooneside}
% \begin{macro}{\ifscrlayer@autooneside}
% Decide whether or not use the optional argument of \Macro{automark} in
% single-side layout.
% \begin{macrocode}
%<*options>
%<*package>
\KOMA@ifkey{autooneside}{scrlayer@autooneside}\scrlayer@autoonesidetrue
\scrlayer@@add@inherited@option{autooneside}
\KOMA@kav@replacebool{.scrlayer.sty}{autooneside}{scrlayer@autooneside}
%</package>
%<*interface>
\KOMA@key{autooneside}[true]{%
\KOMA@set@ifkey{autooneside}{scrlayer@autooneside}{#1}%
\KOMA@kav@replacebool{.scrlayer.sty}{autooneside}{scrlayer@autooneside}%
}
%</interface>
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @autooneside\endcsname\relax
%</interface&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@autooneside
% \end{option}%^^A autooneside
%
%
% \begin{option}{automark}
% \begin{option}{manualmark}
% Maybe we will extend these options later. Currently they do almost the
% same they do at \Package{scrpage2}. The difference is, that single-side or
% two-side doesn't matter here (but it does inside of the definitions of the
% marks itself).
%
% ToDo: Maybe \Option{manualmark} should become deprecated and
% \Option{automark} should have simple values or a new option, that also
% handles \Option{autooneside}?
% \changes{v3.22}{2016/12/07}{prepared for classes without \cs{section} or
% \cs{subsection}}%^^A
% \begin{macrocode}
%<*options>
\KOMA@key{automark}[]{%
\scrlayer@testunexpectedarg{automark}{#1}%
\scrlayer@AtEndOfPackage{%
\if@chapter
\scr@ifundefinedorrelax{section}{%
\automark{chapter}%
}{%
\automark[section]{chapter}%
}%
\else
\scr@ifundefinedorrelax{section}{%
\automark{}%
}{%
\scr@ifundefinedorrelax{subsection}{%
\automark{section}%
}{%
\automark[subsection]{section}%
}
}%
\fi
}%
\FamilyKeyStateProcessed
\KOMA@kav@removekey{.scrlayer.sty}{automark}%
\KOMA@kav@removekey{.scrlayer.sty}{manualmark}%
\KOMA@kav@add{.scrlayer.sty}{automark}{}%
}
%<package>\scrlayer@@add@inherited@option{automark}
%</options>
%<*interface&body>
\expandafter\let\csname KV@KOMA.\@currname.\@currext @automark\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @automark@default\endcsname\relax
%</interface&body>
%<*options>
\KOMA@key{manualmark}[]{%
\scrlayer@testunexpectedarg{manualmark}{#1}%
\scrlayer@AtEndOfPackage{\manualmark}%
\FamilyKeyStateProcessed
\KOMA@kav@removekey{.scrlayer.sty}{automark}%
\KOMA@kav@removekey{.scrlayer.sty}{manualmark}%
\KOMA@kav@add{.scrlayer.sty}{manualmark}{}%
}
%<package>\scrlayer@@add@inherited@option{manualmark}
%</options>
%<*interface&body>
\expandafter\let\csname KV@KOMA.\@currname.\@currext @manualmark\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @manualmark@default\endcsname\relax
%</interface&body>
% \end{macrocode}
% \end{option}%^^A manualmark
% \end{option}%^^A automark
%
% \begin{macro}{\manualmark}
% Switch to manual marks. This resets \Macro{@mkleft}, \Macro{@mkright},
% \Macro{@mkdouble}, \Macro{@mkboth} and the \Macro{\dots mark} of all known
% levels.
% \begin{macrocode}
%<*package&body>
\newcommand*{\manualmark}{%
\begingroup
\def\@elt##1{%
\aftergroup\let\expandafter\aftergroup\csname ##1mark\endcsname
\aftergroup\@gobble
}%
\scrlayer@level@list
\endgroup
\let\@mkleft\@gobble
\let\@mkright\@gobble
\let\@mkdouble\@gobble
\let\@mkboth\@gobbletwo
}
%</package&body>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\automark}
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
% ersetzt}%^^A
% \begin{macro}{\@automark}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% This is the brain knot of the game! I'll try to explain, what I'm doing:
% First of all the new starred version of \Macro{automark} doesn't reset the
% mark commands. So it works cumulatively. This may be useful e.g. to have
% chapter marks as long as no section marks have been made etc.
% \begin{macrocode}
%<*package&body>
\newcommand*{\automark}{%
\kernel@ifstar{\@automark}{\manualmark\@automark}%
}
\newcommand*{\@automark}[2][]{%
\Ifstr{#2}{}{%
\Ifstr{#1}{}{%
% \end{macrocode}
% \Macro{automark[]{}} or \Macro{automark{}} has been used. This will activate
% the low level mark commands, but doesn't change the high level commands. It
% may be useful or may not, the user should know what he does:
% \begin{macrocode}
\automark@basics
}{%
% \end{macrocode}
% \Macro{automark[\dots]{}} has been used. This will activate the higher level
% mark commands and also set up the right mark
% \begin{macrocode}
\automark@basics
\automark@righthigh{#1}%
}%
}{%
\Ifstr{#1}{}{%
% \end{macrocode}
% \Macro{automark[]{\dots}} or \Macro{automark{\dots}} has been used. This
% will activate the low level mark commands and also set up either the left or
% both marks.
% \begin{macrocode}
\automark@basics
\automark@leftlow{#2}%
}{%
% \end{macrocode}
% \Macro{automark[\dots]{\dots}} has been used. This will activate the low
% level mark commands and also both high level marks.
% \begin{macrocode}
\automark@basics
\automark@both{#1}{#2}%
}%
}%
}
% \end{macrocode}
% \begin{macro}{\automark@basics}
% Activate all low level \Macro{@mk\dots} commands:
% \begin{macrocode}
\newcommand*{\automark@basics}{%
\let\@mkleft\markleft
\let\@mkright\markright
\let\@mkboth\markboth
\def\@mkdouble##1{\@mkboth{##1}{##1}}%
}
% \end{macrocode}
% \end{macro}%^^A \automark@basics
% \begin{macro}{\automark@righthigh}
% Set up the right mark of a higher level, but in single-side layout only if
% \Option{autooneside} hasn't been used. Note, that with this definition no
% special handling for \KOMAScript's \Macro{addchap} and \Macro{addsec} is
% needed.
% \begin{macrocode}
\newcommand*{\automark@righthigh}[1]{%
\ifscrlayer@level@prepared{#1}{%
\expandafter\def\csname #1mark\endcsname##1{%
\begingroup
\@tempswafalse
\if@twoside\@tempswatrue
\else\ifscrlayer@autooneside\else\@tempswatrue\fi\fi
\expandafter\endgroup
\if@tempswa
\@mkright{%
\MakeMarkcase{%
\ifnum \c@secnumdepth<\numexpr \csname #1numdepth\endcsname +0\relax
\else\if@mainmatter \csname #1markformat\endcsname\fi\fi
##1%
}%
}%
\fi
}%
}{}%
}
% \end{macrocode}
% \end{macro}%^^A \automark@righthigh
% \begin{macro}{\automark@leftlow}
% Set up the left mark of a low level, but in single-side layout the right
% mark has to be used.
% \begin{macrocode}
\newcommand*{\automark@leftlow}[1]{%
\ifscrlayer@level@prepared{#1}{%
\expandafter\def\csname #1mark\endcsname ##1{%
\if@twoside
% \end{macrocode}
% In two-side mode the left high mark has also to clear the right low
% mark. This would be unwanted, if the left mark is a low mark and the right
% mark is a high mark. But we cannot detect this if no right mark level has
% been given. So we simply use:
% \begin{macrocode}
\expandafter\@mkboth
\else
% \end{macrocode}
% In single-side mode there's no left high mark without a right low mark. So
% instead of only a left high mark, we set up both marks.
% \changes{v3.27}{2019/07/25}{replaced \cs{@empty} by \texttt{\{\}} to avoid
% \textsf{babel} issue}%^^A
% \begin{macrocode}
\expandafter\@mkdouble
\fi
{%
\MakeMarkcase{%
\ifnum \c@secnumdepth<\numexpr \csname #1numdepth\endcsname +0\relax
\else\if@mainmatter \csname #1markformat\endcsname\fi\fi
##1%
}%
}{}%
}%
}{}%
}
% \end{macrocode}
% \end{macro}%^^A \automark@leftlow
% \begin{macro}{\automark@both}
% Set up both marks, but in single-side layout depending on
% \Option{autooneside}.
% \begin{macrocode}
\newcommand*{\automark@both}[2]{%
\ifscrlayer@level@prepared{#1}{%
\ifscrlayer@level@prepared{#2}{%
\ifnum \numexpr \csname #1numdepth\endcsname +0\relax
> \numexpr \csname #2numdepth\endcsname +0\relax
% \end{macrocode}
% Level of left mark is greater than level of right mark. e.g., section >
% chapter. This is unusual. Nevertheless we'll handle it.
% \begin{macrocode}
\automark@leftlow{#2}%
\automark@righthigh{#1}%
\else \ifnum \numexpr \csname #1numdepth\endcsname +0\relax
= \numexpr \csname #2numdepth\endcsname +0\relax
% \end{macrocode}
% Level of left mark is equal to level of right mark. This is
% nice and very easy to handle.
% \begin{macrocode}
\expandafter\def\csname #2mark\endcsname##1{%
\@mkdouble{%
\MakeMarkcase{%
\ifnum \c@secnumdepth<\numexpr
\csname #2numdepth\endcsname +0\relax
\else
\if@mainmatter \csname #2markformat\endcsname\fi
\fi
##1%
}%
}%
}%
\else
% \end{macrocode}
% Level of left mark is less than level of right mark. This is
% usual.
% \begin{macrocode}
\expandafter\def\csname #1mark\endcsname##1{%
\begingroup
\@tempswafalse
\if@twoside\@tempswatrue
\else\ifscrlayer@autooneside\else\@tempswatrue\fi\fi
\expandafter\endgroup
\if@tempswa
\@mkleft{%
\MakeMarkcase{%
\ifnum \c@secnumdepth
< \numexpr\csname #1numdepth\endcsname +0\relax
\else
\if@mainmatter \csname #1markformat\endcsname\fi
\fi
##1%
}%
}%
\fi
}%
\expandafter\def\csname #2mark\endcsname##1{%
\@mkboth{}{%
\MakeMarkcase{%
\ifnum \c@secnumdepth
< \numexpr \csname #2numdepth\endcsname +0\relax
\else\if@mainmatter \csname #2markformat\endcsname\fi\fi
##1%
}%
}%
}%
\fi
\fi
}{}%
}{}%
}
% \end{macrocode}
% \begin{macro}{\ifscrlayer@level@prepared}
% Test, whether or not this level has been prepared.
% \begin{macrocode}
\newcommand*{\ifscrlayer@level@prepared}[1]{%
\typeout{1: \detokenize{#1}}%
\scr@ifundefinedorrelax{#1numdepth}{%
\PackageError{scrlayer}{numbering depth of `#1' unknown}{%
Someone told me to use a section mark for level `#1',\MessageBreak
but the numbering depth hasn't been declared before. You may solve this
using\MessageBreak
\string\DeclareSectionNumberDepth{#1}{NUMBER}.%
}%
\@secondoftwo
}{%
\@firstoftwo
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@level@prepared
% \end{macro}%^^A \automark@both
% \end{macro}%^^A \@automark
% \end{macro}%^^A \automark
%
% \begin{macro}{\DeclareSectionNumberDepth}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{description}
% \item[\Parameter{string}:] the name of the section level, e.g.,
% part, chapter, section etc. (must be fully
% expandable and expand to a string).
% \item[\Parameter{numeric expression}:] the section number depth of the
% level, e.g., -1 for part, 0 for chapter etc.
% \end{description}
% Note that levels part, chapter, section, subsection, sub\dots subsection,
% paragraph, subparagraph, sub\dots subparagraph, minisec, subminisec,
% sub\dots subminisec will be recognised either at load time or at
% \Macro{begin}\PParameter{document} automatically if they have the usual
% levels.
% \begin{macrocode}
%<*package&body>
\newcommand*{\DeclareSectionNumberDepth}[2]{%
\expandafter\edef\csname #1numdepth\endcsname{\the\numexpr #2\relax}%
\@ifundefined{#1mark}{%
\expandafter\let\csname #1mark\endcsname\@gobble
}{}%
\@ifundefined{#1markformat}{%
\@namedef{#1markformat}{\GenericMarkFormat{#1}}%
}{}%
\begingroup
\@tempswatrue
\def\@elt##1{\Ifstr{#1}{##1}{\@tempswafalse}{}}%
\scrlayer@level@list
\if@tempswa
\aftergroup\@firstofone
\else
\aftergroup\@gobble
\fi
\endgroup
{%
\l@addto@macro\scrlayer@level@list{\@elt{#1}}%
}%
}
% \end{macrocode}
% \begin{macro}{\scrlayer@level@list}
% \begin{macro}{\scrlayer@level@init}
% Stores all the existing levels.
% \begin{macrocode}
\newcommand*{\scrlayer@level@list}{}
% \end{macrocode}
% Usually all levels are known on loading this package, but if a package
% defines additional levels later we'll do an additional test at
% \Macro{begin}\PParameter{document}. But we do not redo the part and the
% chapter test.
% \begin{macrocode}
\scr@ifundefinedorrelax{part}{}{%
\DeclareSectionNumberDepth{part}{-1}%
}
\if@chapter
\DeclareSectionNumberDepth{chapter}{0}%
\fi
\newcommand*{\scrlayer@level@init}{%
\@tempcnta=1
\def\reserved@b##1{%
\@tempswatrue
\def\reserved@a{##1}%
\@whilesw \if@tempswa \fi {%
\scr@ifundefinedorrelax{\reserved@a}{%
\@tempswafalse
}{%
\@ifundefined{\reserved@a numdepth}{%
\expandafter\DeclareSectionNumberDepth
\expandafter{\reserved@a}{\@tempcnta}%
}{%
\expandafter\DeclareSectionNumberDepth
\expandafter{\reserved@a}{\csname \reserved@a numdepth\endcsname}%
}%
\advance \@tempcnta by \@ne
\edef\reserved@a{sub\reserved@a}%
}%
}%
}%
\reserved@b{section}%
\reserved@b{paragraph}%
\reserved@b{minisec}%
}
\scrlayer@level@init
\AtBeginDocument{%
\scrlayer@level@init
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@level@init
% \end{macro}%^^A \scrlayer@level@list
% \end{macro}%^^A DeclareSectionNumberDepth
%
%
% \subsection{Providing Layers}
%
% A layer is a virtual sheet of paper stacked behind or above the real sheet
% of paper. All the virtual and real sheets of one page may been seen
% simultanous, but material o one sheet may overlap material on sheets below.
% Layers provided by \Package{scrlayer} will not be stacked below or above
% real sheets unless they are used by a page style.
%
% While we use \meta{key}\texttt{=}\meta{value} arguments for several of the
% layer commands we define a new family with a new member:
% \begin{macrocode}
%<*package&body>
\DefineFamily{KOMAarg}
\DefineFamilyMember[.definelayer]{KOMAarg}
%</package&body>
% \end{macrocode}
%
% \begin{macro}{\DeclareLayer}
% \begin{description}
% \item[\OParameter{option list}:] a comma separated list of
% \texttt{\meta{key}=\meta{value}} pairs.
% \item[\Parameter{string}:] the name of the layer (must be fully expandable
% and expand to a string only).
% \end{description}
% Layers are the basic elements of page styles. A layer has a name and several
% attributes. The attributes may be set as comma separated list at the first,
% optional argument of \cs{DeclareLayer}. The name must be set by the second,
% mandatory argument.
% \begin{macro}{\def@scr@l@pos}
% And a second helper macro to easily define $x, y, w, h$ of a layer.
% \begin{macrocode}
%<*package&body>
\newcommand*{\def@scr@l@pos}[4]{%
\@namedef{scr@l@\scr@current@layer @x}{#1}%
\@namedef{scr@l@\scr@current@layer @y}{#2}%
\@namedef{scr@l@\scr@current@layer @w}{#3}%
\@namedef{scr@l@\scr@current@layer @h}{#4}%
}
% \end{macrocode}
% \end{macro}%^^A \def@scr@l@pos
%
% There are basic, primitive attributes and compounding attributes. The basic
% attributes are:
% \begin{description}
% \item[\texttt{mode=\meta{command sequence}}:] the mode that should be used
% to output the \texttt{contents}. A command \cs{layer\meta{command
% sequence}mode} with one argument need to be defined.
% \changes{v3.19}{2015/07/30}{new layer attribute \texttt{mode}}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{mode}{%
\scr@ifundefinedorrelax{layer#1mode}{\FamilyKeyStateUnknownValue}{%
\@namedef{scr@l@\scr@current@layer @mode}{#1}%
\FamilyKeyStateProcessed
}%
}
% \end{macrocode}
% \item[\texttt{hoffset=\meta{dimension expression}}:] offset from the left
% edge of the paper.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{hoffset}{%
\@namedef{scr@l@\scr@current@layer @x}{\dimexpr #1\relax}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{voffset=\meta{dimension expression}}:] offset from the top
% edge of the paper.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{voffset}{%
\@namedef{scr@l@\scr@current@layer @y}{\dimexpr #1\relax}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{width=\meta{dimension expression}}:] width of the layer.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{width}{%
\@namedef{scr@l@\scr@current@layer @w}{\dimexpr #1\relax}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{height=\meta{dimension expression}}:] height of the layer.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{height}{%
\@namedef{scr@l@\scr@current@layer @h}{\dimexpr #1\relax}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{align=\meta{specification}}:] horizontal and vertical
% alignment of the layer. The \meta{specification} will interpreted
% character by character with the following valid characters:
% \begin{itemize}
% \item[l] -- align the layer with its left edge to the given horizontal
% offset. This means, that the layer's width will span right from the
% given horizontal offset.
% \item[r] -- align the layer with its right edge to the given horizontal
% offset. This means, that the layer's width will span left from the given
% horizontal offset.
% \item[c] -- align the layer centered to the given horizontal and vertical
% offset. This means, that the given offsets are at the middle of the
% layer width and total height.
% \item[t] -- align the layer with its top edge to the given vertical
% offset. This means that the layer's contents will span below the given
% vertical offset.
% \item[b] -- align the layer with its bottom edge to the given vertical
% offset. This means, that the layer's contents will span above the given
% vertical offset.
% \end{itemize}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{align}{%
\@namedef{scr@l@\scr@current@layer @align}{#1}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{contents=\meta{output}}:] whatever should be printed by the
% layer.
% \changes{v3.14}{2014/10/20}{\texttt{contents} is \cs{long}}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{contents}{%
\long\@namedef{scr@l@\scr@current@layer @contents}{#1}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \item[\texttt{background}:] restrict the layer to the page
% background. This means, that the main contents of the page may overprint
% the contents of the layer. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{background}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{background}{#1}%
\csname @scr@l@\scr@current@layer @backgroundtrue\endcsname
\csname @scr@l@\scr@current@layer @foregroundfalse\endcsname
}
% \end{macrocode}
% \item[\texttt{foreground}:] restrict the layer to the page
% foreground. This means, that the layer's contents may overprint the main
% contents of the page. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{foreground}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{foreground}{#1}%
\csname @scr@l@\scr@current@layer @backgroundfalse\endcsname
\csname @scr@l@\scr@current@layer @foregroundtrue\endcsname
}
% \end{macrocode}
% \item[\texttt{backandforeground}:] not really useful, but the counterpart of
% the restrictions above.
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{backandforeground}}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{backandforeground}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{backandforeground}{#1}%
\csname @scr@l@\scr@current@layer @backgroundtrue\endcsname
\csname @scr@l@\scr@current@layer @foregroundtrue\endcsname
}
% \end{macrocode}
% \item[\texttt{oddpage}:] restrict the layer to odd pages only. At
% two-sided layout only pages with odd page numbers are odd pages. At
% single-sided layout all pages are odd pages. Note, that this attribute has
% no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{oddpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{oddpage}{#1}%
\csname @scr@l@\scr@current@layer @oddtrue\endcsname
\csname @scr@l@\scr@current@layer @evenfalse\endcsname
}
% \end{macrocode}
% \item[\texttt{evenpage}:] restrict the layer to even pages only. At
% two-sided layout only pages with even page numbers are even pages. At
% single-sided layout there aren't even pages. Note, that this attribute has
% no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{evenpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{evenpage}{#1}%
\csname @scr@l@\scr@current@layer @oddfalse\endcsname
\csname @scr@l@\scr@current@layer @eventrue\endcsname
}
% \end{macrocode}
% \item[\texttt{oddorevenpage}:] do not restrict the layer to odd or even
% pages.
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{oddorevenpage}}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{oddorevenpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{oddorevenpage}{#1}%
\csname @scr@l@\scr@current@layer @oddtrue\endcsname
\csname @scr@l@\scr@current@layer @eventrue\endcsname
}
% \end{macrocode}
% \item[\texttt{evenoroddpage}:] same as \texttt{oddorevenpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{evenoroddpage}[\relax]{%
\PackageWarning{scrlayer}{Option `evenoroddpage' unknown.\MessageBreak
Using `oddorevenpage' instead}%
\ExecuteFamilyOptions[.definelayer]{KOMAarg}{oddorevenpage=#1}
}
% \end{macrocode}
% \item[\texttt{oddandevenpages}:] same as \texttt{oddorevenpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{oddandevenpages}[\relax]{%
\PackageWarning{scrlayer}{Option `oddandevenpages' unknown.\MessageBreak
Using `oddorevenpage' instead}%
\ExecuteFamilyOptions[.definelayer]{KOMAarg}{oddorevenpage=#1}
}
% \end{macrocode}
% \item[\texttt{evenandoddpages}:] same as \texttt{oddorevenpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{evenandoddpages}[\relax]{%
\PackageWarning{scrlayer}{Option `evenandoddpages' unknown.\MessageBreak
Using `oddorevenpage' instead}%
\ExecuteFamilyOptions[.definelayer]{KOMAarg}{oddorevenpage=#1}
}
% \end{macrocode}
% \item[\Option{floatpage}:] restrict the layer to float pages.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{floatpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{floatpage}{#1}%
\csname @scr@l@\scr@current@layer @nonfloatpagefalse\endcsname
\csname @scr@l@\scr@current@layer @floatpagetrue\endcsname
}
% \end{macrocode}
% \item[\Option{nonfloatpage}:] restrict the layer to pages, which aren't
% float pages.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{nonfloatpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{nonfloatpage}{#1}%
\csname @scr@l@\scr@current@layer @nonfloatpagetrue\endcsname
\csname @scr@l@\scr@current@layer @floatpagefalse\endcsname
}
% \end{macrocode}
% \item[\Option{floatornonfloatpage}:] don't restrict the layer to float or
% non-float pages.
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{floatornonfloatpage}}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{floatornonfloatpage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{floatornonfloatpage}{#1}%
\csname @scr@l@\scr@current@layer @nonfloatpagetrue\endcsname
\csname @scr@l@\scr@current@layer @floatpagetrue\endcsname
}
% \end{macrocode}
% \item[\Option{nonfloatorfloatpage}:] same as \Option{floatornonfloatpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{nonfloatorfloatpage}[\relax]{%
\PackageWarning{scrlayer}{Option `nonfloatorfloatpage' unknown.\MessageBreak
Using `floatornonfloatpage' instead}%
\FamilyExecuteOptions[.definelayer]{KOMAarg}{floatornonfloatpage=#1}%
}
% \end{macrocode}
% \item[\Option{floatandnonfloatpages}:] same as \Option{floatornonfloatpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{floatandnonfloatpages}[\relax]{%
\PackageWarning{scrlayer}{Option `floatandnonfloatpages' unknown.\MessageBreak
Using `floatornonfloatpage' instead}%
\FamilyExecuteOptions[.definelayer]{KOMAarg}{floatornonfloatpage=#1}%
}
% \end{macrocode}
% \item[\Option{nonfloatandfloatpages}:] same as \Option{floatornonfloatpage}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{nonfloatandfloatpages}[\relax]{%
\PackageWarning{scrlayer}{Option `nonfloatandfloatpages' unknown.\MessageBreak
Using `floatornonfloatpage' instead}%
\FamilyExecuteOptions[.definelayer]{KOMAarg}{floatornonfloatpage=#1}%
}
% \end{macrocode}
% \item[\Option{everypage}:] remove all odd-, even-, float-, and
% nonfloat-restrictions.
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{everypage}}%^^A
% \changes{v3.22}{2016/09/24}{foreground and background condition
% removed}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{everypage}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{everypage}{#1}%
\csname @scr@l@\scr@current@layer @oddtrue\endcsname
\csname @scr@l@\scr@current@layer @eventrue\endcsname
\csname @scr@l@\scr@current@layer @nonfloatpagetrue\endcsname
\csname @scr@l@\scr@current@layer @floatpagetrue\endcsname
}
% \end{macrocode}
% \item[\Option{oneside}:] restrict the layer to pages on single-sided
% layouts.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{oneside}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{oneside}{#1}%
\csname @scr@l@\scr@current@layer @twosidefalse\endcsname
\csname @scr@l@\scr@current@layer @onesidetrue\endcsname
}
% \end{macrocode}
% \item[\Option{twoside}:] restrict the layer to pages on two-sided
% layouts.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{twoside}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{twoside}{#1}%
\csname @scr@l@\scr@current@layer @twosidetrue\endcsname
\csname @scr@l@\scr@current@layer @onesidefalse\endcsname
}
% \end{macrocode}
% \item[\Option{everyside}:] remove all one- or two-side restrictions.
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{everyside}}
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{everyside}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{everyside}{#1}%
\csname @scr@l@\scr@current@layer @twosidetrue\endcsname
\csname @scr@l@\scr@current@layer @onesidetrue\endcsname
}
% \end{macrocode}
% \item[\Option{unrestricted}:] remove all restrictions
% \changes{v3.18}{2015/05/14}{new layer feature \texttt{unrestricted}}%^^A
% \changes{v3.22}{2016/09/24}{missing background and foreground
% condition}%^^A
% \changes{v3.22}{2016/09/24}{nonfloatpage condition fixed}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{unrestricted}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{unrestricted}{#1}%
\csname @scr@l@\scr@current@layer @oddtrue\endcsname
\csname @scr@l@\scr@current@layer @eventrue\endcsname
\csname @scr@l@\scr@current@layer @backgroundtrue\endcsname
\csname @scr@l@\scr@current@layer @foregroundtrue\endcsname
\csname @scr@l@\scr@current@layer @nonfloatpagetrue\endcsname
\csname @scr@l@\scr@current@layer @floatpagetrue\endcsname
\csname @scr@l@\scr@current@layer @twosidetrue\endcsname
\csname @scr@l@\scr@current@layer @onesidetrue\endcsname
}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{new attribute \texttt{beforecontents}}%^^A
% \item[\Option{beforecontents}:] code to be executed immediately before
% setting the contents. See also modification attribute
% \texttt{addbeforecontents}.
% \begin{macrocode}
\FamilyCSKey[.definelayer]{KOMAarg}{beforecontents}
{scr@l@\scr@current@layer @precontents@hook}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{new attribute \texttt{aftercontents}}%^^A
% \item[\Option{aftercontents}:] code to be executed immediately before
% setting the contents. See also modification attribute
% \texttt{addaftercontents}.
% \begin{macrocode}
\FamilyCSKey[.definelayer]{KOMAarg}{aftercontents}
{scr@l@\scr@current@layer @postcontents@hook}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{new attribute \texttt{artifact}}%^^A
% \item[\Option{artifact}:] reserved for tagging packages. The artifact can
% either be a boolean or a general value. Boolean false will unset the
% attribute. Boolean true is the same like empty. All other values will be
% stored.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{artifact}[true]{%
\FamilySetBool{KOMAarg}{artifact}{@tempswa}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\if@tempswa
\expandafter\let\csname scr@l@\scr@current@layer @artifact\endcsname
\@empty
\else
\expandafter\let\csname scr@l@\scr@current@layer @artifact\endcsname
\relax
\fi
\else
\FamilyKeyStateProcessed
\@namedef{scr@l@\scr@current@layer @artifact}{#1}%
\fi
}
% \end{macrocode}
% \end{description}
%
% Attribute modifications are attributes, that modify existing basic
% attributes:
% \begin{description}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addhoffset}}%^^A
% \item[\texttt{addhoffset=\meta{dimension expression}}:] add to offset from
% the left edge of the paper.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addhoffset}{%
\expandafter\edef\csname scr@l@\scr@current@layer @x\endcsname{%
\noexpand\dimexpr \unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @x\endcsname + (#1)\relax}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addvoffset}}%^^A
% \item[\texttt{addvoffset=\meta{dimension expression}}:] add to offset from
% the top edge of the paper.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addvoffset}{%
\expandafter\edef\csname scr@l@\scr@current@layer @y\endcsname{%
\noexpand\dimexpr \unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @y\endcsname + (#1)\relax}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addwidth}}%^^A
% \item[\texttt{addwidth=\meta{dimension expression}}:] add to width of the
% layer.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addwidth}{%
\expandafter\edef\csname scr@l@\scr@current@layer @w\endcsname{%
\noexpand\dimexpr \unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @w\endcsname + (#1)\relax}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addheight}}%^^A
% \item[\texttt{addheight=\meta{dimension expression}}:] add to height of the
% layer.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addheight}{%
\expandafter\edef\csname scr@l@\scr@current@layer @h\endcsname{%
\noexpand\dimexpr \unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @h\endcsname + (#1)\relax}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{addcontents}}%^^A
% \item[\texttt{addcontents=\meta{output}}:] append to whatever should be
% printed by the layer.
% \changes{v3.14}{2014/10/20}{\texttt{contents} is \cs{long}}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addcontents}{%
\expandafter\edef\csname scr@l@\scr@current@layer @contents\endcsname{%
\unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @contents\endcsname #1}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.16}{2015/01/26}{new layer attribute \texttt{pretocontents}}%^^A
% \item[\texttt{pretocontents=\meta{output}}:] prefix whatever should be
% printed by the layer.
% \changes{v3.14}{2014/10/20}{\texttt{contents} is \cs{long}}%^^A
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{pretocontents}{%
\expandafter\edef\csname scr@l@\scr@current@layer @contents\endcsname{%
\unexpanded{#1}\unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @contents\endcsname}}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{new attribute \texttt{addbeforecontents}}%^^A
% \item[\Option{addbeforecontents}:] code to be executed immediately before
% setting the contents. The new code will be added before the old code.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addbeforecontents}{%
\scr@ifundefinedorrelax{scr@l@\scr@current@layer @precontents@hook}{%
\expandafter\def
\csname scr@l@\scr@current@layer @precontents@hook\endcsname{#1}%
}{%
\expandafter\edef
\csname scr@l@\scr@current@layer @precontents@hook\endcsname{%
\unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @precontents@hook\endcsname}%
\unexpanded{#1}
}%
}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{new attribute \texttt{addaftercontents}}%^^A
% \item[\Option{addaftercontents}:] code to be executed immediately before
% setting the contents. The new code will be added after the old code.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{addaftercontents}{%
\scr@ifundefinedorrelax{scr@l@\scr@current@layer @postcontents@hook}{%
\expandafter\def
\csname scr@l@\scr@current@layer @postcontents@hook\endcsname{#1}%
}{%
\expandafter\edef
\csname scr@l@\scr@current@layer @postcontents@hook\endcsname{%
\unexpanded{#1}%
\unexpanded\expandafter\expandafter\expandafter{%
\csname scr@l@\scr@current@layer @postcontents@hook\endcsname}%
}%
}%
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \end{description}
%
% Compounding attributes are attributes, that set up several basic attributes
% with a single compounding attribute:
% \begin{description}
% \item[\texttt{page}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values spanning the whole
% page aligned by the default alignment \texttt{tl}. Note, that this
% attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{page}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{page}{#1}%
\def@scr@l@pos{\z@}{\z@}{\paperwidth}{\paperheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{topmargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the top
% margin of the page and horizontally spanning the whole page aligned by the
% default alignment \texttt{tl}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{topmargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{topmargin}{#1}%
\def@scr@l@pos{\z@}{\z@}{\paperwidth}{\dimexpr \topmargin+1in\relax}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{head}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% head and horizontally spanning the text area aligned by usual head
% alignment \texttt{bl}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{head}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{head}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{%
\dimexpr \topmargin+1in+\headheight\relax
}{\textwidth}{\headheight}%
\@namedef{scr@l@\scr@current@layer @align}{bl}%
}
% \end{macrocode}
% \item[\texttt{headsep}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the area
% between page head and text area and horizontally spanning the text area
% aligned by the default alignment \texttt{t}. Note, that this attribute
% has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{headsep}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{head}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{%
\dimexpr \topmargin+1in+\headheight\relax
}{\textwidth}{\headsep}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{textarea}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values spanning the text area of
% the page aligned by the default alignment \texttt{t}. Note, that this
% attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{textarea}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{textarea}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{%
\dimexpr \topmargin+1in+\headheight+\headsep\relax
}{\textwidth}{\textheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{foot}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% footer and horizontally spanning the text area aligned by the usual footer
% alignment \texttt{t}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{foot}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{foot}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{%
\dimexpr \topmargin+1in+\headheight+\headsep+\textheight
+\footskip+\dp\strutbox-\footheight\relax
}{\textwidth}{\footheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{footskip}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the
% distance from the text area to the page
% footer and horizontally spanning the text area aligned by the usual footer
% alignment \texttt{t}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{footskip}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{foot}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{%
\dimexpr \topmargin+1in+\headheight+\headsep+\textheight\relax
}{\textwidth}{\dimexpr\footskip+\dp\strutbox-\footheight\relax}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{bottommargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the
% page's bottom margin below the footer and horizontally spanning the page
% by the default alignment \texttt{t}. Note, that this attribute has no
% value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{bottommargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{bottommargin}{#1}%
\def@scr@l@pos{\z@}{%
\dimexpr \topmargin+1in+\headheight+\headsep
+\textheight
+\footskip+\dp\strutbox\relax
}{\paperwidth}{\dimexpr\paperheight-\layeryoffset\relax}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{leftmargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% and horizontally spanning the left margin of the page by the default
% alignment \texttt{t}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{leftmargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{leftmargin}{#1}%
\def@scr@l@pos{\z@}{\z@}{%
\dimexpr
\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi
+1in
\relax
}{\paperheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{rightmargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% and horizontally spanning the right margin of the page by the default
% alignment \texttt{t}. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{rightmargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{rightmargin}{#1}%
\def@scr@l@pos{\paperwidth}{\z@}{%
\dimexpr \paperwidth-1in-\textwidth
-\if@twoside\ifodd\value{page}\oddsidemargin\else\evensidemargin\fi
\else\oddsidemargin\fi\relax
}{\paperheight}%
\@namedef{scr@l@\scr@current@layer @align}{tr}%
}
% \end{macrocode}
% \item[\texttt{innermargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% and horizontally spanning the right margin of even pages and the left
% margin of odd pages by the default alignment \texttt{t}. See attributes
% \texttt{oddpage} and \texttt{evenpage} for more information about odd and
% even pages. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{innermargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{innermargin}{#1}%
\def@scr@l@pos{%
\if@twoside
\ifodd\value{page} \z@
\else \dimexpr \evensidemargin+1in+\textwidth\relax
\fi
\else \z@\fi
}{\z@}{%
\dimexpr
\if@twoside\ifodd\value{page} \oddsidemargin+1in
\else \paperwidth-\layerxoffset\fi
\else \oddsidemargin+1in\fi
\relax
}{\paperheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{outermargin}:] set up \texttt{hoffset}, \texttt{voffset},
% \texttt{width}, and \texttt{height} to values vertically spanning the page
% and horizontally spanning the left margin of even pages and the right
% margin of odd pages by the default alignment \texttt{t}. See attributes
% \texttt{oddpage} and \texttt{evenpage} for more information about odd and
% even pages. Note, that this attribute has no value!
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{outermargin}[\relax]{%
\FamilyKeyStateProcessed
\scrlayer@testunexpectedarg{outermargin}{#1}%
\def@scr@l@pos{%
\dimexpr
\if@twoside\ifodd\value{page} \oddsidemargin+1in+\textwidth
\else \z@\fi
\else \oddsidemargin+1in+\textwidth\fi
\relax
}{\z@}{%
\dimexpr
\if@twoside\ifodd\value{page}\paperwidth-\layerxoffset
\else \evensidemargin+1in\fi
\else \paperwidth-\layerxoffset\fi
\relax
}{\paperheight}%
\@namedef{scr@l@\scr@current@layer @align}{tl}%
}
% \end{macrocode}
% \item[\texttt{area=\{\meta{hoffset}\}\{\meta{voffset}\}%^^A
% \{\meta{width}\}\{\meta{height}\}}:] set up
% \texttt{hoffset}, \texttt{voffset}, \texttt{width}, and \texttt{height} to
% the given values.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{area}{%
\def@scr@l@pos#1
\FamilyKeyStateProcessed
}
% \end{macrocode}
% \changes{v3.26}{2018/07/14}{clone code for \texttt{precontents@hook},
% \texttt{postcontents@hook} and \texttt{artifact} added}%^^A
% \item[\texttt{clone=\meta{layer}}:] set up the new layer by the settings
% of the given \meta{layer}.
% \begin{macrocode}
\DefineFamilyKey[.definelayer]{KOMAarg}{clone}{%
\scr@ifundefinedorrelax{scr@l@#1@x}{%
\FamilyKeyStateUnknownValue
\PackageError{scrlayer}{layer `#1' undefined}{%
You can clone only already defined layers.\MessageBreak
If you'll continue, `clone=#1' will be ignored.%
}%
}{%
\FamilyKeyStateProcessed
\scrlayer@clone@attribute{\scr@current@layer}{#1}{mode}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{x}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{y}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{w}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{h}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{align}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{contents}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{background}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{foreground}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{odd}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{even}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{oneside}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{twoside}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{floatpage}%
\scrlayer@clone@switch{\scr@current@layer}{#1}{nonfloatpage}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{precontents@hook}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{postcontents@hook}%
\scrlayer@clone@attribute{\scr@current@layer}{#1}{artifact}%
}%
}
% \end{macrocode}
% \begin{macro}{\scrlayer@clone@attribute}
% \begin{macro}{\scrlayer@clone@switch}
% Two helpers used at option \texttt{clone} to clone either a macro-based
% attribute or a if-based attribute.
% \begin{macrocode}
\newcommand*{\scrlayer@clone@attribute}[3]{%
\expandafter\let\csname scr@l@#1@#3\expandafter\endcsname
\csname scr@l@#2@#3\expandafter\endcsname
}
\newcommand*{\scrlayer@clone@switch}[3]{%
\expandafter\let\csname if@scr@l@#1@#3\expandafter\endcsname
\csname if@scr@l@#2@#3\expandafter\endcsname
}
% \end{macrocode}
% \end{macro}%^^A \scrlayer@clone@switch
% \end{macro}%^^A \scrlayer@clone@attribute
% \end{description}
%
% \changes{v0.9}{2014/08/31}{missing reset of \cs{scr@current@layer}
% added}%^^A
% \changes{v3.14}{2014/10/20}{\cs{long}}%^^A
% \begin{macrocode}
\newcommand{\DeclareLayer}[2][]{%
\def\scr@current@layer{#2}%
\@namedef{scr@l@#2@mode}{text}%
\@namedef{scr@l@#2@x}{\z@}%
\@namedef{scr@l@#2@y}{\z@}%
\@namedef{scr@l@#2@w}{\paperwidth}%
\@namedef{scr@l@#2@h}{\paperheight}%
\@namedef{scr@l@#2@align}{tl}%
\@namedef{scr@l@#2@contents}{}%
\expandafter\newif\csname if@scr@l@#2@background\endcsname
\csname @scr@l@#2@backgroundtrue\endcsname
\expandafter\newif\csname if@scr@l@#2@foreground\endcsname
\csname @scr@l@#2@foregroundtrue\endcsname
\expandafter\newif\csname if@scr@l@#2@odd\endcsname
\csname @scr@l@#2@oddtrue\endcsname
\expandafter\newif\csname if@scr@l@#2@even\endcsname
\csname @scr@l@#2@eventrue\endcsname
\expandafter\newif\csname if@scr@l@#2@oneside\endcsname
\csname @scr@l@#2@onesidetrue\endcsname
\expandafter\newif\csname if@scr@l@#2@twoside\endcsname
\csname @scr@l@#2@twosidetrue\endcsname
\expandafter\newif\csname if@scr@l@#2@floatpage\endcsname
\csname @scr@l@#2@floatpagetrue\endcsname
\expandafter\newif\csname if@scr@l@#2@nonfloatpage\endcsname
\csname @scr@l@#2@nonfloatpagetrue\endcsname
\FamilyExecuteOptions[.definelayer]{KOMAarg}{#1}%
\let\scr@current@layer\@empty
}
% \end{macrocode}
% \begin{macro}{\scr@current@layer}
% Helper to hold the current layer and only valid in non recursive calls of
% \Macro{DeclareLayer}.
% \begin{macrocode}
\newcommand*{\scr@current@layer}{}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scr@current@layer
% \end{macro}%^^A \DeclareLayer
%
% \begin{macro}{\IfLayerExists}
% \begin{description}
% \item[\Parameter{string}:] the name of the layer (must be fully expandable
% and expand to a string only).
% \item[\Parameter{then code}:] will be executed, if the layer exists.
% \item[\Parameter{else code}:] will be executed, if the layer doesn't exist.
% \end{description}
% Note, that we don't known really whether or not a layer exists, but have a
% heuristic.
% \begin{macrocode}
%<*package&body>
\newcommand*{\IfLayerExists}[1]{%
\scr@ifundefinedorrelax{scr@l@#1@mode}{%
\expandafter\@secondoftwo
}{%
\expandafter\@firstoftwo
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \IfLayerExists
%
% \begin{macro}{\DeclareNewLayer}
% \changes{v3.14}{2014/10/20}{\cs{long}}%^^A
% \begin{macro}{\ProvideLayer}
% \changes{v3.14}{2014/10/20}{\cs{long}}%^^A
% \begin{macro}{\RedeclareLayer}
% \changes{v3.14}{2014/10/20}{\cs{long}}%^^A
% \begin{macro}{\ModifyLayer}
% \changes{v3.14}{2014/10/20}{\cs{long}}%^^A
% \changes{v0.9}{2014/08/31}{missing definition and reset of
% \cs{scr@current@layer} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% There are also two commands for declaration of layers, that haven't been
% declared before, with or without error message for already declared layers,
% and two commands for changing already declared layers, first one beginning
% again from scratch, second one for only setting up attributes, that should
% be changed.
% \begin{macrocode}
%<*package&body>
\newcommand{\DeclareNewLayer}[2][]{%
\IfLayerExists{#2}{%
\PackageError{scrlayer}{layer `#2' already defined}{%
You may declare only layer, that haven't been declared previously
using\MessageBreak
\string\DeclareNewLayer. See also the alternatives
\string\RedeclareLayer,\MessageBreak
\string\ModifyLayer\space and \string\ProvideLayer.\MessageBreak
If you'll continue, declaration will be ignored.}%
}{\DeclareLayer[{#1}]{#2}}%
}
\newcommand{\ProvideLayer}[2][]{%
\IfLayerExists{#2}{%
%<*trace>
\PackageInfo{scrlayer}{\string\ProvideLayer{#2} ignored,\MessageBreak
because of already defined layer}%
%</trace>
}{\DeclareNewLayer[{#1}]{#2}}%
}
\newcommand{\RedeclareLayer}[2][]{%
\IfLayerExists{#2}{}{%
\PackageError{scrlayer}{layer `#2' not yet defined}{%
You may declare only already declared layers using
\string\RedeclareLayer.\MessageBreak
See also the alternatives
\string\DeclareLayer and \string\ProvideLayer.\MessageBreak
Nevertheless, if you'll continue, declaration will be done.}%
}%
\DeclareLayer[{#1}]{#2}%
}
\newcommand{\ModifyLayer}[2][]{%
\IfLayerExists{#2}{%
\def\scr@current@layer{#2}%
\edef\reserved@a{%
\unexpanded{%
\FamilyExecuteOptions[.definelayer]{KOMAarg}{#1}%
\Ifstr{\csname scr@l@#2@mode\endcsname}%
}{\csname scr@l@#2@mode\endcsname}%
}\reserved@a{}{%
\PackageWarning{scrlayer}{%
change of layer mode could result in unexpected\MessageBreak
output and errors%
}%
}%
\let\scr@current@layer\@empty
}{%
\PackageError{scrlayer}{layer `#2' not yet defined}{%
You may modify only already declared layers using
\string\ModifyLayer.\MessageBreak
See also the alternatives
\string\DeclareLayer and \string\ProvideLayer.\MessageBreak
Nevertheless, if you'll continue, declaration will be done.}%
\DeclareLayer[{#1}]{#2}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \ModifyLayer
% \end{macro}%^^A \RedeclareLayer
% \end{macro}%^^A \ProvideLayer
% \end{macro}%^^A \DeclareNewLayer
%
% \begin{macro}{\ModifyLayers}
% \changes{v3.26}{2018/07/14}{new}%^^A
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% Like \cs{ModifyLayer} but allows a list of layers instead of only one layer.
% For the commands \cs{DeclareLayer}, \cs{ProvideLayer} and
% \cs{RedeclareLayer} this does not make any sense, so there are not similar
% list commands for these commands.
% \begin{macrocode}
%<*package&body>
\newcommand{\ModifyLayers}[2][]{%
\edef\scr@current@layer{#2}%
\@for\scr@current@layer:=\scr@current@layer\do{%
\scr@trim@spaces\scr@current@layer
\ifx\scr@current@layer\@emtpy\else
\edef\scr@current@layer{%
\unexpanded{\ModifyLayer[{#1}]}{\scr@current@layer}%
}%
\scr@current@layer
\fi
}%
\let\scr@current@layer\@empty
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \ModifyLayers
%
% \begin{macro}{\GetLayerContents}
% \changes{v3.16}{2015/01/26}{new}
% \begin{description}
% \item[\Parameter{string}:] the name of the layer
% \end{description}
% Get the contents of the given layer.
% \begin{macrocode}
%<*package&body>
\newcommand*{\GetLayerContents}[1]{%
\IfLayerExists{#1}{\@nameuse{scr@l@#1@contents}}{%
\PackageError{scrlayer}{unknown layer `#1'}{%
You can ask only for the contents of an existing layer.}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\DestroyLayer}
% \changes{v3.26}{2018/07/14}{destroy pre-contents hook, post-contents hook
% and artifact}%^^A
% \begin{description}
% \item[\Parameter{string}:] the name of the layer, that should be
% destroyed
% \end{description}
% Note: Nothing will be done to remove the layer from a page style, but this
% shouldn't matter, because layers with, e.g.,
% \Macro{if@scr@l@\dots@nonfloatpage}=\Macro{relax} and
% \Macro{if@scr@l@\dots@floatpage}=\Macro{relax} won't be output ever. This
% command could be used by interfaces via
% \Macro{scrlayerOnAutoRemoveInterface} to remove the generated
% layers, if the interface commands wouldn't be depreacted.
% However, it only destroys existing layers and doesn't care for not
% existing.
% \begin{macrocode}
%<*package&body>
\newcommand*{\DestroyLayer}[1]{%
\IfLayerExists{#1}{%
\expandafter\let\csname scr@l@#1@mode\endcsname\relax
\expandafter\let\csname scr@l@#1@x\endcsname\relax
\expandafter\let\csname scr@l@#1@y\endcsname\relax
\expandafter\let\csname scr@l@#1@w\endcsname\relax
\expandafter\let\csname scr@l@#1@h\endcsname\relax
\expandafter\let\csname scr@l@#1@align\endcsname\relax
\expandafter\let\csname scr@l@#1@contents\endcsname\relax
\expandafter\let\csname if@scr@l@#1@background\endcsname\relax
\expandafter\let\csname @scr@l@#1@backgroundfalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@backgroundtrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@foreground\endcsname\relax
\expandafter\let\csname @scr@l@#1@foregroundfalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@foregroundtrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@odd\endcsname\relax
\expandafter\let\csname @scr@l@#1@oddfalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@oddtrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@even\endcsname\relax
\expandafter\let\csname @scr@l@#1@evenfalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@eventrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@oneside\endcsname\relax
\expandafter\let\csname @scr@l@#1@onesidefalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@onesidetrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@twoside\endcsname\relax
\expandafter\let\csname @scr@l@#1@twosidefalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@twosidetrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@floatpage\endcsname\relax
\expandafter\let\csname @scr@l@#1@floatpagefalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@floatpagetrue\endcsname\relax
\expandafter\let\csname if@scr@l@#1@nonfloatpage\endcsname\relax
\expandafter\let\csname @scr@l@#1@nonfloatpagefalse\endcsname\relax
\expandafter\let\csname @scr@l@#1@nonfloatpagetrue\endcsname\relax
\expandafter\let\csname scr@l@#1@precontents@hook\relax
\expandafter\let\csname scr@l@#1@postcontents@hook\relax
\expandafter\let\csname scr@l@#1@artifact\relax
}{%
%<*trace>
\PackageInfo{scrlayer}{\string\DestroyLayer{#1} ignored,\MessageBreak
because that layer doesn't exist\MessageBreak
(any longer)%
}%
%</trace>
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \DestroyLayer
%
%
% \begin{macro}{\layercontentsmeasure}
% \changes{v3.19}{2015/07/27}{\cs{@gobble} eliminated}%^^A
% This may used by used as the only value of the layer option
% \texttt{contents} to show measure lines around the layer. The left and the
% top measure line will be in centimeter, the right and the bottom measure
% line in inch. With option \texttt{draft=true} this also be used
% automatically and additionally for every layer of a page style.
% \begin{macrocode}
%<*package&body>
\newcommand*{\layercontentsmeasure}{%
\smash{\begin{picture}(0,0)
(0,\LenToUnit{%
\if t\layervalign -\ht\strutbox
\else
\if b\layervalign -\dimexpr\layerheight-\dp\strutbox\relax
\else -.5\dimexpr\layerheight+\ht\strutbox-\dp\strutbox\relax
\fi
\fi})
% \end{macrocode}
% 1st horizontal cm
% \begin{macrocode}
\setlength{\unitlength}{1mm}%
\put(0,0){\line(1,0){\LenToUnit{\layerwidth}}}%
\@tempcnta=\numexpr \dimexpr\layerwidth + .5mm\relax/\dimexpr 1mm\relax\relax
\multiput(0,0)(1,0){\@tempcnta}{%
\line(0,-1){1}%
}%
\@tempcnta=\numexpr \dimexpr\layerwidth + 2.5mm\relax/\dimexpr 5mm\relax\relax
\multiput(0,0)(5,0){\@tempcnta}{%
\line(0,-1){2}%
}%
\@tempcnta=\numexpr \dimexpr\layerwidth + .5cm\relax/\dimexpr 1cm\relax\relax
\multiput(0,0)(10,0){\@tempcnta}{%
\put(0,0){\line(0,-1){3}}%
\put(0,-3.5){%
\makebox(0,0)[ct]{\the\numexpr\@tempcnta-\@multicnt\relax}}%
}%
% \end{macrocode}
% 2nd horizontal in:
% \begin{macrocode}
\put(0,\LenToUnit{-\layerheight}){\line(1,0){\LenToUnit{\layerwidth}}}%
\@tempcnta=\numexpr \dimexpr\layerwidth + .05in\relax/\dimexpr .1in\relax\relax
\multiput(0,\LenToUnit{-\layerheight})(2.54,0){\@tempcnta}{%
\line(0,1){1}%
}%
\@tempcnta=\numexpr \dimexpr\layerwidth + .25in\relax/\dimexpr .5in\relax\relax
\multiput(0,\LenToUnit{-\layerheight})(12.7,0){\@tempcnta}{%
\line(0,1){2}%
}%
\@tempcnta=\numexpr \dimexpr\layerwidth + .5in\relax/\dimexpr 1in\relax\relax
\multiput(0,\LenToUnit{-\layerheight})(25.4,0){\@tempcnta}{%
\put(0,0){\line(0,1){3}}%
\put(0,3.5){%
\makebox(0,0)[cb]{\the\numexpr\@tempcnta-\@multicnt\relax}}%
}%
% \end{macrocode}
% 3rd vertical cm:
% \begin{macrocode}
\put(0,0){\line(0,-1){\LenToUnit{\layerheight}}}%
\@tempcnta\numexpr \dimexpr\layerheight + .5mm\relax/\dimexpr 1mm\relax\relax
\multiput(0,0)(0,-1){\@tempcnta}{%
\line(1,0){1}%
}%
\@tempcnta\numexpr \dimexpr\layerheight + 2.5mm\relax/\dimexpr 5mm\relax\relax
\multiput(0,0)(0,-5){\@tempcnta}{%
\line(1,0){2}%
}%
\@tempcnta\numexpr \dimexpr\layerheight + .5cm\relax/\dimexpr 1cm\relax\relax
\multiput(0,0)(0,-10){\@tempcnta}{%
\put(0,0){\line(1,0){3}}%
\put(3.5,0){%
\makebox(0,0)[cl]{\the\numexpr\@tempcnta-\@multicnt\relax}}%
}%
% \end{macrocode}
% 4th vertical in:
% \begin{macrocode}
\put(\LenToUnit{\layerwidth},0){\line(0,-1){\LenToUnit{\layerheight}}}%
\@tempcnta\numexpr \dimexpr\layerheight + .05in\relax/\dimexpr .1in\relax\relax
\multiput(\LenToUnit{\layerwidth},0)(0,-2.54){\@tempcnta}{%
\line(-1,0){1}%
}%
\@tempcnta\numexpr \dimexpr\layerheight + .25in\relax/\dimexpr .5in\relax\relax
\multiput(\LenToUnit{\layerwidth},0)(0,-12.7){\@tempcnta}{%
\line(-1,0){2}%
}%
\@tempcnta\numexpr \dimexpr\layerheight + .5in\relax/\dimexpr 1in\relax\relax
\multiput(\LenToUnit{\layerwidth},0)(0,-25.4){\@tempcnta}{%
\put(0,0){\line(-1,0){3}}%
\put(-3.5,0){%
\makebox(0,0)[cr]{\the\numexpr\@tempcnta-\@multicnt\relax}}%
}%
\end{picture}}%
}
% \end{macrocode}
% \begin{macro}{\LenToUnit}
% \changes{v3.19}{2015/07/27}{new}
% Due to an incompatibility of package \textsf{curve2e} I've eliminated
% \cs{@gobble} in the definition of \cs{layercontentsmeasure} and replaced it
% sometimes by \cs{LenToUnit} with the (not long) definition suggested by
% \textsf{curve2e} itself.
% \begin{macrocode}
\providecommand*{\LenToUnit}[1]{\strip@pt\dimexpr#1*\p@/\unitlength}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \LenToUnit
% \end{macro}%^^A \layercontentsmeasure
%
%
% \subsection{Providing Page Styles}
%
% Page styles in \LaTeX{} consist of the elements:
% \begin{itemize}
% \item a header for odd pages,
% \item a header for even pages,
% \item a footer for odd pages,
% \item a footer for even pages,
% \end{itemize}
% and some optional additional commands, that will be expanded, whenever the
% page style will be activated. Note, that header and footer for even pages
% will be used only at two-sided mode. At one-sided mode the header and footer
% for odd pages will be used for all pages.
%
% With package \Package{scrlayer} layers will be linked to package styles and
% expanded at the four elements above. Background layers will expand only
% at the headers. Foreground layers will expand only at the
% footers. Layers, that haven't been restricted to background or foreground,
% will expand at both, page headers and page footers.
%
% Similar to the expansion of background and foreground layers, odd page
% layers will only expand in the headers or footers of odd pages and even page
% layers will only expand in the headers or footers of even pages. Layers,
% that haven't been restricted to odd or even pages, will expand in the
% headers or footers of odd pages and also in the headers or footers of even
% pages.
%
% One step more: Single-side layers will only expand in the headers or footers
% of pages in single-side layouts and two-side layers only in the headers or
% footers of pages in two-side layout.
%
% One more step: float page layers will only expand in the headers or footers
% of pages, that consists of page floats only, while non-float page layers
% will only expand in the headers of footers of pages, that doesn't have page
% floats.
%
% \begin{length}{\footheight}
% For the header \LaTeX{} already defines a length \Length{headheight} to be
% the maximum height of the header. But for footer it only defines the
% distance of the baseline of the footer from the last baseline of the text
% area. \Package{scrlayer} changes this and also defines a new length
% \Length{footheight}. This length will be initialised with magic value
% -12345\,sp. But if it is still that magic value at
% \Macro{begin}\PParameter{document} it will be reset to the value of
% \Length{baselineskip}.
% \begin{macrocode}
%<*package&init>
\@ifundefined{footheight}{%
\newlength{\footheight}%
\setlength{\footheight}{-12345sp}%
}{%
%<*trace>
\PackageInfo{scrlayer}{Using already defined \string\footheight\MessageBreak
hoping, that this is a length and\MessageBreak
not only a macro}%
%</trace>
}
\AtBeginDocument{%
\ifdim\footheight=-12345sp
%<*trace>
\PackageInfo{scrlayer}{Setting magic \string\footheight\space to
\string\baselineskip\space while\MessageBreak
\string\begin{document}}%
%</trace>
\setlength{\footheight}{\baselineskip}
\fi
}
%</package&init>
% \end{macrocode}
% \end{length}%^^A \footheight
%
%
% Several of the following commands use \meta{key}=\meta{value} arguments. So
% we define a family with a new member:
% \begin{macrocode}
%<*package&body>
\DefineFamily{KOMAarg}
\DefineFamilyMember[.definelayerpagestyle]{KOMAarg}
%</package&body>
% \end{macrocode}
%
% \begin{macro}{\DeclarePageStyleByLayers}
% \begin{description}
% \item[\OParameter{option list}:] comma separated list of named page
% style options (see below).
% \item[\Parameter{string}:] the name of the page style to be declared (must
% be expandable and result in a string).
% \item[\Parameter{string list}:] comma separated list of layer names (must
% be expandable and result in strings); first in the list will be added
% first.
% \end{description}
% Page styles may be declared using this command. It has one optional and
% two mandatory arguments. The first mandatory one is the name of the page
% style and the second one is a list of layers to be used for this page
% style. The page style itself will expand all background layers for odd
% pages in \cs{@oddhead}, all background layers for even pages on
% \cs{@evenhead}, all foreground layers for odd pages in \cs{@oddfoot}, and
% all foreground layers for even pages in \cs{@evenfoot}. This may be
% restricted by additional attributes, e.g., \Option{oneside} and
% \Option{twoside}.
%
% The optional argument may be used to define hooks. There are six named
% optional arguments to set up six hooks. And there are also \KOMAScript{}
% options for these, to define global pre-definitions. Note, that you may
% remove the global pre-definitions by emptying the local hooks. The local
% argument are named similar, but without ``\texttt{ps}'' after
% ``\texttt{on}''.
% \begin{option}{onselect}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsselect}
% \begin{macro}{\@ps@initialhook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} whenever the
% page style will be selected, e.g. using \Macro{pagestyle} or
% \Macro{thispagestyle} or the low level command defining the page
% style itself.
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsselect}{%
\l@addto@macro{\@ps@initialhook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsselect}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsselect}
%<package>\newcommand*{\@ps@initialhook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsselect}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsselect\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsselect@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onselect}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @initialhook\endcsname
{#1}%
\let\scr@opt@marker@initialhook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@initialhook
% \end{option}%^^A onpsselect
% \begin{option}{onpsinit}
% \begin{macro}{\@ps@hook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} whenever the
% output of a layer stack is initialised. Note, that \meta{code} must not
% result in any page output. Otherwise the output of the layer stack will be
% broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsinit}{%
\l@addto@macro{\@ps@hook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsinit}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsinit}
%<package>\newcommand*{\@ps@hook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsinit}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsinit\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsinit@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{oninit}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @hook\endcsname
{#1}%
\let\scr@opt@marker@hook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@hook
% \end{option}%^^A onpsinit
% \end{option}%^^A oninit
% \begin{option}{ononeside}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsoneside}
% \begin{macro}{\@ps@onesidehook}
% \begin{description}
% \item[\Option{=\meta{code}}:] executes \meta{code} after
% \Option{oninit}'s \meta{code} whenever the output of a layer stack of a
% page in single-side layout is initialised. Note, that \meta{code} must not
% result in any page output. Otherwise the output of the layer stack will be
% broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsoneside}{%
\l@addto@macro{\@ps@onesidehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsoneside}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsoneside}
%<package>\newcommand*{\@ps@onesidehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsoneside}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsoneside\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsoneside@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{ononeside}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @onesidehook\endcsname
{#1}%
\let\scr@opt@marker@onesidehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@onesidehook
% \end{option}%^^A onpsoneside
% \end{option}%^^A ononeside
% \begin{option}{ontwoside}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpstwoside}
% \begin{macro}{\@ps@twosidehook}
% \begin{description}
% \item[\Option{=\meta{code}}:] executes \meta{code} after
% \Option{oninit}'s \meta{code} whenever the output of a layer stack of a
% page in two-side layout is initialised. Note, that \meta{code} must not
% result in any page output. Otherwise the output of the layer stack will be
% broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpstwoside}{%
\l@addto@macro{\@ps@twosidehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpstwoside}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpstwoside}
%<package>\newcommand*{\@ps@twosidehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpstwoside}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpstwoside\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpstwoside@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{ontwoside}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @twosidehook\endcsname
{#1}%
\let\scr@opt@marker@twosidehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@twosidehook
% \end{option}%^^A onpstwoside
% \end{option}%^^A ontwoside
% \begin{option}{onoddpage}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsoddpage}
% \begin{macro}{\@ps@oddpagehook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} after
% \Option{ononeside}'s or \Option{ontwoside}'s \meta{code} whenever the
% output of a layer stack of an odd page is initialised. Note, that
% \meta{code} must not result in any page output. Otherwise the output of
% the layer stack will be broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsoddpage}{%
\l@addto@macro{\@ps@oddpagehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsoddpage}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsoddpage}
%<package>\newcommand*{\@ps@oddpagehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsoddpage}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsoddpage\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsoddpage@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onoddpage}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @oddpagehook\endcsname
{#1}%
\let\scr@opt@marker@oddpagehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@oddpagehook
% \end{option}%^^A onpsoddpage
% \end{option}%^^A onoddside
% \begin{option}{onevenpage}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsevenpage}
% \begin{macro}{\@ps@evenpagehook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} after
% \Option{ononeside}'s or \Option{ontwoside}'s \meta{code} whenever the
% output of a layer stack of an even page is initialised. Note, that
% \meta{code} must not result in any page output. Otherwise the output of
% the layer stack will be broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsevenpage}{%
\l@addto@macro{\@ps@evenpagehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsevenpage}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsevenpage}
%<package>\newcommand*{\@ps@evenpagehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsevenpage}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsevenpage\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsevenpage@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onevenpage}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @evenpagehook\endcsname
{#1}%
\let\scr@opt@marker@evenpagehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@evenpagehook
% \end{option}%^^A onpsevenpage
% \end{option}%^^A onevenside
% \begin{option}{onfloatpage}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsfloatpage}
% \begin{macro}{\@ps@floatpagehook}
% \begin{description}
% \item[\Option{=\meta{code}}:] executes \meta{code} after
% \Option{onoddpage}'s or \Option{onevenpage}'s \meta{code} whenever a float
% column has been made (usually those pages are float pages).
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsfloatpage}{%
\l@addto@macro{\@ps@floatpagehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsfloatpage}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsfloatpage}
%<package>\newcommand*{\@ps@floatpagehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsfloatpage}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsfloatpage\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsfloatpage@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onfloatpage}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @floatpagehook\endcsname
{#1}%
\let\scr@opt@marker@floatpagehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@floatpagehook
% \end{option}%^^A onpsfloatpage
% \end{option}%^^A onfloatpage
% \begin{option}{onnonfloatpage}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsnonfloatpage}
% \begin{macro}{\@ps@nonfloatpagehook}
% \begin{description}
% \item[\Option{=\meta{code}}:] executes \meta{code} after
% \Option{onoddpage}'s or \Option{onevenpage}'s \meta{code} whenever no
% float column has been made (usually those pages aren't float pages).
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsnonfloatpage}{%
\l@addto@macro{\@ps@nonfloatpagehook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsnonfloatpage}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsnonfloatpage}
%<package>\newcommand*{\@ps@nonfloatpagehook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsnonfloatpage}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsnonfloatpage\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsnonfloatpage@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onnonfloatpage}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @nonfloatpagehook\endcsname
{#1}%
\let\scr@opt@marker@nonfloatpagehook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@nonfloatpagehook
% \end{option}%^^A onpsnonfloatpage
% \end{option}%^^A onnonfloatpage
% \begin{option}{onbackground}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsbackground}
% \begin{macro}{\@ps@backgroundhook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} after
% \Option{onfloatpage}'s or \Option{onnonfloatpage}'s \meta{code} whenever
% the output of a background layer stack is initialised. Note, that
% \meta{code} must not result in any page output. Otherwise the output of
% the layer stack will be broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsbackground}{%
\l@addto@macro{\@ps@backgroundhook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsbackground}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsbackground}
%<package>\newcommand*{\@ps@backgroundhook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsbackground}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsbackground\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsbackground@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onbackground}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @backgroundhook\endcsname
{#1}%
\let\scr@opt@marker@backgroundhook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@ps@backgroundhook
% \end{option}%^^A onbackground
% \end{option}%^^A onbackground
% \begin{option}{onforeground}
% \changes{v3.28}{2019/11/28}{marker for \cs{ModifyLayerPageStyleOptions}}%^^A
% \begin{option}{onpsforeground}
% \begin{macro}{\@ps@foregroundhook}
% \begin{description}
% \item[\texttt{=\meta{code}}:] executes \meta{code} after
% \Option{onfloatpage}'s or \Option{onnonfloatpage}'s \meta{code} whenever
% the output of a foreground layer stack is initialised. Note, that
% \meta{code} must not result in any page output. Otherwise the output of
% the layer stack will be broken!
% \end{description}
% \begin{macrocode}
%<*options>
\KOMA@key{onpsforeground}{%
\l@addto@macro{\@ps@foregroundhook}{#1}%
\FamilyKeyStateProcessed
\KOMA@kav@add{.scrlayer.sty}{onpsforeground}{#1}%
}
%<package>\scrlayer@@add@inherited@option{onpsforeground}
%<package>\newcommand*{\@ps@foregroundhook}{}
%<package>\KOMA@kav@add{.scrlayer.sty}{onpsforeground}{}
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsforeground\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @onpsforeground@default\endcsname\relax
%</interface&body>
%<*package&body>
\DefineFamilyKey[.definelayerpagestyle]{KOMAarg}{onforeground}{%
\expandafter\l@addto@macro
\csname @ps@\scrlayer@current@pagestyle @foregroundhook\endcsname
{#1}%
\let\scr@opt@marker@foregroundhook\FamilyKeyStateProcssed
\FamilyKeyStateProcessed
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \@psforegroundhook
% \end{option}%^^A onpsforeground
% \end{option}%^^A onforeground
% \begin{option}{singlespacing}
% \changes{v3.24}{2017/05/22}{new option added}%^^A
% \begin{description}
% \item[\texttt{=\meta{simple switch}}:] if activated, all page styles will be
% set with line spread 1. This switch is global. If you want it for some
% styles only, add \Macro{linespread}\PParameter{1}\Macro{selectfont} to
% option \Option{oninit} of only those styles.
%\end{description}
% \begin{macrocode}
%<*options>
\KOMA@ifkey{singlespacing}{@ps@singlespacing}
%<package>\scrlayer@@add@inherited@option{singlespacing}
%</options>
% \end{macrocode}
% \end{option}
% \begin{macrocode}
%<*package&body>
\newcommand*{\DeclarePageStyleByLayers}[3][]{%
\edef\scrlayer@current@pagestyle{\GetRealPageStyle{#2}}%
\expandafter\scrlayer@declare@ps@by@layers\expandafter{%
\scrlayer@current@pagestyle
}{#1}{#3}%
}
% \end{macrocode}
% \begin{macro}{\scrlayer@declare@ps@by@layers}
% \changes{v3.15}{2014/12/28}{fix: \cs{linewidth} replaced by
% \cs{textwidth}}%^^A
% \changes{v3.18}{2015/06/09}{usage of \cs{parbox[b]} instead of
% \cs{parbox[t]} because of strange effect with package
% \textsf{multicol}}%^^A
% \changes{v3.24}{2017/05/22}{test for \cs{if@ps@singlespacing} added}%^^A
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% Needed, because of page style aliases. Same arguments like
% \cs{DeclarePageStyleByLayers} but, \#1 is the name of the page style, \#2 is
% the list of options and \#3 is still the list of layers.
% \begin{macrocode}
\newcommand*{\scrlayer@declare@ps@by@layers}[3]{%
\@namedef{@ps@#1@initialhook}{\@ps@initialhook}%
\@namedef{@ps@#1@hook}{\@ps@hook}%
\@namedef{@ps@#1@backgroundhook}{\@ps@backgroundhook}%
\@namedef{@ps@#1@foregroundhook}{\@ps@foregroundhook}%
\@namedef{@ps@#1@oddpagehook}{\@ps@oddpagehook}%
\@namedef{@ps@#1@evenpagehook}{\@ps@evenpagehook}%
\@namedef{@ps@#1@onesidehook}{\@ps@onesidehook}%
\@namedef{@ps@#1@twosidehook}{\@ps@twosidehook}%
\@namedef{@ps@#1@floatpagehook}{\@ps@floatpagehook}%
\@namedef{@ps@#1@nonfloatpagehook}{\@ps@nonfloatpagehook}%
\FamilyExecuteOptions[.definelayerpagestyle]{KOMAarg}{#2}%
\@namedef{ps@#1}{%
\renewcommand*{\currentpagestyle}{#1}%
\@nameuse{@ps@@everystyle@@initialhook}%
\@nameuse{@ps@#1@initialhook}%
\renewcommand*{\currentpagestyle}{#1}%
\renewcommand*{\@oddhead}{%
\begingroup
\let\headmark\rightmark
\if@ps@singlespacing\linespread{1}\selectfont\fi
\@nameuse{@ps@@everystyle@@hook}%
\@nameuse{@ps@#1@hook}%
\@nameuse{@ps@@everystyle@@\if@twoside two\else one\fi sidehook}%
\@nameuse{@ps@#1@\if@twoside two\else one\fi sidehook}%
\@nameuse{@ps@@everystyle@@oddpagehook}%
\@nameuse{@ps@#1@oddpagehook}%
\@nameuse{@ps@@everystyle@@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@#1@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@@everystyle@@backgroundhook}%
\@nameuse{@ps@#1@backgroundhook}%
\parbox[b][\headheight][t]{\textwidth}{%
\vskip \dimexpr -\topmargin-1in
-\ht\strutbox\relax
\hskip \dimexpr -\oddsidemargin-1in\relax
\strut\makebox[\z@][l]{%
\ForEachLayerOfPageStyle{@everystyle@}{%
\scrlayer@do@page@style@element@layer{background}{odd}%
{########1}%
}%
\ForEachLayerOfPageStyle{#1}{%
\scrlayer@do@page@style@element@layer{background}{odd}%
{########1}%
}%
}%
}%
\endgroup
}%
\renewcommand*{\@evenhead}{%
\begingroup
\let\headmark\leftmark
\if@ps@singlespacing\linespread{1}\selectfont\fi
\@nameuse{@ps@@everystyle@@hook}%
\@nameuse{@ps@#1@hook}%
\@nameuse{@ps@@everystyle@@twosidehook}%
\@nameuse{@ps@#1@twosidehook}%
\@nameuse{@ps@@everystyle@@evenpagehook}%
\@nameuse{@ps@#1@evenpagehook}%
\@nameuse{@ps@@everystyle@@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@#1@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@@everystyle@@backgroundhook}%
\@nameuse{@ps@#1@backgroundhook}%
\parbox[b][\headheight][t]{\textwidth}{%
\vskip \dimexpr -\topmargin-1in
-\ht\strutbox\relax
\hskip \dimexpr-\evensidemargin-1in\relax
\strut\makebox[\z@][l]{%
\ForEachLayerOfPageStyle{@everystyle@}{%
\scrlayer@do@page@style@element@layer{background}{even}%
{########1}%
}%
\ForEachLayerOfPageStyle{#1}{%
\scrlayer@do@page@style@element@layer{background}{even}%
{########1}%
}%
}%
}%
\endgroup
}%
\renewcommand*{\@oddfoot}{%
\begingroup
\let\headmark\rightmark
\if@ps@singlespacing\linespread{1}\selectfont\fi
\@nameuse{@ps@@everystyle@@hook}%
\@nameuse{@ps@#1@hook}%
\@nameuse{@ps@@everystyle@@\if@twoside two\else one\fi sidehook}%
\@nameuse{@ps@#1@\if@twoside two\else one\fi sidehook}%
\@nameuse{@ps@@everystyle@@oddpagehook}%
\@nameuse{@ps@#1@oddpagehook}%
\@nameuse{@ps@@everystyle@@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@#1@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@@everystyle@@foregroundhook}%
\@nameuse{@ps@#1@foregroundhook}%
\parbox[t][\headheight][t]{\textwidth}{%
\vskip \dimexpr -\topmargin-1in
-\headheight
-\headsep
-\textheight
-\footskip
-\ht\strutbox\relax
\hskip \dimexpr -\oddsidemargin-1in\relax
\strut\makebox[\z@][l]{%
\ForEachLayerOfPageStyle{@everystyle@}{%
\scrlayer@do@page@style@element@layer{foreground}{odd}%
{########1}%
}%
\ForEachLayerOfPageStyle{#1}{%
\scrlayer@do@page@style@element@layer{foreground}{odd}%
{########1}%
}%
}%
}%
\endgroup
}%
\renewcommand*{\@evenfoot}{%
\begingroup
\let\headmark\leftmark
\if@ps@singlespacing\linespread{1}\selectfont\fi
\@nameuse{@ps@@everystyle@@hook}%
\@nameuse{@ps@#1@hook}%
\@nameuse{@ps@@everystyle@@twosidehook}%
\@nameuse{@ps@#1@twosidehook}%
\@nameuse{@ps@@everystyle@@evenpagehook}%
\@nameuse{@ps@#1@evenpagehook}%
\@nameuse{@ps@@everystyle@@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@#1@\if@fcolmade\else non\fi floatpagehook}%
\@nameuse{@ps@@everystyle@@foregroundhook}%
\@nameuse{@ps@#1@foregroundhook}%
\parbox[t][\headheight][t]{\textwidth}{%
\vskip \dimexpr -\topmargin-1in
-\headheight
-\headsep
-\textheight
-\footskip
-\ht\strutbox\relax
\hskip \dimexpr-\evensidemargin-1in\relax
\strut\makebox[\z@][l]{%
\ForEachLayerOfPageStyle{@everystyle@}{%
\scrlayer@do@page@style@element@layer{foreground}{even}%
{########1}%
}%
\ForEachLayerOfPageStyle{#1}{%
\scrlayer@do@page@style@element@layer{foreground}{even}%
{########1}%
}%
}%
}%
\endgroup
}%
}%
\@namedef{@ps@#1@layers}{}%
\@for \reserved@a:=#3\do {%
\scr@trim@spaces\reserved@a
\Ifstr\reserved@a\@empty{}{%
\expandafter\@cons\csname @ps@#1@layers\endcsname{{\reserved@a}}%
}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@declare@ps@by@layers
%
% \begin{macro}{\ForEachLayerOfPageStyle}
% \changes{v3.18}{2015/05/14}{star version of the command}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
% ersetzt}%^^A
% \begin{description}
% \item[\Parameter{string}:] a valid page style (must be fully expandable
% and expand to the name of a existing page style); note, that currently
% no exists test will be done.
% \item[\Parameter{code}:] any macro definition body with usage of at most
% one argument (\texttt{\#1}), that will be replaced by the layer's name
% \end{description}
% Do the given \meta{code} for each layer of the page style
% \meta{string}. Note, that the expansion of \meta{code} will be done inside
% a group. There's also a star version of the command, that delays execution
% of \meta{code} after the end of the group.
% \begin{macrocode}
%<*package&body>
\newcommand*{\ForEachLayerOfPageStyle}{%
\kernel@ifstar {\@s@ForEachLayerOfPageStyle}{\@ForEachLayerOfPageStyle}%
}
\newcommand*{\@ForEachLayerOfPageStyle}[2]{%
\begingroup
\edef\reserved@a{\GetRealPageStyle{#1}}%
\def\@elt##1{\ifscrlayer@deactivate@layers\else #2\fi}%
\@nameuse{@ps@\reserved@a @layers}%
\endgroup
}
\newcommand*{\@s@ForEachLayerOfPageStyle}[2]{%
\begingroup
\edef\reserved@a{\GetRealPageStyle{#1}}%
\def\reserved@b{\endgroup}%
\def\@elt##1{%
\l@addto@macro\reserved@b{%
\ifscrlayer@deactivate@layers\else #2\fi
}%
}%
\@nameuse{@ps@\reserved@a @layers}%
\reserved@b
}
%</package&body>
% \end{macrocode}
% \begin{option}{deactivatepagestylelayers}
% \begin{macro}{\ifscrlayer@deactivate@layers}
% \begin{description}
% \item[\Parameter{simple switch}:] whether or not
% \Macro{ForEachLayerOfPageStyle} should ignore the layers.
% \end{description}
% This is a global \KOMAScript{} options. Several other definitions and at
% least the usage of the page style will ignore the layers if
% \Macro{ForEachLayerOfPageStyle} ignores them. So this is something like:
% hide the layers. It may also be useful inside the code for the hooks
% described above, because hooks may used to deactivate the layers with this
% option too.
% \begin{macrocode}
%<*options>
%<*package>
\KOMA@ifkey{deactivatepagestylelayers}{scrlayer@deactivate@layers}
%<package>\scrlayer@@add@inherited@option{deactivatepagestylelayers}
%</package>
%<*interface>
\KOMA@key{deactivatepagestylelayers}[true]{%
\KOMA@set@ifkey{deactivatepagestylelayers}{scrlayer@deactivate@layers}{#1}%
\KOMA@kav@replacebool{.scrlayer.sty}{deactivatepagestylelayers}
{scrlayer@deactivate@layers}%
}
%</interface>
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @deactivatepagestylelayers\endcsname
\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @deactivatepagestylelayers@default\endcsname
\relax
%</interface&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@deactivate@layers
% \end{option}%^^A deactivatepagestylelayers
% \end{macro}%^^A \ForEachLayerOfPageStyle
%
% \begin{macro}{\scrlayer@do@page@style@element@layer}
% \changes{v3.26}{2018/07/14}{added hooks and artifact code}%^^A
% Helper macro to show one layer. First argument is either ``background'' or
% ``foreground'', second argument is either ``odd'' or ``even'', and third
% argument is the name of the layer. Note, that in draft mode for every layer
% will be shown also a \cs{layercontentsmeasure}.
% \begin{macrocode}
%<*package&body>
\newcommand*{\scrlayer@do@page@style@element@layer}[3]{%
\begingroup
\expandafter\ifx\csname if@scr@l@#3@\if@fcolmade\else non\fi floatpage%
\expandafter\endcsname\csname iftrue\endcsname
\expandafter\ifx\csname if@scr@l@#3@\if@twoside two\else one\fi side%
\expandafter\endcsname\csname iftrue\endcsname
\expandafter
\ifx\csname if@scr@l@#3@#1\expandafter\endcsname
\csname iftrue\endcsname
\expandafter
\ifx\csname if@scr@l@#3@#2\expandafter\endcsname
\csname iftrue\endcsname
\ifscrlayer@draft
\scr@layerbox(\csname scr@l@#3@x\endcsname,%
\csname scr@l@#3@y\endcsname)%
(\csname scr@l@#3@w\endcsname,%
\csname scr@l@#3@h\endcsname)%
[\csname scr@l@#3@align\endcsname]%
{%
\scrlayer@predraftmeasure@hook
\scrlayer@beginartifact{}%
\layercontentsmeasure
\scrlayer@endartifact{}%
\scrlayer@postdraftmeasure@hook
}%
\fi
\scr@layerbox(\csname scr@l@#3@x\endcsname,%
\csname scr@l@#3@y\endcsname)%
(\csname scr@l@#3@w\endcsname,%
\csname scr@l@#3@h\endcsname)%
[\csname scr@l@#3@align\endcsname]%
{\csname layer\csname scr@l@#3@mode\endcsname
mode\expandafter\endcsname{%
\csname scr@l@#3@precontents@hook\endcsname
\scr@ifundefinedorrelax{scr@l@#3@artifact}{}{%
\expandafter\expandafter\expandafter
\scrlayer@beginartifact
\expandafter\expandafter\expandafter{%
\csname scr@l@#3@artifact\endcsname
}%
\csname scr@l@#3@contents\endcsname
\expandafter\expandafter\expandafter
\scrlayer@endartifact
\expandafter\expandafter\expandafter{%
\csname scr@l@#3@artifact\endcsname
}%
}{%
\csname scr@l@#3@contents\endcsname
}%
\csname scr@l@#3@postcontents@hook\endcsname
}%
}%
\fi
\fi
\fi
\fi
\endgroup
}
% \end{macrocode}
% \begin{macro}{\scrlayer@predraftmeasure@hook}
% \changes{v3.26}{2018/07/14}{new (internal)}%^^A
% The hooks that will be executed before setting the draft measuring.
% \begin{macrocode}
\newcommand*{\scrlayer@predraftmeasure@hook}{}
% \end{macrocode}
% \begin{macro}{\BeforeDraftMeasuringLayer}
% \changes{v3.26}{2018/07/14}{new}%^^A
% New code will be added in front of the hook.
% \begin{macrocode}
\newcommand*{\BeforeDraftMeasuringLayer}[1]{%
\edef\scrlayer@predraftmeasure@hook{%
\unexpanded{#1}\unexpanded\expandafter{\scrlayer@predraftmeasure@hook}%
}%
}
% \end{macrocode}
% \end{macro}%^^A \BeforeDraftMeasuringLayer
% \end{macro}%^^A \scrlayer@predraftmeasure@hook
% \begin{macro}{\scrlayer@postdraftmeasure@hook}
% \changes{v3.26}{2018/07/14}{new (internal)}%^^A
% The hook that will be executed after setting the draft measuring.
% \begin{macrocode}
\newcommand*{\scrlayer@postdraftmeasure@hook}{}
% \end{macrocode}
% \begin{macro}{\AfterDraftMeasuringLayer}
% \changes{v3.26}{2018/07/14}{new}%^^A
% New code will be added at the end of the hook.
% \begin{macrocode}
\newcommand*{\AfterDraftMeasuringLayer}[1]{%
\expandafter\def\expandafter\scrlayer@postdraftmeasure@hook\expandafter{%
\scrlayer@postdraftmeasure@hook #1%
}%
}
% \end{macrocode}
% \end{macro}%^^A \AfterDraftMeasuringLayer
% \end{macro}%^^A \scrlayer@postdraftmeasure@hook
% \begin{macro}{\scr@layerbox}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
% \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\scr@@layerbox}
% \changes{v3.24}{2017/05/08}{\cs{edef} replaced by \cs{protected@edef}}%^^A
% \changes{v3.24}{2017/05/08}{\cs{dimexpr} added to \cs{layer\dots}}%^^A
% \changes{v3.24}{2017/05/08}{\cs{dimexpr} removed from usage of
% \cs{layer\dots}}%^^A
% The layer box is used to output a layer in \cs{@oddhead}, \cs{@evenhead},
% \cs{@oddfoot}, or \cs{@evenfoot}. Is has two pairs of arguments: ($x,y$)
% and ($w,h$), where $x$ is the distance from left paper edge, $y$ is the
% distance from the topmost edge of paper, $w$ is the width of the box and $h$
% is the height of the box. The fifth argument is an optional vertical and
% horizontal alignment of the box. It may be a combination of the alignment
% characters described above. The sixth and last argument is the contents of
% the layer, to be placed into the last argument of the innermost
% \cs{parbox}.
% \begin{macrocode}
\def\scr@layerbox(#1,#2)(#3,#4){%
\kernel@ifnextchar [%]
{\scr@@layerbox(#1,#2)(#3,#4)}{\scr@@layerbox(#1,#2)(#3,#4)[]}%
}
\def\scr@@layerbox(#1,#2)(#3,#4)[#5]#6{%
\begingroup
\protected@edef\layerxoffset{\noexpand\dimexpr #1\relax}%
\protected@edef\layeryoffset{\noexpand\dimexpr #2\relax}%
\protected@edef\layerwidth{\noexpand\dimexpr #3\relax}%
\protected@edef\layerheight{\noexpand\dimexpr #4\relax}%
\def\layervalign{t}%
\def\layerhalign{l}%
\edef\reserved@b{#5}%
\expandafter\@tfor\expandafter\reserved@a\expandafter:\expandafter=%
\reserved@b\do{%
\if t\reserved@a
\def\layervalign{t}%
\else
\if c\reserved@a
\def\layervalign{c}%
\def\layerhalign{c}%
\else
\if b\reserved@a
\def\layervalign{b}%
\else
\if l\reserved@a
\def\layerhalign{l}%
\else
\if r\reserved@a
\def\layerhalign{r}%
\else
\PackageWarning{scrlayer}{%
Unknown alignment `\reserved@a' ignored}%
\fi
\fi
\fi
\fi
\fi
}%
\parbox[t][\z@][t]{\z@}{%
\vskip\layeryoffset
\if b\layervalign\vskip-\layerheight\fi
\if c\layervalign\vskip-.5\layerheight\fi
% \end{macrocode}
% \changes{3.23a}{2017/04/22}{\textsf{bidi} code added}%^^A
% \changes{v3.24}{2017/05/04}{usage of \textsf{scrbase}'s \cs{IfRTL}}%^^A
% If we are in right-to-left mode of package \textsf{bidi} or
% \textsf{xepersian} the horizontal output is in the opposite direction. So we
% need the \cs{makebox} to the right instead of the left and to move the
% contents additionally by its width.
% \begin{macrocode}
\makebox[\z@][\IfRTL{r}{l}]{%
\hskip\layerxoffset
\IfRTL{\hskip\layerwidth}{}%
\makebox[\z@][\layerhalign]{%
\parbox[\layervalign][\layerheight][\layervalign]{\layerwidth}{%
\vskip\z@\strut{%
\ifscrlayer@forceignoreuppercase
\expandafter\let\csname MakeUppercase \endcsname\@firstofone
\let\MakeUppercase\@firstofone
\let\uppercase\@firstofone
\fi
#6%
}\strut\vskip\z@
}%
}%
}%
}%
\endgroup
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scr@@layerbox
% \end{macro}%^^A \scr@layerbox
%
% \begin{macro}{\layerrawmode}
% \changes{v3.19}{2015/07/30}{new command}%^^A
% \begin{macro}{\layertextmode}
% \changes{v3.19}{2015/07/30}{new command}%^^A
% This is the command to output layers in raw mode. This is very simple:
% \begin{macrocode}
%<*package&body>
\newcommand{\layerrawmode}[1]{#1}
\newcommand{\layertextmode}[1]{#1}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \layertextmode
% \end{macro}%^^A \layerrawmode
%
% \begin{macro}{\layerpicturemode}
% \changes{v3.19}{2015/07/30}{new command}%^^A
% \changes{v3.24}{2017/05/08}{redundant \cs{dimexpr} removed}%^^A
% This is a bit more complicated. It is the layer output for \texttt{picture}
% layers. In this case we use a picture environment and internally define some
% additional commands.
% \begin{macrocode}
%<*package&body>
\newcommand{\layerpicturemode}[1]{%
\begin{picture}(0,0)
(0,\LenToUnit{%
\if t\layervalign \dimexpr\layerheight-\ht\strutbox\relax
\else
\if b\layervalign \dp\strutbox
\else .5\dimexpr\layerheight-\ht\strutbox+\dp\strutbox\relax
\fi
\fi})
\long\def\putLL##1{\put(0,0){##1}}%
\long\def\putUL##1{\put(0,\LenToUnit{\layerheight}){##1}}%
\long\def\putLR##1{\put(\LenToUnit{\layerwidth},0){##1}}%
\long\def\putUR##1{\put(\LenToUnit{\layerwidth},%
\LenToUnit{\layerheight}){##1}}%
\long\def\putC##1{\put(\LenToUnit{.5\layerwidth},%
\LenToUnit{.5\layerheight}){##1}}%
#1%
\end{picture}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \layerpicturemode
%
% \begin{option}{draft}
% \begin{macro}{\ifscrlayer@draft}
% \begin{description}
% \item[\Parameter{simple switch}:] whether or not to use the draft mode,
% that, i.e., activates visualisation of the layers.
% \end{description}
% When option is set, every layer is shown twice: one time with it's own
% contents and one time with contents \Macro{layercontentsmeasure}.
% \begin{macrocode}
%<*options>
%<*package>
\KOMA@ifkey{draft}{scrlayer@draft}
%<package>\scrlayer@@add@inherited@option{draft}
%</package>
%<*interface>
\KOMA@key{draft}[true]{%
\KOMA@set@ifkey{draft}{scrlayer@draft}{#1}%
\KOMA@kav@replacebool{.scrlayer.sty}{draft}{scrlayer@draft}%
}
%</interface>
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @draft\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @draft@default\endcsname\relax
%</interface&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@draft
% \end{option}%^^A draft
% \end{macro}%^^A \scrlayer@do@page@style@element@layer
% \end{macro}%^^A \DeclarePageStyleByLayers
%
%
% \begin{macro}{\DeclareNewPageStyleByLayers}
% Arguments like \Macro{DeclarePageStyleByLayers}; results in error if the page
% style has been defined (or declared) already.
% \begin{macro}{\ProvidePageStyleByLayers}
% Arguments like \Macro{DeclarePageStyleByLayers}; doesn't define anything it
% the page style has been defined (or declared) already.
% \begin{macro}{\RedeclarePageStyleByLayers}
% Arguments like \Macro{DeclarePageStyleByLayers}; results in error if the page
% style hasn't been defined (or declared) already.
% \begin{macrocode}
%<*package&body>
\newcommand*{\DeclareNewPageStyleByLayers}[2][]{%
\@ifundefined{ps@#2}{}{%
\PackageError{scrlayer}{%
Page style `#2' already defined%
}{%
You may use \string\DeclareNewPageStyleByLayers\space to declare a new
page style only\MessageBreak
if that page style hasn't been declared or defined before.\MessageBreak
You may use either \string\ProvidePageStyleByLayers\space to declare the
page style only\MessageBreak
if it hasn't been declared or defined before, or
\string\RedeclarePageStyleByLayers\MessageBreak
to overwrite the former
declaration or definition of the page style%
\@ifundefined{@ps@#2@layers}{}{,\MessageBreak
or \string\AddLayersToPageStyle\space to add further layers to the
already declared\MessageBreak
page style, or \string\RemoveLayersFromPageStyle\space to remove
layers from the\MessageBreak
already declared page style}.\MessageBreak
Nevertheless, if you'll continue, the page style will be
overwritten\MessageBreak
by the new declaration.%
}%
}%
\DeclarePageStyleByLayers[{#1}]{#2}%
}
\newcommand*{\ProvidePageStyleByLayers}[3][]{%
\@ifundefined{ps@#2}{%
\DeclarePageStyleByLayers[{#1}]{#2}{#3}%
}{%
%<*trace>
\PackageInfo{scrlayer}{%
\string\ProvidePageStyleByLayers{#2}{#3} ignored,\MessageBreak
because page style `#2'\MessageBreak
already exists%
}%
%</trace>
}%
}
\newcommand*{\RedeclarePageStyleByLayers}[2][]{%
\@ifundefined{ps@#2}{%
\PackageError{scrlayer}{%
Page style `#2' not yet defined%
}{%
You may use \string\RedeclarePageStyleByLayers\space to declare a page
style only\MessageBreak
if that page style has already been declared or defined.\MessageBreak
You may use either \string\DeclareNewPageStyleByLayers,
\string\DeclarePageStyleByLayers,\MessageBreak
or \string\ProvidePageStyleByLayers\space to declare that not yet
defined page style.\MessageBreak
Nevertheless, if you'll continue, the page style will be declared.%
}%
}{}%
\DeclarePageStyleByLayers[{#1}]{#2}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \RedeclarePageStyleByLayers
% \end{macro}%^^A \ProvidePageStyleByLayers
% \end{macro}%^^A \DeclareNewPageStyleByLayers
%
% We also declare page style \Pagestyle{@everystyle@} by default. You should
% not use this page style as an real page style (even not as the empty
% one). The layers of this page style will be used by every other layer page
% style. An we re-declare \Pagestyle{empty} to be a layer page style.
% \begin{macrocode}
%<*package&final>
\DeclareNewPageStyleByLayers{@everystyle@}{}
\RedeclarePageStyleByLayers{empty}{}
%</package&final>
% \end{macrocode}
%
% \begin{macro}{\AddLayersToPageStyle}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{macro}{\AddLayersAtBeginOfPageStyle}
% \begin{macro}{\AddLayersAtEndOfPageStyle}
% \begin{macro}{\RemoveLayersFromPageStyle}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be modified (must
% be expandable and result in a string).
% \item[\Parameter{string list}:] comma separated list of layer names (must
% be expandable and result in strings); first in the list will be added
% first.
% \end{description}
% Change the layer list of a given page style. The differences between the
% commands are:
% \begin{description}
% \item[\Macro{AddLayersToPageStyle}:] first in the \meta{string list} will
% be added first at the end.
% \item[\Macro{AddLayersAtBeginOfPageStyle}:] first in the \meta{string list}
% will be added first at the start. Note, that this will result in changing
% the order of the layers in \meta{string list}.
% \item[\Macro{AddLayerAtEndOfPageStyle}:] same like
% \Macro{AddLayerToPageStyle}.
% \item[\Macro{RemoveLayersFromPageStyle}:] remove the layers from the page
% style's layer list.
% \end{description}
% \begin{macrocode}
%<*package&body>
\newcommand*{\AddLayersToPageStyle}[2]{%
\edef\reserved@b{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{\reserved@b}{%
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\Ifstr\reserved@a\@empty{}{%
\expandafter\@cons\csname @ps@\reserved@b @layers\endcsname
{{\reserved@a}}%
}%
}%
}{%
\scrlayer@lpm@error{#1}{adding layers}%
}%
}
\newcommand*{\AddLayersAtEndOfPageStyle}{%
\AddLayersToPageStyle
}
\newcommand*{\AddLayersAtBeginOfPageStyle}[2]{%
\begingroup
\let\@cons\@snoc
\AddLayersToPageStyle{#1}{#2}%
\endgroup
}
% \end{macrocode}
% \begin{macro}{\@snoc}
% \cs{@snoc} is a helper macro similar to \cs{@cons} from \LaTeX{} kernel, but
% it appends at the front instead of the end.
% \begin{macrocode}
\newcommand*{\@snoc}[2]{%
\begingroup\let\@elt\relax\xdef#1{\@elt #2#1}\endgroup
}
% \end{macrocode}
% \end{macro}%^^A \@snoc
% \begin{macrocode}
\newcommand*{\RemoveLayersFromPageStyle}[2]{%
\edef\reserved@b{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{#1}{%
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\Ifstr\reserved@a\@empty{}{%
\expandafter\remove@layer@from@page@style\expandafter{\reserved@a}%
{\reserved@b}%
}%
}%
}{%
\scrlayer@lpm@error{#1}{removing layers}%
}%
}
% \end{macrocode}
% \begin{macro}{\remove@layer@from@page@style}
% \changes{v0.9}{2014/07/25}{cleaning of layer list must be global}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% Helper macro to remove exactly one layer (arg 1) from a page style (arg 2).
% \begin{macrocode}
\newcommand*{\remove@layer@from@page@style}[2]{%
\begingroup
\expandafter\let\expandafter\reserved@a\csname @ps@#2@layers\endcsname
\expandafter\global\expandafter\let\csname @ps@#2@layers\endcsname\@empty
\def\@elt##1{%
\Ifstr{#1}{##1}{}{%
\expandafter\@cons\csname @ps@#2@layers\endcsname{{##1}}%
}%
}\reserved@a
\endgroup
}
% \end{macrocode}
% \end{macro}%^^A \remoce@layer@from@page@style
% \begin{macro}{\scrlayer@lpm@error}
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be modified (must
% be expandable and result in a string).
% \item[\Parameter{string}:] the kind of modification, that isn't allowed
% (must be expandable and result in a string).
% \end{description}
% Show an error because of page style it either not a defined or not a layer
% page style.
% \begin{macrocode}
\newcommand*{\scrlayer@lpm@error}[2]{%
\PackageError{scrlayer}{`#1' is not a layer page style}{%
\scr@ifundefinedorrelax{ps@#1}{%
Page style `#1' is not defined,
}{%
Page style `#1' is not a layer page style,
}%
but #2\MessageBreak
may be used only for layer page styles declared using\MessageBreak
\string\DeclarePageStyleByLayers,
\string\DeclareNewPageStyleByLayers,\MessageBreak
of \string\ProvidePageStyleByLayers.\MessageBreak
If you'll continue, your operation will be ignored.%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@lpm@error
% \end{macro}%^^A \RemoveLayersFromPageStyle
% \end{macro}%^^A \AddLayersAtEndOfPageStyle
% \end{macro}%^^A \AddLayersAtBeginOfPageStyle
% \end{macro}%^^A \AddLayersToPageStyle
%
% \begin{macro}{\AddLayersToPageStyleBeforeLayer}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{macro}{\AddLayersToPageStyleAfterLayer}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be modified (must
% be expandable and result in a string).
% \item[\Parameter{string list}:] comma separated list of layer names (must
% be expandable and result in strings); first in the list will be added
% first.
% \item[\Parameter{string}:] the name of the layer before
% (\Macro{AddLayersToPageStyleBeforeLayer}) or after
% (\Macro{AddLayersToPageStyleAfterLayer}) that the layers of the list
% should be added.
% \end{description}
% Note: If the layer from third argument is not part of the page style's layer
% list, the new layers won't be added anywhere.
% \begin{macrocode}
%<*package&body>
\newcommand*{\AddLayersToPageStyleAfterLayer}[3]{%
\edef\reserved@b{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{\reserved@b}{%
\begingroup
\expandafter\let\expandafter\reserved@a
\csname @ps@\reserved@b @layers\endcsname
\@namedef{@ps@\reserved@b @layers}{}%
\def\@elt##1{%
\Ifstr{##1}\@empty{}{%
\expandafter\@cons\csname @ps@\reserved@b @layers\endcsname{{##1}}%
\Ifstr{##1}{#3}{%
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\Ifstr\reserved@a\@empty{}{%
\expandafter\@cons\csname @ps@\reserved@b @layers\endcsname
{{\reserved@a}}%
}%
}%
}{}%
}%
}%
\reserved@a
\endgroup
}{%
\scrlayer@lpm@error{#1}{adding layers}%
}%
}
\newcommand*{\AddLayersToPageStyleBeforeLayer}[3]{%
\edef\reserved@b{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{\reserved@b}{%
\begingroup
\expandafter\let\expandafter\reserved@a
\csname @ps@\reserved@b @layers\endcsname
\@namedef{@ps@\reserved@b @layers}{}%
\def\@elt##1{%
\Ifstr{##1}\@empty{}{%
\Ifstr{##1}{#3}{%
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\Ifstr\reserved@a\@empty{}{%
\expandafter\@cons\csname @ps@\reserved@b @layers\endcsname
{{\reserved@a}}%
}%
}%
}{}%
\expandafter\@cons\csname @ps@#1@layers\endcsname{{##1}}%
}%
}%
\reserved@a
\endgroup
}{%
\scrlayer@lpm@error{#1}{adding layers}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \AddLayersToPageStyleAfterLayer
% \end{macro}%^^A \AddLayersToPageStyleBeforeLayer
%
%
% \begin{macro}{\UnifyLayersAtPageStyle}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be unified (must
% be expandable and result in a string).
% \end{description}
% Remove doublets of layers from a page style.
% \begin{macrocode}
%<*package&body>
\newcommand*{\UnifyLayersAtPageStyle}[1]{%
\edef\reserved@b{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{\reserved@b}{%
\expandafter\let\expandafter\reserved@a
\csname @ps@\reserved@b @layers\endcsname
\@namedef{@ps@\reserved@b @layers}{}%
\begingroup
\def\@elt##1{%
\Ifstr{##1}\@empty{}{%
\remove@layer@from@page@style{##1}{\reserved@b}%
\expandafter\@cons\csname @ps@\reserved@b @layers\endcsname{{##1}}%
}%
}%
\reserved@a
\endgroup
}{%
\scrlayer@lpm@error{#1}{unifying}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \UnifyLayersAtPageStyle
%
% \begin{macro}{\ModifyLayerPageStyleOptions}
% \begin{macro}{\AddToLayerPageStyleOptions}
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be modified (must
% be expandable and result in a string).
% \item[\Parameter{option list}:] comma separated list of named page
% style options. You may use any of the options provided for
% \Macro{DeclarePageStyle}.
% \end{description}
% \Macro{ModifyLayerPageStyleOptions} replaces the options and only the
% options from the list by their new
% values. \Macro{AddToLayerPageStyleOptions} adds the new values to the
% already given.
% \begin{macrocode}
%<*package&body>
\newcommand*{\ModifyLayerPageStyleOptions}[2]{%
\edef\reserved@a{\GetRealPageStyle{#1}}%
\IfLayerPageStyleExists{#1}{%
\expandafter\scrlayer@modify@layer@ps@options\expandafter{%
\reserved@a
}{#2}%
}{%
\scrlayer@lpm@error{#1}{modifying}%
}%
}
% \end{macrocode}
% \begin{macro}{\scrlayer@modify@layer@ps@options}
% \changes{v3.28}{2019/11/28}{usage of marker makros}%^^A
% Helper needed because of alias page styles. Same parameters like
% \cs{ModifyLayerPageStyleOptions}
% \begin{macrocode}
\newcommand*{\scrlayer@modify@layer@ps@options}[2]{%
\begingroup
\def\scrlayer@current@pagestyle{#1}%
\@namedef{@ps@#1@initialhook}{}%
\@namedef{@ps@#1@hook}{}%
\@namedef{@ps@#1@backgroundhook}{}%
\@namedef{@ps@#1@foregroundhook}{}%
\@namedef{@ps@#1@oddpagehook}{}%
\@namedef{@ps@#1@evenpagehook}{}%
\@namedef{@ps@#1@onesidehook}{}%
\@namedef{@ps@#1@twosidehook}{}%
\@namedef{@ps@#1@floatpagehook}{}%
\@namedef{@ps@#1@nonfloatpagehook}{}%
\let\scr@opt@marker@initialhook\@empty
\let\scr@opt@marker@hook\@empty
\let\scr@opt@marker@backgroundhook\@empty
\let\scr@opt@marker@foregroundhook\@empty
\let\scr@opt@marker@oddpagehook\@empty
\let\scr@opt@marker@evenpagehook\@empty
\let\scr@opt@marker@onesidehook\@empty
\let\scr@opt@marker@twosidehook\@empty
\let\scr@opt@marker@floatpagehook\@empty
\let\scr@opt@marker@nonfloatpagehook\@empty
\FamilyExecuteOptions[.definelayerpagestyle]{KOMAarg}{#2}%
\def\reserved@a{\endgroup}%
\def\@sls@##1{%
\expandafter\ifx \csname scr@opt@marker@##1hook\endcsname\@empty\else
\expandafter\let\expandafter\reserved@b\csname @ps@#1@##1hook\endcsname
\l@addto@macro\reserved@a{\@namedef{@ps@#1@##1hook}}%
\expandafter\l@addto@macro\expandafter\reserved@a\expandafter{%
\expandafter{%
\reserved@b
}%
}%
\fi
}%
\@sls@{initial}%
\@sls@{}%
\@sls@{background}%
\@sls@{foreground}%
\@sls@{oddpage}%
\@sls@{evenpage}%
\@sls@{oneside}%
\@sls@{twoside}%
\@sls@{floatpage}%
\@sls@{nonfloatpage}%
\reserved@a
}
% \end{macrocode}
% \end{macro}%^^A \scrlayer@modify@layer@ps@options
% \begin{macrocode}
\newcommand*{\AddToLayerPageStyleOptions}[2]{%
\IfLayerPageStyleExists{#1}{%
\def\scrlayer@current@pagestyle{#1}%
\FamilyExecuteOptions[.definelayerpagestyle]{KOMAarg}{#2}%
}{%
\scrlayer@lpm@error{#1}{modifying}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \AddToLayerPageStyleOptions
% \end{macro}%^^A \ModifyLayerPageStyleOptions
%
% \begin{macro}{\scrlayer@beginartifact}
% \changes{v3.26}{2018/07/14}{new (semi internal)}%^^A
% \begin{macro}{\scrlayer@endartifact}
% \changes{v3.26}{2018/07/14}{new (semi internal)}%^^A
% These macros are reserved for tagging packages. The first one is executed
% after the initial contents hook, the last one is executed after the final
% contents hook. Both executions are done only, if the \texttt{artifact}
% option of the layer has been used an was not boolean false. With boolean
% true the argument will be empty. All other values will be passed as
% argument.
%
% In case of package \textsf{tagpdf} the following definition would be
% usefull (here automatically done after loading the package, if the package
% does not do its own definitions):
% \begin{macrocode}
%<*package&body>
\RequirePackage{scrlfile}
\BeforePackage{tagpdf}{%
% \end{macrocode}
% Deactivation of the two commands before loading \textsf{tagpdf}, so that
% after loading the package \cs{providecommand} can be used to do a new
% default definition.
% \begin{macrocode}
\let\scrlayer@beginartifact\relax
\let\scrlayer@endartifact\relax
}
\AfterPackage*{tagpdf}{%
\providecommand*{\scrlayer@beginartifact}[1]{%
\Ifstr{#1}{}{%
\tagmcbegin{artifact}%
}{%
\tagmcbegin{artifact=#1}%
}%
}%
\providecommand*{\scrlayer@endartifact}[1]{%
\tagmcend
}%
}
% \end{macrocode}
% But the default definition (if \textsf{tagpdf} has not already been loaded)
% are simple dummies:
% \begin{macrocode}
\providecommand*{\scrlayer@beginartifact}[1]{}
\providecommand*{\scrlayer@endartifact}[1]{}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@endartifact
% \end{macro}%^^A \scrlayer@beginartifact
%
% \begin{macro}{\DeclarePageStyleAlias}
% \begin{macro}{\DeclareNewPageStyleAlias}
% \begin{macro}{\ProvidePageStyleAlias}
% \begin{macro}{\RedeclarePageStyleAlias}
% \begin{description}
% \item[\Parameter{string}:] The name of the page style to be declared
% (must be expandable and result in a string).
% \item[\Parameter{string}:] The name of the existing page style
% (must be expandable and result in a string).
% \end{description}
% \begin{macrocode}
%<*package&body>
\newcommand*{\DeclarePageStyleAlias}[2]{%
\edef\reserved@a{\GetRealPageStyle{#2}}%
\scr@ifundefinedorrelax{ps@\reserved@a}{%
\PackageError{scrlayer}{unknown real page style `#2'}{%
You've tried to declare an alias for page style `#2',\MessageBreak
but the real page style of `#2' is undefined.\MessageBreak
You can define aliases, only if the real page style has been
defined.\MessageBreak
If you'll continue, the declaration will be ignored.%
}%
\DestroyRealLayerPageStyle{#1}%
\DestroyLayerAlias{#1}%
}{%
\@namedef{@ps@#1@alias}{#2}%
\@namedef{ps@#1}{\pagestyle{\@nameuse{@ps@#1@alias}}}%
}%
}
\newcommand*{\DeclareNewPageStyleAlias}[1]{%
\@ifundefined{ps@#1}{}{%
\PackageError{scrlayer}{%
Page style `#1' already defined%
}{%
You may use \string\DeclareNewPageStyleAlias\space to declare a new
page style only\MessageBreak
if that page style hasn't been declared or defined before.\MessageBreak
You may use either \string\ProvidePageStyleAlias\space to declare the
page style only\MessageBreak
if it hasn't been declared or defined before, or
\string\RedeclarePageStyleAlias\MessageBreak
to overwrite the former declaration or definition of the page
style\MessageBreak
Nevertheless, if you'll continue, the page style will be
overwritten\MessageBreak
by the new alias.%
}%
}%
\DeclarePageStyleAlias{#1}%
}
\newcommand*{\ProvidePageStyleAlias}[2]{%
\@ifundefined{ps@#1}{%
\DeclarePageStyleAlias{#1}{#2}%
}{%
%<*trace>
\PackageInfo{scrlayer}{%
\string\ProvidePageStyleAlias{#1}{#2} ignored,\MessageBreak
because page style `#1' already\MessageBreak
exists%
}%
%</trace>
}%
}
\newcommand*{\RedeclarePageStyleAlias}[1]{%
\@ifundefined{ps@#1}{%
\PackageError{scrlayer}{%
Page style `#1' not yet defined%
}{%
You may use \string\RedeclarePageStyleAlias\space to declare a page
style only\MessageBreak
if that page style has already been declared or defined.\MessageBreak
You may use either \string\DeclareNewPageStyleAlias,
\string\DeclarePageStyleAlias,\MessageBreak
or \string\ProvidePageStyleAlias\space to declare that not yet
defined page style.\MessageBreak
Nevertheless, if you'll continue, the page style will be declared.%
}%
}{}%
\DeclarePageStyleAlias{#1}%
}
% \end{macrocode}
% \end{macro}%^^A \RedeclarePageStyleAlias
% \end{macro}%^^A \ProvidePageStyleAlias
% \end{macro}%^^A \DeclareNewPageStyleAlias
% \end{macro}%^^A \DeclarePageStyleAlias
%
% \begin{macro}{\DestroyPageStyleAlias}
% \begin{description}
% \item[\Parameter{string}:] the name of a page style (must be
% expandable and result in a string).
% \end{description}
% \begin{macrocode}
\newcommand*{\DestroyPageStyleAlias}[1]{%
\scr@ifundefinedorrelax{@ps@#1@alias}{}{%
\expandafter\let\csname @ps@#1@alias\endcsname\relax
\expandafter\let\csname ps@#1\endcsname\relax
}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\GetRealPageStyle}
% \begin{description}
% \item[\Parameter{string}:] the name of a page style (must be
% expandable and result in a string).
% \end{description}
% Get the real name of the page style.
% \begin{macrocode}
\newcommand*{\GetRealPageStyle}[1]{%
\scr@ifundefinedorrelax{@ps@#1@alias}{#1}{%
\expandafter\GetRealPageStyle\expandafter{%
\expandafter\csname @ps@#1@alias\expandafter\endcsname\expandafter}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\IfLayerPageStyleExists}
% \begin{macro}{\IfRealLayerPageStyleExists}
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be tested (must
% be expandable and result in a string).
% \item[\Parameter{code}:] whatever code should be expanded, if the test
% result is true.
% \item[\Parameter{code}:] whatever code should be expanded, if the test
% result is false.
% \end{description}
% Test, whether or not the page style is a declared layer page style.
% \begin{macrocode}
%<*package&body>
\newcommand*{\IfLayerPageStyleExists}[1]{%
\scr@ifundefinedorrelax{ps@#1}{%
\expandafter\@secondoftwo
}{%
\scr@ifundefinedorrelax{@ps@#1@layers}{%
\scr@ifundefinedorrelax{@ps@#1@alias}{%
\expandafter\@secondoftwo
}{%
\expandafter\IfLayerPageStyleExists\expandafter{%
\expandafter\csname @ps@#1@alias\expandafter\endcsname\expandafter}%
}%
}{%
\expandafter\@firstoftwo
}%
}%
}
\newcommand*{\IfRealLayerPageStyleExists}[1]{%
\scr@ifundefinedorrelax{ps@#1}{%
\expandafter\@secondoftwo
}{%
\scr@ifundefinedorrelax{@ps@#1@layers}{%
\expandafter\@secondoftwo
}{%
\expandafter\@firstoftwo
}%
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \IfRealLayerPageStyleExists
% \end{macro}%^^A \IfLayerPageStyleExists
%
% \begin{macro}{\IfLayerAtPageStyle}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{macro}{\IfSomeLayersAtPageStyle}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{macro}{\IfLayersAtPageStyle}
% \begin{description}
% \item[\Parameter{string}:] the name of the page style to be tested (must
% be expandable and result in a string).
% \item[\Parameter{string}:] the name(s) of the layer(s) to be tested (must be
% expandable and result in a string).
% \item[\Parameter{code}:] whatever code should be expanded, if the test
% result is true.
% \item[\Parameter{code}:] whatever code should be expanded, if the test
% result is false.
% \end{description}
% Tests:
% \begin{description}
% \item[\Macro{IfLayerAtPageStyle}:] Test, whether or not the page style has a
% layer. The second argument is the name of one layer only!
% \item[\Macro{IfSomeLayersAtPageStyle}:] Test, whether or not the page style
% has at least one layer of a list of layers. The second argument is a comma
% separated list of layer names.
% \item[\Macro{IfLayersAtPageStyle}:] Test, whether or not the page style has
% every layer of a list of layers. The second argument is a comma separated
% list of layer names.
% \end{description}
% Note, that testing an page style, that is not a layer page style will result
% in an error and neither the third nor the fourth argument will be expanded.
% Note, that layers with empty name are only part of a layer page style
% without any layers.
%
% Note also, that with active \Option{deactivatepagestylelayers} layers are
% logically not longer part of the page styles.
% \begin{macrocode}
%<*package&body>
\newcommand*{\IfLayerAtPageStyle}[2]{%
\IfLayerPageStyleExists{#1}{%
\begingroup
\edef\reserved@a{\GetRealPageStyle{#1}}%
\@tempswafalse
\Ifstr{#2}{}{%
\expandafter\ifx\csname @ps@\reserved@a @layers\endcsname\@empty
\@tempswatrue
\fi
}{%
\expandafter\ForEachLayerOfPageStyle\expandafter{%
\reserved@a}{\Ifstr{##1}{#2}{\aftergroup\@tempswatrue}{}}%
}%
\if@tempswa \aftergroup\@firstoftwo \else \aftergroup\@secondoftwo \fi
\expandafter\endgroup
}{%
\scrlayer@lpm@error{#1}{testing for layers}%
\expandafter\@gobbletwo
}%
}
\newcommand*{\IfSomeLayersAtPageStyle}[2]{%
\IfLayerPageStyleExists{#1}{%
\begingroup
\@tempswafalse
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\edef\reserved@a{\noexpand\IfLayerAtPageStyle{#1}{\reserved@a}}%
\reserved@a{\@tempswatrue}{}%
}%
\if@tempswa \aftergroup\@firstoftwo \else \aftergroup\@secondoftwo \fi
\expandafter\endgroup
}{%
\scrlayer@lpm@error{#1}{testing for layers}%
\expandafter\@gobbletwo
}%
}
\newcommand*{\IfLayersAtPageStyle}[2]{%
\IfLayerPageStyleExists{#1}{%
\begingroup
\@tempswatrue
\Ifstr{#2}{}{%
\edef\reserved@a{\GetRealPageStyle{#1}}%
\expandafter\ifx\csname @scr@\reserved@a @layers\endcsname\@empty \else
\@tempswafalse
\fi
}{%
\@for \reserved@a:=#2\do {%
\scr@trim@spaces\reserved@a
\edef\reserved@a{\noexpand\IfLayerAtPageStyle{#1}{\reserved@a}}%
\reserved@a{}{\@tempswafalse}%
}%
}%
\if@tempswa \aftergroup\@firstoftwo \else \aftergroup\@secondoftwo \fi
\expandafter\endgroup
}{%
\scrlayer@lpm@error{#1}{testing for layers}%
\expandafter\@gobbletwo
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \IfLayersAtPageStyle
% \end{macro}%^^A \IfSomeLayersAtPageStyle
% \end{macro}%^^A \IfLayerAtPageStyle
%
%
% \begin{macro}{\DestroyRealLayerPageStyle}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% \begin{description}
% \item[\Parameter{string}:] name of the layer page style to be destroyed.
% \end{description}
% Destroys the given layer page style but not the layers! If the page style is
% the current page style, the empty page style an empty page style will be
% activated. If the special page style is valid an the destroyed one, this
% will be removed. This command could be used, e.g., at
% \Macro{scrlayerOnAutoRemoveInterface} after destroying the layers. However,
% the interface commands are deprecated.
% \begin{macrocode}
%<*package&body>
\newcommand*{\DestroyRealLayerPageStyle}[1]{%
\IfRealLayerPageStyleExists{#1}{%
\expandafter\let\csname @ps@#1@initialhook\endcsname\relax
\expandafter\let\csname @ps@#1@hook\endcsname\relax
\expandafter\let\csname @ps@#1@backgroundhook\endcsname\relax
\expandafter\let\csname @ps@#1@foregroundhook\endcsname\relax
\expandafter\let\csname @ps@#1@oddpagehook\endcsname\relax
\expandafter\let\csname @ps@#1@evenpagehook\endcsname\relax
\expandafter\let\csname @ps@#1@onesidehook\endcsname\relax
\expandafter\let\csname @ps@#1@twosidehook\endcsname\relax
\expandafter\let\csname @ps@#1@floatpagehook\endcsname\relax
\expandafter\let\csname @ps@#1@nonfloatpagehook\endcsname\relax
\expandafter\let\csname @ps@#1@layers\endcsname\relax
\expandafter\let\csname ps@#1\endcsname\relax
\Ifstr{\currentpagestyle}{#1}{%
\def\currentpagestyle{scrlayer@empty}%
\let\@oddhead\@empty\let\@evenhead\@empty
\let\@oddfoot\@empty\let\@evenfoot\@empty
}{}%
\if@specialpage
\Ifstr{\@specialstyle}{#1}{%
\global\let\@specialstyle\relax
\global\@specialpagefalse
}{}%
\fi
}{%
%<*trace>
\PackageInfo{scrlayer}{%
\string\DestroyRealLayerPageStyle{#1} ignored,\MessageBreak
because the layer page style isn't\MessageBreak
defined (any longer)%
}%
%</trace>
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \DestroyRealLayerPageStyle
%
%
% \subsection{Kernel Patches}
%
% This package as so many others need to patch the \LaTeX{} kernel. This will
% be done, because we need information about the current active package style.
%
% \begin{macro}{\pagestyle}
% \begin{macro}{\currentpagestyle}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% We save the current page style. Note, that this doesn't work for special
% page styles\footnote{Special page styles are set by
% \Macro{thispagestyle}.} that hasn't been defined using
% \Package{scrlayer}. As long as \Macro{currentpagestyle} is empty, the
% current page style is unknown. And we add two hooks into page style
% selection: one before an one after the selection.
% \begin{macrocode}
%<*package&body>
\newcommand*{\currentpagestyle}{}
\PackageInfo{scrlayer}{patching LaTeX kernel macro \string\pagestyle}
\def\reserved@a{%
\iftoplevelpagestyle\edef\toplevelpagestyle{##1}\toplevelpagestylefalse\fi
\scrlayer@exec@before@pagestyle@hook{##1}%
}
\expandafter\expandafter\expandafter\renewcommand
\expandafter\expandafter\expandafter*%
\expandafter\expandafter\expandafter\pagestyle
\expandafter\expandafter\expandafter[%
\expandafter\expandafter\expandafter1%
\expandafter\expandafter\expandafter]%
\expandafter\expandafter\expandafter{%
\expandafter\reserved@a
\pagestyle{#1}%
\edef\currentpagestyle{\GetRealPageStyle{#1}}%
\scrlayer@exec@after@pagestyle@hook{#1}%
\toplevelpagestyletrue
}
\newif\iftoplevelpagestyle\toplevelpagestyletrue
\AtBeginDocument{%
\begingroup
\let\scrlayer@exec@before@pagestyle@hook\@gobble
\let\scrlayer@exec@after@pagestyle@hook\@gobble
\def\ps@test{}%
\pagestyle{test}%
\Ifstr{\currentpagestyle}{test}{}{%
\PackageError{scrlayer}{package incompatibility detected}{%
Another package redefines \string\pagestyle\space incompatible with
scrlayer.\MessageBreak
This disables setting of \string\currentpagestyle\space and may
be serious.\MessageBreak
Maybe you could prevent this loading package scrlayer
later.\MessageBreak
If not you should either not use scrlayer or not the other
package,\MessageBreak
that redefines \string\pagestyle.%
}%
}%
\endgroup
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \currentpagestyle
%
% \begin{macro}{\BeforeSelectAnyPageStyle}
% \begin{macro}{\scrlayer@exec@before@pagestyle@hook}
% \begin{macro}{\AfterSelectAnyPageStyle}
% \begin{macro}{\scrlayer@exec@after@pagestyle@hook}
% We have two macros to locally add code to be executed whenever a page style
% changes using \Macro{pagestyle}. The first one executes the code before the
% page style will be changed, the second one after the page style has been
% changed. Note, that you may use \#1 as a placeholder of the argument of
% \Macro{pagestyle}.
% \begin{macrocode}
%<*package&body>
\newcommand*{\BeforeSelectAnyPageStyle}[1]{%
\expandafter\renewcommand\expandafter*%
\expandafter\scrlayer@exec@before@pagestyle@hook
\expandafter[\expandafter1\expandafter]\expandafter{%
\scrlayer@exec@before@pagestyle@hook{##1}#1}%
}
\newcommand*{\scrlayer@exec@before@pagestyle@hook}[1]{}
\newcommand*{\AfterSelectAnyPageStyle}[1]{%
\expandafter\renewcommand\expandafter*%
\expandafter\scrlayer@exec@after@pagestyle@hook
\expandafter[\expandafter1\expandafter]\expandafter{%
\scrlayer@exec@after@pagestyle@hook{##1}#1}%
}
\newcommand*{\scrlayer@exec@after@pagestyle@hook}[1]{}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayer@exec@after@pagestyle@hook
% \end{macro}%^^A \AfterSelectAnyPageStyle
% \end{macro}%^^A \scrlayer@exec@before@pagestyle@hook
% \end{macro}%^^A \BeforeSelectAnyPageStyle
% \end{macro}%^^A \pagestyle
%
%
% \subsection{Declaration of End User Interfaces}
%
% \changes{v3.32}{2020/09/11}{the interface commands are deprecated}
%
% The package also supports an interface for loading end user interfaces.
% Maybe it would be a good idea to move this to \Package{scrbase}, but
% currently it is not needed.
%
% \begin{macro}{\scrlayerAddToInterface}
% \begin{macro}{\scrlayerAddCsToInterface}
% \begin{description}
% \item[\texttt{\{\meta{command}\textbar\meta{command sequence}\}}:] the
% command (with backslash) or the command sequence of the command (without
% backslash) of the command, that should be added to the interface.
% \item[\Parameter{code}:] will be executed, only if the command could be
% added to the interface.
% \end{description}
% Add either a command sequence or a command to the user interface.
% \begin{macrocode}
%<*package&body>
\newcommand*{\scrlayerAddToInterface}[2][\@currname.\@currext]{%
\scrlayer@report@deprecated{#1}{\scrlayerAddToInterface}%
\begingroup
\edef\reserve@a{%
\noexpand\scrlayerAddCsToInterface[#1]{\expandafter\@gobble\string #2}%
}%
\expandafter\endgroup\reserve@a
}
\newcommand{\scrlayerAddCsToInterface}[3][\@currname.\@currext]{%
\scrlayer@report@deprecated{#1}{\scrlayerAddCsToInterface}%
\@ifundefined{scrlayer@#1@commandlist}{%
\PackageError{scrlayer}{unkown interface `#1'}{%
I've been told to add a command sequence to an interface, that hasn't
been\MessageBreak
defined yet. Please initialise every interface using
\string\InitInterface\space before\MessageBreak
trying to add command sequences to it.\MessageBreak
If you'll continue, the command will be ignored.%
}%
}{%
\@ifundefined{#2}{%
\scrlayer@AddCsToInterface[#1]{#2}#3%
}{%
\@ifundefined{scrlayer@command@#2}{%
\ifscrlayer@forceoverwrite
\PackageWarning{scrlayer}{%
Overloading `\@backslashchar#2'!\MessageBreak
scrlayer detected, that the given command\MessageBreak
has been defined already, when\MessageBreak
`#1' tried to define it again.\MessageBreak
Nevertheless, while scrlayer is in force overwrite\MessageBreak
mode currently, the original definition will be\MessageBreak
removed%
}%
\expandafter\let\csname #2\endcsname\relax
\scrlayer@AddCsToInterface[#1]{#2}#3%
\else
\PackageError{scrlayer}{cannot define `\@backslashchar#2'}{%
scrlayer interface `#1' has tried to
define command\MessageBreak
`\@backslashchar#2', but this has already been defined\MessageBreak
and is not part of another interface. So it cannot be
defined.\MessageBreak
Before continuing you should solve this conflict.\MessageBreak
Nevertheless, you may use option `forceoverwrite' to get only a
warning instead\MessageBreak
of an error. But this wouldn't solve the problem at
all!\MessageBreak
This error is almost fatal, so you should abort the LaTeX
run.%
}%
\fi
}{%
\ifscrlayer@autoremoveinterfaces
\PackageInfo{scrlayer}{%
already define interface command\MessageBreak
`\@backslashchar#2' detected.\MessageBreak
Command has been defined by interface\MessageBreak
`\@nameuse{scrlayer@command@#2}'.\MessageBreak
To continue installation of interface\MessageBreak
`#1', interface\MessageBreak
`\@nameuse{scrlayer@command@#2}' will\MessageBreak
be removed%
}%
\@nameuse{scrlayer@\@nameuse{scrlayer@command@#2}@onremove}%
\begingroup
\def\@elt##1{%
\aftergroup\let\aftergroup##1\aftergroup\relax
}%
\@nameuse{scrlayer@\@nameuse{scrlayer@command@#2}@commandlist}%
\endgroup
\expandafter\let\csname
scrlayer@\@nameuse{scrlayer@command@#2}@commandlist\endcsname\relax
\expandafter\let\csname
scrlayer@\@nameuse{scrlayer@command@#2}@onremove\endcsname\relax
\expandafter\let\csname #2\endcsname\relax
\scrlayer@AddCsToInterface[#1]{#2}#3%
\else
\PackageError{scrlayer}{cannot define `\@backslashchar#2'}{%
Interface command `\@backslashchar#2' has already
been\MessageBreak
defined by interface
`\@nameuse{scrlayer@command@#2}'.\MessageBreak
So it cannot be defined again.\MessageBreak
You may try scrlayer option `autoremoveinterfaces' to
automatically remove\MessageBreak
older interfaces in such conflict situations.\MessageBreak
For now, it's recommended so solve the problem before you'll
continue.%
}%
\fi
}%
}%
}%
}%
% \end{macrocode}
% \begin{macro}{\scrlayer@AddCsToInterface}
% Little helper, to avoid repeating this \Macro{expandafter} orgy.
% \begin{description}
% \item[\OParameter{string}:] the interface name (must be expandable and
% expand to a string)
% \item[\Parameter{command sequence}] the command sequence of the command to
% be added.
% \end{description}
% \begin{macrocode}
\newcommand*\scrlayer@AddCsToInterface[2][\@currname.\@currext]{%
\scrlayer@report@deprecated{#1}{\scrlayer@AddCsToInterface}%
\expandafter\expandafter\expandafter\def\expandafter
\csname scrlayer@#1@commandlist\expandafter\expandafter\expandafter\endcsname
\expandafter\expandafter\expandafter{%
\csname scrlayer@#1@commandlist\expandafter\endcsname
\expandafter\@elt\csname #2\endcsname
}%
\@namedef{scrlayer@command@#2}{#1}%
}
%</package&body>
% \end{macrocode}
% \begin{option}{forceoverwrite}
% \begin{macro}{\ifscrlayer@forceoverwrite}
% \begin{description}
% \item[\Parameter{simple switch}:] whether or not to overwrite already
% defined command. Note: If true, there will still be a warning.
% \end{description}
% \begin{macrocode}
%<*options>
%<*package>
\KOMA@ifkey{forceoverwrite}{scrlayer@forceoverwrite}
%<package>\scrlayer@@add@inherited@option{forceoverwrite}
%</package>
%<*interface>
\KOMA@key{forceoverwrite}[true]{%
\KOMA@set@ifkey{forceoverwrite}{scrlayer@forceoverwrite}{#1}%
\KOMA@kav@replacebool{.scrlayer.sty}{forceoverwrite}{scrlayer@forceoverwrite}%
}
%</interface>
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @forceoverwrite\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @forceoverwrite@default\endcsname\relax
%</interface&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@forceoverwrite
% \end{option}%^^A forceoverwrite
%
% \begin{option}{autoremoveinterfaces}
% \begin{macro}{\ifscrlayer@autoremoveinterfaces}
% \begin{description}
% \item[\Parameter{simple switch}:] whether or not older interfaces may be
% automatically removed in conflict cases.
% \end{description}
% \begin{macrocode}
%<*options>
%<*package>
\KOMA@ifkey{autoremoveinterfaces}{scrlayer@autoremoveinterfaces}
%<package>\scrlayer@@add@inherited@option{autoremoveinterfaces}
%</package>
%<*interface>
\KOMA@key{autoremoveinterfaces}[true]{%
\scrlayer@report@deprecated{#1}{autoremoveinterface}%
\KOMA@set@ifkey{autoremoveinterfaces}{scrlayer@autoremoveinterfaces}{#1}%
\KOMA@kav@replacebool{.scrlayer.sty}{autoremoveinterfaces}
{scrlayer@autoremoveinterfaces}%
}
%</interface>
%</options>
%<*interface&body>
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @autoremoveinterfaces\endcsname\relax
\expandafter\let
\csname KV@KOMA.\@currname.\@currext @autoremoveinterfaces@default\endcsname
\relax
%</interface&body>
% \end{macrocode}
% \end{macro}%^^A \ifscrlayer@autoremoveinterfaces
% \end{option}%^^A autoremoveinterfaces
% \end{macro}%^^A \scrlayer@AddCsToInterface
% \end{macro}%^^A \scrlayerAddCsToInterface
% \end{macro}%^^A \scrlayerAddToInterface
%
% \begin{macro}{\scrlayerInitInterface}
% \begin{description}
% \item[\OParameter{string}:] the name of the interface. Generally this is
% the file name of the package or class, that defines the interface
% (default: \texttt{\Macro{@currname}.\Macro{@currext}}).
% \end{description}
% This registers a new user interface.
% \begin{macrocode}
%<*package&body>
\newcommand*{\scrlayerInitInterface}[1][\@currname.\@currext]{%
\scrlayer@report@deprecated{#1}{\scrlayerInitInterface}%
\@ifundefined{scrlayer@#1@commandlist}{%
\@namedef{scrlayer@#1@commandlist}{}%
}{%
\begingroup
\def\@elt##1{\space\space\string##1\MessageBreak}%
\PackageError{scrlayer}{interface `#1' already initialised}{%
You've tried to initialise scrlayer interface `#1',\MessageBreak
but an interface of this name has been initialised
already.\MessageBreak
Here's a list of all macros of the already initialised
interface:\MessageBreak
\@nameuse{scrlayer@#1@commandlist}.%
If you'll continue, this re-initialisation will be ignored.%
}%
\endgroup
}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayerInitInterface
%
% \begin{macro}{\scrlayerOnAutoRemoveInterface}
% \begin{description}
% \item[\OParameter{string}:] the name of the interface. Generally this is
% the file name of the package or class, that defines the interface
% (default: \texttt{\Macro{@currname}.\Macro{@currext}}).
% \item[\Parameter{code}:] will be executed if the interface will be removed
% automatically (see option \Option{autoremoveinterfaces}).
% \end{description}
% \begin{macrocode}
%<*package&body>
\newcommand*{\scrlayerOnAutoRemoveInterface}[2][\@currname.\@currext]{%
\scrlayer@report@deprecated{#1}{\scrlayerOnAutoRemoveInterface}%
\@ifundefined{scrlayer@#1@onremove}{\@namedef{scrlayer@#1@onremove}{}}{}%
\expandafter\l@addto@macro\csname scrlayer@#1@onremove\endcsname{#2}%
}
%</package&body>
% \end{macrocode}
% \end{macro}%^^A \scrlayerOnAutoRemoveInterface
%
% \begin{macro}{\scrlayer@report@deprecated}
% \changes{v3.32}{2020/09/11}{new (internal)}
% Report that the deprecated interface commands are used but should not. But
% report this only once per interface.
% \begin{macrocode}
%<*package&init>
\newcommand*{\scrlayer@report@deprecated}[2]{%
\@ifundefined{scrlayer@deprecated@reported@for@#1}{%
\PackageWarning{scrlayer}{%
Deprecated interface detected for `#1'.\MessageBreak
There isn't any support for using, e.g.,\MessageBreak
`\string #2'%
}%
\@namedef{scrlayer@deprecated@reported@for@#1}{\string #2}%
}{}%
}
%</package&init>
% \end{macrocode}
% \end{macro}
%
% \iffalse^^A meta-comment
%</package|interface|class>
% \fi^^A meta-comment
%
%
% \Finale
%
\endinput
%
% end of file `scrlayer.dtx'
%%% Local Variables:
%%% mode: doctex
%%% ispell-local-dictionary: "en_GB"
%%% flyspell-mode: t
%%% TeX-master: t
%%% End:
|