-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrkernel-tocstyle.dtx
More file actions
2832 lines (2832 loc) · 110 KB
/
scrkernel-tocstyle.dtx
File metadata and controls
2832 lines (2832 loc) · 110 KB
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
% \iffalse meta-comment
% ======================================================================
% ======================================================================
%
% This is a modified version of scrkernel-tocstyle.dtx, explicitly
% permitted by Markus Kohm. Maintainer of this modified version is
% Marei Peischl.
%
% This file is based on revision 4120 of the repository:
% https://sourceforge.net/p/koma-script/.
% The copyright notice below is left unchanged to simplify
% the integration of this project into KOMA-Script
%
% ======================================================================
% ======================================================================
% scrkernel-tocstyle.dtx
% Copyright (c) Markus Kohm, 2015-2023
%
% 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.md.
% ======================================================================
%%% From File: $Id: scrkernel-tocstyle.dtx 4060 2023-06-20 08:59:01Z kohm $
% The runs of run-time file generation:
%<preidentify>%%% (run: preidentify)
% - everything that is needed before selfidentification of resulting files
% (unused)
%<identify>%%% (run: identify)
% - everything that is needed for selfidentification of resulting files
% (unused)
%<prepare>%%% (run: prepare)
% - everything that is needed to define options
%<option>%%% (run: option)
% - definition of options (unused)
%<execoption>%%% (run: execoption)
% - initial option executions up to \KOMAProcessOptions
% (unused)
%<body>%%% (run: body)
% - everything, that should be done after \KOMAProcessOptions
%<exit>%%% (run: exit)
% - everything, that should be done immediately before leaving the file
% (unused)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
\filedate$Date: 2023-06-20 10:59:01 +0200 (Tue, 20 Jun 2023) $
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
\filerevision$Revision: 4060 $
\edef\reserved@a{%
\noexpand\endgroup
\noexpand\ProvidesFile{scrkernel-tocstyle.dtx}%
[\filedate\space\filerevision\space
KOMA-Script source (TOC styles)]
}%
\reserved@a
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\setcounter{StandardModuleDepth}{3}
\begin{document}
\DocInput{scrkernel-tocstyle.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v3.20}{2015/11/13}{new}
% \changes{v3.36}{2022/02/14}{switch over from \cls*{scrdoc} to
% \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/14}{whole implementation documentation in English}
% \changes{v3.40}{2023/04/17}{guide names changed}
%
% \GetFileInfo{scrkernel-tocstyle.dtx}
% \title{The Predifined Directory Styles of
% \href{https://komascript.de}{\KOMAScript} Package \pkg*{tocbasic} and the
% \href{https://komascript.de}{\KOMAScript} Classes}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
% \file{scrkernel-tocstyle.dtx} provides the predefined directory (or ToC)
% styles. The basic styles of \pkg*{tocbasic} are defined independent from
% the \KOMAScript{} classes. However, the \KOMAScript{} classes define their
% own styles depending on the styles of \pkg*{tocbasic}.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user documentation the commands implemented here in the
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
% English \file{scrguide-en.pdf}.
%
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of the Basic ToC Styles of Package
% \pkg*{tocbasic} and the Specific ToC Styles of the \KOMAScript{} classes}
%
% \subsection{Settings independent from directories but nevertheless basis for
% them}
%
% Before \KOMAScript~3.20 the commands here were part of the \KOMAScript{}
% classes. But now they are part of package \pkg*{tocbasic}, because they
% are more basic than only to be used by the \KOMAScript{} classes.
%
%
% \begin{command}{\numberline}
% \changes{v3.20}{2016/03/10}{\cs{numberline} defined indirectly by
% \cs{scr@numberline}}
% \begin{macro}{\scr@numberline}
% \changes{v2.3c}{1995/08/06}{\cs{numberline} redefined}
% \changes{v3.06}{2010/05/18}{Usage of\cs{numberline@prefix} and
% \cs{numberline@postfix}}
% \changes{v3.12}{2013/11/22}{use \cs{numberline@numberformat} only, if the
% argument expands to a non-empty string}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}}
% This macro is used indirectly in the ToC and has to be redefined to fulfil
% rules~5 and 6 of DUDDEN, 20th edition.
% \begin{macrocode}
%<*tagging-lab>
%<@@=scrlab>
%</tagging-lab>
%<*package&(body|tagging-lab)>
%<!tagging-lab>\newcommand*{\scr@numberline}[1]{%
%<tagging-lab>\newcommand*{\_@@_scr@numberline}[1]{%
\numberline@box{%
%<tagging-lab|tagging> \UseHookWithArguments{contentsline/number/before}{1}{#1}%
\numberline@prefix
\Ifstr{#1}{}{#1}{%
\numberline@numberformat{#1}%
}%
\numberline@postfix
%<tagging-lab|tagging> \UseHookWithArguments{contentsline/number/after}{1}{#1}%
}%
}
% \end{macrocode}
% \begin{command}{\usetocbasicnumberline}
% \changes{v3.20}{2016/03/15}{added}
% The macro tests, whether \cs{numberline} used \cs{scr@numberline}. If not,
% the optional argument is executed and a afterwards \cs{numberline} is
% redefined.
% \begin{macrocode}
%<tagging-lab>\cs_new:Npn \_@@_usetocbasicnumberline [ #1 ]{%
%<*!tagging-lab>
\newcommand*{\usetocbasicnumberline}[1][%
\PackageInfo{tocbasic}{Using my definition of `\string\numberline'}%
]{%
%</!tagging-lab>
% \end{macrocode}
% tagging: \SuspendTagging does not exist before |begin{document}|
% TODO: ask if theres a better option otherwhise we have to check if the command exists for the main version of KOMA-Script.
% \begin{macrocode}
%<tagging-lab> \tag_stop:n {toc/tocline-measure}
\@tempswatrue
\begingroup
\def\scr@numberline##1{\global\@tempswafalse}%
% \end{macrocode}
% For \cs{numberline} \cs{@tempdima} usually is the width reserved for the
% number. To avoid problems with to low values, we use the maximum value for
% the test.
% \begin{macrocode}
\@tempdima\maxdimen
\sbox\@tempboxa{\numberline{0}}%
\endgroup
\if@tempswa #1\renewcommand*{\numberline}[1]{\scr@numberline{##1}}\fi
%<tagging-lab> \tag_start:n {toc/tocline-measure}
}
%</package&(body|tagging-lab)>
%<*package&body>
% \end{macrocode}
% \end{command}^^A \usetocbasicnumberline
% \begin{macro}{\numberline@prefix}
% \changes{v3.06}{2010/05/18}{added}
% The default is just empty. It can be used, e.g., to print something before
% the number or to make the number right aligned.
% \begin{macrocode}
\newcommand*{\numberline@prefix}{}
% \end{macrocode}
% \end{macro}^^A \numberline@prefix
% \begin{macro}{\numberline@postfix}
% \changes{v3.06}{2010/05/18}{added}
% The default is \cs{hfil} to make the number left aligned.
% \begin{macrocode}
\newcommand*{\numberline@postfix}{\hfil}
% \end{macrocode}
% \end{macro}^^A \numberline@postfix
% \begin{macro}{\numberline@numberformat}
% \changes{v3.06}{2010/05/18}{added}
% \changes{v3.12}{2013/11/22}{don't output anything, if argument expands to
% an empty string}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}}
% Used to fulfil rules~5 and 6 of DUDEN, 20th edition.
% \begin{macrocode}
\newcommand*{\numberline@numberformat}[1]{%
\Ifstr{#1}{}{}{\numberline@numberprefix#1\numberline@numberpostfix}%
}
% \end{macrocode}
% \begin{macro}{\numberline@numberprefix}
% \changes{v3.20}{2016/03/15}{added}
% Used to prefix the number inside \cs{numberline@numberformat}. In opposite
% to \cs{numberline@prefix} it is only used, if the argument of
% \cs{numberline@numberformat} and therefore the argument of \cs{numberline}
% is not empty.
% \begin{macrocode}
\newcommand*{\numberline@numberprefix}{}
% \end{macrocode}
% \end{macro}^^A \numberline@numberprefix
% \begin{macro}{\numberline@numberpostfix}
% \changes{v3.20}{2016/03/15}{added}
% Used to postfix the number inside \cs{numberline@numberformat}. In opposite
% to \cs{numberline@prefix} it is only used, if the argument of
% \cs{numberline@numberformat} and therefore the argument of \cs{numberline}
% is not empty.
% \begin{macrocode}
\newcommand*{\numberline@numberpostfix}{}
% \end{macrocode}
% \end{macro}^^A \numberline@numberpostfix
% \end{macro}^^A \numberline@numberformat
% \begin{macro}{\numberline@box}
% \changes{v3.06}{2010/05/18}{added}
% Is used to put the sectioning number into a box.
% \begin{macrocode}
\newcommand*{\numberline@box}[1]{\hb@xt@\@tempdima{#1}}
%</package&body>
% \end{macrocode}
% \end{macro}^^A \numberline@box
% \end{macro}^^A \scr@numberline
%
% \begin{macrocode}
%<*class&body>
\let\numberline\scr@numberline
%</class&body>
% \end{macrocode}
% \end{command}^^A \numberline
%
%
% \subsection{The basics of the styles}
%
% From \KOMAScript~3.20 styles are a new basic feature for the entries into
% the table of contents and other directories. Each style consists of a
% command that defines the entry command and the corresponding options. The
% options are used to provide configuration features.
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \changes{v3.20}{2015/11/17}{ToC styles have the \texttt{KOMAarg} member
% \texttt{.dte}}
% \begin{macrocode}
%<*body>
\DefineFamily{KOMAarg}
\DefineFamilyMember[.dte]{KOMAarg}
%</body>
% \end{macrocode}
%
% \begin{macro}{\@DefineTOCEntryOption}
% \changes{v3.20}{2015/04/10}{added}
% The definition of the options is done by a general interface. Important is,
% that the definition of the option is done indirectly, which means: Here we
% define a command, that defines the options when needed. Note, not only the
% entry command interface itself but also the sectioning command interface may
% and should be able to setup options of the entry commands.
% The parameters:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}:] default value of the option depending on the
% \meta{definition}
% \item[\marg{definition}: \meta{code},] definition of the option
% \end{description}
% \begin{macro}{\@DefineTOCEntryOptionWithoutDefault,\@DefineTOCEntryOptionWithDefault}
% \changes{v3.20}{2015/11/10}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need two
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryOption}[2]{%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2}%
}%
\kernel@ifnextchar [%]
{\@DefineTOCEntryOptionWithDefault{#1}{#2}}%
{\@DefineTOCEntryOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryOptionWithoutDefault}[3]{%
\DefineFamilyKey[.dte]{KOMAarg}{#2}{#3}%
}
\newcommand*{\@DefineTOCEntryOptionWithDefault}{}
\def\@DefineTOCEntryOptionWithDefault#1#2[#3]#4{%
\l@addto@macro\scr@dte@doopts{[{#3}]}%
\DefineFamilyKey[.dte]{KOMAarg}{#2}[{#3}]{#4}%
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryOptionWithoutDefault,\@DefineTOCEntryOptionWithDefault
% \end{macro}^^A \@DefineTOCEntryOption
%
% \begin{macro}{\@RelaxTOCEntryOptions}
% \changes{v3.20}{2015/04/10}{added}
% Reset all options of the current do-list back to \cs{relax}.
% \begin{macrocode}
%<*body>
\newcommand*{\@RelaxTOCEntryOptions}{%
\begingroup
\def\do@endgroup{\endgroup}%
\def\do##1{%
\l@addto@macro\do@endgroup{%
\RelaxFamilyKey[.dte]{KOMAarg}{##1}%
}%
\scr@dte@gobbleopt
}%
\scr@dte@doopts
\do@endgroup
}
\newcommand{\scr@dte@gobbleopt}[1][]{}
%</body>
% \end{macrocode}
% \end{macro}^^A \@RelaxTOCEntryOptions
%
% \begin{macro}{\@DefineTOCEntryListOption}
% \changes{v3.31}{2020/06/11}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents a list.
% It has following parameters:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{default}: \meta{string},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the macro to be defined
% \item[\marg{postfix}: \meta{string},] postfix of the macro to be defined
% \item[\marg{description}: \meta{String},] short description of the option
% \item[\oarg{init}: \meta{code},] initialization of the option
% \end{description}
% Between the \meta{prefix} and \meta{postfix} automatically
% \cs{scr@dte@current} will be added. A copy option using ``\opt{:=}''
% instead of ``\opt{=}'' and an add (append) option using ``\opt{+=}''
% instead of ``\opt{=}'' is also defined.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryListOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryListOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryListOptionWithoutDefault{#1}{#2}}%
}
% \end{macrocode}
% \begin{macro}{\@DefineTOCEntryListOptionWithoutDefault}
% \changes{v3.31}{2020/06/11}{added}
% This is the case without default value. So we only have to define
% the three internal options, that manipulate a macro.
% \begin{macrocode}
\newcommand*{\@DefineTOCEntryListOptionWithoutDefault}[5]{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
\@DefineTOCEntryOption{#1}{#2}{%
\expandafter\protected@edef\csname #3\scr@dte@current#4\endcsname{##1}%
\FamilyKeyStateProcessed
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #3\scr@dte@current#4\expandafter\endcsname
\csname #3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\expandafter\protected@edef\csname #2\scr@dte@current#4\endcsname{%
\csname #2\scr@dte@current#4\endcsname,##1}%
\FamilyKeyStateProcessed
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryListOptionWithoutDefault
% \begin{macro}{\@DefineTOCEntryListOptionWithDefault}
% \changes{v3.31}{2020/06/11}{added}
% This is the case with a default value. It's almost the same, but the
% argument numbers and using \cs{DefineFamilyKey} with optional argument.
% \begin{macrocode}
\newcommand*{\@DefineTOCEntryListOptionWithDefault}{}
\def\@DefineTOCEntryListOptionWithDefault#1#2[#3]#4#5#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
\@DefineTOCEntryOption{#1}{#2}[{#3]}{%
\expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{##1}%
\FamilyKeyStateProcessed
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{%
\csname #4\scr@dte@current#5\endcsname,##1}%
\FamilyKeyStateProcessed
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryListOptionWithDefault
% \end{macro}^^A \@DefineTOCEntryListOption
%
% \begin{macro}{\@DefineTOCEntryLengthOption}
% \changes{v3.20}{2015/12/04}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents a length
% macro. The parameters are:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}: \meta{length},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro
% \item[\marg{explanation}: \meta{string},] short description of the option
% \item[\oarg{init}: \meta{code},] initialisation code for the option
% \end{description}
% Later, when the option is defines, between \meta{prefix} and \meta{postfix}
% will be added \cs{scr@dte@current} automatically. This is the name of the
% entry level, e.g., |subsection| or |figure|. Additionally to
% the option \marg{option} itself a copy option \marg{option}\opt{:} will
% be defined. So it seems, that for the copy option a colon is before the
% equal sign. The value of the copy option has to be the name of another entry
% level and it copies the value of the same option of that entry
% level. Additionally an additive option with appended plus sign is
% defined. It adds the new value to the existing one.
% \begin{macro}{\@DefineTOCEntryLengthOptionWithoutDefault,
% \@DefineTOCEntryLengthOptionWithDefault}
% \changes{v3.20}{2015/11/10}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \changes{v3.27}{2019/10/03}{automatic definition of add option}
% \begin{macro}{\@DefineTOCEntryLengthOptionMacro,\@DefineTOCEntryAddLengthOptionMacro}
% \changes{v3.27}{2019/10/03}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need three
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryLengthOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryLengthOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryLengthOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryLengthOptionWithoutDefault}[5]{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
\@DefineTOCEntryOption{#1}{#2}{%
\@DefineTOCEntryLengthOptionMacro{#2}{#3}{#4}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #3\scr@dte@current#4\expandafter\endcsname
\csname #3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\@DefineTOCEntryAddLengthOptionMacro{#2+}{#3}{#4}{##1}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}%
\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
\newcommand*{\@DefineTOCEntryLengthOptionWithDefault}{}
\def\@DefineTOCEntryLengthOptionWithDefault#1#2[#3]#4#5#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryLengthOptionMacro{#2}{#4}{#5}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\@DefineTOCEntryAddLengthOptionMacro{#2+}{#4}{#5}{##1}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}%
\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
\newcommand*{\@DefineTOCEntryLengthOptionMacro}[4]{%
\protected@edef\reserved@a{%
\noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
}\reserved@a
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\ifscr@dte@expandtopt
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
\the\@tempskipa}%
\else
\expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{#4}%
\fi
\fi
}
\newcommand*{\@DefineTOCEntryAddLengthOptionMacro}[4]{%
\@ifundefined{#2\scr@dte@current#3}{%
\FamilyKeyStateUnknownValue
}{%
\protected@edef\reserved@a{%
\noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
}\reserved@a
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\ifscr@dte@expandtopt
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
\the\glueexpr\@tempskipa
+\csname #2\scr@dte@current#3\endcsname\relax}%
\else
\expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{%
\the\glueexpr #4%
+\csname #2\scr@dte@current#3\endcsname\relax}%
\fi
\fi
}%
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryAddLengthOptionMacro,\@DefineTOCEntryLengthOptionMacro
% \end{macro}^^A \@DefineTOCEntryLengthOptionWithDefault,\@DefineTOCEntryLengthOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryLengthOption
%
% \begin{macro}{\@DefineTOCEntryNumberOption}
% \changes{v3.20}{2015/12/04}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents a number
% macro. The parameters are:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}: \meta{length},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro
% \item[\marg{explanation}: \meta{string},] short description of the option
% \item[\oarg{init}: \meta{code},] initialisation code for the option
% \end{description}
% Later, when the option is defines, between \meta{prefix} and \meta{postfix}
% will be added \cs{scr@dte@current} automatically. This is the name of the
% entry level, e.g., |subsection| or |figure|. Additionally to
% the option \marg{option} itself a copy option \marg{option}\opt{:} will
% be defined. So it seems, that for the copy option a colon is before the
% equal sign. The value of the copy option has to be the name of another entry
% level and it copies the value of the same option of that entry
% level. Additionally an additive option with appended plus sign is
% defined. It adds the new value to the existing one.
% \begin{macro}{\@DefineTOCEntryNumberOptionWithoutDefault,
% \@DefineTOCEntryNumberOptionWithDefault}
% \changes{v3.20}{2015/11/12}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \changes{v3.27}{2019/10/03}{automatic definition of add option}
% \begin{macro}{\@DefineTOCEntryNumberOptionMacro,\@DefineTOCEntryAddNumberOptionMacro}
% \changes{v3.27}{2019/10/03}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need three
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryNumberOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryNumberOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryNumberOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryNumberOptionWithoutDefault}[5]{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#5}%
\@DefineTOCEntryOption{#1}{#2}{%
\@DefineTOCEntryNumberOptionMacro{#2}{#3}{#4}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #3\scr@dte@current#4\expandafter\endcsname
\csname #3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\@DefineTOCEntryAddNumberOptionMacro{#2+}{#3}{#4}{##1}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}%
\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
\newcommand*{\@DefineTOCEntryNumberOptionWithDefault}{}
\def\@DefineTOCEntryNumberOptionWithDefault#1#2[#3]#4#5#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryNumberOptionMacro{#2}{#4}{#5}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
\@DefineTOCEntryAddNumberOptionMacro{#2+}{#4}{#5}{##1}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}%
\noexpand\do{#2:}\noexpand\do{#2+}%
}%
}
\newcommand*{\@DefineTOCEntryNumberOptionMacro}[4]{%
\protected@edef\reserved@a{%
\noexpand\FamilySetCounterMacro{KOMAarg}{#1}{%
\expandafter\noexpand\csname #2\scr@dte@current#3\endcsname
}{#4}%
}\reserved@a
}
\newcommand*{\@DefineTOCEntryAddNumberOptionMacro}[4]{%
\@ifundefined{#2\scr@dte@current#3}{%
\FamilyKeyStateUnknownValue
}{%
\FamilySetCounterMacro{KOMAarg}{#1}{%
\reserved@a
}{#4}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
\the\numexpr \reserved@a+\csname #2\scr@dte@current#3\endcsname\relax
}%
\fi
}%
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryAddNumberOptionMacro,\@DefineTOCEntryNumberOptionMacro
% \end{macro}^^A \@DefineTOCEntryNumberOptionWithDefault,\@DefineTOCEntryNumberOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryNumberOption
%
% \begin{macro}{\@DefineTOCEntryBooleanOption}
% \changes{v3.20}{2015/12/04}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents a boolean
% switch. The parameters are:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}: \meta{length},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro
% \item[\marg{explanation}: \meta{string},] short description of the option
% \item[\oarg{init}: \meta{code},] initialisation code for the option
% \end{description}
% Later, when the option is defines, between \meta{prefix} and \meta{postfix}
% will be added \cs{scr@dte@current} automatically. This is the name of the
% entry level, e.g., |subsection| or |figure|. Additionally to
% the option \marg{option} itself a copy option \marg{option}\opt{:} will
% be defined. So it seems, that for the copy option a colon is before the
% equal sign. The value of the copy option has to be the name of another entry
% level and it copies the value of the same option of that entry
% level.
% \begin{macro}{\@DefineTOCEntryBoolOptionWithoutDefault,
% \@DefineTOCEntryBoolOptionWithDefault}
% \changes{v3.20}{2015/11/12}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \begin{macro}{\@DefineTOCEntryBoolOptionMacro}
% \changes{v3.20}{2015/11/12}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need three
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryBooleanOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryBoolOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryBoolOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryBoolOptionWithoutDefault}[5]{%
\@TOCEntryStyleNeedsCommandByOption{#1}{if#3}{#4}{#2}{#5}%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4false}{#2}{#5}%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4false}{#2}{#5}%
\@DefineTOCEntryOption{#1}{#2}[true]{%
\@DefineTOCEntryBoolOptionMacro{#2}{#3}{#4}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{if#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname if#3\scr@dte@current#4\expandafter\endcsname
\csname if#3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
}
\newcommand*{\@DefineTOCEntryBoolOptionWithDefault}{}
\def\@DefineTOCEntryBoolOptionWithDefault#1#2[#3]#4#5#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{if#4}{#5}{#2}{#6}%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5true}{#2}{#6}%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5false}{#2}{#6}%
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryBoolOptionMacro{#2}{#4}{#5}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{if#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname if#4\scr@dte@current#5\expandafter\endcsname
\csname if#4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
}
\newcommand*{\@DefineTOCEntryBoolOptionMacro}[4]{%
\@ifundefined{if#2\scr@dte@current#3}{%
\expandafter\newif\csname if#2\scr@dte@current#3\endcsname
}{}%
\FamilySetBool{KOMAarg}{#1}{#2\scr@dte@current#3}{#4}%
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryBoolOptionMacro
% \end{macro}^^A \@DefineTOCEntryBoolOptionWithDefault,\@DefineTOCEntryBoolOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryBooleanOption
%
% \begin{macro}{\@DefineTOCEntryIfOption}
% \changes{v3.20}{2015/12/06}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents an if
% command. The option itself is a boolean option. The parameters are:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}: \meta{length},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro
% \item[\marg{explanation}: \meta{string},] short description of the option
% \end{description}
% Later, when the option is defines, between \meta{prefix} and \meta{postfix}
% will be added \cs{scr@dte@current} automatically. This is the name of the
% entry level, e.g., |subsection| or |figure|. Additionally to
% the option \marg{option} itself a copy option \marg{option}\opt{:} will
% be defined. So it seems, that for the copy option a colon is before the
% equal sign. The value of the copy option has to be the name of another entry
% level and it copies the value of the same option of that entry
% level.
% \begin{macro}{\@DefineTOCEntryIfOptionWithoutDefault,
% \@DefineTOCEntryIfOptionWithDefault}
% \changes{v3.20}{2015/11/12}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \begin{macro}{\@DefineTOCEntryIfOptionMacro}
% \changes{v3.20}{2015/11/12}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need three
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryIfOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryIfOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryIfOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryIfOptionWithoutDefault}[5]{%
\@TOCEntryStyleNeedsCommandByOption{#1}{If#3}{#4}{#2}{#5}%
\@DefineTOCEntryOption{#1}{#2}[true]{%
\@DefineTOCEntryIfOptionMacro{#2}{#3}{#4}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{If#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname If#3\scr@dte@current#4\expandafter\endcsname
\csname If#3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
}
\newcommand*{\@DefineTOCEntryIfOptionWithDefault}{}
\def\@DefineTOCEntryIfOptionWithDefault#1#2[#3]#4#5#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{If#4}{#5}{#2}{#6}%
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryIfOptionMacro{#2}{#4}{#5}{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{If#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname If#4\scr@dte@current#5\expandafter\endcsname
\csname If#4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
}
\newcommand*{\@DefineTOCEntryIfOptionMacro}[4]{%
\FamilySetBool{KOMAarg}{#1}{@tempswa}{#4}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed
\if@tempswa
\expandafter\let\csname If#2\scr@dte@current#3\endcsname\@firstoftwo
\else
\expandafter\let\csname If#2\scr@dte@current#3\endcsname\@secondoftwo
\fi
\fi
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@DefineTOCEntryIfOptionMacro
% \end{macro}^^A \@DefineTOCEntryIfOptionWithDefault,\@DefineTOCEntryIfOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryIfOption
%
% \begin{macro}{\@DefineTOCEntryCommandOption}
% \changes{v3.20}{2015/11/17}{added}
% Use \cs{DefineTOCEntryOption} to define an option that represents a
% macro. The parameters are:
% \begin{description}
% \item[\marg{style}: \meta{string},] name of the entry style
% \item[\marg{option}: \meta{string},] name of the option
% \item[\oarg{value}: \meta{length},] default value of the option
% \item[\marg{prefix}: \meta{string},] prefix of the name of the macro
% \item[\marg{postfix}: \meta{string},] postfix of the name of the macro
% \item[\marg{explanation}: \meta{string},] short description of the option
% \item[\oarg{init}: \meta{code},] initialisation code for the option
% \end{description}
% Later, when the option is defines, between \meta{prefix} and \meta{postfix}
% will be added \cs{scr@dte@current} automatically. This is the name of the
% entry level, e.g., |subsection| or |figure|. Additionally to
% the option \marg{option} itself a copy option \marg{option}\opt{:} will
% be defined. So it seems, that for the copy option a colon is before the
% equal sign. The value of the copy option has to be the name of another entry
% level and it copies the value of the same option of that entry
% level. Additionally an appending option with appended plus sign is
% defined. It appends the new code to the existing one.
% \begin{macro}{\@DefineTOCEntryCommandOptionWithoutDefault}
% \changes{v3.20}{2015/11/12}{added}
% \begin{macro}{\@@DefineTOCEntryCommandOptionWithoutDefault}
% \changes{v3.20}{2015/11/12}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \changes{v3.27}{2019/10/03}{automatic definition of add option}
% \begin{macro}{\@DefineTOCEntryCommandOptionWithDefault}
% \changes{v3.20}{2015/11/12}{added}
% \begin{macro}{\@@DefineTOCEntryCommandOptionWithDefault}
% \changes{v3.20}{2015/11/12}{added}
% \changes{v3.27}{2019/10/02}{automatic definition of copy option}
% \changes{v3.27}{2019/10/03}{automatic definition of add option}
% \begin{macro}{\@DefineTOCEntryCommandOptionMacro,\@@DefineTOCEntryCommandOptionMacro}
% \changes{v3.20}{2015/11/26}{added}
% Because of the options argument at position 3 (and because we've made this
% before \pkg{xparse} became part of the \LaTeX{} kernel), we need three
% auxiliary macros.
% \begin{macrocode}
%<*body>
\newcommand*{\@DefineTOCEntryCommandOption}[2]{%
\kernel@ifnextchar [%]
{\@DefineTOCEntryCommandOptionWithDefault{#1}{#2}}
{\@DefineTOCEntryCommandOptionWithoutDefault{#1}{#2}}%
}
\newcommand*{\@DefineTOCEntryCommandOptionWithoutDefault}[4]{%
\@testopt{\@@DefineTOCEntryCommandOptionWithoutDefault{#1}{#2}{#3}{#4}}0%
}
\newcommand*{\@@DefineTOCEntryCommandOptionWithoutDefault}{}%
\def\@@DefineTOCEntryCommandOptionWithoutDefault#1#2#3#4[#5]#6{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#3}{#4}{#2}{#6}%
\ifcase #5
\@DefineTOCEntryOption{#1}{#2}{%
\@DefineTOCEntryCommandOptionMacro{#2}{#3}{#4}[#5]{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #3\scr@dte@current#4\expandafter\endcsname
\csname #3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
\or
\@DefineTOCEntryOption{#1}{#2}{%
\@DefineTOCEntryCommandOptionMacro{#2}{#3}{#4}[#5]{##1{####1}}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#3##1#4}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #3\scr@dte@current#4\expandafter\endcsname
\csname #3##1#4\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
\else
\PackageError{tocbasic}{only one argument supported}{%
\string\DefineTOCEntryCommandOption\space currently supports only
commands with\MessageBreak
at most one argument not #5}%
\fi
}
\newcommand*{\@DefineTOCEntryCommandOptionWithDefault}{}
\def\@DefineTOCEntryCommandOptionWithDefault#1#2[#3]#4#5{%
\@testopt{\@@DefineTOCEntryCommandOptionWithDefault{#1}{#2}{#3}{#4}{#5}}0%
}
\def\@@DefineTOCEntryCommandOptionWithDefault#1#2#3#4#5[#6]#7{%
\@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#7}%
\ifcase #6
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
\or
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
\or
\@DefineTOCEntryOption{#1}{#2}[{#3}]{%
\@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}}%
}%
\DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
\scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
\expandafter\let
\csname #4\scr@dte@current#5\expandafter\endcsname
\csname #4##1#5\endcsname
\FamilyKeyStateProcessed
}%
}%
\edef\scr@dte@doopts{%
\unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
}%
\else
\PackageError{tocbasic}{only one argument supported}{%
\string\DefineTOCEntryCommandOption\space currently supports only
commands with\MessageBreak
at most two argument not #6}%
\fi
}
\newcommand*{\@DefineTOCEntryCommandOptionMacro}[3]{%
\@testopt{\@@DefineTOCEntryCommandOptionMacro{#1}{#2}{#3}}0%
}
\newcommand*{\@@DefineTOCEntryCommandOptionMacro}{}
\long\def\@@DefineTOCEntryCommandOptionMacro#1#2#3[#4]#5{%
\let\l@ngrel@x\long
\expandafter\@yargdef\csname #2\scr@dte@current#3\endcsname\@ne{#4}{#5}%
\FamilyKeyStateProcessed
}
%</body>
% \end{macrocode}
% \end{macro}^^A \@@DefineTOCEntryCommandOptionMacro,\@DefineTOCEntryCommandOptionMacro
% \end{macro}^^A \@@DefineTOCEntryCommandOptionWithDefault
% \end{macro}^^A \@DefineTOCEntryCommandOptionWithDefault
% \end{macro}^^A \@@DefineTOCEntryCommandOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryCommandOptionWithoutDefault
% \end{macro}^^A \@DefineTOCEntryCommandOption
%
% \begin{macro}{\@AddToDeclareTOCStyleEntryPreCheckNeeds,
% \@PreToDeclareTOCStyleEntryPreCheckNeeds}
% \changes{v3.20}{2015/12/06}{added}
% Before the existence of the mandatory commands can be tested in
% \cs{DeclareTOCStyleEntry}, a hook will be executed. To add code to this hook
% we have this command with the following parameter:
% \begin{description}
% \item[\marg{code}: \meta{code},] code to be executed.
% \end{description}
% Please note, this command is used inside the init code of styles, which