summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/tocbasic.sty
blob: 2a782c7d57088bf798ab2fca3206bb79cbeaa3d2 (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
%%
%% This is file `tocbasic.sty',
%% generated with the docstrip utility, extended by scrdocstrip.
%%
%% The original source files were:
%%
%% tocbasic.dtx  (with options: `package')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2008-2013 Markus Kohm [komascript at gmx info]
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% It may be distributed under the conditions of the
%% LaTeX Project Public License in the version distributed together
%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
%% 
%% This file may only be distributed together with a copy of the
%% KOMA-Script bundle.  You may however distribute the
%% KOMA-Script bundle without all such generated files.  See also
%% `lppl.txt' or `lppl-de.txt' for additional information.
%% 
%% The list of files belonging to KOMA-Script distribution is given in
%% the file `manifest.txt'.  See also `lppl.txt' or `lppl-de.txt' for
%% additional information.
%% 
%% If this file is a beta version, you may not be allowed to distribute
%% it.  Look at the comments below to see if this is the case.
%% 
%% English and German manuals are part of KOMA-Script bundle.
%% ----------------------------------------------------------
%% 
%% See `README'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.  You may
%% find a complete unmodified copy of LaTeX2e at
%% <http://www.ctan.org/pub/tex-archive/macros/latex/base/>.
%% 
%%% From File: $Id: tocbasic.dtx 1533 2013-12-10 18:06:14Z mjk $
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{tocbasic}[%
  2013/12/19 v3.12 KOMA-Script
  package
  (handling toc-files)%
]
\ProcessOptions\relax
\RequirePackage{keyval}
\newcommand*{\tb@listoftocs}{}
\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
}
\newcommand*{\addtotoclist}{%
  \@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
  }%
}
\newcommand*{\AtAddToTocList}{%
  \@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
}
\newcommand*{\tocbasic@extend@babel}[1]{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \ifx\csname bbl@set@language\endcsname\relax
    \PackageInfo{tocbasic}{babel extension for `#1' omitted\MessageBreak
      because of missing \string\bbl@set@language}%
  \else
    \iftocfeature{#1}{nobabel}{%
      \PackageInfo{tocbasic}{omitting babel extension for `#1'\MessageBreak
        because of feature `nobabel' available\MessageBreak
        for `#1'}%
    }{%
      \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}}%
      }%
    }%
  \fi
}
\AtAddToTocList[]{\expandafter\tocbasic@extend@babel\expandafter{\@currext}}
\newcommand*{\removefromtoclist}{%
  \@ifnextchar [%]
    \@removefromtoclist\@@removefromtoclist
}
\newcommand*{\@removefromtoclist}[2][]{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
        \begingroup
          \edef\reserved@a{##2}%
          \edef\reserved@b{#1}%
          \ifx\reserved@a\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}\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
\newcommand*{\@@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}\let\tb@listoftocs\@empty
    \tb@oldlist
  \endgroup
}
\newcommand{\doforeachtocfile}{%
  \@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
}
\newcommand{\addtoeachtocfile}{%
  \@ifnextchar [%]
    \@addtoeachtocfile\@@addtoeachtocfile
}
\newcommand{\@addtoeachtocfile}[2][]{%
  \doforeachtocfile[{#1}]{\addtocontents{\@currext}{#2}}%
}
\newcommand{\@@addtoeachtocfile}[1]{%
  \doforeachtocfile{\addtocontents{\@currext}{#1}}%
}
\newcommand{\addcontentslinetoeachtocfile}{%
  \@ifnextchar [%]
    \@addcontentslinetoeachtocfile\@@addcontentslinetoeachtocfile
}
\newcommand{\@addcontentslinetoeachtocfile}[3][]{%
  \doforeachtocfile[{#1}]{\addcontentsline{\@currext}{#2}{#3}}%
}
\newcommand{\@@addcontentslinetoeachtocfile}[2]{%
  \doforeachtocfile{\addcontentsline{\@currext}{#1}{#2}}%
}
\newcommand*{\addxcontentsline}[2]{%
  \@ifnextchar [%]
  {\@addxcontentsline{#1}{#2}}%
  {\@addxcontentsline{#1}{#2}[]}%
}
\newcommand*{\@addxcontentsline}{}
\def\@addxcontentsline#1#2[#3]#4{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname add#2#1entry\endcsname\relax
    \tocbasic@addxcontentsline{#1}{#2}{#3}{#4}%
  \else
    \@nameuse{add#2#1entry}{#3}{#4}%
  \fi
}
\newcommand*{\nonumberline}{}%
\newcommand*{\tocbasic@addxcontentsline}[4]{%
  \if\relax\detokenize{#3}\relax
    \addcontentsline{#1}{#2}{\protect\nonumberline#4}%
  \else
    \addcontentsline{#1}{#2}{\protect\numberline{#3}#4}%
  \fi
}
\newcommand{\addxcontentslinetoeachtocfile}{%
  \@ifnextchar [%]
    \@addxcontentslinetoeachtocfile\@@addxcontentslinetoeachtocfile
}
\newcommand{\@addxcontentslinetoeachtocfile}[2][]{%
  \@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]{%
  \@ifnextchar [%]
    {\@@@@addxcontentslinetoeachtocfile{#1}}%
    {\@@@@addxcontentslinetoeachtocfile{#1}[]}%
}
\newcommand*{\@@@@addxcontentslinetoeachtocfile}{}
\def\@@@@addxcontentslinetoeachtocfile#1[#2]#3{%
  \doforeachtocfile{\addxcontentsline{\@currext}{#1}[{#2}]{#3}}%
}
\newcommand*{\tocbasic@starttoc}[1]{%
  \begingroup
    \setlength{\parskip}{\z@}%
    \setlength{\parindent}{\z@}%
    \setlength{\parfillskip}{\z@\@plus 1fil}%
    \edef\@currext{#1}%
    \csname tocbasic@@before@hook\endcsname
    \csname tb@#1@before@hook\endcsname
    \@starttoc{#1}%
    \csname tb@#1@after@hook\endcsname
    \csname tocbasic@@after@hook\endcsname
  \endgroup
}
\newcommand*{\tocbasic@@before@hook}{}
\newcommand*{\tocbasic@@after@hook}{}
\newcommand{\BeforeStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@before@hook{#2}%
  \else
    \@ifundefined{tb@#1@before@hook}{%
      \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}{%
      \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
}
\newcommand*{\listoftoc}{%
  \@ifstar \tocbasic@starttoc\@listoftoc
}
\newcommand*{\@listoftoc}[2][\list@fname]{%
  \begingroup
    \@ifundefined{listof#2name}{%
      \let\list@fname\relax
      \ifx\relax#1\relax
        \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{}}}{}%
    \tocbasic@listhead{#1}%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname microtypesetup\endcsname\relax
    \else
      \iftocfeature{\@currext}{noprotrusion}{}{%
        \microtypesetup{protrusion=false}%
        \PackageInfo{tocbasic}{character protrusion at \@currext\space deactivated}%
      }%
    \fi
    \tocbasic@starttoc{#2}%
  \endgroup
}
\newcommand*{\listofname}{List of}
\newcommand*{\listofeachtoc}{%
  \@ifnextchar [%]
    \@listofeachtoc\@@listofeachtoc
}
\newcommand{\@listofeachtoc}[1][]{%
  \doforeachtocfile[{#1}]{\listoftoc{\@currext}}%
}
\newcommand{\@@listofeachtoc}[1]{%
  \doforeachtocfile{\listoftoc{\@currext}}%
}
\newcommand*{\tocbasic@listhead}[1]{%
  \@ifundefined{tocbasic@listhead@\@currext}{%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname chapter\endcsname\relax
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \iftocfeature{\@currext}{leveldown}{%
          \iftocfeature{\@currext}{numbered}{%
            \subsection[##1]{##1}%
          }{%
            \subsection*{##1}%
            \ifx\@mkboth\@gobbletwo\else\markright{\MakeMarkcase{##1}}\fi
            \iftocfeature{\@currext}{totoc}{%
              \addxcontentsline{toc}{subsection}{##1}%
            }{}%
          }%
        }{%
          \iftocfeature{\@currext}{numbered}{%
            \section[##1]{##1}%
          }{%
            \section*{##1}%
            \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
            \iftocfeature{\@currext}{totoc}{%
              \addxcontentsline{toc}{section}{##1}%
            }{}%
          }%
        }%
      }%
    \else
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \iftocfeature{\@currext}{leveldown}{%
          \iftocfeature{\@currext}{numbered}{%
            \section{##1}%
          }{%
            \section*{##1}%
            \iftocfeature{\@currext}{totoc}{%
              \addxcontentsline{toc}{section}{##1}%
            }{}%
            \ifx\@mkboth\@gobbletwo\else\markright{\MakeMarkcase{##1}}\fi
          }%
        }{%
          \iftocfeature{\@currext}{numbered}{%
            \chapter[##1]{##1}%
          }{%
            \chapter*{##1}%
            \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
            \iftocfeature{\@currext}{totoc}{%
              \addxcontentsline{toc}{chapter}{##1}%
            }{}%
          }%
        }%
      }%
    \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
}
\newcommand{\BeforeTOCHead}[2][]{%
  \@ifundefined{tb@#1@beforehead@hook}{%
    \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}{%
    \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}%
}
\AtBeginDocument{%
  \@ifundefined{MakeMarkcase}{%
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname KOMAClassName\endcsname\relax
      \let\MakeMarkcase\MakeUppercase
    \else
      \let\MakeMarkcase\@firstofone
    \fi
  }{}%
}
\newcommand*{\deftocheading}[1]{%
  \@namedef{tocbasic@listhead@#1}##1}
\newcommand*{\setuptoc}[2]{%
  \@for\@tempa:=#2\do{%
    \expandafter\tb@@sp@def\expandafter\@tempa\expandafter{\@tempa}%
    \@namedef{tocbasic@#1@feature@\@tempa}{}%
  }%
}
\newcommand*{\unsettoc}[2]{%
  \@for\@tempa:=#2\do{%
    \expandafter\tb@@sp@def\expandafter\@tempa\expandafter{\@tempa}%
    \expandafter\let\csname tocbasic@#1@feature@\@tempa\endcsname\relax
  }%
}
\def\@tempa#1{%
  \def\tb@@sp@def##1##2{%
    \futurelet\tb@sp@tempa\tb@@sp@d##2\@nil\@nil#1\@nil\relax##1}%
  \def\tb@@sp@d{%
    \ifx\tb@sp@tempa\@sptoken
      \expandafter\tb@@sp@b
    \else
      \expandafter\tb@@sp@b\expandafter#1%
    \fi}%
  \def\tb@@sp@b#1##1 \@nil{\tb@@sp@c##1}%
}
\@tempa{ }
\def\tb@@sp@c#1\@nil#2\relax#3{\@temptokena{#1}\edef#3{\the\@temptokena}}
\setuptoc{toc}{nobabel}
\setuptoc{lof}{nobabel}
\setuptoc{lot}{nobabel}
\newcommand*{\iftocfeature}[2]{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname tocbasic@#1@feature@#2\endcsname\relax
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi
}
\newcommand*{\tocbasicautomode}{%
  \let\tb@saved@starttoc\@starttoc
  \let\@starttoc\tocbasic@starttoc
  \BeforeStartingTOC{%
    \let\@starttoc\tb@saved@starttoc
    \expandafter\ifattoclist\expandafter{\@currext}{}{%
      \addtotoclist[tocbasicautomode]{\@currext}%
    }%
  }%
}
\define@key{tocbasic}{type}{%
  \tb@ifvalueisnotempty{type}{#1}{\edef\tb@nt@type{#1}}%
}
\define@key{tocbasic}{counterwithin}{%
  \edef\tb@nt@counterwithin{#1}%
}
\define@key{tocbasic}{types}{%
  \tb@ifvalueisnotempty{types}{#1}{\edef\tb@nt@types{#1}}%
}
\define@key{tocbasic}{extension}{%
  \tb@ifvalueisnotempty{extension}{#1}{\edef\tb@nt@ext{#1}}%
}
\define@key{tocbasic}{owner}{%
  \tb@ifvalueisnotempty{owner}{#1}{\edef\tb@nt@owner{#1}}%
}
\define@key{tocbasic}{name}{%
  \tb@ifvalueisnotempty{name}{#1}{\edef\tb@nt@name{#1}}%
}
\define@key{tocbasic}{listname}{%
  \tb@ifvalueisnotempty{listname}{#1}{\edef\tb@nt@listname{#1}}%
}
\newif\iftb@forcenames
\define@key{tocbasic}{forcenames}[true]{%
  \lowercase{\tb@boolkey{#1}}{forcenames}%
}
\define@key{tocbasic}{level}{%
  \tb@ifvalueisnotempty{level}{#1}{\tb@numkey\tb@nt@level{#1}}%
}
\define@key{tocbasic}{indent}{%
  \tb@ifvalueisnotempty{indent}{#1}{\tb@dimkey\tb@nt@indent{#1}}%
}
\define@key{tocbasic}{hang}{%
  \tb@ifvalueisnotempty{hang}{#1}{\tb@dimkey\tb@nt@hang{#1}}%
}
\newif\iftb@float
\define@key{tocbasic}{float}[true]{%
  \lowercase{\tb@boolkey{#1}}{float}%
}
\newif\iftb@nonfloat
\define@key{tocbasic}{nonfloat}[true]{%
  \lowercase{\tb@boolkey{#1}}{nonfloat}%
}
\define@key{tocbasic}{floattype}{%
  \tb@ifvalueisnotempty{floattype}{#1}{\tb@numkey\tb@nt@floattype{#1}}%
}
\define@key{tocbasic}{floatpos}{%
  \tb@ifvalueisnotempty{floatpos}{#1}{\edef\tb@nt@floatpos{#1}}%
}
\define@key{tocbasic}{atbegin}{%
  \def\tb@nt@atbegin{#1}%
}
\define@key{tocbasic}{atend}{%
  \def\tb@nt@atend{#1}%
}
\newcommand*{\DeclareNewTOC}[2][]{%
  \tb@floatfalse
  \tb@nonfloatfalse
  \tb@forcenamesfalse
  \def\tb@nt@floattype{\tb@nt@autofloattype}%
  \def\tb@nt@floatpos{tbp}%
  \def\tb@nt@ext{#2}%
  \def\tb@nt@type{#2}%
  \def\tb@nt@types{\tb@nt@type s}%
  \def\tb@nt@owner{float}%
  \def\tb@nt@name{\expandafter\MakeUppercase\tb@nt@type}%
  \def\tb@nt@listname{List of \expandafter\MakeUppercase\tb@nt@types}%
  \def\tb@nt@level{1}%
  \def\tb@nt@indent{1em}%
  \def\tb@nt@hang{1.5em}%
  \let\tb@nt@counterwithin\@empty
  \let\tb@nt@atbegin\@empty
  \let\tb@nt@atend\@empty
  \setkeys{tocbasic}{#1}%
  \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}%
  \@ifundefined{\tb@nt@type name}{%
    \expandafter\let\csname \tb@nt@type name\endcsname\tb@nt@name
  }{%
    \iftb@forcenames
      \expandafter\let\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@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{\tb@nt@ext}%
    }%
  }\@tempa
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname l@\tb@nt@type\endcsname{%
      \noexpand\@dottedtocline{\tb@nt@level}{\tb@nt@indent}{\tb@nt@hang}%
    }%
  }\@tempa
  \@ifundefined{listof\tb@nt@ext entryname}{%
    \expandafter\let\csname listof\tb@nt@ext entryname\endcsname\tb@nt@name
  }{}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname setup\tb@nt@types\endcsname{%
      \noexpand\setuptoc{\tb@nt@ext}%
    }%
  }\@tempa
  \@tempswafalse
  \iftb@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\@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\@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
  \iftb@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
  \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
          \noexpand\csname autodot\endcsname
        }%
        \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
}
\newcommand*{\tb@atbegin@after}[3]{}
\def\tb@atbegin@after#1#2[#3]{%
  #1{#2}[#3]%
  \csname #2@atbegin\endcsname
}
\newcommand*{\tb@ifvalueisnotempty}[2]{%
  \begingroup
    \edef\@tempa{#2}\ifx\@tempa\@empty
      \PackageError{tocbasic}{empty value for key `#1'}{%
        The argument of key `#1' may not by empty!}%
      \aftergroup\@gobble
    \else
      \aftergroup\@firstofone
    \fi
  \endgroup
}
\newcommand*{\tb@boolkey}[2]{%
  \csname tb@#2\ifx\relax#1\relax true\else#1\fi\endcsname
}
\newcommand*{\tb@dimkey}[2]{%
  \begingroup
    \@defaultunits\@tempdima#2pt\relax\@nnil
    \edef\@tempa{\noexpand\endgroup\noexpand\def\noexpand#1{\the\@tempdima}}
  \@tempa
}
\newcommand*{\tb@numkey}[2]{%
  \begingroup
    \afterassignment\remove@to@nnil\@tempcnta#2\relax\@nnil
    \edef\@tempa{\noexpand\endgroup\noexpand\def\noexpand#1{\the\@tempcnta}}
  \@tempa
}
\newcommand*{\tb@nt@autofloattype}{16}
%%% From File: $Id: scrlogo.dtx 1380 2013-10-01 15:31:55Z mjk $
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `tocbasic.sty'.