summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/koma-script/tocstyle.sty
blob: e6adcb7539fa36f12e6ad5567d4d46a5642e4139 (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
%%
%% This is file `tocstyle.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tocstyle.dtx  (with options: `package,trace,tocstyle')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2007-2019 by Markus Kohm <komascript(at)gmx.info>
%% 
%% This file was generated from file(s) of the 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 file may only be distributed together with the file
%% `tocstyle.dtx' and `scrlogo.dtx'. You may however distribute the files
%% `tocstyle.dtx' and `scrlogo.dtx' without this file.
%% 
%% The english manual is in `tocstyle.dtx', too.
%% 
%% THIS IS AN OBSOLETE PACKAGE! YOU SHOULD NOT USE IT!
%% 
%%% From File: $Id: tocstyle.dtx 3249 2019-10-09 11:35:26Z kohm $
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{tocstyle}
  [2019/10/09 v0.2j-alpha deprecated package (versatile toc styles)]
\PackageWarningNoLine{tocstyle}{%
  THIS IS A DEPRECATED ALPHA VERSION!\MessageBreak
  USAGE OF THIS VERSION IS ON YOUR OWN RISK!\MessageBreak
  EVERYTHING MAY HAPPEN!\MessageBreak
  THE PACKAGE IS FROZEN WITH ALL IT'S BUGS!\MessageBreak
  IT WILL BE REMOVED FROM KOMA-SCRIPT SOON!\MessageBreak
  THERE IS NO SUPPORT, IF YOU USE THIS PACKAGE!\MessageBreak
  Maybe it would be better, not to load this package%
}
\newif\if@tocstyle@penalties
\newif\iftocstyle@autolength
\newif\iftocstyle@indentnotnumbered
\newcount\tocstyle@indentstyle\tocstyle@indentstyle=\z@
\newcommand*{\selecttocstyleoption}[1]{%
  \begingroup
    \edef\@tempa{#1}%
    \edef\@tempb{tocbreaksstrict}%
    \ifx\@tempa\@tempb\aftergroup\@tocstyle@penaltiestrue\else
      \edef\@tempb{tocbreakscareless}%
      \ifx\@tempa\@tempb\aftergroup\@tocstyle@penaltiesfalse\else
        \edef\@tempb{tocindentauto}
        \ifx\@tempa\@tempb\aftergroup\tocstyle@autolengthtrue\else
          \edef\@tempb{tocindentmanual}%
          \ifx\@tempa\@tempb\aftergroup\tocstyle@autolengthfalse\else
            \edef\@tempb{tocgraduated}%
            \ifx\@tempa\@tempb
              \aftergroup\tocstyle@indentstyle\aftergroup\z@
            \else
              \edef\@tempb{tocflat}%
              \ifx\@tempa\@tempb
                \aftergroup\tocstyle@indentstyle\aftergroup\@ne
                \aftergroup\relax
              \else
                \edef\@tempb{tocfullflat}%
                \ifx\@tempa\@tempb
                  \aftergroup\tocstyle@indentstyle\aftergroup\tw@
                  \aftergroup\relax
                \else
                  \edef\@tempb{toctextentriesindented}%
                  \ifx\@tempa\@tempb\aftergroup\tocstyle@indentnotnumberedtrue
                  \else
                    \edef\@tempb{toctextentriesleft}%
                    \ifx\@tempa\@tempb
                      \aftergroup\tocstyle@indentnotnumberedfalse
                    \else
                      \PackageError{tocstyle}{unknown option `#1'}{%
                        You've told me to select toc style option
                        `#1',\MessageBreak
                        but tocstyle doesn't know an option named `#1'}%
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \endgroup
}
\newif\iftochaschapter\tochaschapterfalse
\ifcsname l@chapter\endcsname
  \ifcsname chapter\endcsname
    \tochaschaptertrue
  \fi
\fi
\DeclareOption{tocbreaksstrict}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocbreakscareless}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocindentauto}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocindentmanual}{\selecttocstyleoption\CurrentOption}
\DeclareOption{toctextentriesindented}{\selecttocstyleoption\CurrentOption}
\DeclareOption{toctextentriesleft}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocgraduated}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocflat}{\selecttocstyleoption\CurrentOption}
\DeclareOption{tocfullflat}{\selecttocstyleoption\CurrentOption}
\ExecuteOptions{tocbreaksstrict,tocindentauto,tocgraduated,%
  toctextentriesleft}
\ProcessOptions\relax
\ifcsname if@tocleft\endcsname
  \expandafter\let\csname if@tempswa\expandafter\endcsname
  \csname if@tocleft\endcsname
\else
  \@tempswafalse
