summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/koma-script/source/tocbasic.dtx
blob: eae0e3ed9172bf2203a5094170cc4637e9f65b80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
% \iffalse meta-comment
% ======================================================================
% tocbasic.dtx
% Copyright (c) Markus Kohm, 2008-2020
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in manifest.txt.
% ----------------------------------------------------------------------
% tocbasic.dtx
% Copyright (c) Markus Kohm, 2008-2020
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c, verteilt und/oder veraendert werden.
% 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 oder spaeter 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.
% ======================================================================
% \fi
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \iffalse
%%% From File: $Id: tocbasic.dtx 3508 2020-07-08 08:45:20Z kohm $
%<identify>%%%            (run: identify)
%<prepare>%%%            (run: prepare)
%<option>%%%            (run: option)
%<execoption>%%%            (run: execoption)
%<body>%%%            (run: body)
%<exit>%%%            (run: exit)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
  \filedate$Date: 2020-07-08 10:45:20 +0200 (Wed, 08 Jul 2020) $
  \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
  \filerevision$Revision: 1962 $
\endgroup
\ProvidesFile{tocbasic.dtx}[\filedate\space\filerevision\space
%</dtx>
%<package&identify>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<package&identify>\ProvidesPackage{tocbasic}[%
%<*dtx|(package&identify)>
%!KOMAScriptVersion
  package
%<*dtx>
  source
%</dtx>
%</dtx|(package&identify)>
%<package&identify>  (handling toc-files)%
%<*dtx>
  (dtx)%
%</dtx>
%<*dtx|(package&identify)>
]
%</dtx|(package&identify)>
%<*dtx>
\ifx\documentclass\undefined
  \input scrdocstrip.tex
  \@@input scrkernel-version.dtx
  \@@input scrstrip.inc
  \KOMAdefVariable{COPYRIGHTFROM}{2008}
  \generate{\usepreamble\defaultpreamble
    \file{tocbasic.sty}{%
      \from{tocbasic.dtx}{package,identify}%
      \from{tocbasic.dtx}{package,prepare}%
      \from{scrkernel-tocstyle.dtx}{package,prepare}%
      \from{tocbasic.dtx}{package,option}%
      \from{scrkernel-tocstyle.dtx}{package,option}%
      \from{tocbasic.dtx}{package,body}%
      \from{scrkernel-tocstyle.dtx}{package,body}%
      \from{scrkernel-tocstyle.dtx}{package,style,gobble}%
      \from{scrkernel-tocstyle.dtx}{package,style,dottedtocline}%
      \from{scrkernel-tocstyle.dtx}{package,style,undottedtocline}%
      \from{scrkernel-tocstyle.dtx}{package,style,largetocline}%
      \from{scrkernel-tocstyle.dtx}{package,style,tocline}%
      \from{scrkernel-tocstyle.dtx}{package,style,toctext}%
      \from{scrkernel-tocstyle.dtx}{package,style,default}%
      \from{tocbasic.dtx}{package,exit}%
      \from{scrlogo.dtx}{logo}%
    }%
  }%
  \@@input scrstrop.inc
\else
  \let\endbatchfile\relax
\fi
\endbatchfile
\documentclass[parskip=half-]{scrdoc}
\usepackage[english]{babel}
\usepackage{array}
\usepackage{listings}
\lstset{breaklines,prebreak=\mbox{$\hookleftarrow$},language=[LaTeX]TeX,
  basicstyle=\small}
\lstnewenvironment{lstcode}[1][]{%
  \lstset{breaklines,prebreak=\mbox{$\hookleftarrow$},language=[LaTeX]TeX,
    basicstyle=\ttfamily\small,#1}%
}{}
\lstnewenvironment{lstoutput}[1][]{}{}
\CodelineIndex
\RecordChanges
\GetFileInfo{tocbasic.dtx}
\sloppy
\begin{document}
\DocInput{\filename}
\end{document}
% \fi
%
% \title{\KOMAScript{} \partname\ \texttt{\filename}%
%   \thanks{Diese Datei ist Version \fileversion\ von \texttt{\filename}.}}
% \date{\filedate}
% \author{Markus Kohm\thanks{mailto:komascript(at)gmx.info}}
% \maketitle
% \begin{abstract}
%   The main purpose of package \textsf{tocbasic} is to provide features for
%   authors of classes and packages to create own tables or lists of contents
%   like the list of figures and the list of tables and thereby allow other
%   classes or packages some types of control over these. For examples package
%   \textsf{tocbasic} delegates language control of all these tables and lists
%   of contents to package \textsf{babel}. So automatic change of language
%   will be provided inside all these tables and lists of contents. Using
%   \textsf{tocbasic} will exculpate authors of classes and packages from
%   implementation of such features.
%
%   \KOMAScript{} itself uses \textsf{tocbasic} not only for the table of
%   contents but also for the already mentioned lists of figures and tables.
% \end{abstract}
%
% \tableofcontents
% 
% \iffalse
%</dtx>
% \fi
%
% \StopEventually{\PrintIndex\PrintChanges}
%
%
% \section{Implementation}
% \label{sec:implementation}
%
% All macros with prefix \texttt{tb@} or \texttt{@} are internal macros and
% should not be used by package and class authors. Macros with prefix
% \texttt{tocbasic@} are internal macros, that may be used by class and
% packages authors. Macros without \texttt{@} are interface macros and may be
% used by class and package authors and users.
%
% Note: Parts of the implementation of package \textsf{tocbasic} are
% out-sourced into file \texttt{scrkernel-tocbasic.dtx}.
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Options}
% \label{sec:options}
%
% There are no options because the package should be used by class and package
% authors not by users. So the package will be loaded using
% \cs{RequiresPackage}. Using different options by different packages would
% result in an option clash.
%    \begin{macrocode}
%<*option>
\ProcessOptions\relax
%</option>
%    \end{macrocode}
%
%
% \subsection{Required Packages}
% \label{sec:packages}
%
% Package \textsf{scrbase} is needed to process all macro options. As long as
% no package options are provided, the \texttt{body}-run is early enough to
% load it.
%    \begin{macrocode}
%<*body>
\RequirePackage{scrbase}
%</body>
%    \end{macrocode}
% We load it after processing the options, because we don't need it for
% processing options.
%
%
%
% \subsection{Unwanted Packages}
% \label{sec:unpackages}
%
% There are packages, that are not recommended to be used together with
% \textsf{tocbasic}:
%    \begin{macrocode}
%<*body>
%    \end{macrocode}
% \begin{description}
% \item[\textsf{multitoc}:] This package implements multi-column ToCs using
%   \textsf{multicol}. Unfortunately there is a bug in that package, that
%   disables all extensions but \texttt{toc}, \texttt{lof} and \texttt{lot} and
%   even these if the corresponding option has not been set.
%    \begin{macrocode}
\AfterPackage*{multitoc}{%
  \@ifpackagelater{multitoc}{2018/08/31}{}{%
    \PackageWarningNoLine{tocbasic}{%
      Usage of package `multitoc' is not recommended!\MessageBreak
      Note, this package generally results in empty ToCs\MessageBreak
      for all extension but `toc', `lof' and `lot' and\MessageBreak
      even for these extensions if you do not use the\MessageBreak
      corresponding multitoc options.\MessageBreak
      It is recommended to use:\MessageBreak
      \space\space\string\usepackage{multicol}\MessageBreak
      \space\space\string\BeforeStartingTOC{\string\begin{multicols}{2}}%
      \MessageBreak
      \space\space\string\AfterStartingTOC{\string\end{multicols}}%
      \MessageBreak
      instead of loading package `multitoc'.\MessageBreak
      See the KOMA-Script manual for more information\MessageBreak
      about using \string\BeforeStartingTOC\space and
      \string\AfterStartingTOC\MessageBreak
      and the multicol manual for more information\MessageBreak
      about the `multicols' environment%
    }%
  }%
}
%    \end{macrocode}
% \end{description}
%    \begin{macrocode}
%</body>
%    \end{macrocode}
%
%
% \subsection{Having a List of All Tocs}
% \label{sec:listoftocs}
%
% If we have a list of all toc-files we may do commands for all
% toc-files. Somethimes it may be usefull to known the package, that created
% the toc-file, so this information will be stored additionally.
%
% \begin{macro}{\tb@listoftocs}
% This is the list of toc-files. The list will be:
% \begin{quote}
%   \cs{do}\marg{extension}\marg{class or
%   package}\cs{do}\marg{extension}\marg{class or package}\dots
% \end{quote}
% With this, adding and processing the list will be very fast but removing
% an element will be very slow.
%
% The initial state of the list will be \emph{empty}.
%    \begin{macrocode}
%<*body>
\newcommand*{\tb@listoftocs}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifattoclist}
% \changes{v3.28}{2019/11/19}{renamed to \cs{Ifattoclist}}%^^A
% \begin{macro}{\Ifattoclist}
% \changes{v3.28}{2019/11/19}{renamed from \cs{ifattoclist}}%^^A
% This command tests, if an extension is already at the list of
% toc-files. The extension has to be the first argument. The second argument
% will be done, if the extension is already at the list of toc-files. The
% third argument will be done, if the extension is at the list of toc-files
% not yet.
%    \begin{macrocode}
\providecommand*{\ifattoclist}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\ifattoclist'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifattoclist' by `\string\Ifattoclist'%
  }%
  \Ifattoclist
}
\newcommand{\Ifattoclist}[1]{%
  \begingroup
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b\@tempswatrue\fi
    }%
    \edef\reserved@b{#1}\@tempswafalse\tb@listoftocs
    \if@tempswa\aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi
  \endgroup
}
%    \end{macrocode}
% \end{macro}%^^A \Ifattoclist
% \end{macro}%^^A \ifattoclist
%
% \begin{macro}{\addtotoclist}
% \changes{v1.0a}{2008/11/11}{internal \cs{@addtotoclist} renamed to
%   \cs{scr@addtotoclist} because of package \textsf{floatfram}}.^^A
% \changes{v1.0a}{2008/11/11}{internal \cs{@@addtotoclist} renamed to
%   \cs{scr@@addtotoclist} because of package \textsf{floatfram}}.^^A
% \changes{v3.06a}{2010/09/14}{expand the arguments while adding them to the
%   internal list}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\scr@addtotoclist}
% \begin{macro}{\scr@@addtotoclist}
% \changes{v3.28}{2019/11/19}{\cs{ifattoclist} replaced by
%   \cs{Ifattoclist}}%^^A
% This command adds an extension to the list of toc-files. The first,
% optional argument is the class or package name with the corresponding
% extension of class or package files. If this argument was omitted
% \textsf{tocbasic} tries to get it automatically. This should be
% successfull while loading a class or package but not while processing any
% command of a class or package after loading the class or package. The
% second, mandatory argument is the extension of the toc-file. NOTE: An
% empty first argument is not the same like omitting the first argument!
%    \begin{macrocode}
\newcommand*{\addtotoclist}{%
  \kernel@ifnextchar [%]
    \scr@@addtotoclist\scr@addtotoclist
}
\newcommand*{\scr@addtotoclist}{%
  \ifx\@currname\@empty
    \def\reserved@a{\scr@@addtotoclist[]}%
  \else
    \edef\reserved@a{\noexpand\scr@@addtotoclist[\@currname.\@currext]}%
  \fi
  \reserved@a
}
\newcommand*{\scr@@addtotoclist}[2][]{%
  \Ifattoclist{#2}{%
    \PackageError{tocbasic}{%
      file extension `#2' cannot be used twice
    }{%
      File extension `#2' is already used by a toc-file, while
      \ifx\relax#1\relax someone\else #2\fi\MessageBreak
      tried to use it again for a toc-file.\MessageBreak
      This may be either an incompatibility of packages, an error at a
      package,\MessageBreak
      or a mistake by the user.\MessageBreak
    }%
  }{%
    \begingroup
      \protected@edef\reserved@a{%
        \noexpand\g@addto@macro\noexpand\tb@listoftocs{%
          \noexpand\do{#2}{#1}}}\reserved@a
    \endgroup
    \ifx\relax #1\relax\else
      \@ifundefined{tb@#1@add@hook}{}{%
        \edef\reserved@a{%
          \noexpand\def\noexpand\@currext{#2}%
          \noexpand\@nameuse{tb@#1@add@hook}%
          \noexpand\def\noexpand\@currext{\@currext}%
        }\reserved@a
      }%
    \fi
    \edef\reserved@a{%
      \noexpand\def\noexpand\@currext{#2}%
      \noexpand\@nameuse{tb@@add@hook}%
      \noexpand\def\noexpand\@currext{\@currext}%
    }\reserved@a
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\owneroftoc}
% \changes{v3.22}{2016/08/09}{new}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% Returns the owner of a TOC or uses the owner of a TOC as argument of the
% optional argument, if it exists.
%    \begin{macrocode}
\newcommand*{\owneroftoc}[2][\@firstofone]{%
  \begingroup
    \let\reserved@a\endgroup
    \def\do##1##2{\Ifstr{#2}{##1}{\def\reserved@a{\endgroup#1{##2}}}{}}%
    \tb@listoftocs
  \reserved@a
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\categoryoftoc}
% \changes{v3.27}{2019/05/12}{new}%^^A
% Synonym for \cs{owneroftoc}.
%    \begin{macrocode}
\newcommand*{\categoryoftoc}{\owneroftoc}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\AtAddToTocList}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% Action to be done, when adding a toc-file of a known owner. The first
% optional argument is the owner. The second, mandatory argument is the
% action. While doing the action \cs{@currext} will be the extension of the
% added toc-file. If the first argument was omitted \textsf{tocbasic} tries
% to get it automatically. This should be successfull while loading a class
% or package but not while processing any command of a class or package
% after loading the class or package. The second, mandatory argument is the
% extension of the toc-file. NOTE: An empty first argument is not the same
% like omitting the first argument, but set's up the general hook. The
% general hook will be done for every adding after the individual hook (this
% means, you may dactivate features at the individual hook before processing
% the general hook). But the individual hook will not be processed for
% toc-files without any owner!
%    \begin{macrocode}
\newcommand*{\AtAddToTocList}{%
  \kernel@ifnextchar [%]
    \@@AtAddToTocList\@AtAddToTocList
}
\newcommand*{\@AtAddToTocList}{%
  \ifx\@currname\@empty
    \def\reserved@a{\@@AtAddToTocList[]}%
  \else
    \edef\reserved@a{\noexpand\@@AtAddToTocList[\@currname.\@currext]}%
  \fi
  \reserved@a
}
\newcommand*{\@@AtAddToTocList}[1][]{%
  \@ifundefined{tb@#1@add@hook}{\@namedef{tb@#1@add@hook}{}}{}%
  \expandafter\g@addto@macro\csname tb@#1@add@hook\endcsname
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tocbasic@extend@babel}
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by
%   \cs{Iftocfeature}}%^^A
% NOTE: To extend the original \cs{bbl@set@language} the argument of
% \cs{tocbasic@extend@babel} must not be a local macro (like \cs{@currext})
%    \begin{macrocode}
\newcommand*{\tocbasic@extend@babel}[1]{%
  \scr@ifundefinedorrelax{bbl@set@language}{%
    \PackageInfo{tocbasic}{babel extension for `#1' omitted\MessageBreak
      because of missing \string\bbl@set@language}%
  }{%
    \Iftocfeature{#1}{nobabel}{%
      \PackageInfo{tocbasic}{omitting babel extension for `#1'\MessageBreak
        because of feature `nobabel' available\MessageBreak
        for `#1'}%
    }{%
%    \end{macrocode}
% \changes{v3.23}{2017/02/23}{using \cs{BabelContentsFiles} if available}%^^A
% Since version 3.9a provides adding extensions to the language switch
% preparation. So it is used if it is available.
%    \begin{macrocode}
      \scr@ifundefinedorrelax{BabelContentsFiles}{%
        \PackageInfo{tocbasic}{setting babel extension for `#1'}%
        \expandafter\gdef\expandafter\bbl@set@language
        \expandafter##\expandafter1%
        \expandafter{%
          \bbl@set@language{##1}%
          \addtocontents{#1}{\xstring\select@language{\languagename}}%
        }%
      }{%
        \@expandtwoargs\in@{,#1,}{,\BabelContentsFiles,}%
        \ifin@
          \PackageInfo{tocbasic}{omitting babel extension for
            `#1'\MessageBreak
            because it is already in \string\BabelContentsFiles}%
        \else
          \PackageInfo{tocbasic}{setting babel extension for `#1'}%
          \xdef\BabelContentsFiles{\BabelContentsFiles,#1}%
        \fi
      }%
    }%
  }%
}
%    \end{macrocode}
% This feature should be used for all toc-files (unless feature
% \texttt{nobabel} was set for the toc-file).
%    \begin{macrocode}
\AtAddToTocList[]{\expandafter\tocbasic@extend@babel\expandafter{\@currext}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\removefromtoclist}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\scr@removefromtoclist}
% \changes{v3.22}{2016/09/06}{missing \cs{global} added}%^^A
% \changes{v3.28}{2019/11/22}{renamed from \cs{@removefromtoclist}}%^^A
% \begin{macro}{\scr@@removefromtoclist}
% \changes{v3.22}{2016/09/06}{missing \cs{global} added}%^^A
% \changes{v3.28}{2019/11/22}{renamed from \cs{@@removefromtoclist}}%^^A
% This command will remove an extension from the list of toc-files. If the
% first, optional argument is given, the extension will only be removed, if
% it was added by the given owner. NOTE: An empty first argument is not the
% same like omitting the first argument!
%    \begin{macrocode}
\newcommand*{\removefromtoclist}{%
  \kernel@ifnextchar [%]
    \scr@removefromtoclist\scr@@removefromtoclist
}  
\newcommand*{\scr@removefromtoclist}[2][]{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
        \begingroup
          \edef\@currext{##2}%
          \edef\reserved@b{#1}%
          \ifx\@currext\reserved@b
          \else
            \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
          \fi
        \endgroup
      \else
        \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
      \fi
    }%
    \edef\reserved@b{#2}\global\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
\newcommand*{\scr@@removefromtoclist}[1]{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
      \else
        \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
      \fi
    }%
    \edef\reserved@b{#1}\global\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\doforeachtocfile}
% \changes{v3.09}{2011/03/01}{\cs{@currext} defined using \cs{edef} instead
%   of \cs{def}}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% This command does the second, mandatory argument for each toc-file at the
% list of toc-files. If the first, optional argument was given this will be
% done only for the toc-files of that owner. NOTE: An empty first argument
% is not the same like omitting the first argument!
%
% While processing the second argument \cs{@currext} is the extension of
% the toc-file. The second argument will be processed with increased group
% level!
%
% See \cs{addtoeachtocfile} for an example of usage of
% \cs{doforeachtocfile}.
%    \begin{macrocode}
\newcommand{\doforeachtocfile}{%
  \kernel@ifnextchar [%]
    \@doforeachtocfile\@@doforeachtocfile
}
\newcommand{\@doforeachtocfile}[2][]{%
  \def\do##1##2{%
    \edef\reserved@a{#1}\edef\reserved@b{##2}\ifx\reserved@a\reserved@b
      \edef\@currext{##1}#2%
    \fi
  }%
  \edef\reserved@a{%
    \noexpand\tb@listoftocs
    \noexpand\def\noexpand\@currext{\@currext}%
  }\reserved@a
  \let\do\relax
}
\newcommand{\@@doforeachtocfile}[1]{%
  \def\do##1##2{%
    \edef\@currext{##1}#1%
  }%
  \edef\reserved@a{%
    \noexpand\tb@listoftocs
    \noexpand\def\noexpand\@currext{\@currext}%
  }\reserved@a
  \let\do\relax
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addtoeachtocfile}
% \begin{macro}{\@addtoeachtocfile}
% \begin{macro}{\@@addtoeachtocfile}
% \changes{v3.03b}{2009/06/08}{typo fix at usage of \cs{doforeachtocfile}}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% This command calls \cs{addtocontents} with the section, mandatory
% argument for each toc-file at the list of toc-files. If the first,
% optional argument was given this will be done only for the toc-files of
% that owner. NOTE: An empty first argument is not the same like omitting
% the first argument! And don't forget to protect the commands, that should
% not be expanded, at the mandatory argument.
%    \begin{macrocode}
\newcommand{\addtoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addtoeachtocfile\@@addtoeachtocfile
}
\newcommand{\@addtoeachtocfile}[2][]{%
  \doforeachtocfile[{#1}]{\addtocontents{\@currext}{#2}}%
}
\newcommand{\@@addtoeachtocfile}[1]{%
  \doforeachtocfile{\addtocontents{\@currext}{#1}}%
}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Adding Entries into Toc-Files}
%
% We have a new general command to add entries to several toc-files at
% once. And we have some special commands for the table of contents.
%
% \begin{macro}{\addcontentslinetoeachtocfile}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% Something like a combination of \cs{addtoeachtocfile} and
% \cs{addcontentsline}.
%    \begin{macrocode}
%<*body>
\newcommand{\addcontentslinetoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addcontentslinetoeachtocfile\@@addcontentslinetoeachtocfile
}
\newcommand{\@addcontentslinetoeachtocfile}[3][]{%
  \doforeachtocfile[{#1}]{\addcontentsline{\@currext}{#2}{#3}}%
}
\newcommand{\@@addcontentslinetoeachtocfile}[2]{%
  \doforeachtocfile{\addcontentsline{\@currext}{#1}{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\addxcontentsline}
% \changes{v3.12}{2013/09/24}{new}%^^A
% \changes{v3.12}{2013/09/24}{Take care of new feature \texttt{numberline}}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\@addxcontentsline}
% \changes{v3.12}{2013/09/24}{new (internal)}%^^A
% This will be used instead of \cs{addcontentsline} to generate numbered or
% not numbered entries to a toc-file. First argument is the toc-file, second
% the entry type, e.g., \texttt{chapter}, the third is the entry number or
% empty and the fourth and last is the entry text.
%    \begin{macrocode}
\newcommand*{\addxcontentsline}[2]{%
  \kernel@ifnextchar [%]
  {\@addxcontentsline{#1}{#2}}%
  {\@addxcontentsline{#1}{#2}[]}%
}
\newcommand*{\@addxcontentsline}{}
\def\@addxcontentsline#1#2[#3]#4{%
  \scr@ifundefinedorrelax{add#2#1entry}{%
    \tocbasic@addxcontentsline{#1}{#2}{#3}{#4}%
  }{%
    \@nameuse{add#2#1entry}{#3}{#4}%
  }%
}
%    \end{macrocode}
% \begin{macro}{\nonumberline}
% \changes{v3.12}{2013/09/24}{new}%^^A
% Either \cs{relax} or \cs{numberline} depending on the feature
% \texttt{numberline}.
%    \begin{macrocode}
\newcommand*{\nonumberline}{}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\addxcontentsline}
% This may be used to either use a heading type command or the general default
% one. You are not allowed to use it in the definition of a heading type
% command like \cs{addchaptertocentry}! You may use
% \cs{tocbasic@addxcontentsline} at the definition of those commands.
%    \begin{macrocode}
\newcommand*{\tocbasic@addxcontentsline}[4]{%
  \if\relax\detokenize{#3}\relax
    \addcontentsline{#1}{#2}{\protect\nonumberline#4}%
  \else
    \addcontentsline{#1}{#2}{\protect\numberline{#3}#4}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\addxcontentslinetoeachtocfile}
% \changes{v3.12}{2013/09/24}{new}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\@addxcontentslinetoeachtocfile}
% \changes{v3.12}{2013/09/24}{new (internal)}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\@@addxcontentslinetoeachtocfile}
% \changes{v3.12}{2013/09/24}{new (internal)}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \begin{macro}{\@@@addxcontentslinetoeachtocfile}
% \changes{v3.12}{2013/09/24}{new (internal)}%^^A
% \begin{macro}{\@@@@addxcontentslinetoeachtocfile}
% \changes{v3.12}{2013/09/24}{new (internal)}%^^A
% Similar to \cs{addcontentslinetoeachtocfile} using
% \cs{addxcontentsline} instead of \cs{addcontentsline}.
%    \begin{macrocode}
\newcommand{\addxcontentslinetoeachtocfile}{%
  \kernel@ifnextchar [%]
    \@addxcontentslinetoeachtocfile\@@addxcontentslinetoeachtocfile
}
\newcommand{\@addxcontentslinetoeachtocfile}[2][]{%
  \kernel@ifnextchar [%]
    {\@@@addxcontentslinetoeachtocfile[{#1}]{#2}}%
    {\@@@addxcontentslinetoeachtocfile[{#1}]{#2}[]}
}
\newcommand*{\@@@addxcontentslinetoeachtocfile}{}
\def\@@@addxcontentslinetoeachtocfile[#1]#2[#3]#4{%
  \doforeachtocfile[{#1}]{\addxcontentsline{\@currext}{#2}[#3]{#4}}%
}
\newcommand{\@@addxcontentslinetoeachtocfile}[1]{%
  \kernel@ifnextchar [%]
    {\@@@@addxcontentslinetoeachtocfile{#1}}%
    {\@@@@addxcontentslinetoeachtocfile{#1}[]}%
}
\newcommand*{\@@@@addxcontentslinetoeachtocfile}{}
\def\@@@@addxcontentslinetoeachtocfile#1[#2]#3{%
  \doforeachtocfile{\addxcontentsline{\@currext}{#1}[{#2}]{#3}}%
}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Show List of Toc-File}
% \label{sec:showlistoftocfile}
%
% If you have a toc-file you want a list-of-command for this toc-file,
% too. Here are basics and high level commands for this.
%
% \begin{macro}{\tocbasic@starttoc}
% \changes{v3.17}{2015/03/23}{usage of feature \texttt{noparskipfake}}%^^A
% \changes{v3.27}{2019/07/08}{hack to add \cs{par} at end of (main) file}%^^A
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by
%   \cs{Iftocfeature}}%^^A
% Some basics are done like setting up \cs{parskip}, \cs{parindent} and
% \cs{parfillskip}, a general hook will be called, an individual hook will
% be called, the toc will be started, an individual hook will be called, an
% general hook wil be called, that's it.
%    \begin{macrocode}
%<*body>
\newcommand*{\tocbasic@starttoc}[1]{%
  \begingroup
    \edef\@currext{#1}%
    \Iftocfeature{\@currext}{noparskipfake}{}{%
      \ifvmode
        \@tempskipa\lastskip
        \vskip-\lastskip
        \addtolength{\@tempskipa}{\parskip}%
        \vskip\@tempskipa
      \fi
    }%
    \setlength{\parskip}{\z@}%
    \setlength{\parindent}{\z@}%
    \setlength{\parfillskip}{\z@\@plus 1fil}%
    \csname tocbasic@@before@hook\endcsname
    \csname tb@#1@before@hook\endcsname
    \let\tocbasic@saved@input\@input
    \def\@input##1{%
      \let\@input\tocbasic@saved@input\@input{##1}\par
    }%
    \@starttoc{#1}%
    \csname tb@#1@after@hook\endcsname
    \csname tocbasic@@after@hook\endcsname
  \endgroup
}
%    \end{macrocode}
% \begin{macro}{\tocbasic@@before@hook}
% \begin{macro}{\tocbasic@@after@hook}
% These are the general hooks. They may be used by classes and packages for
% commands, that should be used for all lists of not only the own lists of,
% e.\,g., \KOMAScript{} may use it to handle option \texttt{tocleft}.
%    \begin{macrocode}
\newcommand*{\tocbasic@@before@hook}{}
\newcommand*{\tocbasic@@after@hook}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\BeforeStartingTOC}
% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}%^^A
% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of
%   undefined \cs{scr@ifundefinedorrelax}}%^^A
% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}%^^A
% \begin{macro}{\AfterStartingTOC}
% \changes{v3.04b}{2010/01/05}{fix:define the hook if not already defined}%^^A
% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of
%   undefined \cs{scr@ifundefinedorrelax}}%^^A
% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}%^^A
% These are the commands to add code to the general or individual hooks. If
% the first, optional argument was given, the second, mandatory argument
% will be added to the individual hook, otherwise the general hook will be
% extended.
%    \begin{macrocode}
\newcommand{\BeforeStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@before@hook{#2}%
  \else
    \@ifundefined{tb@#1@before@hook}{%
%<trace>      \PackageInfo{tocbasic}{defining new hook before starting `#1'}%
      \expandafter\global\expandafter\let\csname tb@#1@before@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@before@hook\endcsname{#2}%
  \fi
}
\newcommand{\AfterStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@after@hook{#2}%
  \else
    \@ifundefined{tb@#1@after@hook}{%
%<trace>      \PackageInfo{tocbasic}{defining new hook after starting `#1'}%
      \expandafter\global\expandafter\let\csname tb@#1@after@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@after@hook\endcsname{#2}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\listoftoc}
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} durch \cs{kernel@ifstar}
%   ersetzt}%^^A
% \begin{macro}{\@listoftoc}
% \changes{v1.0a}{2008/11/12}{\cs{twocolumn} fixed}%^^A
% \changes{v1.01}{2008/11/13}{new feature \texttt{onecolumn}}%^^A
% \changes{v3.09}{2011/03/01}{\cs{@currext} defined using \cs{edef} instead
%   of \cs{def}}%^^A
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by
%   \cs{Iftocfeature}}%^^A
% \changes{v3.31}{2020/07/08}{use one time expansion of local
%   \cs{list@fname}}%^^A
% Command to handle the hole list of something. There are additional hooks
% for this. The first optional argument is the title for this list. If the
% optional argument was omitted \cs{listof\#2name} will be used. The star
% version does not set up a heading or switch the column number!
%    \begin{macrocode}
\newcommand*{\listoftoc}{%
  \kernel@ifstar \tocbasic@starttoc\@listoftoc
}
\newcommand*{\@listoftoc}[2][]{%
  \begingroup
    \def\list@fname{#1}%
    \@ifundefined{listof#2name}{%
      \ifx\list@fname\@empty
        \PackageWarning{tocbasic}{%
          You should either define \expandafter\string\csname
          listof#2name\endcsname\MessageBreak
          or use the optional argument of \string\listoftoc\space\MessageBreak
          to set the term to be used for the\MessageBreak
          heading of list of #2}%
        \def\list@fname{\listofname~#2}%
      \fi
    }{%
      \expandafter\let\expandafter\list@fname\csname listof#2name\endcsname
    }%
    \edef\@currext{#2}%
    \Iftocfeature{\@currext}{onecolumn}{%
      \Iftocfeature{\@currext}{leveldown}{}{%
        \if@twocolumn
          \aftergroup\twocolumn\onecolumn
        \fi
      }%
    }{}%
    \Iftocfeature{\@currext}{numberline}{\def\nonumberline{\numberline{}}}{}%
    \expandafter\tocbasic@listhead\expandafter{\list@fname}%
    \scr@ifundefinedorrelax{microtypesetup}{}{%
      \Iftocfeature{\@currext}{noprotrusion}{}{%
        \microtypesetup{protrusion=false}%
        \PackageInfo{tocbasic}{%
          character protrusion at \@currext\space deactivated}%
      }%
    }%
    \tocbasic@starttoc{#2}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \changes{v3.25}{2017/11/21}{\textsf{tocbibind} warning added}%^^A
% Using \textsf{tocbibind} and \textsf{tocbasic} together can break features
% either of \textsf{tocbibind} or \textsf{tocbasic}.  Here we add at least a
% warning:
%    \begin{macrocode}
\@ifpackageloaded{tocbibind}{}{%
  \AtBeginDocument{%
    \@ifpackageloaded{tocbibind}{%
      \PackageInfo{tocbasic}{usage of `tocbibind' detected}%
      \newcommand*{\tb@tocbibindpatch}[3]{%
        \long\def\reserved@a{\tocfile{#2}{#1} }%
        \ifx #3\reserved@a
          \PackageWarningNoLine{tocbasic}{%
            `tocbibind' redefinition of `\string#3'\MessageBreak
            detected.\MessageBreak
            Note: Loading `tocbibind' without option `not#1'\MessageBreak
            can break several features of `tocbasic'%
            \scr@ifundefinedorrelax{KOMAClassName}{%
              .\MessageBreak
              Loading `tocbibind' before `tocbasic' would avoid\MessageBreak
              this warning message%
            }{}%
          }%
        \fi
      }%
      \tb@tocbibindpatch{toc}{\contentsname}{\tableofcontents}%
      \tb@tocbibindpatch{lof}{\listfigurename}{\listoffigures}%
      \tb@tocbibindpatch{lot}{\listtablename}{\listoftables}%
    }{}%
  }%
}
%    \end{macrocode}
%
% \begin{macro}{\listofname}
%   While this is only an emergancy command, we don't support languages.
%    \begin{macrocode}
\newcommand*{\listofname}{List of}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\listofeachtoc}
% \begin{macro}{\@listofeachtoc}
% \begin{macro}{\@@listofeachtoc}
% \changes{v3.03b}{2009/06/08}{typo fix at usage of \cs{doforeachtocfile}}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%     \cs{kernel@ifnextchar}}%^^A
%   Another example of using \cs{doforeachtocfile}.
%    \begin{macrocode}
\newcommand*{\listofeachtoc}{%
  \kernel@ifnextchar [%]
    \@listofeachtoc\@@listofeachtoc
}
\newcommand{\@listofeachtoc}[1][]{%
  \doforeachtocfile[{#1}]{\listoftoc{\@currext}}%
}
\newcommand{\@@listofeachtoc}[1]{%
  \doforeachtocfile{\listoftoc{\@currext}}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ext@toc}
% \changes{v3.23}{2017/02/23}{use indirect extension for toc}%^^A
% We do not longer hard code extension \texttt{toc} for the table of
% contents. This allowes users to change it. Classes or other packages may
% also define it. So it seems to be better to \cs{providecommand} instead of
% \cs{newcommand} here.
%    \begin{macrocode}
\providecommand*{\ext@toc}{toc}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tocbasic@listhead}
% \changes{v3.02a}{2009/01/20}{no explicite marks if ``numbered''}%
% \changes{v3.09a}{2011/04/12}{again no explicite marks if ``numbered''}%
% \changes{v3.12}{2013/09/24}{usage of new
%   \cs{tocbasic@addxcontentsline}}%
% \changes{v3.15}{2014/12/10}{moved \cs{@mkboth} inside \cs{chapter*}}%^^A
% \changes{v3.15}{2014/12/10}{usage of \cs{addsec} if available}%^^A
% \changes{v3.15}{2014/12/10}{usage of \cs{@mkright} if available}%^^A
% \changes{v3.17}{2015/03/08}{moved \cs{@mkboth} outside \cs{chapter*}}%^^A
% \changes{v3.17}{2015/03/08}{usage of \cs{@mkdouble} if available}%^^A
% \changes{v3.17}{2015/03/25}{penalty and skip reconstruction after
%   \cs{@mkright}, \cs{@mkboth}, or \cs{@mkdouble}}%^^A
% \changes{v3.26}{2018/06/22}{removed spurious group}%^^A
% \changes{v3.26}{2018/09/03}{usage of \cs{addsecmark} or \cs{sectionmark}
%   instead of \cs{@mkright} or \cs{markright}}%^^A
% \changes{v3.28}{2019/11/19}{\cs{iftocfeature} replaced by
%   \cs{Iftocfeature}}%^^A
% Setting the headings of a list of something. The heading is the only
% argument.
%    \begin{macrocode}
\newcommand*{\tocbasic@listhead}[1]{%
  \@ifundefined{tocbasic@listhead@\@currext}{%
    \scr@ifundefinedorrelax{chapter}{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \subsection[##1]{##1}%
          }{%
            \subsection*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {subsection}{##1}%
              }{}%
              \c@secnumdepth=-\maxdimen
              \subsectionmark{##1}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \section[##1]{##1}%
          }{%
            \section*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {section}{##1}%
              }{}%
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \section{##1}%
          }{%
            \Iftocfeature{\@currext}{totoc}{%
              \@ifundefined{addsec}{%
                \section*{##1}%
                \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
                \begingroup
                  \@ifundefined{@mkright}{%
                    \IfActiveMkBoth{\markright{\MakeMarkcase{##1}}}{}%
                  }{%
                    \@mkright{\MakeMarkcase{##1}}%
                  }%
                  \expandafter\addxcontentsline\expandafter{\ext@toc}%
                  {section}{##1}%
                \endgroup
                \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
              }{%
                \addsec{##1}%
              }%
            }{%
              \section*{##1}%
              \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
              \begingroup
                \@ifundefined{addsecmark}{%
                  \c@secnumdepth=-\maxdimen
                  \sectionmark{##1}%
                }{%
                  \addsecmark{##1}%
                }%
              \endgroup
              \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
            }%
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \chapter[##1]{##1}%
          }{%
            \chapter*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {chapter}{##1}%
              }{}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }%
  }{}%
  \csname tb@@beforehead@hook\endcsname
  \csname tb@\@currext @beforehead@hook\endcsname
  \csname tocbasic@listhead@\@currext\endcsname{#1}%
  \csname tb@\@currext @afterhead@hook\endcsname
  \csname tb@@afterhead@hook\endcsname
}
%    \end{macrocode}
% \begin{macro}{\BeforeTOCHead}
% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}%^^A
% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of
%   undefined \cs{scr@ifundefinedorrelax}}%^^A
% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}%^^A
% \begin{macro}{\AfterTOCHead}
% \changes{v3.04b}{2010/01/05}{fix: define the hook if not already defined}%^^A
% \changes{v3.06}{2010/06/09}{fix: using \cs{@ifundefined} instead of
%   undefined \cs{scr@ifundefinedorrelax}}%^^A
% \changes{v3.26}{2018/08/10}{message moved to \texttt{trace}}%^^A
% These are the commands to add code to the general or individual hooks. If
% the first, optional argument was given, the second, mandatory argument
% will be added to the individual hook, otherwise the general hook will be
% extended.
%    \begin{macrocode}
\newcommand{\BeforeTOCHead}[2][]{%
  \@ifundefined{tb@#1@beforehead@hook}{%
%<trace>    \PackageInfo{tocbasic}{defining new hook before heading of `#1'}%
    \expandafter\global\expandafter\let\csname tb@#1@beforehead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@beforehead@hook\endcsname{#2}%
}
\newcommand{\AfterTOCHead}[2][]{%
  \@ifundefined{tb@#1@afterhead@hook}{%
%<trace>    \PackageInfo{tocbasic}{defining new hook after heading of `#1'}%
    \expandafter\global\expandafter\let\csname tb@#1@afterhead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@afterhead@hook\endcsname{#2}%
}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\MakeMarkcase}
% Use upper-case or not?
%    \begin{macrocode}
%<*exit>
\AtBeginDocument{%
  \@ifundefined{MakeMarkcase}{%
    \scr@ifundefinedorrelax{KOMAClassName}{%
      \let\MakeMarkcase\MakeUppercase
    }{%
      \let\MakeMarkcase\@firstofone
    }%
  }{}%
}
%</exit>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\deftocheading}
% Define a toc headings command with one argument (the title).
%    \begin{macrocode}
%<*body>
\newcommand*{\deftocheading}[1]{%
  \@namedef{tocbasic@listhead@#1}##1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setuptoc}
% \changes{v3.26}{2018/08/29}{Verwendung von \cs{scr@trim@spaces} statt
%   \cs{tb@@sp@def}}%^^A
% \begin{macro}{\unsettoc}
% \changes{v3.26}{2018/08/29}{Verwendung von \cs{scr@trim@spaces} statt
%   \cs{tb@@sp@def}}%^^A
% Known features are:
% \begin{description}
% \item[\texttt{totoc}] writes the title of the list of to the table of
%   contents
% \item[\texttt{numberline}] redefines \cs{nonumberline} to use
%   \cs{numberline}
% \item[\texttt{numbered}] uses a numbered headings for the list of
% \item[\texttt{leveldown}] uses not the top level heading (e.\,g.,
%   \cs{chapter} with book) but the first sub level (e.\,g., \cs{section} with
%   book).
% \item[\texttt{nobabel}] prevents the extension to be added to the babel
%   handling of toc-files.  To make this work, you have to set the feature
%   before adding the extension to the list of known extension.
% \item[[\texttt{noprotrusion}]] prevents disabling character protrusion at
%   the toc.
% \end{description}
% Other features may be package dependent. You may test the feature using:
% \begin{quote}
%   \cs{@ifundefined}\texttt{\{tocbasic@\meta{toc}@feature@\meta{feature}\}}\\
%   \phantom{\cs{@ifundefined}}\marg{do if feature not set}\\
%   \phantom{\cs{@ifundefined}}\marg{do if feature set}
% \end{quote}
% See \cs{tocbasic@listhead} for an example of this.
%    \begin{macrocode}
\newcommand*{\setuptoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \@namedef{tocbasic@#1@feature@\@tempa}{}%
  }%
}
\newcommand*{\unsettoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \expandafter\let\csname tocbasic@#1@feature@\@tempa\endcsname\relax
  }%
}
%    \end{macrocode}
% Do not add the files, that babel handles by default.
%    \begin{macrocode}
\setuptoc{toc}{nobabel}
\setuptoc{lof}{nobabel}
\setuptoc{lot}{nobabel}
%    \end{macrocode}
% \begin{macro}{\iftocfeature}
% \changes{v3.28}{2019/11/19}{renamed to \cs{Iftocfeature}}%^^A
% \begin{macro}{\Iftocfeature}
% \changes{v3.28}{2019/11/19}{renamed from \cs{iftocfeature}}%^^A
% We need a test for the features
%    \begin{macrocode}
\providecommand*{\iftocfeature}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\iftocfeature'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\iftocfeature' by `\string\Iftocfeature'%
  }%
  \Iftocfeature
}
\newcommand*{\Iftocfeature}[2]{%
  \scr@ifundefinedorrelax{tocbasic@#1@feature@#2}{%
    \expandafter\@secondoftwo
  }{%
    \expandafter\@firstoftwo
  }%
}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tocbasicautomode}
% \changes{v1.0a}{2008/11/11}{use of \cs{addtotoclist} instead of
%   internal}%^^A
% \changes{v3.07a}{2010/11/25}{fix: added missing
%   \cs{let}\cs{@starttoc}\cs{tocbasic@starttoc}}%^^A
% \changes{v3.28}{2019/11/19}{\cs{ifattoclist} replaced by
%   \cs{Ifattoclist}}%^^A
% \textsf{tocbasic} can overtake \cs{@starttoc} to automaticly add all
% used extensions to the list of known extensions and use
% \cs{tocbasic@starttoc} instead of \cs{@starttoc} from \LaTeX{}
% kernel. Please note, that we don't need a fix for the unfriendly
% redefinition of \cs{@starttoc} by \textsf{hyperref}, because hyperref
% does it only at the first \LaTeX{} run. So this action of \textsf{hyperref}
% may only result in the need of one more \LaTeX{} run, but not in a permanent
% mistake.
%    \begin{macrocode}
%<*body>
\newcommand*{\tocbasicautomode}{%
  \let\tb@saved@starttoc\@starttoc
  \let\@starttoc\tocbasic@starttoc
  \BeforeStartingTOC{%
    \let\@starttoc\tb@saved@starttoc
    \expandafter\Ifattoclist\expandafter{\@currext}{}{%
      \addtotoclist[tocbasicautomode]{\@currext}%
    }%
  }%
}
%</body>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{High Level Interface for Generating New TOCs and Floats}
% \label{sec:newfloats}
%
% \begin{macro}{\DeclareNewTOC}
% \changes{v3.06}{2010/06/01}{new high level command}%^^A
% \changes{v3.18}{2015/06/20}{\cs{tb@nt@types} and \cs{tb@nt@listname} are
%   initialised \cs{relax}}%^^A
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}%^^A
% \changes{v3.26a}{2018/12/30}{fixed usage of \cs{kernel@ifnextchar}}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% This command defines only a new TOC and a new caption command for this
% TOC.  It does not define a new foat unless option float was set!  It does
% not define a new nonfloat unless option nonfloat was set!  The optional
% argument is used to set up several settings using \textsf{keyval}.  The
% mandatory argument is the shortcut.  The default type is the shortcut.
% The extension is the shortcut.  The default owner is ``\texttt{float}''.
%    \begin{macrocode}
%<*body>
\DefineFamily{KOMAarg}
\DefineFamilyMember[.toc]{KOMAarg}
\newcommand*{\DeclareNewTOC}[2][]{%
  \newif\iftb@nt@float
  \newif\iftb@nt@nonfloat
  \newif\iftb@nt@forcenames
  \def\tb@nt@floattype{\tb@nt@autofloattype}%
  \def\tb@nt@floatpos{tbp}%
  \def\tb@nt@ext{#2}%
  \edef\tb@nt@type{#2}%
  \let\tb@nt@types\relax
  \def\tb@nt@owner{float}%
  \def\tb@nt@name{\expandafter\protect\expandafter\MakeUppercase\tb@nt@type}%
  \let\tb@nt@listname\relax
  \let\tb@nt@counterwithin\@empty
  \let\tb@nt@atbegin\@empty
  \let\tb@nt@atend\@empty
  \def\tb@nt@tocentrystyle{default}%
%    \end{macrocode}
% \changes{v3.20}{2016/04/29}{need more initialization for empty optional
%   argument}%^^A
%    \begin{macrocode}
  \def\tb@nt@tocstyle@options{level=1}%
  \IfArgIsEmpty{#1}{%
%    \end{macrocode}
% Also need to call the style init code, to set the defaults for options
% \texttt{numwidth} and \texttt{indent}.
%    \begin{macrocode}
    \begingroup
      \let\scr@dte@current\tb@nt@type
      \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
      \def\do@endgroup{\endgroup}%
      \def\do##1{%
        \Ifstr{##1}{numwidth}{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro{\tb@nt@tocstyle@options}{,numwidth=1.5em}%
          }%
        }{%
          \Ifstr{##1}{indent}{%
%<trace>\typeout{TRACE \string\DeclareNewTOC[...]{#2}: set default indent 1em}%
            \l@addto@macro\do@endgroup{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,indent=1em}%
            }%
          }{}%
        }%
        \kernel@ifnextchar[%]
          {\@dodefault}%
          {}%
      }%
      \def\@dodefault[##1]{}%
      \scr@dte@doopts
    \do@endgroup
  }{%
    \let\tb@nt@extra@relax@opts\@empty
%    \end{macrocode}
% After initialisation of the local values we need to know the style of the
% toc entry, to define style dependend options.
% \begin{macro}{\tb@nt@type}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% The type of list is used for environment and counter names and as part of
% several internal and user macros. It is needed before defining the style
% dependend options. So we use a first run to set it up.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{type}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@type{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@tocentrystyle}
% \changes{v3.20}{2015/12/16}{neu (intern)}
% The style of the toc entry. It is needed before defining the style
% dependend options. So we use a first run to set it up.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}[default]{%
      \IfArgIsEmpty{##1}{%
        \edef\tb@nt@tocentrystyle{##1}%
        \FamilyKeyStateProcessed
      }{%
        \scr@ifundefinedorrelax{scr@dte@def@l@##1}{%
          \FamilyKeyStateUnknownValue
        }{%
          \edef\tb@nt@tocentrystyle{##1}%
          \FamilyKeyStateProcessed
        }%
      }%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@ext}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% \changes{v3.25}{2017/11/20}{moved to pass 1}%^^A
% Don't tell the user, that the mandatory argument of the command may be
% overloaded by this option. This was only done to simplify the definition.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@ext{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@owner}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% \changes{v3.26}{2018/06/09}{moved to pass 1}%^^A
% \changes{v3.27}{2019/05/12}{\texttt{category} is a synonym for
%   \texttt{owner}}%^^A
% The owner of the new list extension.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{owner}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% After this we define pseudo option \texttt{@else@} to ignore all currently
% not needed options. After this we do the first option execution run.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{@else@}{\FamilyKeyStateProcessed}%
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{@else@}%
%    \end{macrocode}
% \changes{v3.26}{2018/06/09}{add extension already after first pass}%^^A
% First of all, every TOC needs an extension, that should be added to the
% list of known extensions. This has to be done also, if no options has been
% given!
%    \begin{macrocode}
  }%
  \expandafter\newcommand\csname ext@\tb@nt@type\endcsname{}%
  \expandafter\let\csname ext@\tb@nt@type\endcsname\tb@nt@ext
  \addtotoclist[\tb@nt@owner]{\csname ext@\tb@nt@type\endcsname}%
  \IfArgIsEmpty{#1}{}{%
%    \end{macrocode}
% For the second option pass we do not need to set up these options
% again. So define it as no-opt.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{type}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{\FamilyKeyStateProcessed}%
%    \end{macrocode}
% \changes{v3.20}{2015/12/16}{defining toc style depending options}%^^A
% \changes{v3.20}{2016/06/12}{using prefix \texttt{tocentry} instead of
%     \texttt{toc}}%^^A
% \changes{v3.27}{2019/10/02}{additional \texttt{:}-options}%^^A
% If the toc style is empty we won't define any \cs{l@\dots}. Otherwise we
% need to define additional options.
%    \begin{macrocode}
    \Ifstr{\tb@nt@tocentrystyle}{}{}{%
      \begingroup
        \let\scr@dte@current\tb@nt@type
        \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
        \def\do@endgroup{\endgroup}%
        \def\do##1{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro\tb@nt@extra@relax@opts{%
              \RelaxFamilyKey[.toc]{KOMAarg}{toc##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1:}%
            }%
          }%
          \kernel@ifnextchar[%]
            {\@dodefault{##1}}%
            {\@donodefault{##1}}%
        }%
        \def\@donodefault##1{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \def\@dodefault##1[##2]{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}[##2]{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}[##2]{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \scr@dte@doopts
      \do@endgroup
    }%
%    \end{macrocode}
% After this, we need to define all the other options and do the real option
% execution.
% \begin{macro}{\tb@nt@atbegin}
% \changes{v3.09}{2011/03/01}{new optional identifier \texttt{atbegin}}%^^A
% \changes{v3.11c}{2013/02/01}{\texttt{atbegin} argument may be empty}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Additional code executed at the begin of a new defined environment.
%    \begin{macrocode}
    \FamilyStringKey[.toc]{KOMAarg}{atbegin}{\tb@nt@atbegin}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@atend}
% \changes{v3.09}{2011/03/01}{new optional identifier \texttt{atbend}}%^^A
% \changes{v3.11c}{2013/02/01}{\texttt{atend} argument may be empty}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Additional code executed at the end of a new defined environment.
%    \begin{macrocode}
    \FamilyStringKey[.toc]{KOMAarg}{atend}{\tb@nt@atend}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@counterwithin}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% If a counter will be defined, this counter may depend on another counter
% (like figure counter depends on chapter counter at book classes). If the
% value is empty, the counter does not depend on any other counter.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{counterwithin}{%
      \edef\tb@nt@counterwithin{##1}\FamilyKeyStateProcessed
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\iftb@nt@float}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% \changes{v3.06}{2010/06/01}{new internal}%^^A
% This boolean indicates, that float environments should also be defined.
%    \begin{macrocode}
    \FamilyBoolKey[.toc]{KOMAarg}{float}{tb@nt@float}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@floatpos}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Simply the value for the |\fps@...| macro.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{floatpos}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@floatpos{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@floattype}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Simply the value for the |\ftype@...| macro. It has to be
% $1<=\textrm{value}<=31$.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{floattype}{%
      \FamilySetCounterMacro{KOMAarg}{floattype}{\reserved@d}{##1}%
      \ifx\FamilyKeyState\FamilyKeyStateProcessed
        \ifnum 0=
          \ifnum\reserved@d<1 0 \else\ifnum\reserved@d>31 0 \else 1 \fi\fi
          \FamilyKeyStateUnknownValue
        \else
          \let\tb@nt@floattype\reserved@d
        \fi
      \fi
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\iftb@nt@forcenames}
% \changes{v3.06}{2010/06/01}{new internal}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% The |\...name| commands will only be defined, if they are not already
% defined. But some users may want to define their own names even if there
% are already definitions. So this boolean option may switch to force the
% definition.
%    \begin{macrocode}
    \FamilyBoolKey[.toc]{KOMAarg}{forcenames}{tb@nt@forcenames}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@hang}
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Earch entry of a TOC/list of is idented on the left side. This is the
% amount of the indention of the text of the entry.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{hang}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `numwidth'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          You should replace option `hang' by option\MessageBreak
          `tocentrynumwidth'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,numwidth={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{}{%
      \l@addto@macro\tb@nt@tocstyle@options{,numwidth=1.5em}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@indent}
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Earch entry of a TOC/list of is idented on the left side. This is the
% amount of the indention of the number part.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{indent}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `indent'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          You should replace option `indent' by option\MessageBreak
          `tocentryindent'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,indent={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{}{%
%<trace>\typeout{TRACE \string\DeclareNewTOC[...]{#2}: set default indent 1em}%
      \l@addto@macro\tb@nt@tocstyle@options{,indent=1em}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@level}
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% \changes{v3.30}{2020/02/25}{spurious space in warning message removed}%^^A
% Each entry to a TOC/list of has a numeric level. You may set up your own
% level.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{level}{%
      \PackageWarning{tocbasic}{%
        deprecated option `level'.\MessageBreak
        You should replace option `level' by option\MessageBreak
        `tocentrylevel'%
      }%
      \l@addto@macro\tb@nt@tocstyle@options{,level={##1}}%
      \FamilyKeyStateProcessed
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@listname}
% \changes{v3.18}{2015/06/20}{using \cs{def} instead of \cs{edef}}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% The list itself has a heading. A |\list<type>name| will also be defined.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{listname}{%
      \tb@ifvalueisnotempty{##1}{\def\tb@nt@listname{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@name}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% We need a name/term for the entries of the new list. This may e.\,g. be used
% for |caption| output. A |\<type>name| will also be defined.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{name}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@name{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\iftb@nt@nonfloat}
% \changes{v3.06}{2010/06/01}{new (internal)}%^^A
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% This boolean indicates, that non-float environment should also be
% defined. The environment has the postfix ``-''.
%    \begin{macrocode}
    \FamilyBoolKey[.toc]{KOMAarg}{nonfloat}{tb@nt@nonfloat}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@nt@types}
% \changes{v3.20}{2015/12/16}{local valid only}%^^A
% Sometimes the plural of the type is needed and may be defined by a
% seperate option.
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{types}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@types{##1}}%
    }%
%    \end{macrocode}
% \end{macro}
% \changes{v3.25}{2017/11/20}{new (internal)}%^^A
% The new option \texttt{setup} allowes to setup ToC features provided by
% \cs{setuptoc}. Note, currently there is no test whether or not a feature
% does exist!
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{setup}{%
      \setuptoc\tb@nt@ext{##1}%
    }%
%    \end{macrocode}
% \changes{v3.25}{2017/11/20}{new (internal)}%^^A
% The new option \texttt{unset} allowes to unset ToC features provided
% by \cs{unsettoc}. Note, currently there is no test whether or not a
% feature does exist!
%    \begin{macrocode}
    \DefineFamilyKey[.toc]{KOMAarg}{unset}{%
      \unsettoc\tb@nt@ext{##1}%
    }%
%    \end{macrocode}
% Last but not least we have to execute the options and reset the option
% definitions.
% \changes{v3.25}{2017/09/27}{\texttt{nonfloat} fixed}%^^A
% \changes{v3.26}{2018/06/09}{added missing reset of \texttt{unset} and
%   \texttt{setup}}%^^A
%    \begin{macrocode}
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{unset}%
    \RelaxFamilyKey[.toc]{KOMAarg}{setup}%
    \RelaxFamilyKey[.toc]{KOMAarg}{types}%
    \RelaxFamilyKey[.toc]{KOMAarg}{nonfloat}%
    \RelaxFamilyKey[.toc]{KOMAarg}{name}%
    \RelaxFamilyKey[.toc]{KOMAarg}{listname}%
    \RelaxFamilyKey[.toc]{KOMAarg}{level}%
    \RelaxFamilyKey[.toc]{KOMAarg}{indent}%
    \RelaxFamilyKey[.toc]{KOMAarg}{hang}%
    \RelaxFamilyKey[.toc]{KOMAarg}{forcenames}%
    \RelaxFamilyKey[.toc]{KOMAarg}{floatpos}%
    \RelaxFamilyKey[.toc]{KOMAarg}{float}%
    \RelaxFamilyKey[.toc]{KOMAarg}{counterwithin}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atend}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atbegin}%
    \tb@nt@extra@relax@opts
    \RelaxFamilyKey[.toc]{KOMAarg}{category}%
    \RelaxFamilyKey[.toc]{KOMAarg}{owner}%
    \RelaxFamilyKey[.toc]{KOMAarg}{extension}%
    \RelaxFamilyKey[.toc]{KOMAarg}{tocentrystyle}%
    \RelaxFamilyKey[.toc]{KOMAarg}{type}%
  }%
%    \end{macrocode}
% We save the type of the extension at \cs{tb@nt@type@\meta{extension}}
% for later usage.
%    \begin{macrocode}
  \expandafter\let\csname tb@nt@type@\tb@nt@ext\endcsname\tb@nt@type
%    \end{macrocode}
% Then we need the TOC itself with a name:
% \changes{v3.25}{2017/10/10}{use \cs{ext@\dots} instead of the extension
%   itself in definition of \cs{listof\dots}}%^^A
%    \begin{macrocode}
  \scr@ifundefinedorrelax{tb@nt@types}{%
    \edef\tb@nt@types{\tb@nt@type s}%
  }{}%
  \scr@ifundefinedorrelax{tb@nt@listname}{%
    \protected@edef\tb@nt@listname{List of \protect\MakeUppercase\tb@nt@types}%
  }{}%
  \@ifundefined{\tb@nt@type name}{%
    \expandafter\protected@edef\csname \tb@nt@type name\endcsname{\tb@nt@name}%
  }{%
    \iftb@nt@forcenames
      \expandafter\protected@edef\csname \tb@nt@type name\endcsname
      {\tb@nt@name}%
    \fi
  }%
  \@ifundefined{list\tb@nt@type name}{%
    \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
  }{%
    \iftb@nt@forcenames
      \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
    \fi
  }%
  \expandafter\newcommand\csname listof\tb@nt@ext name\expandafter\endcsname
    \expandafter{\csname list\tb@nt@type name\endcsname}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname listof\tb@nt@types\endcsname{%
      \noexpand\listoftoc{%
        \expandafter\noexpand\csname ext@\tb@nt@type\endcsname}%
    }%
  }\@tempa
%    \end{macrocode}
% The list entry:
% \changes{v3.20}{2016/04/05}{warning if \cs{l@\dots} is undefined}%^^A
%    \begin{macrocode}
  \Ifstr{\tb@nt@tocentrystyle}{}{%
    \@ifundefined{l@\tb@nt@type}{%
      \PackageWarning{tocbasic}{%
        \expandafter\string\csname l@\tb@nt@type\endcsname\space
        undefined!\MessageBreak
        I hope you know, what you are doing, but\MessageBreak
        maybe it would be better to use proper\MessageBreak
        `tocentrystyle' settings%
      }%
    }{}%
  }{%
    \edef\reserved@a{%
      \noexpand\DeclareTOCStyleEntry[%
        {\unexpanded\expandafter{\tb@nt@tocstyle@options}}%
      ]{\tb@nt@tocentrystyle}{\tb@nt@type}%
    }%
    \reserved@a
  }%
%    \end{macrocode}
% \changes{v3.12}{2013/05/03}{fixed: definition of
%   \cs{listof\meta{type}entryname} added as explained in the manual}%^^A
%    \begin{macrocode}
  \@ifundefined{listof\tb@nt@ext entryname}{%
    \expandafter\let\csname listof\tb@nt@ext entryname\endcsname\tb@nt@name
  }{}%
%    \end{macrocode}
% The setup command:
%    \begin{macrocode}
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname setup\tb@nt@types\endcsname{%
      \noexpand\setuptoc{\tb@nt@ext}%
    }%
  }\@tempa
  \@tempswafalse
%    \end{macrocode}
% The float environments:
% \changes{v3.09a}{2011/05/30}{fixed: floats may have an optional argument}%^^A
% \changes{v3.12}{2013/12/10}{fixed: usage of default placement}%^^A
%    \begin{macrocode}
  \iftb@nt@float
    \expandafter\newcommand\expandafter*\csname fps@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floatpos}%
    \expandafter\newcommand\expandafter*\csname ftype@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floattype}%
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@float{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@float{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@float
        }%
        \noexpand\newenvironment{\tb@nt@type*}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@dblfloat{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@dblfloat{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@dblfloat
        }%
      }%
    \@tempa
    \@tempswatrue
  \fi
%    \end{macrocode}
% The nonfloat environment:
%    \begin{macrocode}
  \iftb@nt@nonfloat
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type-}{%
          \noexpand\trivlist\noexpand\item\noexpand\relax
          \noexpand\minipage{\noexpand\linewidth}%
          \noexpand\def\noexpand\@captype{\tb@nt@type}%
          \noexpand\csname \tb@nt@type @atbegin\noexpand\endcsname
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\endminipage\noexpand\endtrivlist
        }%
      }%
    \@tempa
    \@tempswatrue
  \fi
%    \end{macrocode}
% The counter and hooks of float and nonfloat environments:
% \changes{v3.10b}{2012/04/04}{\cs{noexpand} added to fix problems using
%   \cs{autodot}}%^^A
% \changes{v3.13}{2014/07/31}{add \cs{autodot} only to hierachical
%   counters}%^^A
%    \begin{macrocode}
  \if@tempswa
    \@ifundefined{c@\tb@nt@type}{%
      \newcounter{\tb@nt@type}%
    }{%
      \PackageWarning{tocbasic}{using already defined counter `\tb@nt@type'}%
    }%
    \ifx\tb@nt@counterwithin\@empty\else
      \@addtoreset{\tb@nt@type}{\tb@nt@counterwithin}%
      \begingroup\edef\@tempa{%
        \noexpand\endgroup
        \noexpand\renewcommand*\expandafter\noexpand
        \csname the\tb@nt@type\endcsname{%
          \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
          .\noexpand\arabic{\tb@nt@type}%
        }%
      }\@tempa
    \fi
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newcommand*\expandafter\noexpand
        \csname \tb@nt@type format\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type name\endcsname
          \noexpand\nobreakspace
          \expandafter\noexpand\csname the\tb@nt@type\endcsname
          \ifx\tb@nt@counterwithin\@empty\else
            \noexpand\csname autodot\endcsname
          \fi
        }%
        \noexpand\newcommand*\expandafter\noexpand
        \csname fnum@\tb@nt@type\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type format\endcsname
        }%
      }%
    \@tempa
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atbegin\expandafter
    \endcsname\expandafter{\tb@nt@atbegin}%
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atend\expandafter
    \endcsname\expandafter{\tb@nt@atend}%
  \fi
}
%    \end{macrocode}
% \begin{macro}{\tb@atbegin@after}
% \changes{v3.09a}{2011/05/30}{new internal}%^^A
% Processes command \#1 with argument \#2 and optional argument \#3 and than
% \verb|\csname #2@atbegin\endcsname|. This is used to add
% \verb|csname #2@atbegin\endcsname| at begin part of a float (but after
% optional argument of the float).
%    \begin{macrocode}
\newcommand*{\tb@atbegin@after}[3]{}
\def\tb@atbegin@after#1#2[#3]{%
  #1{#2}[#3]%
  \csname #2@atbegin\endcsname
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@ifvalueisnotempty}
% \changes{v3.06}{2010/05/21}{new internal}%^^A
% \changes{v3.20}{2015/12/16}{simpler definition}%^^A
% \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
% This is only a helper for defining some of the keys.
%    \begin{macrocode}
\newcommand*{\tb@ifvalueisnotempty}[1]{%
  \Ifstr{#1}{}{%
    \FamilyKeyStateUnknownValue
    \expandafter\@gobble
  }{%
    \FamilyKeyStateProcessed
    \expandafter\@firstofone
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\tb@boolkey}
% \changes{v3.06}{2010/05/21}{new (internal)}%^^A
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \end{macro}
% \begin{macro}{\tb@dimkey}
% \changes{v3.06}{2010/05/21}{new (internal)}%^^A
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \end{macro}
% \begin{macro}{\tb@numkey}
% \changes{v3.06}{2010/05/21}{new internal}%
% \changes{v3.20}{2015/12/16}{undefined}%^^A
% \end{macro}
% \begin{macro}{\tb@nt@autofloattype}
% \changes{v3.06}{2010/06/01}{new internal}%^^A
% This macro saves the float type for auto generated float types.
%    \begin{macrocode}
\newcommand*{\tb@nt@autofloattype}{16}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \iffalse
%</package>
%<*load>
% Used at \KOMAScript{} packages and classes to load the package.
%    \begin{macrocode}
\RequirePackage{tocbasic}[%
%!KOMAScriptVersion
]
%    \end{macrocode}
%</load>
% \fi
%
% \Finale
%
\endinput
%
% end of file `tocbasic.dtx'
%%% Local Variables:
%%% mode: doctex
%%% coding: utf-8
%%% TeX-master: t
%%% End: