summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/labelcas/labelcas.dtx
blob: 6ec5108c23c78e4fa89b92b38a9e76a93135f5da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
% \iffalse meta-comment
%
% Copyright (C) 2006 by Ulrich Diez <ulrich.diez@alumni.uni-tuebingen.de>
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version.  The latest version of this
% license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of LaTeX version
% 2003/12/01 or later.
%
% \fi
%
% \iffalse
%<labelcas>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<labelcas>\ProvidesPackage{labelcas}
%<labelcas>   [2006/04/27 v1.07 check label-existence and fork accordingly]
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\usepackage[DefineLabelcase]{labelcas}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\begin{document}
  \DocInput{labelcas.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{390}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \catcode`\&=14\relax
% &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
% &                                                                      &
% &  !!!!!  Henceforth alignment-tab is used for commenting- and  !!!!!  &
% &  !!!!!  line-breaking-purposes in the documentation-parts.    !!!!!  &
% &                                                                      &
% &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
%
% & Put an 's' behind the word 'italic' in the index-prologue:
% \makeatletter
% \renewcommand*\index@prologue{&
%   \section*{Index}\markboth{Index}{Index}Numbers written in italics
%   refer to the page where the corresponding entry is described; numbers
%   underlined refer to the \ifcodeline@index code line of the \fi
%   definition; numbers in roman refer to the \ifcodeline@index code
%   lines \else pages \fi where the entry is used.&
% }&
% \makeatother
%
% & Write the word '\if' from the tocs:
% \DeclareRobustCommand\Outif{\string\if}&
%
% & Write the equal-sign in change-history:
% \DeclareRobustCommand\ChgEq{$=$}&
%
% & Write macro-names with <prefix> into the margin:
% \renewcommand*\PrintMacroName[1]{&
%   \strut
%   \ifx\pref\empty
%   \else
%     {\MacroFont\char`\\}&
%     {\footnotesize\meta{\pref}}&
%   \fi
%   \MacroFont\string #1&
% }&
%
% & Write macro-names with <prefix> into the index:
% \makeatletter
% \renewcommand*\SpecialMainIndex[1]{&
%   \@bsphack
%   \ifx\pref\empty
%     \SpecialIndex@{#1}{\encapchar main}&
%   \else
%      \expandafter\SpecialIndex@
%      \expandafter{&
%      \expandafter<&
%      \pref!>#1}{\encapchar main}&
%   \fi
%   \@esphack
% }&
%
% & Write macro-names with <prefix> into change-history:
% \newcommand*\Patchsavedatmacroname{&
%   \ifx\pref\empty
%   \else
%     \expandafter\edef
%     \expandafter\saved@macroname
%     \expandafter{&
%     \expandafter\string
%     \csname<\pref!>\saved@macroname\endcsname}&
%   \fi
% }&
% \makeatother
%
% & The <prefix>:
% \newcommand*\pref{}&
% \let\pref\empty
%
% \changes{v1.0}{2006/01/04}{Initial public release}
% \changes{v1.01}{2006/01/06}{Fixed documentation-inaccuracies}
% \changes{v1.02}{2006/01/29}{Fixed documentation-inaccuracies}
% \changes{v1.04}{2006/03/04}{Fixed documentation-inaccuracies}
% \changes{v1.05}{2006/03/09}{Fixed documentation-inaccuracies}
% \changes{v1.07}{2006/04/27}{Fixed documentation-inaccuracies}
%
% \GetFileInfo{labelcas.sty}
%
% \DoNotIndex{\@empty,\@firstoftwo,\@ifdefinable,\@secondoftwo,\@gobble,&
%             \@nil,\@sptoken,\@temptokena,\toks@,\begingroup,\csname,&
%             \DeclareOption,\DeclareRobustCommand,\def,\edef,\else,&
%             \endcsname,\endgroup,\expandafter,\fi,\futurelet,\global,&
%             \ifx,\let,\long,\newcommand,\ProcessOptions,\relax,\the}&
%
% \title{&
%   The \textsf{labelcas} package&
%   \thanks{This document corresponds to \textsf{labelcas}~\fileversion,
%           dated \filedate.}&
% }
% \author{Ulrich Diez\\ \texttt{ulrich.diez@alumni.uni-tuebingen.de}}
%
% \maketitle
%
% \begin{abstract}
% \noindent This {\LaTeXe}-package provides macros |\eachlabelcase| and
% |\lotlabelcase| as a means of forking dependent on whether specific
% labels are defined in the current document.
% \end{abstract}
%
% \tableofcontents
% \newpage
%
% \section{Introduction}\label{sec1}
%
% The package's name |labelcas| is an eight-letter abbreviation for the
% phrases ``label'' and ``case''.
%
% There are rare occasions where the author of a document would like to
% have detected whether specific labels are defined/in use within the
% document so that proper forking/referencing can take place.
% This package provides the macros |\eachlabelcase| and |\lotlabelcase|
% which might facilitate this task.
%
% A mechanism for branching dependent on the existence of labels might be
% handy, e.g., when extracting a ``snippet'' from a large document: In
% case that within the snippet a label/document-part is referenced which
% is outside the snippet's scope, ugly |`?'| will intersperse the
% resulting output-file and warnings about undefined references will
% accumulate within the log-file.
%
% By testing the label's existence, you can catch up the error and either
% change the way of referencing (e.g., refer to the snippet's bibliography
% instead) or completely suppress referencing for those cases. (By using
% \emph{David Carlisle's} |xr|- or |xr-hyper|-package, you can make
% available labels of the large document to the snippet also. A label not
% defined in the snippet can be picked up from the large document\dots)
%
% \subsection{Space notation}
%
% When listing some piece of \TeX-source-code, you may need to visibly
% distinguish word-separation from single space-characters. The symbol
% \verb*+ + is chosen whenever it is important to give a visible
% impression of a space-character in a (possibly \textsl{ASCII}-encoded)
% \TeX-input-file. {\verb*+ +}\nobreak\(_{x}\) does not represent a
% character of an input-file but a token which occurs after tokenizing the
% input. The token's category-code is \(x\), the character-number usually
% is \(32\), which is the \textsl{ASCII}-number of the space-character.
%
% \section{Package-loading}\label{sec2}
%
% The package is loaded within in the document-preamble by |\usepackage|.
% \medskip
%
% |\usepackage{labelcas}|~~~or
%
% |\usepackage[DefineLabelcase]{labelcas}|.
% \medskip
%
% The only package-option is |DefineLabelcase|. It's usage is described in
% section~\ref{sec4} ``Package option---Different spaces, different
% separators''.
%
% \section{The macros}\label{sec3}
%
% \subsection{Basic usage}\label{sec3-1}
%
% \DescribeMacro{\eachlabelcase}
% The macro |\eachlabelcase| iterates on a comma-separated list of
% ``argument-triplets'', whereby each triplet specifies:~~\nobreak
% {&
%   \makeatletter
%   \setbox\@tempboxa\hbox{3. Action if the label is undefined.}&
%   \@tempdima\dp\@tempboxa
%   \vtop{&
%     \noindent
%     1. a label,\\
%     2. action if the label is defined,\\
%     3. action if the label is undefined.&
%   }&
%   \par\prevdepth\@tempdima
% }&
% \noindent
% During the iteration, an ``action-queue'' is gathered up from these
% specifications. After iterating, the ``action-queue'' will be executed.
% You can also specify a new macro-name within an optional argument. If
% you do so, the ``action-queue'' will not be executed but the macro will
% be defined to perform the actions specified in the queue:
% \bigskip
%
% \noindent
% {&
%   \footnotesize
%   |\eachlabelcase[|\emph{\textbackslash macro}|]{|~~~\nobreak
%   \vtop{&
%     \noindent
%     \marg{label 1}\marg{action if label 1 defined}&
%     \marg{action if label 1 undefined}|,|\\
%     \marg{label 2}\marg{action if label 2 defined}&
%     \marg{action if label 2 undefined}| ,|\\
%     \hspace*{.275\hsize}\texttt{\dots}\\
%     \marg{label n}\marg{action if label n defined}&
%     \marg{action if label n undefined}\ \ \ |}|&
%   }&
% }&
% \bigskip
%
% \noindent Space-tokens which might surround the comma-separated triplets
%  will be gobbled.
% \medskip
%
% \noindent
% \DescribeMacro{\lotlabelcase}
% The macro |\lotlabelcase| iterates on a comma-separated list of label-&
% names and tests for each name if the corresponding label is defined.
% Within the arguments you can specify actions for the cases:~~\nobreak
% {&
%   \makeatletter
%   \setbox\@tempboxa\hbox{4. the list does not contain any label.}&
%   \@tempdima\dp\@tempboxa
%   \vtop{&
%     \noindent
%     1. all labels are defined,\\
%     2. none of the labels are defined,\\
%     3. some labels are defined/some are undefined,\\
%     4. the list does not contain any label.&
%   }&
%   \par\prevdepth\@tempdima
% }&
% \noindent
% Like in |\eachlabelcase|, you can also specify a new macro-name within
% an optional argument. If you do so, the action will not be executed but
% the macro will be defined to perform the action:
% \bigskip
%
% \noindent
% {&
%   \footnotesize
%   |\lotlabelcase[|\emph{\textbackslash macro}|]|\nobreak
%   \vtop{&
%     \noindent
%     |{|\meta{label 1}|,|\meta{label 2}|,|\texttt{\dots}&
%     |,|\meta{label n}|}|\\
%     \marg{actions if all labels are defined}\\
%     \marg{actions if all labels are undefined}\\
%     \marg{actions if some labels are defined and
%           some labels are undefined}\\
%     \marg{actions if list is empty}&
%   }&
% }&
% \bigskip
%
% \noindent Space-tokens which might surround the label-names will be
% gobbled. One level of braces will also be gobbled so that you can also
% test for labels the names of which start or end by a space or contain
% some comma.
%
% \subsubsection{Possible problems}\label{sec3-1-1}
%
% \begin{itemize}
% \item Testing for labels which are \textbf{not definable} according to
%       the syntax-rules will lead to \TeX-internal error-messages and
%       deliver unexpected/unwanted results!
% \item ``Label- and referencing management'' in {\LaTeXe} is done by
%       means of the aux-file, the content of  which is gathered and
%       corrected during several {\LaTeX}-runs, and which does not yet
%       exist in the first run. So, in the first run, all labels from the
%       current document are undefined---when applying |\...labelcase| to
%       labels of the current document, it will in any case take at least
%       two {\LaTeX}-runs until everything matches out correctly.
% \item It was mentioned that, in the macros |\eachlabelcase| and
%       |\lotlabelcase|, space-tokens which surround the argument-&
%       triplets/label-names, will be gobbled. There are situations where
%       the category-code of the input-character \verb*+ + is changed---&
%       e.g., due to a preceding |\obeyspaces| or when using some package
%       where the encoding of \TeX-input-files it is played around with.
%       In such cases, the input-character \verb*+ + does not get
%       tokenized as space-token any more but as some \verb*+ +\nobreak&
%       \(_{\neq10}\)-token, so that in such cases, triplets/labels in
%       these macros may, in the input-file, not be surrounded by
%       \verb*+ +\nobreak-\nobreak characters.\\
%       If you want to have these \verb*+ +\nobreak\(_{\neq10}\)-tokens
%       gobbled anyway, you can easily achieve this by defining another
%       set of these macros where the appropriate token, e.g.,
%       \verb*+ +\nobreak\(_{13}\)~(active-space) instead of
%       \verb*+ +\nobreak\(_{10}\)~(space-token), is taken into account.
%       How this is done, is described in section~\ref{sec4} ``Package
%       option---Different spaces, different separators''.
% \item In the very unlikely case{\makeatletter\footnote{The case is very
%       unlikely because it is a convention in {\LaTeXe} to leave
%       {\verbatim@font\string\@nil} undefined. If labels are defined in
%       terms of macros, these macros are to expand to something that can
%       be evaluated by a {\verbatim@font\string\csname\dots\string&
%       \endcsname}-construct. If they are to expand to something, they
%       must be defined\dots}} that you wish |\lotlabelcase| (or variants
%       thereof\thinspace\footnote{\(_{^\rightarrow}\)section~\ref{sec4}~&
%       ``Package option---Different spaces, different separators''.})&
%       \addtocounter{footnote}{-1} to scan for the label |\@nil|, |\@nil|
%       has to be put in  braces and/or has to be surrounded by space-&
%       tokens. This is because the internal iterator-macros terminate on
%       |\@nil|.
% \item Internally token-registers are used and temporary-macros get
%       defined. So the macros |\eachlabelcase| and |\lotlabelcase| (and
%       all variants\footnotemark) are not ``full-expandable''. This
%       means, |\edef| or |\write| or control-sequences the like which
%       evaluate their arguments fully, cannot be applied to them.&
%       \footnote{In any case it cannot be ensured that all arguments
%       supplied are ``full-expandable''\dots} Therefore they are declared
%       robust.
% \item |\lotlabelcase| and |\eachlabelcase| can be nested. Inner
%       instances will be gathered into the action-queues of outer
%       instances.
% \item If the optional argument for defining a \meta{macro} rather than
%       having the action(s) executed immediately, is used, \meta{macro}
%       will only be defined within the group where the |\...labelcase|-&
%       command occurred.\\
%       |\@ifdefinable| is involved into the assignment-process, so that
%       an ``already-defined''-error is forced whenever an existing macro
%       is about to be overridden.\\
%       If you need it global, you can achieve this---after having
%       \meta{macro} defined---by something like
%       |\global\let\macro=\macro|.\\
%       If you need a ``long''-macro, you can achieve this---after having
%       \meta{macro} defined---by something like:\\
%       |\expandafter\renewcommand\expandafter\macro\expandafter{\macro}|&
%       .\\
%       But think about it. These macros don't take arguments!
% \end{itemize}
%
% \subsubsection{Examples}\label{sec3-1-2}
% \smallskip
%
% Within this document, only the labels |sec1|, |sec2|, |sec3| and |sec4|
% are defined.\smallskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\lotlabelcase{sec1, sec2 , {sec3} ,sec4}|\\
%   |             {All labels are defined.}|\\
%   |             {None of the labels is defined.}|\\
%   |             {Some labels are defined, some not.}|\\
%   |             {The list is empty.}|\medskip\\
%   yields:
%   \lotlabelcase{sec1, sec2 , {sec3} ,sec4}
%                {All labels are defined.}
%                {None of the labels is defined.}
%                {Some labels are defined, some not.}
%                {The list is empty.}&
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\lotlabelcase{sec1, sec2 , UNDEFINED ,sec3}|\\
%   |             {All labels are defined.}|\\
%   |             {None of the labels is defined.}|\\
%   |             {Some labels are defined, some not.}|\\
%   |             {The list is empty.}|\medskip\\
%   yields:
%   \lotlabelcase{sec1, sec2 , UNDEFINED ,sec3}
%                {All labels are defined.}
%                {None of the labels is defined.}
%                {Some labels are defined, some not.}
%                {The list is empty.}&
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\lotlabelcase{UNDEF1, UNDEF2 , {UNDEF3} ,UNDEF4}|\\
%   |             {All labels are defined.}|\\
%   |             {None of the labels is defined.}|\\
%   |             {Some labels are defined, some not.}|\\
%   |             {The list is empty.}|\medskip\\
%   yields:
%   \lotlabelcase{UNDEF1, UNDEF2 , {UNDEF2-1} ,UNDEF2-2}
%                {All labels are defined.}
%                {None of the labels is defined.}
%                {Some labels are defined, some not.}
%                {The list is empty.}&
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\lotlabelcase{ ,,  ,}|\\
%   |             {All labels are defined.}|\\
%   |             {None of the labels is defined.}|\\
%   |             {Some labels are defined, some not.}|\\
%   |             {The list is empty.}|\medskip\\
%   yields:
%   \lotlabelcase{ ,,  ,}
%                {All labels are defined.}
%                {None of the labels is defined.}
%                {Some labels are defined, some not.}
%                {The list is empty.}&
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\lotlabelcase[\test]{sec1, sec2 , UNDEFINED ,sec3}|\\
%   |                    {All labels are defined.}|\\
%   |                    {None of the labels is defined.}|\\
%   |                    {Some labels are defined, some not.}|\\
%   |                    {The list is empty.}|\medskip\\
%   defines: |\test|:{
%   \lotlabelcase[\test]{sec1, sec2 , UNDEFINED ,sec3}
%                       {All labels are defined.}
%                       {None of the labels is defined.}
%                       {Some labels are defined, some not.}
%                       {The list is empty.}&
%   {\makeatletter\verbatim@font\meaning\test}}
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\eachlabelcase{ {sec1}{sec1 defined/}{sec1 undefined/},|\\
%   |                {sec2}{sec2 defined/}{sec2 undefined/} ,|\\
%   |                {UNDEF}{UNDEF defined/}{UNDEF undefined/} ,|\\
%   |                {sec3}{sec3 defined.}{sec3 undefined.}  }|&
%   \medskip\\
%   yields:
%   \eachlabelcase{ {sec1}{sec1 defined/}{sec1 undefined/},
%                   {sec2}{sec2 defined/}{sec2 undefined/} ,
%                   {UNDEF}{UNDEF defined/}{UNDEF undefined/} ,
%                   {sec3}{sec3 defined.}{sec3 undefined.}  }&
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\eachlabelcase[\test]{ {sec1}{sec1 defined/}{sec1 undefined/},|\\
%   |                       {sec2}{sec2 defined/}{sec2 undefined/} ,|\\
%   |                       {UNDEF}{UNDEF defined/}{UNDEF undefined/} ,|&
%   \\
%   |                       {sec3}{sec3 defined.}{sec3 undefined.}  }|&
%   \medskip\\
%   {&
%      \eachlabelcase[\test]{ {sec1}{sec1 defined/}{sec1 undefined/},
%                             {sec2}{sec2 defined/}{sec2 undefined/} ,
%                             {UNDEF}{UNDEF defined/}{UNDEF undefined/} ,
%                             {sec3}{sec3 defined.}{sec3 undefined.}  }&
%      defines: |\test|:
%
%     \hskip\leftmargini
%     \vtop{{\makeatletter\verbatim@font\meaning\test}}&
%   }&
% \end{minipage}
%
% \subsection{Advanced usage (brace-matching,{\ttfamily\selectfont\Outif&
% \dots\thinspace}, defining macros)}
%
% \begin{itemize}
%   \item Braces within the arguments/comma-separated items must be
%         balanced.
%   \item Within the ``action-parts'' of |\eachlabelcase|'s argument-&
%         triplets from which the action-queue is formed, balancing
%         {\makeatletter\verbatim@font\mbox{\string\if\dots\string\else
%         \dots\string\fi}}-constructs is not required. But ensured must
%         be, that in the resulting action-queue everything is balanced
%         correctly in any case.
%         \bigskip
%
%         \noindent
%         \begin{minipage}{\linewidth}
%           \noindent
%           |\eachlabelcase{  {sec1}     {\if aa}       {\if ab},|\\
%           |                 {sec2}  {a is a\else}   {a is b\else} ,|\\
%           |                 {sec3}{a is not a\fi.}{a is not b\fi.}   }|&
%           \smallskip\\
%           is gathered to: |\if aaa is a\else a is not a\fi.|\\
%           Executing the queue yields:
%           \eachlabelcase{ {sec1}    {\if aa}       {\if aa},
%                           {sec2}  {a is a\else}   {a is b\else} ,
%                           {sec3}{a is not a\fi.}{a is not b\fi.},   }&
%         \end{minipage}
%         \bigskip
%
%         \noindent
%         \begin{minipage}{\linewidth}
%           \noindent
%           |\eachlabelcase{  {sec1}     {\if aa}       {\if ab},|\\
%           |                 {UNDEF}  {a is a\else}  {a is b\else} ,|\\
%           |                 {sec3} {a is not a\fi.}{a is not b\fi.}   }|&
%           \smallskip\\
%           is gathered to: |\if aaa is b\else a is not a\fi.|\\
%           Executing the queue yields:
%           \eachlabelcase{ {sec1}     {\if aa}       {\if aa},
%                           {UNDEF}  {a is a\else}  {a is b\else} ,
%                           {sec3} {a is not a\fi.}{a is not b\fi.},   }&
%         \end{minipage}
%         \bigskip
%
%         When trying such obscure things, you must be aware that brace/&
%         group-nesting is independent from conditional-nesting! You might
%         easily end up with a ``forgotten-endgroup''-error or some
%         ``extra |\else|\dots''-error when placing such things into other
%         {\makeatletter\verbatim@font\mbox{\string\if\dots\string\else
%         \dots\string\fi}}-constructs!
%
%   \item If you wish to use the arguments/comma-separated items for
%         defining macros, no extra |#|-level is needed as everything is
%         accumulated within/pro\-ces\-sed by means of token-registers.
%         \bigskip
%
%         \noindent
%         \begin{minipage}{\linewidth}
%           \noindent
%           |\eachlabelcase{ {sec1}{\def\testA#1#2#3}{\def\testB#1#2#3},|\\
%           |                {sec2}   {{#1,#2,#3}}      {{#3,#2,#1}}     }|&
%           \smallskip\\
%           is gathered to: |\def\testA#1#2#3{#1,#2,#3}|~~~.\\
%           Executing the queue defines:&
%           {&
%             \eachlabelcase{ {sec1}{\def\testA#1#2#3}{\def\testB#1#2#3},
%                             {sec2}   {{#1,#2,#3}}     {{#3,#2,#1}}   }
%             \vtop{&
%               |\testA|: {\makeatletter\verbatim@font\meaning\testA}\\
%               |\testB|: {\makeatletter\verbatim@font\meaning\testB}~~~.&
%             }&
%           }&
%         \end{minipage}
%         \bigskip
%
%         \noindent
%         \begin{minipage}{\linewidth}
%           |\eachlabelcase{ {sec1}{\def\testA#1#2#3}{\def\testB#1#2#3},|\\
%           |               {UNDEF}   {{#1,#2,#3}}      {{#3,#2,#1}}     }|&
%           \smallskip\\
%           is gathered to: |\def\testA#1#2#3{#3,#2,#1}|~~~.\\
%           Executing the queue defines:&
%           {&
%             \eachlabelcase{ {sec1}{\def\testA#1#2#3}{\def\testB#1#2#3},
%                          {UNDEF}   {{#1,#2,#3}}     {{#3,#2,#1}}   }
%             \vtop{&
%               |\testA|: {\makeatletter\verbatim@font\meaning\testA}\\
%               |\testB|: {\makeatletter\verbatim@font\meaning\testB}~~~.&
%             }&
%           }&
%         \end{minipage}
%         \medskip
% \end{itemize}
%
% \section{Package option---Different spaces, different se\-pa\-ra\-tors}&
% \label{sec4}
%
% Above was said that space-tokens (\verb*+ +\nobreak\(_{10}\)-tokens)
% which surround the comma-list-arguments of |\eachlabelcase| and
% |\lotlabelcase| are gobbled.
%
% There are circumstances where the category-code which gets assigned to
% the input-character \verb*+ + during the tokenizing-process is changed,
% and thus the gobbling-mechanism is broken for these input-characters.
% E.g., due to a preceding |\obeyspaces| or when using some package where
% the encoding of \TeX-input-files is played around with.
% This is because space-gobbling internally is implemented by means of
% macros with \verb*+ +\nobreak\(_{10}\)-token-delimited arguments.
%
% In normal circumstances, \verb*+ +\nobreak-characters in the input-file
% which trail a control-word do not get tokenized when {\TeX} ``reads'' an
% input. So it's kind of a problem to get space-tokens right behind the
% name of a control-word, e.g., as first items of the parameter-text when
% defining macros. A space within braces \verb*+{ }+ does get tokenized as
% it is not preceded by a control-word, but by a brace-character. So a
% solution to the problem is: Define a macro which takes an (en-braced)
% argument and use this macro for defining the desired control-word
% whereby the argument is placed right behind the name of the control-&
% word which is about to be defined. (Henceforth the term \emph{definer&
% -macro} is applied in order to call special attention to the fact that
% defining other control-sequences is the only purpose of such a macro.)
% A \verb*+ + in the definer-macro's argument gets tokenized while this
% argument is used as the first item of the desired control-word's
% parameter-text \(\rightarrow\) the first item of the desired control-&
% word's parameter-text will be a space-token.
%
% \DescribeMacro{\DefineLabelcase}
% In case of the |labelcas|-package, the problem of getting space-tokens
% as delimiters right behind control-words, is also solved by implementing
% such a definer-macro. It is called |\DefineLabelcase| and used for
% defining both the user-level-macros |\eachlabelcase| and |\lotlabelcase|
% and the internal-macros |\lc@iterate|, |\lc@remtrailspace| and
% |\lc@remleadspace|. Usually it is discarded/destroyed when defining
% these macros has taken place. But you can specify the package-option
% |DefineLabelcase|. When you do so, |\DefineLabelcase| does not get
% destroyed, and you can use it for creating ``new variants'' of
% |\eachlabelcase| and |\lotlabelcase| plus internals while specifying
% proper space-tokens and separators. |\DefineLabelcase| takes four
% mandatory arguments:
% \bigskip
%
% \noindent
% |\DefineLabelcase|\marg{space}\marg{delimiter}\marg{prefix}&
% \marg{global-indicator}
%
% \begin{description}
% \item[\textnormal{\meta{space}}] specifies the argument-surrounding
%      token that is to be removed. Usually surrounding space-tokens
%      shall be discarded. Default:~\verb*+ +\nobreak\(_{10}\)~(space).
% \item[\textnormal{\meta{delimiter}}] specifies the delimiter/separator.
%      Usually the argument-triplets or label-lists are comma-separated.
%      Default:~\verb*+,+\nobreak\(_{12}\)~(comma).
% \item[\textnormal{\meta{prefix}}] specifies the macro-name-prefix. You
%      cannot assign the same name at the same time to different
%      control-sequences. Therefore, when creating new variants of
%      |\eachlabelcase| and |\lotlabelcase|, you have to specify a prefix
%      which gets inserted at the beginning of the macro-name. E.g.,
%      specifying the prefix |FOO| leads to defining the macro-set:\\
%      |\FOOeachlabelcase|, |\FOOlotlabelcase| (user-macros) and\\
%      |\FOOlc@iterate|, |\FOOlc@remtrailspace|, |\FOOlc@remleadspace|
%      (internal).\\
%      The original versions are just called |\eachlabelcase|,
%      |\lotlabelcase|, |\lc@iterate|\dots (without a prefix in the
%      macro-name). Default:~(empty).
% \item[\textnormal{\meta{global-indicator}:}] In case that this argument
%      contains only the token |\global|, defining the new macro-set takes
%      place in terms of |\global|. Otherwise the scope is restricted to
%      the current grouping-level. Default:~\verb*+\global+.
% \end{description}
%
% Don't try weird things like specifying the same token both for
% \meta{space} and \meta{delimiter}, or leaving any of those empty, or
% specifying any of those to |\@nil| (,~which is reserved for terminating
% the recursion)---unless you like error-messages! Please only specify
% tokens which may be used for separating parameters from each other
% within the parameter-text of a definition! Also please specify the
% \meta{prefix} only in terms of letter-character-tokens! \textbf{There is
% no error-checking implemented on these things!}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\begingroup|\\
%   |\obeyspaces|\\
%   |\endlinechar=-1\relax|\\
%   |\DefineLabelcase{ }{/}{SPACEOBEYED}{local}%|\\
%   |\SPACEOBEYEDlotlabelcase[\test]{sec1/ sec2 /    UNDEFINED /sec3}%|\\
%   |{All   labels   are   defined.}%|\\
%   |{None   of   the   labels   is   defined.}%|\\
%   |{Some   labels   are   defined,   some not.}%|\\
%   |{The   list   is   empty.}%|\\
%   |\global\let\test\test|\\
%   |\endgroup|\medskip\\
%   defines: |\test|:
%\begingroup
%\obeyspaces
%\endlinechar=-1\relax
%\DefineLabelcase{ }{/}{SPACEOBEYED}{local}&
%\SPACEOBEYEDlotlabelcase[\test]{sec1/ sec2 /    UNDEFINED /sec3}&
%{All   labels   are   defined.}&
%{None   of   the   labels   is   defined.}&
%{Some   labels   are   defined,   some not.}&
%{The   list   is   empty.}&
%\global\let\test\test
%\endgroup
%   {\makeatletter\verbatim@font\meaning\test}&
%   \global\let\test\undefined
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\begingroup|\\
%   |\endlinechar=-1\relax|\\
%   |\DefineLabelcase{-}{/}{BAR}{local}%|\\
%   |\BARlotlabelcase[\test]{sec1/-sec2-/--%|\\
%   |                              ---/sec3}%|\\
%   |{All   labels   are   defined.}%|\\
%   |{None   of   the   labels   is   defined.}%|\\
%   |{Some   labels   are   defined,   some not.}%|\\
%   |{The   list   is   empty.}%|\\
%   |\global\let\test\test|\\
%   |\endgroup|\medskip\\
%   defines: |\test|:
%   \begingroup
%     \endlinechar=-1\relax
%     \DefineLabelcase{-}{/}{BAR}{local}&
%     \BARlotlabelcase[\test]{sec1/-sec2-/--&
%                                   ---/sec3}&
%                            {All   labels   are   defined.}&
%                            {None   of   the   labels   is   defined.}&
%                            {Some   labels   are   defined,   some not.}&
%                            {The   list   is   empty.}&
%     \global\let\test\test
%   \endgroup
%   {\makeatletter\verbatim@font\meaning\test}&
%   \global\let\test\undefined
% \end{minipage}
% \bigskip
%
% \noindent
% \begin{minipage}{\linewidth}
%   \noindent
%   |\begingroup|\\
%   |\endlinechar=-1\relax|\\
%   |\DefineLabelcase{.}{/}{DOT}{local}%|\\
%   |\DOTeachlabelcase{.{sec1}..{sec1 defined/}{sec1 undefined/}/%|\\
%   |..................{sec2}...{sec2 defined/}...{sec2 undefined/}./..%|\\
%   |..................{UNDEF}{UNDEF defined/}...{UNDEF undefined/}./%|\\
%   |..................{sec3}{sec3 defined.}{sec3 undefined.}..}|\\
%   |\endgroup|\medskip\\
%   yields:
%   \begingroup
%     \endlinechar=-1\relax
%     \DefineLabelcase{.}{/}{DOT}{local}&
%     \DOTeachlabelcase{.{sec1}..{sec1 defined/}{sec1 undefined/}/&
%...................{sec2}...{sec2 defined/}...{sec2 undefined/}./..&
%...................{UNDEF}{UNDEF defined/}...{UNDEF undefined/}./&
%...................{sec3}{sec3 defined.}{sec3 undefined.}..}&
%   \endgroup
% \end{minipage}
%
% \section{Thanks, Acknowledgements}
% \begin{itemize}
% \item Many thanks to all who encouraged me in making the attempt of
%       getting things in this package less error-prone.
% \item Thanks to everybody who took the macro-writing challenges
%       presented in the \textbf{INFO-\TeX}-`Around the bend'-department
%       which was initiated back in the early 90's by Michael Downes and
%       regularly took place under his guidance. His summaries of the
%       solutions are archived and on-line available at
%       |http://www.tug.org/tex-archive/info/aro-bend/|. The information
%       therein helps a great deal in understanding {\TeX} in general and
%       learning about basic problem solving strategies---e.g., the
%       removal of leading- and trailing spaces from an (almost) arbitrary
%       token-sequence (exercise.015/answer.015).
% \item Thanks to everybody who provides valuable information at the
%       {\TeX} news groups and mailing lists. I received great help
%       especially at |comp.text.tex|, where my---often trivial---&
%       questions were answered patiently again and again.
% \item Thanks to the \LaTeX-package authors, not only for providing means
%       of achieving special typesetting-goals, but also for hereby
%       delivering informative programming-examples. |labelcas| actually
%       was inspired by \emph{David Carlisle's} |xr-| and |xr-hyper|-&
%       packages which make available the labels of other \LaTeX-documents
%       to the current one.
% \end{itemize}
%
% \section{Legal Notes}
%
% |labelcas| is released under the {\LaTeX} Project Public Licence.
% \medskip
%
% Usage of the |labelcas|-package is at your own risk. There is no
% warranty---neither for documentation nor for any other part of the
% |labelcas|-package. If something breaks, you may keep the pieces.
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{Implementation}
%
% \subsection{A note about removing leading and trailing spaces}
%
% The matter of removing trailing spaces from an (almost) arbitrary
% token-sequence is elaborated in detail by Michael Downes, `Around the
% Bend \#15, answers', a summary of internet-discussion which took place
% under his guidance primarily at the \textbf{INFO-\TeX} list, but also in
% usenet (|comp.text.tex|) and via private e-mail; December 1993. Online
% archived at:\newline
% |http://www.tug.org/tex-archive/info/aro-bend/answer.015|.
%
% One basic approach suggested therein is using {\TeX}'s scanning of
% delimited parameters in order to detect and discard the ending space of
% an argument:
% \begin{quote}
%   \dots scan for a pair of tokens: a space-token and some well-chosen
%   bizarre token that can't possibly occur in the scanned text. If you
%   put the bizarre token at the end of the text, and if the text has a
%   trailing space, then \TeX's delimiter matching will match at that
%   point and not before, because the earlier occurrences of space don't
%   have the requisite other member of the pair.
%
%   Next consider the possibility that the trailing space is absent:
%   {\TeX} will keep on scanning ahead for the pair \meta{space}&
%   \meta{bizarre} until either it finds them or it decides to give up and
%   signal a `Runaway argument?' error. So you must add a stop pair to
%   catch the runaway argument possibility: a second instance of the
%   bizarre token, preceded by a space. If {\TeX} doesn't find a match at
%   the first bizarre token, it will at the second one.
% \end{quote}
%
% (Look up the macros |\KV@@sp@def|, |\KV@@sp@b|, |\KV@@sp@c| and
% |\KV@@sp@d| in \emph{David Carlisle's} |keyval|-package for an
% interesting variation on this approach.)
% \medskip
%
% When scanning for parameters ~~~|##1|\meta{space}\meta{bizarre}|##2|&
% \meta{B1}~~~ the sequence:
% \\
% \meta{stuff where to remove trail-space}\meta{bizarre}\meta{space}&
% \meta{bizarre}\meta{B1}&
% \\
% , you can fork two cases:
% \begin{enumerate}
%   \parskip=0ex\relax
%   \item Trailing-space:\\
%         |##1|=\meta{stuff where to remove trail-space}, but with removed
%         space. (And possibly one removed brace-level!)\\
%         |##2| = \meta{space}\meta{bizarre}.
%   \item No trailing-space:\\
%         |##1|=\meta{stuff where to remove trail-space}\meta{bizarre}.\\
%         |##2| is empty.
% \end{enumerate}
%
% So forking can be implemented dependent on the emptiness of |##2|.
%
% You can easily prevent the brace-removal in the first case, e.g. by
% adding (and later removing) something in front of the \meta{stuff where
% to remove trail-space}.
%
% You can choose \meta{B1}=\meta{bizarre}\meta{space}.
% \medskip
%
% `Around the Bend \#15, answers' also presents a similar way for the
% removal of leading spaces from an (almost) arbitrary token-sequence:
% \begin{quote}
%   The latter method is perhaps most straightforwardly done as a mirror-&
%   image of the method for removing a trailing space: make the delimiter
%   \meta{bizarre}\meta{space}, and call the macro [\dots] by putting
%   \meta{bizarre} before the scanned text and a stop pair \meta{bizarre}&
%   \meta{space} after it, in case a leading space is not present
% \end{quote}
%
% When scanning for parameters ~~~|##1|\meta{bizarre}\meta{space}|##2|&
% \meta{bizarre}\meta{B2}~~~ the sequence:
% \\
% \meta{bizarre}\meta{stuff where to remove lead-space}\meta{bizarre}&
% \meta{space}\meta{bizarre}\meta{B2}&
% \\
% , you can fork two cases:
% \begin{enumerate}\parskip=0ex\relax
%   \item Leading space:\\
%         |##1|= is empty.\\
%         |##2| = \meta{stuff where to remove lead-space}\meta{bizarre}&
%                 \meta{space} (but with a leading-space removed from
%                 \meta{stuff where to remove lead-space}).
%   \item No leading space:\\
%         |##1|=\meta{bizarre}\meta{stuff where to remove lead-space}.\\
%         |##2| is empty.
% \end{enumerate}
%
% Thus forking can be implemented dependent on the emptiness of either of
% the two arguments.
%
% You can choose \meta{B2}=\meta{bizarre}.
%
% \subsection{Flow of work}
%
% \begin{sloppypar}
% Both |\|\meta{prefix}|eachlabelcase| and |\|\meta{prefix}|lotlabelcase|
% iterate on (e.g., comma-) separated lists:
% \settowidth\labelwidth{5.}&
% \leftmargini=\labelwidth\relax
% \advance\leftmargini\labelsep\relax
% \advance\leftmargini\parindent\relax
% \begin{enumerate}
%   \parskip=0ex\relax\itemsep=.25\baselineskip\relax
% \item The list is passed as an argument to the user-macro.
% \item The list is passed from the user-macro to
%       |\|\meta{prefix}|lc@iterate| whereby a leading \meta{space} is
%       added for brace-removal-protection.
% \item |\|\meta{prefix}|lc@iterate| recursively iterates on the list-&
%       items until the item \meta{space}|\@nil| occurs:&
% {\def\labelenumii{\theenumii)}&
%  \settowidth\labelwidth{a)}&
%  \leftmarginii=\labelwidth\relax
%  \advance\leftmarginii\labelsep\relax
% \begin{enumerate}
%   \parskip=0ex\relax\itemsep=0ex\relax
%   \makeatletter\@topsep=0ex\relax\makeatother
%   \item If the item
%         (with leading \meta{space} stripped-off) is not empty, it will
%         be passed to
%   \item |\|\meta{prefix}|lc@remtrailspace|. Here trailing \meta{space}
%         is removed recursively. Afterwards, it is passed by
%         |\|\meta{prefix}|lc@remtrailspace| to
%   \item |\|\meta{prefix}|lc@remleadspace| where leading \meta{space}
%         (also the previously inserted one) is removed recursively. After
%         that |\|\meta{prefix}|lc@remleadspace| passes the item to the
%         macro
%   \item |\@tempa| for further processing. |\@tempa| at this stage will
%         be locally defined within the user-macro. |\@tempa| initiates
%         the actual work which (hopefully!) results in adding the
%         appropriate action-sequence to the queue which is represented by
%         |\@temptokena|.
%   \item Before processing the next item in the next iteration-round, a
%         leading \meta{space} for brace-removal-protection will be added
%         in front of the remaining list by |\|\meta{prefix}|lc@iterate|.
% \end{enumerate}\unskip}&
% \item After iterating the list within the user-macro, the routine
%       |\lc@macrodefiner| will check for the user-macro's optional
%       argument and, in case that it is present, modify the action-&
%       queue-register, so that, when flushing it, a macro will be
%       produced instead of queue-execution.
% \item The final step within the user-macro is flushing the action-&
%       queue-register.
% \end{enumerate}
% \end{sloppypar}
%
% \subsection{Code}
%
% \begin{macro}{\DefineLabelcase}
%   |\DefineLabelcase| is used for providing parameters during the
%   definition of the macros~\nobreak
%   {&
%     \makeatletter
%     \setbox\@tempboxa\hbox{|\|\meta{prefix}|lc@remleadspace|
%                            (internal).}&
%     \@tempdima\dp\@tempboxa
%     \vtop{&
%       \noindent
%       |\|\meta{prefix}|eachlabelcase|,
%       |\|\meta{prefix}|lotlabelcase| (user),\\
%       |\|\meta{prefix}|lc@iterate|,
%       |\|\meta{prefix}|lc@remtrailspace|,\\
%       |\|\meta{prefix}|lc@remleadspace| (internal).&
%     }&
%     \par\prevdepth\@tempdima
%   }&
%   \noindent
%   Parameters are:
%   |#1|\(=\)\meta{space}; |#2|\(=\)\meta{delimiter};
%   |#3|\(=\)\meta{prefix}; |#4|\(=\)\meta{global-indicator}.
%
%   Defining of |\DefineLabelcase| takes place within a group, so that
%   after closing the group it gets discarded. Package-options will also
%   be evaluated within that group, right after defining
%   |\DefineLabelcase|. By the option |DefineLabelcase|,
%   |\DefineLabelcase| can be ``globalized'' before closing the group:
%    \begin{macrocode}
%<*labelcas>
\DeclareOption{DefineLabelcase}%
              {\global\let\DefineLabelcase\DefineLabelcase}%
\begingroup
\newcommand\DefineLabelcase[4]{%
%    \end{macrocode}
% \end{macro}
% \def\pref{prefix}
% \begin{macro}{lc@remtrailspace}
% \Patchsavedatmacroname
% \changes{v1.01}{2006/01/06}{Let \meta{B1}\ChgEq\meta{bizarre}\nobreak
% \meta{space}}
% \changes{v1.03}{2006/02/21}{Chan\-ged forking-mechanism from
%   token-register to \string\verb+\string\@firstoftwo+/\empty
%   \string\verb+\string\@secondoftwo+}
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%   instead of \string\verb*+\string\newcommand+}
%   It is assured that \meta{delimiter} does not occur in the top-level of
%   the \meta{stuff where to remove trail-space}, for \meta{delimiter} is
%   used in the list for separating the single items of \meta{stuff where
%   to remove trail-space} from each other. Therefore you can choose
%   \meta{bizarre}=\meta{delimiter} and \meta{B1}=\meta{delimiter}&
%   \meta{space}:
%    \begin{macrocode}
  \expandafter\@ifdefinable\csname#3lc@remtrailspace\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@remtrailspace\endcsname##1#1#2##2#2#1{%
%    \end{macrocode}
%   Above was said that forking can take place depending on emptiness of
%   the second argument. The arguments come from the items of the comma-&
%   separated list---thus they might contain macro-definitions and/or
%   unbalanced {\makeatletter\verbatim@font\mbox{\string\if\dots\string
%   \else\dots\string\fi}}-constructs. So put the second argument into a
%   macro |\@tempa| by means of a token-register in order to prevent
%   errors related to parameter-numbering:
%    \begin{macrocode}
      \begingroup
      \toks@{##2}%
      \edef\@tempa{\the\toks@}%
%    \end{macrocode}
%   When forking takes place, the content of the arguments might---when
%   placed into the corresponding |\if|- or |\else|-branches directly---&
%   erroneously match up those constructs. In order to prevent this, the
%   action related to the different branches is handled by means of
%   |\@firstoftwo| and |\@secondoftwo| which get expanded when
%   ``choosing the forking-route'' is already accomplished:
%    \begin{macrocode}
      \expandafter\endgroup
      \ifx\@tempa\@empty
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
%    \end{macrocode}
%   The appropriate action in case of no more trailing \meta{space} is
%   removing leading \meta{space}. In this case |##1| is terminated by
%   \meta{bizarre}, so add only \meta{space}\meta{bizarre}\meta{B2} at the
%   end instead of \meta{bizarre}\meta{space}\meta{bizarre}\meta{B2}\\
%   (\meta{B2}=\meta{bizarre}=\meta{delimiter} in
%   |\|\meta{prefix}|lc@remleadspace|):
%    \begin{macrocode}
      {\csname#3lc@remleadspace\endcsname#2##1#1#2#2}%
%    \end{macrocode}
%   The appropriate action in case of trailing \meta{space} is checking
%   and removing more thereof:
%    \begin{macrocode}
      {\csname#3lc@remtrailspace\endcsname##1#2#1#2#2#1}%
    }%
  }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{lc@remleadspace}
% \Patchsavedatmacroname
% \changes{v1.01}{2006/01/06}{Let \meta{B2}\ChgEq\meta{bizarre}}
% \changes{v1.03}{2006/02/21}{Chan\-ged forking-mechanism from
%   token-register to \string\verb+\string\@firstoftwo+/\empty
%   \string\verb+\string\@secondoftwo+}
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%   instead of \string\verb*+\string\newcommand+}
%   |\|\meta{prefix}|lc@remleadspace| is similar to
%   |\|\meta{prefix}|lc@remtrailspace|, but with \meta{B2}=\meta{bizarre}&
%   =\meta{delimiter}:
%    \begin{macrocode}
  \expandafter\@ifdefinable\csname#3lc@remleadspace\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@remleadspace\endcsname##1#2#1##2#2#2{%
%    \end{macrocode}
%   Above was said that forking can take place e.g., depending on
%   emptiness of the first argument. Arguments still come from the list-&
%   items, so let's use token-registers for the same reasons as in
%   |\|\meta{prefix}|lc@remtrailspace|:
%    \begin{macrocode}
      \begingroup
      \toks@{##1}%
      \edef\@tempa{\the\toks@}%
%    \end{macrocode}
%   The single list-items might still contain macro-definitions, |\if|-&
%   forking and the like, therefore again choose the forking-route in
%   terms of |\@firstoftwo| and |\@secondoftwo|:
%    \begin{macrocode}
      \expandafter\endgroup
      \ifx\@tempa\@empty
        \expandafter\@firstoftwo
      \else
        \expandafter\@secondoftwo
      \fi
%    \end{macrocode}
%   The appropriate action in case of leading \meta{space} is checking
%   and removing more thereof:
%    \begin{macrocode}
      {\csname#3lc@remleadspace\endcsname#2##2#2#2}%
%    \end{macrocode}
%   In case of no more leading \meta{space}, the actual work, which is
%   defined in user-macro's |\@tempa|, can be done:
%    \begin{macrocode}
      {\@tempa##1#2}%
    }%
  }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{lc@iterate}
% \Patchsavedatmacroname
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%   instead of \string\verb*+\string\newcommand+}
% \changes{v1.07}{2006/04/27}{Define \string\verb*+\string\@tempa+
%   in terms of \string\verb*+\string\long+}
%   |\|\meta{prefix}|lc@iterate| iterates on arguments which are
%   delimited by \meta{delimiter}.
%    \begin{macrocode}
  \expandafter\@ifdefinable\csname#3lc@iterate\endcsname{%
    \expandafter\long
    \expandafter\def
    \csname#3lc@iterate\endcsname##1#2{%
%    \end{macrocode}
%   Let's put the \meta{space}, which needs to be inserted for brace-&
%   removal-protection, into a token-register---just in case: Maybe some
%   day somebody might specify weird |\fi|- or multiple-token-\meta{space}
%   or the like&
%   \dots\thinspace:
%    \begin{macrocode}
      \toks@{#1}%
%    \end{macrocode}
%   Make locally available the arguments as macros:\\
%   |\@tempa|\(=\)current argument without leading \meta{space}\\
%   |\@tempb|\(=\)current argument\\
%   |\@tempc|\(=\)recursion-stop-item\\
%   |\@tempd|\(=\)call for trailing-\meta{space}-removal\\
%   (|\|\meta{prefix}|lc@remleadspace| launches |\@tempa|
%   when no more leading \meta{space} is present---therefore before
%   starting the leading-\meta{space}-removal, |\@tempa| is defined to
%   redefine itself to the desired value)\thinspace:
%    \begin{macrocode}
      \begingroup
      \long\def\@tempa#2####1#2{\toks@{####1}\edef\@tempa{\the\toks@}}%
      \csname#3lc@remleadspace\endcsname#2##1#2#1#2#2%
      \toks@{##1}%
      \edef\@tempb{\the\toks@}%
      \toks@{#1\@nil}%
      \edef\@tempc{\the\toks@}%
      \toks@{\csname#3lc@remtrailspace\endcsname##1#2#1#2#2#1}%
      \edef\@tempd{\the\toks@}%
%    \end{macrocode}
%   Test if the current argument equals the recursion-stop-item:
%    \begin{macrocode}
      \ifx\@tempb\@tempc
%    \end{macrocode}
%   If so terminate the iteration---do nothing but closing the current
%   group:
%    \begin{macrocode}
        \expandafter\endgroup
      \else
%    \end{macrocode}
%   Otherwise check---before closing the group---if the current argument
%   minus leading \meta{space} is empty:
%    \begin{macrocode}
        \ifx\@tempa\@empty
%    \end{macrocode}
%   If so, do nothing but ending the group:
%    \begin{macrocode}
          \expandafter\endgroup
        \else
%    \end{macrocode}
%   Otherwise launch trailing-\meta{space}-removal:
%    \begin{macrocode}
          \expandafter\expandafter
          \expandafter            \endgroup
          \expandafter\@tempd
        \fi
%    \end{macrocode}
%   Then continue iterating the list and hereby add a preceding
%   \meta{space} to the next item for brace-protection during trailing-&
%   \meta{space}-removal in the next run:
%    \begin{macrocode}
        \csname#3lc@iterate\expandafter\expandafter
        \expandafter\endcsname
        \expandafter\the
        \expandafter\toks@
      \fi
    }%
  }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{eachlabelcase}
% \Patchsavedatmacroname
% \changes{v1.03}{2006/02/21}{Chan\-ged forking-mechanism from
%   token-register to \string\verb+\string\@firstoftwo+/\empty
%   \string\verb+\string\@secondoftwo+}
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%    instead of \string\verb*+\string\newcommand+}
%   |\|\meta{prefix}|eachlabelcase|'s optional argument is the possibly-&
%   to-be-defined control-sequence. The mandatory-argument contains the
%   argument-triplet-list.
%    \begin{macrocode}
  \expandafter\@ifdefinable\csname#3eachlabelcase\endcsname{%
    \expandafter\DeclareRobustCommand
    \csname#3eachlabelcase\endcsname[2][]{%
%    \end{macrocode}
%   Locally define |\@tempa|---it is called by
%   |\|\meta{prefix}|lc@remleadspace| for working on a list-item when all
%   surrounding \meta{space} has been removed:
%    \begin{macrocode}
      {%
%    \end{macrocode}
%   The stuff that results from \meta{space}-removing is surrounded by
%   \meta{delimiter}. It cannot be processed at this place, as first the
%   triplet needs to be split into it's components by |\@tempb|:
%    \begin{macrocode}
        \long\def\@tempa#2####1#2{%
          \@tempb####1#2#1#2#2%
        }%
%    \end{macrocode}
%   |\@tempb| is used for splitting the triplet and removing \meta{space}
%   between the triplet's components. In this process it redefines itself
%   several times. In case that no label is defined the name thereof
%   corresponds to the first component, add the third  component to
%   |\@temptokena|, otherwise add the second:
%    \begin{macrocode}
        \long\def\@tempb####1{%
          \begingroup
          \long\def\@tempb########1########2########3{%
            \expandafter\expandafter
            \expandafter\endgroup
            \expandafter\ifx
            \csname r@########1\endcsname\relax
              \expandafter\@firstoftwo
            \else
              \expandafter\@secondoftwo
            \fi
            {\@temptokena\expandafter{\the\@temptokena########3}}%
            {\@temptokena\expandafter{\the\@temptokena########2}}%
          }%
          \begingroup
          \toks@{}%
          \long\def\@tempb########1{%
            \long\def\@tempa#2################1#2{%
              \toks@\expandafter{\the\toks@{################1}}%
              \expandafter\endgroup\expandafter\@tempb\the\toks@
            }%
            \toks@\expandafter{\the\toks@{########1}}%
            \csname#3lc@remleadspace\endcsname#2%
          }%
          \toks@{{####1}}\csname#3lc@remleadspace\endcsname#2%
        }%
%    \end{macrocode}
%   Let's clear the register where the action-queue is accumulated:
%    \begin{macrocode}
        \@temptokena{}%
%    \end{macrocode}
%   Let's iterate on the list:
%    \begin{macrocode}
        \csname#3lc@iterate\endcsname#1##2#2\@nil#2%
%    \end{macrocode}
%   In case that the optional argument is specified, the routine
%   |\lc@macrodefiner| will modify the register to define a macro:
%    \begin{macrocode}
        \lc@macrodefiner{##1}%
%    \end{macrocode}
%   Close the group and ``flush'' the register:
%    \begin{macrocode}
      \expandafter}\the\@temptokena
    }%
  }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{lotlabelcase}
% \Patchsavedatmacroname
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%    instead of \string\verb*+\string\newcommand+}
%   |\|\meta{prefix}|lotlabelcase|'s optional argument is the possibly-&
%   to-be-defined control-sequence. The five mandatory-arguments contain
%   the label-list and the actions that shall take place in the cases: All
%   of the labels are defined~/ none are defined~/ just some are defined~/
%   list is empty:
%    \begin{macrocode}
  \expandafter\@ifdefinable\csname#3lotlabelcase\endcsname{%
    \expandafter\DeclareRobustCommand
    \csname#3lotlabelcase\endcsname[6][]{%
%    \end{macrocode}
%   Locally define |\@tempa|---it is called by
%   |\|\meta{prefix}|lc@remleadspace| for working on a list-item when all
%   surrounding \meta{space} has been removed:
%    \begin{macrocode}
      {%
        \long\def\@tempa#2####1#2{%
%    \end{macrocode}
%   The list item is a label. In case that it is undefined, have the
%   helper-macro |\@tempb| defined/switched to |\relax|, otherwise do the
%   same but use |\@tempc| instead:
%    \begin{macrocode}
          {\expandafter\expandafter\expandafter}\expandafter
          \ifx\csname r@####1\endcsname\relax
            \let\@tempb\relax
          \else
            \let\@tempc\relax
          \fi
        }%
%    \end{macrocode}
%   Define |\@tempb| and |\@tempc| to empty. They may be ``switched'' to
%   |\relax| when |\@tempa| is called during iteration.
%    \begin{macrocode}
        \def\@tempb{}%
        \def\@tempc{}%
%    \end{macrocode}
%   Let's iterate on the list:
%    \begin{macrocode}
        \csname#3lc@iterate\endcsname#1##2#2\@nil#2%
%    \end{macrocode}
%   Assign the register according to the label-defining-cases which are
%   now represented by the definitions of |\@tempb| and |\@tempc| which
%   are defined either |\relax| or |empty|:
%    \begin{macrocode}
        \ifx\@tempb\@empty
          \ifx\@tempc\@empty
            \@temptokena{##6}%
          \else
            \@temptokena{##3}%
          \fi
        \else
          \ifx\@tempc\@empty
            \@temptokena{##4}%
          \else
            \@temptokena{##5}%
          \fi
        \fi
%    \end{macrocode}
%   In case that the optional argument is specified, the routine
%   |\lc@macrodefiner| will modify the register to define a macro:
%    \begin{macrocode}
        \lc@macrodefiner{##1}%
%    \end{macrocode}
%   Close the group and ``flush'' the register:
%    \begin{macrocode}
      \expandafter}\the\@temptokena
    }%
  }%
%    \end{macrocode}
% \end{macro}
% If the \meta{global-indicator}-argument equals |\global|, the above
% definitions need to be made |\global|:
%    \begin{macrocode}
  {\toks@{#4}\edef\@tempa{\the\toks@}\def\@tempb{\global}\expandafter}%
  \ifx\@tempa\@tempb
    \expandafter\global\expandafter\let
      \csname#3lc@remtrailspace\expandafter\endcsname
      \csname#3lc@remtrailspace\endcsname
    \expandafter\global\expandafter\let
      \csname#3lc@remleadspace\expandafter\endcsname
      \csname#3lc@remleadspace\endcsname
    \expandafter\global\expandafter\let
      \csname#3lc@iterate\expandafter\endcsname
      \csname#3lc@iterate\endcsname
    \expandafter\global\expandafter\let
      \csname#3eachlabelcase\expandafter\endcsname
      \csname#3eachlabelcase\endcsname
    \expandafter\global\expandafter\let
      \csname#3lotlabelase\expandafter\endcsname
      \csname#3lotlabelcase\endcsname
  \fi
%    \end{macrocode}
% Now the definition of |\DefineLabelcase| is complete:
%    \begin{macrocode}
}%
%    \end{macrocode}
% Remember that a group was started for performing |\DefineLabelcase|'s
% definition and that |\DefineLabelcase| will be gone when that group gets
% closed---unless some ``globalizing'' takes place before. So this is the
% time for checking if |\DefineLabelcase| shall be available to the user
% and in this case for making it global:
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
% Now the group which was started for defining |\DefineLabelcase| can be
% closed---right after using it for defining the basic-usage-macros:
%    \begin{macrocode*}
\expandafter\endgroup\DefineLabelcase{ }{,}{}{\global}%
%    \end{macrocode*}
% \let\pref\empty
% \begin{macro}{\lc@macrodefiner}
% \changes{v1.06}{2006/04/20}{Use \string\verb*+\string\@ifdefinable+
%    instead of \string\verb*+\string\newcommand+}
%   There is still the routine left which is applied by the user-macros
%   for having the action-queue-register modified, so that when flushing
%   it, a macro will be produced instead of queue-execution.
%   |\lc@macrodefiner| takes as it's argument the optional argument of a
%   user-macro. In case that the argument is not empty, the action-queue-&
%   register is modified, so that it's flushing yields the attempt of
%   defining a macro from the argument which expands to the former content
%   of the register:
%    \begin{macrocode}
\newcommand\lc@macrodefiner[1]{%
  {\def\@tempa{#1}\expandafter}%
  \ifx\@tempa\@empty
  \else
    \@temptokena\expandafter{%
      \expandafter\begingroup
      \expandafter\toks@
      \expandafter\expandafter
      \expandafter            {%
      \expandafter\expandafter
      \expandafter            \@temptokena
      \expandafter\expandafter
      \expandafter            {%
      \expandafter\the
      \expandafter\@temptokena
      \expandafter}%
      \expandafter}%
      \expandafter\@temptokena
      \expandafter{%
      \expandafter\@temptokena
      \expandafter{%
      \the\@temptokena}%
      \@ifdefinable#1{\edef#1{\the\@temptokena}}}%
      \expandafter\expandafter
      \expandafter            \endgroup
      \expandafter\the
      \expandafter\@temptokena
      \the\toks@
    }%
  \fi
}%
%</labelcas>
%    \end{macrocode}
% \end{macro}
%
% \Finale
\endinput