\fi
\if@tempswa
  \PackageWarningNoLine{tocstyle}{%
    You should not use class option `toc=flat'!\MessageBreak
    This may result in errors or unexpected results.\MessageBreak
    I'll try to deactivate `toc=flat', now.\MessageBreak
    You may use package options `tocflat' and\MessageBreak
    `tocindentauto' instead of `toc=flat'}%
  \csname @tocleftfalse\endcsname
\fi
\newcommand*\tocstyle@saved@starttoc{}
\let\tocstyle@saved@starttoc\@starttoc
\renewcommand*{\@starttoc}[1]{%
  \tocstyle@pre@starttoc{#1}%
  \tocstyle@saved@starttoc{#1}%
  \tocstyle@post@starttoc{#1}%
}
\newcommand*{\tocstyle@saved@dottedtocline}{}
\newcommand*{\tocstyle@dottedtocline}[5]{%
  \let\numberline\tocstyle@numberline
  \ifnum #1>\c@tocdepth \else
    \if@tocstyle@penalties
      \begingroup
        \@tempcnta 20010
        \advance \@tempcnta by -#1
        \ifnum \@tempcnta>\lastpenalty
          \aftergroup\penalty\aftergroup\@lowpenalty
        \fi
      \endgroup
    \fi
    \edef\tocstyledepth{#1}%
    \tocstyle@activate@features
    \ifx\tocstyle@feature@entryvskip\relax
      \vskip \z@ \@plus.2\p@
    \else
      \addvspace{\tocstyle@feature@entryvskip}%
    \fi
    {%
      \parskip \z@ \parindent \z@ \leftskip \z@ \rightskip \z@
      \tocstyle@feature@raggedhook
      \@tempdima #3\relax
      \@tempdimb #2\relax
      \typeout{number indent by \string\l@... (\tocstyleTOC, \tocstyledepth): \space\the\@tempdimb}%
      \typeout{text indent by \string\l@... (\tocstyleTOC, \tocstyledepth): \space\the\@tempdima}%
      \ifnum #1>\z@\relax
        \@tempcnta #1\relax \advance\@tempcnta \m@ne
        \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
          \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname
            \@tempdimb
            \csname tocstyle@maxskipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
            \advance\@tempdimb
            \csname tocstyle@maxnumwidth@\tocstyleTOC @\the\@tempcnta\endcsname
          \fi
        \fi
      \fi
      \typeout{number indent by parent (\tocstyleTOC, \tocstyledepth): \space\the\@tempdimb}%
      \ifcsname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname
        \ifdim \@tempdimb>
        \csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname\relax
          \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
          @#1\endcsname{\the\@tempdimb}%
        \fi
      \else
        \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
        @#1\endcsname{\the\@tempdimb}%
      \fi
      \iftocstyle@autolength
        \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
          \@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
          \relax
        \fi
        \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
          \@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
          \relax
        \fi
        \typeout{text indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
        \typeout{number indent calculated (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
      \else
        \@tempdimb #2\relax
        \typeout{number indent explicite (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
      \fi
      \ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname
        \ifdim \@tempdima>
        \csname tocstyle@unumwidth@\tocstyleTOC @\endcsname\relax
          \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
          @\endcsname{\the\@tempdima}%
        \fi
      \else
        \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
        @\endcsname{\the\@tempdima}%
      \fi
      \ifcase\tocstyle@indentstyle\relax\else
        \@tempdimb \z@
        \ifcsname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
          \@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
          \relax
        \fi
        \typeout{text noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
        \typeout{number noindent (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
      \fi
      \advance\parindent \@tempdimb\@afterindenttrue
      \advance\leftskip \parindent
      \advance\rightskip \@tocrmarg
      \parfillskip -\rightskip
      \ifx\tocstyle@feature@parfillskip\relax\else
        \advance\parfillskip \tocstyle@feature@parfillskip\relax
      \fi
      \interlinepenalty\@M
      \leavevmode
      \advance\leftskip \@tempdima
      \null\nobreak
      \iftocstyle@indentnotnumbered\else
        \hskip -\leftskip
      \fi
      \tocstyle@feature@entryhook
      {#4}\nobreak
      \ifx\tocstyle@feature@leaders\relax
        \leaders\hbox{$\m@th
          \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
          \mkern \@dotsep mu$}\hfill
      \else
        \tocstyle@feature@leaders
      \fi
      \nobreak
      \ifx\tocstyle@feature@pagenumberbox\relax
      \hb@xt@\@pnumwidth{\hfil\tocstyle@feature@pagenumberhook #5%
        \kern-\p@\kern\p@}%
      \else
        \tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5%
        \kern-\p@\kern\p@}%
      \fi
      \par
    }%
    \if@tocstyle@penalties
      \bgroup
        \@tempcnta 20009
        \advance\@tempcnta by -#1
        \edef\reserved@a{\egroup\penalty\the\@tempcnta\relax}%
      \reserved@a
    \fi
  \fi}
\newcommand*{\tocstyle@saved@numberline}{}
\newcommand*{\tocstyle@numberline}[1]{%
  \begingroup
    \ifx\tocstyle@feature@spaceafternumber\relax
      \settowidth\@tempdima{\tocstyle@@numberline{#1}\enskip}%
    \else
      \settowidth\@tempdima{\tocstyle@@numberline{#1}}%
      \advance \@tempdima \tocstyle@feature@spaceafternumber\relax
    \fi
    \ifcsname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname
      \ifdim \@tempdima >
      \csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname\relax
        \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
        @\tocstyledepth\endcsname{\the\@tempdima}%
      \fi
    \else
      \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
      @\tocstyledepth\endcsname{\the\@tempdima}%
    \fi
  \endgroup
  \iftocstyle@indentnotnumbered
    \hskip -\leftskip
  \fi
  \ifcase \tocstyle@indentstyle
    \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
  \or
    \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
  \else
    \ifx\tocstyle@feature@spaceafternumber\relax
      \hbox{\tocstyle@@numberline{#1}\enskip}%
    \else
      \hbox{\tocstyle@@numberline{#1}\hskip
        \tocstyle@feature@spaceafternumber\relax}%
    \fi
  \fi
}
\newcommand*{\tocstyle@@numberline}[1]{%
  #1\csname autodot\endcsname
}
\AtBeginDocument{%
  \@ifpackageloaded{tocbasic}{%
    \@ifpackagelater{tocbasic}{2016/03/01}{%
      \PackageWarningNoLine{tocstyle}{%
        Usage of `tocstyle' with new `tocbasic' detected.\MessageBreak
        This is not an error! You can do this.\MessageBreak
        Nevertheless, you should note, combining `tocstyle'\MessageBreak
        with this version of `tocbasic' will break several\MessageBreak
        features of `tocbasic'. You should use `tocstyle'\MessageBreak
        features instead of `tocbasic' attributes for all\MessageBreak
        entry changes you want.\MessageBreak
        You may also get additional warnings because of\MessageBreak
        redefined `\string\numberline'. Ignore them}%
    }{}%
  }{}%
  \@ifpackageloaded{etoc}{%
    \PackageWarningNoLine{tocstyle}{%
      Usage of `tocstyle' with `etoc' detected.\MessageBreak
      I suggest to use either `tocstyle' or `etoc'\MessageBreak
      but not both of them together}%
  }{}%
  \@ifpackageloaded{titletoc}{%
    \PackageWarningNoLine{tocstyle}{%
      Usage of `tocstyle' with `titletoc' detected.\MessageBreak
      I suggest to use either `tocstyle' or `titletoc'\MessageBreak
      but not both of them together. I expect even\MessageBreak
      error messages because of this combination}%
  }{}%
  \def\tocstyle@test@level{-1}%
  \def\tocstyle@test@levelname{part}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \ifnum\tocstyle@test@level<\z@
    \def\tocstyle@test@level{0}%
  \fi
  \def\tocstyle@test@levelname{chapter}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \ifnum\tocstyle@test@level<\@ne
    \def\tocstyle@test@level{1}%
  \fi
  \def\tocstyle@test@levelname{section}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \def\tocstyle@test@levelname{paragraph}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \def\tocstyle@test@level{1}%
  \def\tocstyle@test@levelname{table}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \def\tocstyle@test@level{1}%
  \def\tocstyle@test@levelname{figure}%
  \@whilesw\ifcsname l@\tocstyle@test@levelname\endcsname\fi{%
    \setbox\@tempboxa\vbox{\hsize\maxdimen
      \let\normalcolor\relax
      \let\color\@gobble
      \edef\reserved@a{%
        \expandafter\noexpand\csname l@\tocstyle@test@levelname\endcsname{%
          \noexpand\tocstyle@l@define{\tocstyle@test@levelname}%
                                     {\tocstyle@test@level}%
        }{}%
      }%
      \reserved@a
    }%
    \edef\tocstyle@test@levelname{sub\tocstyle@test@levelname}%
    \edef\tocstyle@test@level{\the\numexpr\tocstyle@test@level+1}%
  }%
  \def\@tempa#1#2#3#4#5{%
    \ifnum #1>\c@tocdepth \else
      \vskip \z@ \@plus.2\p@
      {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
       \parindent #2\relax\@afterindenttrue
       \interlinepenalty\@M
       \leavevmode
       \@tempdima #3\relax
       \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
       {#4}\nobreak
       \leaders\hbox{$\m@th
          \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
          mu$}\hfill
       \nobreak
       \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5}%
       \par}%
    \fi}%
  \ifx\@dottedtocline\@tempa\else
    \def\@tempa#1#2#3#4#5{%
      \ifnum #1>\c@tocdepth \else
        \vskip \z@ \@plus.2\p@
        {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
         \parindent #2\relax\@afterindenttrue
         \interlinepenalty\@M
         \leavevmode
         \@tempdima #3\relax
         \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
         {#4}\nobreak
         \leaders\hbox{$\m@th
            \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
            mu$}\hfill
         \nobreak
         \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5\kern-\p@\kern\p@}%
         \par}%
      \fi}%
    \ifx\@dottedtocline\@tempa\else
      \tocstyle@macrochangewarning\@dottedtocline
    \fi
  \fi
  \let\tocstyle@saved@dottedtocline\@dottedtocline
  \def\@tempa#1{\hb@xt@\@tempdima{#1\autodot\hfil}}%
  \ifx\numberline\@tempa\else
    \def\@tempa#1{\hb@xt@\@tempdima{#1\hfil}}%
    \ifx\numberline@tempa\else
      \tocstyle@macrochangewarning\numberline
    \fi
  \fi
  \let\tocstyle@saved@numberline\numberline
}
\newcommand*{\tocstyle@macrochangewarning}[1]{%
  \PackageWarningNoLine{tocstyle}{%
    unexpected \string#1\space definition!\MessageBreak
    You are either using an unknown LaTeX kernel\MessageBreak
    version, an unknown class or package, that redefines\MessageBreak
    \string#1, or a \string#1\space
    redefinition\MessageBreak
    at the document preamble.\MessageBreak
    Because of this you may get unexpected results!\MessageBreak
    Maybe it would be better not to use package tocstyle}%
  \PackageInfo{tocstyle}{Unexpected definition is:\MessageBreak
    \meaning#1}%
}
\newcommand*{\tocstyle@activate@all@l}{}
\newcommand*{\tocstyle@l@define}[2]{%
  \advance\leftskip-\@tempdima
  \edef\@tempa{%
    \noexpand\global\noexpand\let
    \expandafter\noexpand\csname tocstyle@saved@l@#1\endcsname
    \expandafter\noexpand\csname l@#1\endcsname
    \noexpand\gdef
    \expandafter\noexpand\csname tocstyle@l@#1\endcsname{%
      \noexpand\@dottedtocline{#2}{\the\leftskip}{\the\@tempdima}}%
    \noexpand\g@addto@macro\noexpand\tocstyle@activate@all@l{%
      \noexpand\let\expandafter\noexpand\csname l@#1\endcsname
      \expandafter\noexpand\csname tocstyle@l@#1\endcsname
    }%
  }%
  \PackageInfo{tocstyle}{prepare \expandafter\string
    \csname l@#1\endcsname\space for redefinition}%
  \@tempa
}
\newcommand*{\showtoc}[2][\aliastoc\tocstyleTOC\tocstyleAliasTOC]{%
  \ifcsname tocstyle@copyname@#2\endcsname
    \@tempcnta \csname tocstyle@copyname@#2\endcsname\relax
    \advance\@tempcnta \@ne
    \expandafter\xdef\csname tocstyle@copyname@#2\endcsname{\the\@tempcnta}%
  \else
    \expandafter\xdef\csname tocstyle@copyname@#2\endcsname{1}%
  \fi
  \ifx\@dofilelist\relax\let\@dofilelist\@empty\fi
  \edef\@tempa{\noexpand\g@addto@macro\noexpand\@dofilelist{%
      \noexpand\tocstyle@copy@toc{#2}{\csname
        tocstyle@copyname@#2\endcsname}}%
  }\@tempa%
  \begingroup
    \edef\tocstyleAliasTOC{#2}%
    \edef\tocstyleTOC{#2\csname tocstyle@copyname@#2\endcsname}%
    #1
    \tocstyle@pre@starttoc{#2\csname tocstyle@copyname@#2\endcsname}%
    \makeatletter
    \@input{\jobname.#2\csname tocstyle@copyname@#2\endcsname}%
    \@nobreakfalse
    \tocstyle@post@starttoc{#2\csname tocstyle@copyname@#2\endcsname}%
  \endgroup
}
\newcommand*{\tocstyle@copy@toc}[2]{%
  \if@filesw
    \begingroup
      \endlinechar=\m@ne
      \immediate\closeout\csname tf@#1\endcsname
      \immediate\openin\@inputcheck \jobname.#1
      \immediate\openout\@partaux \jobname.#1#2
      \loop\unless\ifeof\@inputcheck
        \immediate\readline\@inputcheck to \@tempa
        \immediate\write\@partaux{\@tempa}%
      \repeat
      \immediate\closeout\@partaux
      \immediate\closein\@inputcheck
    \endgroup
  \fi
}
\newcommand*{\aliastoc}[2]{%
  \expandafter\edef\csname tocstyle@alias@TOC@#1\endcsname{#2}%
}
\newcommand*{\tocstyle@pre@starttoc}[1]{%
  \begingroup
    \expandafter\ifx\csname tocstyle@deactivated@\endcsname\relax
      \expandafter\ifx\csname tocstyle@deactivated@#1\endcsname\relax\relax
        \tocstyle@activetrue
      \else
        \tocstyle@activefalse
      \fi
    \else
      \tocstyle@activefalse
    \fi
    \iftocstyle@active
      \let\@dottedtocline\tocstyle@dottedtocline
      \parskip \z@
      \parindent \z@
      \parfillskip \z@\@plus 1fil
      \ifcsname tocstyle@alias@TOC@#1\endcsname
        \edef\tocstyleAliasTOC{\csname tocstyle@alias@TOC@#1\endcsname}%
      \else
        \edef\tocstyleAliasTOC{#1}%
      \fi
      \edef\tocstyleTOC{#1}%
      \tocstyle@activate@all@l
    \fi
}
\newcommand*{\tocstyle@post@starttoc}[1]{%
    \iftocstyle@active
      \if@filesw
        \ifcsname tocstyle@unumwidth@#1@\endcsname
          \protected@write\@auxout{}{%
            \protect\tocstyle@set@width{unum}{#1}{}{%
              \csname tocstyle@unumwidth@#1@\endcsname}%
          }%
        \fi
        \expandafter\let\expandafter\@tempa
          \csname tocstyle@depthlist@#1\endcsname
        \ifx\@tempa\relax\else
          \expandafter\@for \expandafter\@tempa\expandafter:\expandafter=\@tempa
          \do {%
            \ifcsname tocstyle@numwidth@#1@\@tempa\endcsname
              \protected@write\@auxout{}{%
                \protect\tocstyle@set@width{num}{#1}{\@tempa}{%
                  \csname tocstyle@numwidth@#1@\@tempa\endcsname}%
              }%
            \fi
            \ifcsname tocstyle@skipwidth@#1@\@tempa\endcsname
              \protected@write\@auxout{}{%
                \protect\tocstyle@set@width{skip}{#1}{\@tempa}{%
                  \csname tocstyle@skipwidth@#1@\@tempa\endcsname}%
              }%
            \fi
          }%
        \fi
      \fi
    \fi
  \endgroup
}
\newcommand*{\tocstyle@set@width}[4]{%
  \iftocstyle@indentnotnumbered
    \ifdim #4<\z@
      \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{%
        \dimexpr #4/2\relax}%
    \else
      \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#4}%
    \fi
  \else
    \ifdim #4<\z@
      \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{\z@}%
    \else
      \expandafter\gdef\csname tocstyle@max#1width@#2@#3\endcsname{#4}%
    \fi
  \fi
}
\AtBeginDocument{%
  \if@filesw
    \immediate\write\@auxout{%
      \string\providecommand*\string\tocstyle@set@width[4]{}%
    }%
  \fi
}
\newcommand*{\tocstyleTOC}{}
\newcommand*{\tocstyleAliasTOC}{}
\newcommand*{\tocstyledepth}{}
\newif\iftocstyle@active
\newcommand*{\deactivatetocstyle}[1][]{%
  \expandafter\let\csname tocstyle@deactivated@#1\endcsname\@empty}
\newcommand*{\reactivatetocstyle}[1][]{%
  \expandafter\let\csname tocstyle@deactivated@#1\endcsname\relax}
\newcommand*{\@settocfeature}[1][]{%
  \kernel@ifnextchar[ {\@@settocfeature[{#1}]}{\@@settocfeature[{#1}][]}
}
\def\@@settocfeature[#1][#2]#3#4{%
  \typeout{exclude: \tocstyle@feature@excludelist}%
  \@expandtwoargs\in@{,#3,}{,\tocstyle@feature@excludelist,}%
  \ifin@\else
    \expandafter\ifcsname tocstyle@feature@#3\endcsname
      \@namedef{tocstyle@feature@#3@#1@#2}{#4}%
      \begingroup
        \expandafter\let\expandafter\@tempa
        \csname tocstyle@commandlist@#1\endcsname
        \@expandtwoargs\in@{,tocstyle@feature@#3@#1@#2,}{,\@tempa,}%
        \ifin@\let\@tempa\endgroup\else
          \edef\@tempa{\endgroup
            \noexpand\expandafter\noexpand\ifx
            \noexpand\csname tocstyle@commandlist@#1\noexpand\endcsname\relax
              \noexpand\expandafter\noexpand\expandafter\noexpand\expandafter
              \noexpand\def
            \noexpand\else
              \noexpand\expandafter\noexpand\expandafter\noexpand\expandafter
              \noexpand\l@addto@macro
            \noexpand\fi
            \noexpand\csname tocstyle@commandlist@#1\noexpand\endcsname%
            {tocstyle@feature@#3@#1@#2,}}%
        \fi
      \@tempa
    \else
      \PackageError{tocstyle}{unkown feature `#3'}{%
        You've told me to set up toc style feature `#3',\MessageBreak
        but I don't know this feature.\MessageBreak
        See the tocstyle manual for all known feature.\MessageBreak
      }%
    \fi
  \fi
}
\newcommand*{\settocfeature}{}
\let\settocfeature\@settocfeature
\providecommand{\l@addto@macro}[2]{%
  \edef#1{\unexpanded\expandafter{#1#2}}%
}%
\newcommand*{\@settocstylefeature}{%
  \kernel@ifnextchar[ {\@settocfeature[]}{\@settocfeature[][]}%
}
\newcommand*{\settocstylefeature}{}
\let\settocstylefeature\@settocstylefeature
\newcommand*{\tocstyle@activate@features}{%
  \expandafter\ifx\csname tocstyle@depthlist@\tocstyleTOC\endcsname\relax
    \expandafter\xdef\csname tocstyle@depthlist@\tocstyleTOC\endcsname{%
      \tocstyledepth}%
  \else
    \expandafter\let\expandafter\@tempa
    \csname tocstyle@depthlist@\tocstyleTOC\endcsname
    \@expandtwoargs\in@{,\tocstyledepth,}{,\@tempa,}%
    \ifin@\else
      \expandafter\xdef\csname tocstyle@depthlist@\tocstyleTOC\endcsname{%
        \csname tocstyle@depthlist@\tocstyleTOC\endcsname,\tocstyledepth}%
    \fi
  \fi
  \expandafter\@for \expandafter\@tempa
  \expandafter:\expandafter=\tocstyle@featurelist \do
  {%
    \@ifundefined{tocstyle@feature@\@tempa @\tocstyleAliasTOC @\tocstyledepth}{%
      \@ifundefined{tocstyle@feature@\@tempa @@\tocstyledepth}{%
        \@ifundefined{tocstyle@feature@\@tempa @\tocstyleAliasTOC @}{%
          \@ifundefined{tocstyle@feature@\@tempa @@}{%
            \expandafter\let\csname tocstyle@feature@\@tempa\endcsname\relax
          }{%
            \expandafter\let\csname tocstyle@feature@\@tempa
            \expandafter\endcsname
            \csname tocstyle@feature@\@tempa @@\endcsname
          }%
        }{%
          \expandafter\let\csname tocstyle@feature@\@tempa
          \expandafter\endcsname
          \csname tocstyle@feature@\@tempa @\tocstyleAliasTOC @\endcsname
        }%
      }{%
        \expandafter\let\csname tocstyle@feature@\@tempa
        \expandafter\endcsname
        \csname tocstyle@feature@\@tempa @@\tocstyledepth\endcsname
      }%
    }{%
      \expandafter\let\csname tocstyle@feature@\@tempa
      \expandafter\endcsname
      \csname tocstyle@feature@\@tempa @\tocstyleAliasTOC @\tocstyledepth\endcsname
    }%
  }%
}
\newcommand*{\newtocstyle}{%
  \kernel@ifnextchar [{\@newtocstyle}{\@newtocstyle[]}}
\newcommand*{\@newtocstyle}{}
\def\@newtocstyle[#1]{%
  \kernel@ifnextchar [{\@@newtocstyle[{#1}]}{\@newtocstyle[{#1}][]}}
\newcommand*{\@@newtocstyle}{}
\def\@@newtocstyle[#1][#2]#3#4{%
  \@ifundefined{tocstyle@style@#3}{%
    \@ifundefined{tocstyle@style@#1}{%
      \ifx \relax#1\relax\else
        \PackageError{tocstyle}{unknown parent TOC style `#1'}{%
          You've told me to inheritate parent TOC style `#1',\MessageBreak
          but there's no TOC style `#1' defined.}%
      \fi
      \expandafter\def\csname tocstyle@style@#3\endcsname{#4}%
    }{%
      \expandafter\def\csname tocstyle@style@#3\endcsname{%
        \edef\reserved@a{%
          \noexpand\l@addto@macro\noexpand\tocstyle@feature@excludelist{#2}%
          \noexpand\@usetocstyle{#1}%
          \noexpand\def\noexpand\tocstyle@feature@excludelist{%
            \tocstyle@feature@excludelist}%
        }\reserved@a
        #4%
      }%
    }%
  }{%
    \PackageError{tocstyle}{TOC style `#3' already defined}{%
      You've tried to define a new TOC style `#3',\MessageBreak
      but there's already a TOC style named `#3'.}%
  }%
}
\newcommand*{\tocstyle@feature@excludelist}{}
\newcommand*{\usetocstyle}[2][]{%
  \@ifundefined{tocstyle@deprecated@style@#2}{%
    \@ifundefined{tocstyle@style@#2}{%
      \PackageError{tocstyle}{unknown TOC style `#2'}{%
        You've told me to use TOC style `#2',\MessageBreak
        but there's no TOC style `#2' defined.}%
    }{%
      \def\settocfeature{%
        \kernel@ifnextchar[ %]
        {\@@settocfeature[{#1}]}{\@@settocfeature[{#1}][]}%
      }%
      \let\settocstylefeature\settocfeature
      \expandafter\ifx\csname tocstyle@commandlist@#1\endcsname\relax
      \else
        \expandafter\expandafter\expandafter\@for
        \expandafter\expandafter\expandafter\@tempa
        \expandafter\expandafter\expandafter:%
        \expandafter\expandafter\expandafter=%
        \csname tocstyle@commandlist@#1\endcsname
        \do{%
          \expandafter\let\csname \@tempa\endcsname\relax
        }%
        \expandafter\let\csname tocstyle@commandlist@#1\endcsname\relax
      \fi
      \@usetocstyle{#2}%
      \let\settocfeature\@settocfeature
      \let\settocstylefeature\@settocstylefeature
    }%
  }{%
    \expandafter\ifx\csname tocstyle@deprecated@style@#2\endcsname\@empty
      \PackageWarning{tocstyle}{%
        deprecated TOC style `#2'!\MessageBreak
        You should not longer use this style,\MessageBreak
        because it will be removed soon.\MessageBreak
        You should select another TOC style}%
      \usetocstyle[{#1}]{deprecated@#2}%
    \else
      \PackageWarning{tocstyle}{%
        deprecated TOC style `#2'!\MessageBreak
        You should use TOC style '\csname
        tocstyle@deprecated@style@#2\endcsname'\MessageBreak
        instead of `#2'}%
    \fi
  }%
}
\newcommand*{\@usetocstyle}[1]{%
  \csname tocstyle@style@#1\endcsname
}
\newcommand*{\tocstyle@featurelist}{%
  pagenumberhook,entryhook,dothook,entryvskip,leaders,raggedhook,%
  spaceafternumber,parfillskip,pagenumberbox,%
}
\newcommand*{\tocstyle@feature@pagenumberhook}{}
\let\tocstyle@feature@pagenumberhook\relax
\newcommand*{\tocstyle@feature@pagenumberbox}{}
\let\tocstyle@feature@pagenumberbox\relax
\newcommand*{\tocstye@feature@entryhook}{}
\let\tocstyle@feature@entryhook\relax
\newcommand*{\tocstye@feature@dothook}{}
\let\tocstyle@feature@dothook\relax
\newcommand*{\tocstye@feature@entryvskip}{}
\let\tocstyle@feature@entryvskip\relax
\newcommand*{\tocstye@feature@leaders}{}
\let\tocstyle@feature@leaders\relax
\newcommand*{\tocstye@feature@parfillskip}{}
\let\tocstyle@feature@parfillskip\relax
\newcommand*{\tocstye@feature@raggedhook}{}
\let\tocstyle@feature@raggedhook\relax
\newcommand*{\tocstye@feature@spaceafternumber}{}
\let\tocstyle@feature@spaceafternumber\relax
\newcommand*{\iftochasdepth}[2]{%
  \begingroup
    \expandafter\let\expandafter\@tempa\csname tocstyle@depthlist@#1\endcsname
    \ifx\@tempa\relax
      \aftergroup\@secondoftwo
    \else
      \@expandtwoargs\in@{,#2,}{,\@tempa}%
      \expandafter\aftergroup\ifin@
        \@firstoftwo
      \else
        \@secondoftwo
      \fi
    \fi
  \endgroup
}
\providecommand*{\ext@toc}{toc}
\newtocstyle{standard}{%
  \settocfeature{dothook}{\normalfont}%
  \settocfeature[-1]{entryhook}{\bfseries}%
  \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}%
  \settocfeature[-1]{leaders}{\hfill}%
  \settocfeature[0]{entryvskip}{1em\@plus\p@}%
  \settocfeature[0]{leaders}{\hfill}%
  \settocfeature[0]{entryhook}{\bfseries}
  \iftochaschapter\else
    \settocfeature[1]{entryvskip}{1em\@plus\p@}%
    \settocfeature[1]{leaders}{\hfill}%
    \settocfeature[1]{entryhook}{%
      \ifx\tocstyleAliasTOC\ext@toc\bfseries\fi
    }%
  \fi
}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname KOMAClassName\endcsname\relax
  \newtocstyle{KOMAlike}{%
    \settocfeature{dothook}{\normalfont}%
    \settocfeature[-1]{entryhook}{\sffamily\bfseries}%
    \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}%
    \settocfeature[-1]{leaders}{\hfill}%
    \settocfeature[-1]{pagenumberhook}{\sffamily\bfseries}%
    \settocfeature[0]{entryvskip}{1em\@plus\p@}%
    \settocfeature[0]{leaders}{\hfill}%
    \settocfeature[0]{entryhook}{\sffamily\bfseries}
    \settocfeature[0]{pagenumberhook}{\sffamily\bfseries}%
    \iftochaschapter\else
      \settocfeature[1]{entryvskip}{1em\@plus\p@}%
      \settocfeature[1]{leaders}{\hfill}%
      \settocfeature[1]{entryhook}{%
        \ifx\tocstyleAliasTOC\ext@toc\sffamily\bfseries\fi
      }%
      \settocfeature[1]{pagenumberhook}{%
        \ifx\tocstyleAliasTOC\ext@toc\sffamily\bfseries\fi
      }%
    \fi
  }
\else
  \newtocstyle{KOMAlike}{%
    \settocfeature{dothook}{\normalfont}%
    \settocfeature[-1]{entryhook}{\usekomafont{partentry}}%
    \settocfeature[-1]{entryvskip}{2.25em\@plus\p@}%
    \settocfeature[-1]{leaders}{\hfill}%
    \settocfeature[-1]{pagenumberhook}{\usekomafont{partentrypagenumber}}%
    \settocfeature[0]{entryvskip}{1em\@plus\p@}%
    \settocfeature[0]{leaders}{\hfill}%
    \settocfeature[0]{entryhook}{\usekomafont{chapterentry}}%
    \settocfeature[0]{pagenumberhook}{\usekomafont{chapterentrypagenumber}}%
    \iftochaschapter\else
      \settocfeature[1]{entryvskip}{1em\@plus\p@}%
      \settocfeature[1]{leaders}{\hfill}%
      \settocfeature[1]{entryhook}{%
        \begingroup
          \ifx\tocstyleAliasTOC\ext@toc
            \def\@tempa{\endgroup\usekomafont{sectionentry}}%
          \else
            \let\@tempa\endgroup
          \fi
        \@tempa
      }%
      \settocfeature[1]{pagenumberhook}{%
        \begingroup
          \ifx\tocstyleAliasTOC\ext@toc
            \def\@tempa{\endgroup\usekomafont{sectionentrypagenumber}}%
          \else
            \let\@tempa\endgroup
          \fi
        \@tempa
      }%
    \fi
  }
\fi
\newcommand*{\tocstyle@deprecated@style@KOMAScript}{KOMAlike}%
\newtocstyle[KOMAlike]{classic}{%
  \settocfeature[-1]{pagenumberhook}{\normalfont\normalcolor}%
  \settocfeature[0]{pagenumberhook}{\normalfont\normalcolor}%
  \iftochaschapter\else
    \settocfeature[1]{pagenumberhook}{\normalfont\normalcolor}%
  \fi
  \settocfeature{pagenumberhook}{\normalfont\normalcolor}%
  \settocfeature{raggedhook}{\raggedright}%
}
\newtocstyle[classic][leaders]{allwithdot}{}
\newtocstyle[allwithdot]{noonewithdot}{%
  \settocfeature{leaders}{\hfill}%
}
\newtocstyle[classic][leaders]{nopagecolumn}{%
  \settocfeature{leaders}{\quad}%
  \settocfeature{parfillskip}{\z@ plus 1fil}%
  \settocfeature{pagenumberbox}{\hbox}%
}
\InputIfFileExists{tocstyle.cfg}{%
  \PackageInfo{tocstyle}{using tocstyle.cfg}%
}{%
  \PackageInfo{tocstyle}{no tocstyle.cfg found}%
}
%%% From File: $Id: scrlogo.dtx 2640 2017-05-08 09:36:55Z kohm $
\@ifundefined{KOMAScript}{%
  \DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
      M\kern.05em A\kern.1em-\kern.1em Script}}}{}
\endinput
%%
%% End of file `tocstyle.sty'.