summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/forarray/forarray.dtx
blob: 75e63a43bdc94bfeebfbe1d057afa637a74120bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
% \iffalse
%<*version>
Character Map:
ISO-8859-1 (Latin1, Western)

File Identifier:
forarray

Package: 
'forarray'

Description: 
Using array structures in LaTeX

Abstract: 
The package 'forarray' provides functionality for processing lists and array structures in LaTeX. Arrays can contain characters as well as TeX and LaTeX commands, nesting of arrays is possible, and arrays are processed within the same brace level as their surrounding environment. Array levels can be delimited by characters or control sequences defined by the user. Practical uses of this package include data management, construction of lists and tables, and calculations based on the contents of lists and arrays.

Version: 
1.01

Date: 
2008/06/20

Licence: 
LaTeX Project Public License (LPPL), version 1.3c

Licence Site:
http://www.latex-project.org/lppl.txt

Copyright:
The package 'forarray' is (c) 2008 by Christian Schröppel, and distributed under the terms of the LaTeX Project Public License (LPPL), version 1.3c.

Copyright Years: 
2008

Author: 
Christian Schröppel

Maintainance Status:
maintained

Current Maintainer: 
Christian Schröppel

Address:
'christian@schroeppel.com'

Master File: 
'forarray.dtm'

Documentation Style File:
'forarray.dts'

Installation Script:
'forarray'

Derived Files: 
'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf'

DTX File:
'forarray.dtx'

Version File:
'forarray.ver'

README File:
'README.txt'

Style File:
'forarray.sty'

Documentation File:
'forarray.pdf'

Test File:
'forarray-test.tex'

Test Result File:
'forarray-test.pdf'

Style File Directory:
<your local texmf directory>/tex/latex/forarray

Content:
The package 'forarray' consists of the master file 'forarray.dtm', the file 'README.txt', and the derived files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf'.

Documentation:
The file 'forarray.pdf' contains the documentation for the package 'forarray'.

The file 'README.txt' contains some basic information about the package.

The file 'forarray-test.tex' can be used to obtain a test page for the package. You can run this file with your LaTeX installation and compare the result with the file 'forarray-test.pdf' to check if everything works well.

Installation:
In order to use the package, you need to save the file 'forarray.sty' to a directory where your LaTeX installation will find it. This will often be <your local texmf directory>/tex/latex/forarray. Please consult the manuals for your LaTeX system for further information. In many cases, it will be possible to use a package manager provided with your LaTeX system to install the package.

DTM File:
You can obtain the files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf', as well as 'README.txt' by placing the files 'forarray.dtm', 'forarray.dts' and the Bourne shell script 'forarray' in a single directory and typing in forarray at the command prompt (after cd <your empty directory>). The installation script 'forarray' and the documentation style file 'forarray.dts' are not part of the package 'forarray'. Please note, however, that the provisions in the section "No warranty" of the LaTeX Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.

Copyright Notice:
The package 'forarray' is (c) 2008 by Christian Schröppel. It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), version 1.3c. This licence allows you to distribute unmodified copies of the package, as long as you include all components of the package in your distribution. It also allows modification of the package under certain conditions. Please read the licence if you intend to modify any of the contents of this package.

If any later version of the LPPL replaces this version, the package may be distributed and/or modified under the conditions of the current version of the LPPL at that time. The latest version of the LPPL is available at http://www.latex-project.org/lppl.txt.

The Author of the package is Christian Schröppel. You can contact the author at 'christian@schroeppel.com'.

This package has the LPPL maintenance status "maintained". The Current Maintainer is Christian Schröppel.

The package 'forarray' consists of the master file 'forarray.dtm', the file 'README.txt', and the derived files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf'.

The installation script 'forarray' and the documentation style file 'forarray.dts' are not part of the package 'forarray'. Please note, however, that the provisions in the section "No warranty" of the LaTeX Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.

No Warranty:
The installation script 'forarray' and the documentation style file 'forarray.dts' are not part of the package 'forarray'. Please note, however, that the provisions in the section "No warranty" of the LaTeX Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.

%</version>
%<*preamble>

The file 'forarray.dtx' was generated with the shell script 'forarray' from the master file 'forarray.dtm'.

COPYRIGHT NOTICE:

This file is part of the package 'forarray'.

The package 'forarray' is (c) 2008 by Christian Schröppel. It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), version 1.3c. This licence allows you to distribute unmodified copies of the package, as long as you include all components of the package in your distribution. It also allows modification of the package under certain conditions. Please read the licence if you intend to modify any of the contents of this package.

If any later version of the LPPL replaces this version, the package may be distributed and/or modified under the conditions of the current version of the LPPL at that time. The latest version of the LPPL is available at http://www.latex-project.org/lppl.txt.

The Author of the package is Christian Schröppel. You can contact the author at 'christian@schroeppel.com'.

This package has the LPPL maintenance status "maintained". The Current Maintainer is Christian Schröppel.

The package 'forarray' consists of the master file 'forarray.dtm', the file 'README.txt', and the derived files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf'.

The installation script 'forarray' and the documentation style file 'forarray.dts' are not part of the package 'forarray'. Please note, however, that the provisions in the section "No warranty" of the LaTeX Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.

%</preamble>
%<*postamble>
%</postamble>
% \fi
%
%
% \DOCstart
% \DefineTab{\ \ \ }
% \MakeShortVerb{\|}
% \def\RemarkCountToken{This is a \argsymb{count} token, so you must prefix it by \cmdarg\the, \cmdarg\number, \cmdarg\romannumeral\ or another appropriate command if you want to print out its content.}
% \def\RemarkCommandCharacters{You can use any characters that \TeX\ accepts as part of a \cmdarg\csname\ \textellipsis\ \cmdarg\endcsname\ construct.}
% \def\UsageFigureRef#1{Figure \vref{Usage of #1} illustrates the usage of \expandafter\cmdarg\csname #1\endcsname.}
% \def\UsageFigureCaption#1{\caption{Usage of \expandafter\cmdarg\csname #1\endcsname\label{Usage of #1}}}
% \parindent0pt
%  \title{Using array structures in \LaTeX: The package \mbox{\fontfamily{cmss}\selectfont forarray}\\ [.5ex]\Large Version 1.01 (2008/06/20)}
% \author{Christian Schr\"{o}ppel\footnote{Please send any comments or suggestions to \protect\href{mailto:christian@schroeppel.com}{\mbox{\fontfamily{cmss}\selectfont christian@schroeppel.com}}.}}
% \maketitle
% \abstract{The package \mbox{\fontfamily{cmss}\selectfont forarray} provides functionality for processing lists and array structures in \LaTeX. Arrays can contain characters as well as \TeX\ and \LaTeX\ commands, nesting of arrays is possible, and arrays are processed within the same brace level as their surrounding environment. Array levels can be delimited by characters or control sequences defined by the user. Practical uses of this package include data management, construction of lists and tables, and calculations based on the contents of lists and arrays.\par The package \mbox{\fontfamily{cmss}\selectfont forarray} is \textcopyright\ 2008 by Christian Schr\"{o}ppel, and distributed under the terms of the \LaTeX\ Project Public License (LPPL), version 1.3c.}
% \tableofcontents
% \parskip 1ex plus .25ex minus .15ex
% 
% \section{Introduction}
% 
% \TeX\ as well as \LaTeX\ do not provide any native functionality for processing arrays. Command structures such as |\loop| \textellipsis\ |\repeat| cannot be easily nested, and processing list or array items that contain arbitrary \TeX\ code, including braces that should be preserved during the execution, is difficult to implement.
% 
% The package \mbox{\fontfamily{cmss}\selectfont forarray} provides the commands |\ForEach| and |\ForArray|, as well as some additional commands, that simplify processing of array structures in \LaTeX.
% 
% It offers the following features:
%  
% \begin{itemize}
% \item Array data may contain arbitrary \LaTeX\ code.\footnote{There are some restrictions, however: Category code changes of characters take effect only after a \cmdarg\ForEach\ or \cmdarg\ForArray\ command has been processed, and they do not take effect immediately while processing a \cmdarg\ForEachD\ command.}
% \item Array delimiters are chosen by the user, which is especially useful if you intend to process data provided in a format that you cannot or do not want to change.
% \item Arrays are being processed at the same brace level as their environment, so that any variables or commands defined while processing an array keep their values or definitions without using |\global|.
% \item While processing the array, braces supplied with the content of the array are being preserved. 
% \end{itemize}
% 
% When processing arrays, the macros provided by the package \mbox{\fontfamily{cmss}\selectfont forarray} create functions that are used for processing each array level ``on the fly''. This approach is essential for being able to nest arrays within each other. However, it creates a certain processing overhead. This will usually not matter much if you use the \mbox{\fontfamily{cmss}\selectfont forarray} package commands within a \LaTeX\ document. Package writers, when defining commands that repeatedly process large amounts of data, should keep in mind that solutions tailor-made for specific data can avoid this overhead.
% 
% The name \mbox{\fontfamily{cmss}\selectfont forarray} indicates that this package offers functionality similar to the structures |for|\nolinebreak\ \textellipsis\ |next| or |for|\nolinebreak\ \textellipsis\ |each| that can be found in most programming languages.
% 
% \section{Files}
% 
% The package \mbox{\fontfamily{cmss}\selectfont forarray} consists of the master file \mbox{\fontfamily{cmss}\selectfont forarray.dtm}, the file \mbox{\fontfamily{cmss}\selectfont README.txt}, and the derived files \mbox{\fontfamily{cmss}\selectfont forarray.dtx}, \mbox{\fontfamily{cmss}\selectfont forarray.sty}, \mbox{\fontfamily{cmss}\selectfont forarray.pdf}, \mbox{\fontfamily{cmss}\selectfont forarray-test.tex}, and \mbox{\fontfamily{cmss}\selectfont forarray-test.pdf}. 
%  
% The file \mbox{\fontfamily{cmss}\selectfont forarray.pdf} contains the documentation for the package \mbox{\fontfamily{cmss}\selectfont forarray}.\par The file \mbox{\fontfamily{cmss}\selectfont README.txt} contains some basic information about the package.\par The file \mbox{\fontfamily{cmss}\selectfont forarray-test.tex} can be used to obtain a test page for the package. You can run this file with your \LaTeX\ installation and compare the result with the file \mbox{\fontfamily{cmss}\selectfont forarray-test.pdf} to check if everything works well.
% 
% You can obtain the files \mbox{\fontfamily{cmss}\selectfont forarray.dtx}, \mbox{\fontfamily{cmss}\selectfont forarray.sty}, \mbox{\fontfamily{cmss}\selectfont forarray.pdf}, \mbox{\fontfamily{cmss}\selectfont forarray-test.tex}, and \mbox{\fontfamily{cmss}\selectfont forarray-test.pdf}, as well as \mbox{\fontfamily{cmss}\selectfont README.txt} by placing the files \mbox{\fontfamily{cmss}\selectfont forarray.dtm}, \mbox{\fontfamily{cmss}\selectfont forarray.dts} and the Bourne shell script \mbox{\fontfamily{cmss}\selectfont forarray} in a single directory and typing in |forarray| at the command prompt (after |cd| \argsymb{your empty directory}). The installation script \mbox{\fontfamily{cmss}\selectfont forarray} and the documentation style file \mbox{\fontfamily{cmss}\selectfont forarray.dts} are not part of the package \mbox{\fontfamily{cmss}\selectfont forarray}. Please note, however, that the provisions in the section ``No warranty'' of the \LaTeX\ Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.
% 
% \section{Usage}
% 
% The package \mbox{\fontfamily{cmss}\selectfont forarray} provides commands for the following tasks:
% 
% \begin{description}
% \item[Processing lists] Use |\ForEach| or one of the other commands described in section \vref{Lists}.
% \item[Processing arrays] Use |\ForArray|, described in section \vref{Arrays}.
% \item[Defining variables] Use |\DefineArrayVar| or one of the other commands described in section \vref{Variables}.
% \end{description}
% 
% In order to use the package, you need to save the file \mbox{\fontfamily{cmss}\selectfont forarray.sty} to a directory where your \LaTeX\ installation will find it. This will often be \argsymb{your local texmf directory}\mbox{\fontfamily{cmss}\selectfont /tex/latex/forarray}. Please consult the manuals for your \LaTeX\ system for further information. In many cases, it will be possible to use a package manager provided with your \LaTeX\ system to install the package.
% 
% As with most other packages, simply include the package in your file with the command |\usepackage{forarray}|. Currently, you cannot supply any options to the package \mbox{\fontfamily{cmss}\selectfont forarray}.
% 
% \subsection{Processing lists}\label{Lists} 
% 
% \subsubsection{The command \cmdarg\ForEach}
% 
% The command \DMacro\ForEach\ can be used to process the items of a list. It has the following syntax:
% 
% \cmdsyntax{\cmdarg\ForEach}{\argsymbB{separator}\argsymbB{function}\argsymbB{list}}
% 
% \begin{description}
% \item[\argsymb{separator}] This can be any character or control sequence. Often, a comma or a semicolon will be used as the separator.
% \item[\argsymb{function}] This is the function that will be executed for every item in the list. You can use the token \DMacro\thislevelitem\ to reference the contents of the item that is being processed.\footnote{\cmdarg\thislevelitem\ is a \cmdarg\long\ macro that expands to the token list of the item. If you intend to compare its contents with the contents of other macros, please make sure that these macros are also defined as \cmdarg\long\ macros, e.g. by using \cmdarg\newcommand.} The variable \DMacro\thislevelcount\ contains the number of the position of the item within the list. \RemarkCountToken
% \item[\argsymb{list}] This argument contains the items of your list. Space characters of category code 10 will be ignored if they immediately precede or follow a separator.
% \end{description}
% 
% \UsageFigureRef{ForEach}
% 
% \begin{figure}[hbt]
% \begin{NoHyper}
% \begin{WBoth}
% \begin{itemize}
% \ForEach
% {,}
% {\item This is item No.\ %
% \the\thislevelcount.\\
% It contains: ``\thislevelitem''.}
% {A \textbf{bold} word, 
% \textit{Some more words, written 
% in italics},
% \multiply\thislevelcount\thislevelcount
% the number \the\thislevelcount,
% Some more text}
% \end{itemize}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \UsageFigureCaption{ForEach}
% \ShowExampleBox
% \end{figure}
% 
% \subsubsection{The command \cmdarg\ForEachX}
% 
% The command \DMacro\ForEachX\ processes the list of items in the same way as the command \cmdarg\ForEach. However, it expands its third argument, a token containing the actual list, before processing it. It has the following syntax:
% 
% \cmdsyntax{\cmdarg\ForEachX}{\argsymbB{separator}\argsymbB{function}\argsymbB{list token}}
% 
% \begin{description}
% \item[\argsymb{separator}] Same as in |\ForEach|.
% \item[\argsymb{function}] Same as in |\ForEach|.
% \item[\argsymb{list token}] This is a control sequence or an active character that expands to the list that is to be processed by |\ForEachX|. 
% \end{description}
% 
% \subsubsection{The command \cmdarg\ForEachSublevel}
% 
% The command \DMacro\ForEachSublevel\ processes the the contents of a item of a surrounding list processing command. It is based on the command |\ForEachX|, but operates on the expansion of the token |\thislevelitem| taken from the surrounding list. It has the following syntax:
% 
% \cmdsyntax{\cmdarg\ForEachSublevel}{\argsymbB{separator}\argsymbB{function}}
% 
% \begin{description}
% \item[\argsymb{separator}] Same as in |\ForEach|.
% \item[\argsymb{function}] Same as in |\ForEach|.
% \end{description}
% 
% With the command |\ForEachSublevel|, lists can be easily nested, as shown in Figure \vref{Nested}.
% 
% \begin{figure}[hbt]
% \begin{NoHyper}
% \begin{WBoth}
% \begin{enumerate}
% \ForEach
% {;}
% {
% \item This is item No.\ %
% \the\thislevelcount.
% \begin{enumerate}
% \ForEachSublevel
% {,}
% {\item \thislevelitem.}
% \end{enumerate}
% }
% {This is a nested item,
% Another nested item;
% {This item is, well, nested},
% A final item}
% \end{enumerate}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \caption{Nested Lists\label{Nested}}
% \ShowExampleBox
% \end{figure}
% 
% \subsubsection{The command \cmdarg\ForEachD}
% 
% The command \DMacro\ForEachD\ processes the list of items in the same way as the command |\ForEach|. However, it does not the contents of the list as its third argument, but parses the characters supplied after the second argument. These characters have to be delimited by the separator, followed by the control sequence |\endforeach|.\footnote{The token \cmdarg\endforeach\ is never actually expanded.} It has the following syntax:
% 
% \cmdsyntax{\cmdarg\ForEachD}{\argsymbB{separator}\argsymbB{function}\argsymb{list}\argsymb{separator}\cmdarg\endforeach}
% 
% \begin{description}
% \item[\argsymb{separator}] Same as in |\ForEach|.
% \item[\argsymb{function}] Same as in |\ForEach|.
% \item[\argsymb{list}] Same as in |\ForEach|. The \argsymb{list} must be supplied \emph{without} surrounding braces. 
% \end{description}
% 
% The command |\ForEachD| allows to change the category codes of characters during the execution of the list. However, if the commands changing the category codes are supplied as part of the list, these changes only take effect after the current item has been processed. Figure \vref{Category Codes} illustrates how category codes can be changed during the execution of |\ForEachD|.
% 
% \begin{figure}[hbt]
% \begin{NoHyper}
% \begin{WBoth}
% \ForEachD
% {;}
% {\thislevelitem\par\bigskip}
% * Huh? What is this?;
% \catcode`\*\active * I still have no clue!;
% \newcommand{*}{\textbf{star}} 
% Now I see \textellipsis\ This is a *!;
% I remember, this is a *.;\endforeach
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \caption{Changing category codes within a list\label{Category Codes}}
% \ShowExampleBox
% \end{figure}
% 
% \subsubsection{The command \cmdarg\ExitForEach}
%  
% The command \DMacro\ExitForEach\ stops the execution of the list after the current item has been processed. It does not take any arguments. \UsageFigureRef{ExitForEach}
% 
% \begin{figure}[hbt]
% \begin{NoHyper}
% \begin{WBoth}
% \newcommand{\LeaveThisPlace}
% {Leave this place!}
% \ForEach
% {;}
% {-- This item says: 
% ``\thislevelitem''\par\medskip
% \ifx\thislevelitem\LeaveThisPlace
% \ExitForEach Ooops, I have to quit.\par
% \else
% Continuing to the next item 
% \textellipsis\par\bigskip
% \fi}
% {Please continue.;Please continue.;
% Leave this place!;Where has he gone?}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \UsageFigureCaption{ExitForEach}
% \ShowExampleBox
% \end{figure}
% 
% \subsection{Processing arrays}\label{Arrays} 
% 
% \subsubsection{The command \cmdarg\ForArray}
% 
% The command \DMacro\ForArray\ processes the contents of an array. The first arguments supplied to this command specify the separators for each level of the array, a grouping marker for each array level, a token or active character that can be for executing a sublevel of the array, and the functions that the command |\ForArray| executes for each item of the array at the respective levels. The command |\ForArray| has the following syntax:
% 
% \cmdsyntax{\cmdarg\ForArray}{\argsymbB{separator list}\argbrackets{\argsymbO{marker list separator}\argsymb{marker list}}\argsymbB{sublevel token}\argsymbB{function list separator}\argsymbB{function list}\argsymbB{array}}
% 
% \begin{description}
% \item[\argsymb{separator list}] This is a list of characters or control sequences that are used to separate the respective level of the array. For example, if you have an array with a semicolon as first level separator and a comma as second level separator, you would use \argbraces{{\tt;,}} as the \argsymbB{separator list}.
% \item[\argsymb{marker list separator}] Optional argument. This is a control sequence or active character that separates the markers in the \argsymb{marker list}. It can only be used if a \argsymb{marker list} is supplied as well. If the \argsymb{marker list} is supplied without a \argsymb{marker list separator}, each character or control sequence of the marker list is taken as separate marker.
% \item[\argsymb{marker list}] Optional argument. This is a list of characters or control sequences that are used as markers for the respective level of the array. You can use the token \DMacro\thislevelmarker\ to reference the marker of the respective level.
% \item[\argsymb{sublevel token}] This is a control sequence or an active character that expands to the function that processes the level of the array below the level that is being processed at the respective time. If you intend to process the lower levels of your array, you have to include this token in the \argsymb{function list} as part of the functions for the higher levels of your array. The \argsymb{sublevel token} expands to the content of the item if used in the function applied to the lowest level of the array.\footnote{The \argsymb{sublevel token} actually expands to \cmdarg\fa@array@level, which in turn expands to \cmdarg\fa@array@\argsymb{array level}. The token \cmdarg\fa@array@\argsymb{array level} either expands to the function that processes the level of the array below the current level or, if used at the lowest level of the array, to \cmdarg\thislevelitem, the reference to the current item. Using \cmdarg\thislevelitem\ avoids this overhead.}
% \item[\argsymb{function list separator}] This is a control sequence or active character that separates the functions in the \argsymb{function list}.
% \item[\argsymb{function list}] This is a list of functions for the respective levels of the array, separated by the \argsymb{function list separator}. The variables \cmdarg\thislevelitem\ and \cmdarg\thislevelcount\ can be used in the same way as with the \cmdarg\ForEach\ command. In addition, the variable \DMacro\thislevelnr\ can be used. It contains the number of level within the array. \RemarkCountToken
% \item[\argsymb{array}] This argument contains the items of your array. Space characters of category code 10 will be ignored if they immediately follow a separator.
% \end{description}
% 
% \UsageFigureRef{ForArray}
% 
% \begin{figure}[hbt]
% \UsageFigureCaption{ForArray}
% 
% \begin{NoHyper}
% \begin{WBoth}
% \ForArray{;,}{*}{|}
% {[*]\par|(*)}
% {A,B;C,D}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \subfloat[Basic usage]{\ShowExampleBox}
% 
% \begin{NoHyper}
% \begin{WBoth}
% \ForArray{;,}{*}{|}
% {\framebox{*}\par\smallskip|
% \framebox{\parbox[t]{3em}
% {\centering*}}\ }
% {A,B;%
% \ForArray{;,}{*}{|}
% {\centering*\par|(*)}
% {a,b;c,d},D}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \subfloat[Nested arrays]{\ShowExampleBox}
% \end{figure} 
% 
% \subsubsection{The command \cmdarg\ExitForEachLevels}
% The command \DMacro\ExitForEachLevels\ stops the execution of the array at the levels indicated in its arguments have been processed. It takes effect after the current item has been processed. Its syntax is as follows:
% 
% \cmdsyntax{\cmdarg\ExitForEachLevels}{\argsymbB{Start level}\argsymbB{Number of levels}}
% 
% \begin{description}
% \item[\argsymb{Start level}] This is the number of the lowest level that is exited after the command \cmdarg\ExitForEachLevels\ is being read. The number is relative to the current level, i.e. a value of 1 indicates that the current level is the lowest level that is being exited, a value of 2 indicates that the level above the current level is the lowest level that is being exited.
% \item[\argsymb{Number of levels}] This is the number of levels that are being exited. The levels are being exited in consecutive order, beginning with the lowest level, which is being supplied as \argsymb{Start level}.
% \end{description}
% 
% During the processing of an array item, you can supply multiple \cmdarg\ExitForEachLevels\ commands. \cmdarg\ForArray\ will exit from all levels indicated in the \cmdarg\ExitForEachLevels\ commands that have been supplied. The command \mbox{\cmdarg\ExitForEachLevels\argbraces{{\tt1}}\argbraces{{\tt1}}} has the same effect as the command \cmdarg\ForEachExit.
% 
% \subsection{Defining variables}\label{Variables} 
% 
% \subsubsection{The command \cmdarg\DefineArrayVar}
% 
% The command \DMacro\DefineArrayVar\ defines a group of variables that are being named as \argsymb{array name}\argsymb{variable name separator}\argsymb{variable name}. Its syntax is as follows:
%  
% \cmdsyntax{\cmdarg\DefineArrayVar}{\argsymbB{array name}\\\argsymbB{variable name separator}\\\argsymbB{variable list separator}\\\argsymbB{variable list}\\\argsymbB{variable content list separator}\\\argsymbB{variable content list}}
% 
% \begin{description}
% \item[\argsymb{array name}] The names of all variables that are being defined by \cmdarg\DefineArrayVar\ start with the sequence of characters supplied as \argsymb{array name}. \RemarkCommandCharacters
% \item[\argsymb{variable name separator}] This character or sequence of characters separates the \argsymb{array name} and the \argsymb{variable name}. \RemarkCommandCharacters
% \item[\argsymb{variable list separator}] The \argsymb{variable list separator} separates the variable names supplied with the \argsymb{variable list}. It is a single control sequence or character. 
% \item[\argsymb{variable list}] The \argsymb{variable list} contains the \argsymb{variable name}s that are used to construct the names of the variables in the array. \RemarkCommandCharacters
% \item[\argsymb{variable content list separator}] The \argsymb{variable content list separator} separates the contents of the variables supplied with the \argsymb{variable content list}. It is a single control sequence or character.
% \item[\argsymb{variable content list}] The \argsymb{variable content list} contains the contents of the variables in the array. 
% \end{description}
% 
% If you supply less items in the \argsymb{variable content list} than in the \argsymb{variable list}, the content of the remaining variables will be set to the token \cmdarg\relax. If you supply more items in the \argsymb{variable content list} than in the \argsymb{variable list}, the remaining content items will be ignored. \UsageFigureRef{DefineArrayVar}
% 
% \begin{figure}[hbt]
% \UsageFigureCaption{DefineArrayVar}
% 
% \begin{NoHyper}
% \begin{WBoth}
% \makeatletter
% \fontfamily{upl}\selectfont
% 
% \DefineArrayVar{Capital}{@}
% {,}{Brazil,Japan,South Korea,Viet Nam}
% {,}{Bras\'{i}lia,T\={o}ky\={o},
% S\u{o}ul,H\^{a} N\^{o}i}
% 
% \DefineArrayVar{Name}{@}
% {,}{Brazil,Japan,South Korea,Viet Nam}
% {,}{Brazil,Japan,the Republic of Korea,
% Vi\d\ecircumflex t Nam}
% 
% \newcommand{\CapitalCity}[1]
% {The capital city of
% \csname Name@#1\endcsname\ is
% \csname Capital@#1\endcsname.}
% 
% \ForEach{,}
% {\CapitalCity{\thislevelitem}
% \par\medskip}
% {Brazil,Japan,South Korea,Viet Nam}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \ShowExampleBox
% \end{figure} 
% 
% \subsubsection{The command \cmdarg\DefineArrayVars}
% 
% The command \DMacro\DefineArrayVars\ defines a set of grouped variables that are being named as \argsymb{array name}\argsymb{variable name separator}\argsymb{variable name}. The \argsymb{array name} is taken from a list of names supplied by the user. The syntax of \cmdarg\DefineArrayVars\ is as follows:
%  
% \cmdsyntax{\cmdarg\DefineArrayVars}{\argsymbB{variable list separator}\\\argsymbB{array definitions separator}\\\argsymbB{array name/content separator}\\\argsymbB{content list separator}\\\argsymbB{variable name separator}\\\argsymbB{variable list}\\\argsymbB{content definition list}}
%  
% A precise explanation of the functions of the respective arguments would probably be rather lengthy and somewhat confusing. Therefore, the command \cmdarg\DefineArrayVar\ will be explained with the help of an example. Figure \vref{Usage of DefineArrayVars} shows that the result already produced with the use of \cmdarg\DefineArrayVar\ (see Figure \vref{Usage of DefineArrayVar}) can be obtained in a shorter and more structured way by using \cmdarg\DefineArrayVars.
% 
% \begin{figure}[hbt]
% \UsageFigureCaption{DefineArrayVars}
% 
% \begin{NoHyper}
% \begin{WBoth}
% \makeatletter
% \fontfamily{upl}\selectfont
% 
% \DefineArrayVars{,}{/}{:}{;}{@}
% {Brazil,Japan,South Korea,Viet Nam}
% {Capital:
% Bras\'{i}lia;T\={o}ky\={o};
% S\u{o}ul;H\^{a} N\^{o}i/
% Name:
% Brazil;Japan;the Republic of Korea;
% Vi\d\ecircumflex t Nam}
% 
% \newcommand{\CapitalCity}[1]
% {The capital city of
% \csname Name@#1\endcsname\ is
% \csname Capital@#1\endcsname.}
% 
% \ForEach{,}
% {\CapitalCity{\thislevelitem}
% \par\medskip}
% {Brazil,Japan,South Korea,Viet Nam}
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \ShowExampleBox
% \end{figure} 
% 
% In the example, the \emph{first argument} of \cmdarg\DefineArrayVars\ is a comma. It separates the names of the sequences of character and/or tokens that are being used to construct the second part of the names of the array variables. 
% 
% The \emph{second argument} of \cmdarg\DefineArrayVars\ is a slash. It is used to delimit the arrays that you intend to define. In this case, only one slash is needed: It separates the array of ``Capital'' variables from the array of ``Name'' variables. 
% 
% The \emph{third argument} separates the array name from the list of contents. In this case, a colon is being used. 
% 
% The \emph{fourth argument}, which, in this example, is a semicolon, separates the items of the list of content definitions. 
% 
% The \emph{fifth argument} is the string of characters that is being used to separate the array name from the variable name. Here, an \textit{at} sign is being used, and the resulting names of the variables are \cmdarg\Capital@Brazil, \cmdarg\Capital@Japan, \textellipsis\ \verb*|\Name@Viet Nam|.\footnote{Be aware that you cannot directly access control sequences whose names contain non-letter characters without changing the category codes of the respective characters.}
% 
% The \emph{sixth argument} and the \emph{seventh argument} contain the list of variable names and the list of array names and contents, respectively. Both have to be structured accordings to the specifications supplied with the preceding arguments.
% 
% \subsubsection{The command \cmdarg\DefineArrayDefault}
% 
% The command \DMacro\DefineArrayDefault\ can be used to access the contents of a group of variables that have been defined with \cmdarg\DefineArrayVar\ or \cmdarg\DefineArrayVars. It defines a new control sequence whose expansion depends on the value of another variable. If, for a particular content of the second variable, no specific expansion has been defined, the variable expands to a default content. The syntax of \cmdarg\DefineArrayDefault\ is as follows:
% 
% \cmdsyntax{\cmdarg\DefineArrayDefault}{\argsymbB{array list separator}\\\argsymbB{variable name separator}\\\argsymbB{index variable}\\\argsymbB{default variable}\\\argsymbB{array list}}
% 
% \begin{description}
% \item[\argsymb{array list separator}] The \argsymb{variable list separator} separates the array names supplied with the \argsymb{array list}. It is a single control sequence or character.
% \item[\argsymb{variable name separator}] Same as in \cmdarg\DefineArrayVar.
% \item[\argsymb{index variable}] The variable that expands to one of the names of the variables supplied with the \argsymb{variable list} of \cmdarg\DefineArrayVar\ or \cmdarg\DefineArrayVars. If this variable does not expand to one of these names, the name of the default index variable is being used, resulting in an expansion to the default content.
% \item[\argsymb{default variable}] The name of the default variable.
% \item[\argsymb{array list}] This in a list of array names, for which the index variable and the default variable are being defined.
% \end{description}
% 
% \UsageFigureRef{DefineArrayDefault}
% 
% \begin{figure}[hbt]
% \UsageFigureCaption{DefineArrayDefault}
% 
% \begin{NoHyper}
% \begin{WBoth}
% \makeatletter
% \fontfamily{upl}\selectfont
% 
% \DefineArrayVars{,}{/}{:}{;}{@}
% {Brazil,Japan,South Korea,Viet Nam,Unknown}
% {Capital:
% Bras\'{i}lia;T\={o}ky\={o};
% S\u{o}ul;H\^{a} N\^{o}i;unknown/
% Name:
% Brazil;Japan;the Republic of Korea;
% Vi\d\ecircumflex t Nam;this country}
% 
% \DefineArrayDefault{,}{@}{\country}%
% {Unknown}{Capital,Name}
% 
% \newcommand{\WhatIsTheCapitalCity}
% {-- You've asked for the capital city of 
% \textit{\country}.\par\medskip
% The capital city of \Name\ is 
% \textbf{\Capital}.\par\bigskip}
% 
% \newcommand{\country}{Brazil}
% \WhatIsTheCapitalCity
% \renewcommand{\country}{South Korea}
% \WhatIsTheCapitalCity
% \renewcommand{\country}{a strange country}
% \WhatIsTheCapitalCity
% \end{WBoth}
% \end{NoHyper}
% \MakeExampleBox
% \ShowExampleBox
% \end{figure} 
% 
% \subsubsection{The command \cmdarg\DefineArrayVarTo}
% 
% The command \DMacro\DefineArrayVarTo\ assigns the same content to a group of variables. It has the following syntax:
%  
% \cmdsyntax{\cmdarg\DefineArrayVarTo}{\argsymbB{variable list separator}\argsymbB{variable name separator}\argsymbB{array name}\argsymbB{content}\argsymbB{variable list}}
% 
% \begin{description}
% \item[\argsymb{variable list separator}] Same as in \cmdarg\DefineArrayVar.
% \item[\argsymb{variable name separator}] Same as in \cmdarg\DefineArrayVar.
% \item[\argsymb{array name}] Same as in \cmdarg\DefineArrayVar.
% \item[\argsymb{content}] The content that is being assigned to the variables.
% \item[\argsymb{variable list}] Same as in \cmdarg\DefineArrayVar.
% \end{description}
% 
% \subsubsection{The command \cmdarg\CommandForEach}
% 
% The command \DMacro\CommandForEach\ executes the same control sequence (or token list) for each item in a list. The items can consist of one or more characters or tokens. The command \cmdarg\CommandForEach\ has the following syntax:
%  
% \cmdsyntax{\cmdarg\CommandForEach}{\argsymbB{variable list separator}\argsymbB{command}\argsymbB{variable list}}
% 
% \begin{description}
% \item[\argsymb{list separator}] Same as in \cmdarg\ForEach.
% \item[\argsymb{command}] This is the control sequence or token list that uses the respective item taken from the list as its argument.
% \item[\argsymb{list}] Same as in \cmdarg\ForEach.
% \end{description}
% 
% \subsubsection{The command \cmdarg\FunctionForEach}
% 
% The command \DMacro\FunctionForEach\ works in nearly the same way and has the same syntax as the command \cmdarg\CommandForEach. The difference between the two commands is that \cmdarg\FunctionForEach\ encloses the respective list item in braces and supplies it as a single argument to the function. This command has the same syntax as \cmdarg\CommandForEach.
% 
% \subsection{Additional features}
% 
% The style file for this package contains some features which are not described in the documentation. In particular, some of the commands of the package can be used with optional arguments that are not included in the documentation. These features are still under development, and their usage may change in the future.
% 
%
%
% \section{The implementation\label{Implementation}}
%
% \subsection{Initial commands}
%
%    \begin{macrocode}
%<*sty>
\ProvidesPackage{forarray}
	[2008/06/20 Version 1.01 -- Using array structures in LaTeX]
\makeatletter
\def\fe@checkifdefined#1{%
\ifx#1\empty
\else
	\expandafter\ifx\csname #1\endcsname\relax
	\else
		\PackageError{forarray}
			{
			Command #1 is already defined.\MessageBreak
			This command is being used by the package "forarray" %
			and must not be defined when the package is loaded
			}
			{No further immediate help available.}
		\csname fi\endcsname\csname fi\endcsname\@gobblefour
	\fi
	\expandafter\fe@checkifdefined
\fi}
\fe@checkifdefined
	{CommandForEach}{DefineArrayDefault}{DefineArrayVar}
	{DefineArrayVars}{DefineArrayVarTo}{endforeach}
	{ExitForEach}{ExitForEachLevels}{ForArray}{ForEach}
	{ForEachD}{ForEachSublevel}{ForEachX}{FunctionForEach}
	{thislevelcount}{thislevelitem}{thislevelmarker}
	{thislevelnr}{}
\edef\fe@aux@endlinecharrestore{\the\endlinechar}
\endlinechar\m@ne
\newtoks\fe@toks
\newcount\fe@level
\newcount\fe@cnt@i
\newcount\fe@cnt@ii
\newcount\thislevelcount
\newcount\thislevelnr
\fe@level\z@
\chardef\fa@arraylevel\z@
\chardef\fe@toplevel\z@
\chardef\fe@count@abs@\@ne
\chardef\fe@relmax\z@
\chardef\fe@relmax@abs@\z@
\let\fe@item@abs@\empty
\let\fe@first@abs@\empty
\let\fe@last@abs@\empty
\let\fe@empty@abs@\empty
\let\fe@position@abs@\empty
\let\fe@levelrn\empty
%    \end{macrocode}
%
% \subsection{Macros for processing lists}
%
% \subsubsection{User commands}
%
% \begin{macro}{\ForEachD}
% The macro \cmdarg\ForEachD\ directly calls \cmdarg\ForEachD@. It does not take the list as an argument, so that catcodes can be changed during the execution.
%    \begin{macrocode}
\def\ForEachD{\@ifnextchar(\ForEachD@Arg\ForEachD@NoArg}
\def\ForEachD@Arg(#1){\ForEachD@{#1\relax}}
\def\ForEachD@NoArg{\ForEachD@\fe@relmax}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ForEach}
% The macro \cmdarg\ForEach\ absorbs the list immediately as its third mandatory argument.
%    \begin{macrocode}
\def\ForEach{\@ifnextchar(\ForEach@Arg\ForEach@NoArg}
\def\ForEach@Arg(#1){\ForEach@{#1\relax}}
\def\ForEach@NoArg{\ForEach@\fe@relmax}
\long\def\ForEach@#1#2#3#4{\ForEachD@{#1}{#2}{#3}#4#2\endforeach}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ForEachX}
% The macro \cmdarg\ForEachX\ expands its third mandatory argument, which contains the list.
%    \begin{macrocode}
\def\ForEachX{\@ifnextchar(\ForEachX@Arg\ForEachX@NoArg}
\def\ForEachX@Arg(#1){\ForEachX@{#1\relax}}
\def\ForEachX@NoArg{\ForEachX@\fe@relmax}
\long\def\ForEachX@#1#2#3#4
	{
	\def\fe@i{\ForEachD@{#1}{#2}{#3}}
	\expandafter\fe@i#4#2\endforeach
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ForEachSublevel}
% The macro \cmdarg\ForEachSublevel\ expands the current item of a surrounding list or array.
%    \begin{macrocode}
\def\ForEachSublevel
	{\@ifnextchar(\ForEachSublevel@Arg\ForEachSublevel@NoArg}
\def\ForEachSublevel@Arg(#1){\ForEachSublevel@{#1\relax}}
\def\ForEachSublevel@NoArg{\ForEachSublevel@\fe@relmax}
\long\def\ForEachSublevel@#1#2#3
	{
	\def\fe@i{\ForEachD@{#1}{#2}{#3}}
	\expandafter\fe@i\thislevelitem#2\endforeach
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ExitForEach}
% The macro \cmdarg\ExitForEach\ redefines the kernel macro \cmdarg\fe@next@\argsymb{current level} in order to stop the execution of the current list. The rest of the list is being supplied as an argument to \cmdarg\fe@next@\argsymb{current level}, which just gobbles it. 
%    \begin{macrocode}
\def\ExitForEach
	{
	\expandafter\let
	\csname fe@next@\romannumeral\fe@level\endcsname
	\fe@ExitForEach@base
	}
\def\fe@ExitForEach@base#1\endforeach{}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\ForEachD@}
% The macro \cmdarg\ForEachD@\ defines several tokens used for processing a list or a level of an array. If it enters a level higher than any previous one, it calls \cmdarg\fe@newlevel, which defines the macros that are being used for processing lists as well as arrays for that level, i.e. the ``kernel'' macros.
%    \begin{macrocode}
\long\def\ForEachD@#1#2#3
	{
	\let\fe@upperlevelrn\fe@levelrn
	\advance\fe@level\@ne\relax
	\expandafter\def\expandafter\fe@levelrn\expandafter
		{\romannumeral\fe@level}
	\ifnum\fe@level>\fe@toplevel
		\expandafter
		\ifx\csname fe@count@abs@\fe@levelrn\endcsname\relax
			\expandafter\newcount
				\csname fe@count@abs@\fe@levelrn\endcsname
		\fi
		\fe@define@position
	\fi
	\csname fe@count@abs@\fe@levelrn\endcsname\z@
	\expandafter\chardef
		\csname fe@first@abs@\fe@levelrn\endcsname\@ne
	\expandafter\chardef
		\csname fe@last@abs@\fe@levelrn\endcsname\z@
	\expandafter\chardef
		\csname fe@relmax@abs@\fe@levelrn\endcsname#1\relax
	\expandafter\fe@define
		\csname fe@relmax@abs@\fe@levelrn\endcsname\fe@levelvars
	\expandafter\long\expandafter\def
		\csname fe@function@\fe@levelrn\endcsname##1{#3}
	\def\fe@emptytest{#2}
	\ifx\fe@emptytest\empty
		\fe@definelevel\empty{}
	\else
		\fe@definelevel#2{\expandafter#2}
	\fi
	\expandafter\expandafter\expandafter\fe@fnsl@
		\expandafter\expandafter
		\csname fe@nextcommandcode@\fe@levelrn\endcsname
		\csname fe@check@\fe@levelrn\endcsname
	}
\def\fe@levelvars{count,item,first,last,position}
\def\fe@definelevel#1#2
	{
	\ifnum\fe@level>\fe@toplevel
		\fe@newlevel#1
		\chardef\fe@toplevel\fe@level
	\fi
	\expandafter\let\csname fe@separator@\fe@levelrn\endcsname#1
	\expandafter\expandafter\expandafter\long
		\expandafter\expandafter\expandafter\def
		\expandafter\expandafter
		\csname fe@getitem@\fe@levelrn\endcsname
		\expandafter##\expandafter1#2\expandafter
		{\csname fe@setitem@\fe@levelrn\endcsname{##1}}
	}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Defining the kernel macros}
%
% The following macros define the kernel macros \cmdarg\fe@check@\argsymb{current level}, \cmdarg\fe@setitem@\argsymb{current level} and \cmdarg\fe@process@\argsymb{current level}. \cmdarg\fe@check@\argsymb{current level} checks the next list item and supplies it to \cmdarg\fe@setitem@\argsymb{current level}, which defines the token that is being processed in turn by \cmdarg\fe@process@\argsymb{current level}, which uses the function supplied by \cmdarg\ForEachD@.
% \begin{macro}{\fe@newlevel}
% The macro \cmdarg\fe@newlevel\ sets up the tokens that are being used to define the kernel for the new level.
%    \begin{macrocode}
\def\fe@newlevel#1
	{
	\fe@DefLevelVar{fe}{\fe@levelrn}
		{
		process,next,item@abs,count@abs,first@abs,
		last@abs,position@abs,function,check,getitem,
		nextcommandcode,aftergroup,
		aftergroup@,firsttoken,space,separator,setitem
		}
	\fe@CollectLevelVar{base}
		{check,getitem,next,nextcommandcode}
	\fe@CollectLevelVar{i}
		{firsttoken,aftergroup,aftergroup@,space,separator}
	\fe@CollectLevelVar{ii}
		{count@abs,first@abs}
	\fe@CollectLevelVar{iii}
		{process,function,item@abs,last@abs,setitem}
	\expandafter\expandafter\expandafter\fe@newlevel@i
		\expandafter\fe@level@base\fe@level@i
	\expandafter\fe@newlevel@ii\fe@level@ii
	\expandafter\expandafter\expandafter\fe@newlevel@iii
		\expandafter\fe@level@base\fe@level@iii
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@newlevel@i}
% The macro \cmdarg\fe@newlevel@i\ defines two auxilliary macros for the kernel macros and then assembles the first tokens of the macro \cmdarg\fe@def@check, which defines the kernel macro \cmdarg\fe@check@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@newlevel@i#1#2#3#4#5#6#7#8#9
	{
	\def#6{\fe@fnsl#4#8#7}
	\def#7{
		\ifx#9#4
			\ifnum#8=\z@
				\fe@braces@ii#2#5{}
			\else
				\fe@braces@ii#2#5{ }
			\fi
		\else
			\ifnum#8=\z@
				\fe@braces@i#2#5{}
			\else
				\fe@braces@i#2#5{ }
			\fi
		\fi
		\fe@item@check@next
		}
	\def\fe@i##1
		{
		\fe@def@check
			{
			\long\def#5{##1}
				\ifcat\noexpand#4\bgroup
					\ifx#9\empty
						\expandafter\def\expandafter#3\expandafter
							{
							\expandafter#2\expandafter
								{\expandafter{#5}}
							}
					\else
						\let#3#6
					\fi
				\else
					\expandafter\def\expandafter#3
						\expandafter{\expandafter#2#5}
				\fi
			}
			{#1##1}#2#3#4
		}
	}
\long\def\fe@braces@i#1#2#3
	{
	\expandafter\def\expandafter\fe@item@check@next\expandafter
		{\expandafter#1\expandafter{#2}#3}
	}
\long\def\fe@braces@ii#1#2#3
	{
	\expandafter\def\expandafter\fe@item@check@next\expandafter
		{\expandafter#1\expandafter{\expandafter{#2}}#3}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@newlevel@ii}
% The macro \cmdarg\fe@newlevel@ii\ actually calls the macro \cmdarg\fe@def@check, which defines the kernel macro \cmdarg\fe@check@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@newlevel@ii#1#2{\fe@i{##1}#1#2}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@newlevel@iii}
% The macro \cmdarg\fe@newlevel@iii\ calls the macros \cmdarg\fe@def@setitem\ and \cmdarg\fe@def@process, which define the kernel macros \cmdarg\fe@setitem@\argsymb{current level} and \cmdarg\fe@process@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@newlevel@iii#1#2#3#4#5#6#7#8#9
	{
	\fe@def@setitem#9#7#5
	\fe@def@process#5#3#1#6#4#7#8
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@def@check}
% The macro \cmdarg\fe@def@check\ defines the kernel macro \cmdarg\fe@check@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@def@check#1#2#3#4#5#6#7
	{
	\long\def#2
		{
		\ifx#5\endforeach
			\let#4\fe@endlevel
		\else
			\advance#6\@ne
			\thislevelcount#6
			\ifnum#6=\tw@
				\chardef#7\z@
			\fi
			#1
		\fi
		#4
		}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@def@setitem}
% The macro \cmdarg\fe@def@setitem\ defines the kernel macro \cmdarg\fe@setitem@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@def@setitem#1#2#3
	{
	\long\def#1##1
		{
		\long\def#2{##1}
		\let\thislevelitem#2
		#3
		}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@def@process}
% The macro \cmdarg\fe@def@process\ defines the kernel macro \cmdarg\fe@process@\argsymb{current level}.
%    \begin{macrocode}
\long\def\fe@def@process#1#2#3#4#5#6#7
	{
	\long\def#1
		{
		\ifx#5\endforeach
			\chardef#7\@ne
		\fi
		\def#2{\fe@fnsl@#5#3}
		#4#6
		#2
		}
	}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Auxilliary macros}
%
% \begin{macro}{\fe@endlevel}
% The macro \cmdarg\fe@endlevel\ is being called after a list or array level has been processed, i.e. when \cmdarg\fe@check@\argsymb{current level} identifies an \cmdarg\endforeach\ token. It resets the pointers \cmdarg\thislevelitem\ and \cmdarg\thislevelcount. It also resets the expansions of some variables, most notably the pointers to the kernel macros, so that they refer to the contents associated with the previous level.
%    \begin{macrocode}
\def\fe@endlevel
	{
	\chardef\fe@count@total\thislevelcount
	\advance\fe@level\m@ne
	\expandafter\def\expandafter\fe@levelrn\expandafter
		{\romannumeral\fe@level}
	\expandafter\fe@define
		\csname fe@relmax@abs@\fe@levelrn\endcsname\fe@levelvars
	\expandafter\thislevelcount
		\csname fe@count@abs@\fe@levelrn\endcsname
	\expandafter\let\expandafter\thislevelitem
		\csname fe@item@abs@\fe@levelrn\endcsname
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@fnsl}
% The macro \cmdarg\fe@fnsl\ discards any implicit or explicit space tokens that intervene before a nonspace is scanned, and provides information about the next token and the presence of spaces before this token. It is a modified version of the macro \cmdarg\futurenonspacelet\ from \textit{The TeXBook}.\footnote{\frenchspacing See D. Knuth, \textit{The TeXBook}, Reading: Addison-Wesley, 20\textsuperscript{th} printing, rev., p. 376.}
%    \begin{macrocode}
\begingroup\def\\{\global\let\fe@fnsl@stoken= }\\ \endgroup
\def\fe@fnsl#1#2#3
	{
	\def\fe@fnsl@cs{#1}
	\def\fe@fnsl@space{#2}
	\def\fe@fnsl@next@ii{#3}
	\expandafter\chardef\fe@fnsl@space\z@
	\fe@fnsl@stepone
	}
\def\fe@fnsl@stepone
	{\expandafter\futurelet\fe@fnsl@cs\fe@fnsl@steptwo}
\def\fe@fnsl@steptwo
	{
	\expandafter\ifx\fe@fnsl@cs\fe@fnsl@stoken
		\let\fe@fnsl@next@i=\fe@fnsl@stepthree
	\else
		\let\fe@fnsl@next@i\fe@fnsl@next@ii
	\fi
	\fe@fnsl@next@i
	}
\def\fe@fnsl@stepthree
	{
	\expandafter\chardef\fe@fnsl@space\@ne
	\afterassignment\fe@fnsl@stepone\let\fe@fnsl@next@i= %
	}
\def\fe@fnsl@#1#2
	{
	\def\fe@fnsl@cs{#1}
	\def\fe@fnsl@next@ii{#2}
	\fe@fnsl@stepone@
	}
\def\fe@fnsl@stepone@
	{\expandafter\futurelet\fe@fnsl@cs\fe@fnsl@steptwo@}
\def\fe@fnsl@steptwo@
	{
	\expandafter\ifx\fe@fnsl@cs\fe@fnsl@stoken
		\let\fe@fnsl@next@i=\fe@fnsl@stepthree@
	\else
		\let\fe@fnsl@next@i\fe@fnsl@next@ii
	\fi
	\fe@fnsl@next@i
	}
\def\fe@fnsl@stepthree@
	{
	\afterassignment\fe@fnsl@stepone@\let\fe@fnsl@next@i= %
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\endforeach}
% The token \cmdarg\endforeach\ is used as a list delimiter. If executed, it expands to an error message.
%    \begin{macrocode}
\def\endforeach
	{
	\PackageError{forarray}
		{Tried to expand an \string\endforeach token. %
		Something is wrong.\MessageBreak
		The level of the current list is: %
			\the\fe@level\MessageBreak
		The content of the current item is: %
			\expandafter\strip@prefix\meaning\thislevelitem
			\MessageBreak
		The position of the item is:
			\the\thislevelcount}
		{No further immediate help available. Sorry.}
	}
%    \end{macrocode}
% \end{macro}
% The following auxilliary macros redefine several variables when entering or exiting a nesting level.
% \begin{macro}{\fe@@define@process}
% The macro \cmdarg\fe@@define@process\ processes a list of variables supplied by \cmdarg\fe@@define.
%    \begin{macrocode}
\def\fe@@define@process#1,
	{
	\def\fe@@define@Item{#1}
	\ifx\fe@@define@Item\empty
		\let\fe@@define@process@next\relax
	\else
		\def\fe@@define@process@next
			{
			\expandafter\expandafter\expandafter\def
			\expandafter\expandafter
			\csname
				\fe@VarMacro @\fe@@define@Item @rel@
				\romannumeral\fe@cnt@ii
			\endcsname
			\expandafter
				{
				\csname
					\fe@VarMacro @\fe@@define@Item @abs@
					\romannumeral\fe@cnt@i
				\endcsname
				}
			\fe@@define@process
			}
	\fi
	\fe@@define@process@next
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@@define}
% The macro \cmdarg\fe@@define\ processes a list of variables supplied by \cmdarg\fe@define, iterating through the current nesting levels.
%    \begin{macrocode}
\def\fe@@define
	{
	\ifnum\fe@cnt@i>\m@ne
		\ifnum\fe@cnt@ii>\fe@define@max
			\let\fe@@define@next\relax
		\else
			\def\fe@@define@next{
				\expandafter\fe@@define@process\fe@Vars,{},
				\advance\fe@cnt@ii\@ne
				\advance\fe@cnt@i\m@ne
				\fe@@define
				}
		\fi
	\else
		\let\fe@@define@next\relax
	\fi
	\fe@@define@next
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@define}
% The macro \cmdarg\fe@define\ supplies the names of variables that are being redefined when entering or exiting a nesting level.
%    \begin{macrocode}
\def\fe@define#1
	{
	\chardef\fe@define@max#1\relax
	\ifnum\fe@define@max>\z@
		\expandafter\fe@define@
	\else
		\expandafter\@gobble
	\fi
	}
\def\fe@define@#1
	{
	\def\fe@VarMacro{fe}
	\let\fe@Vars#1
	\fe@cnt@i\fe@level
	\fe@cnt@ii\@ne
	\fe@@define
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@ProcessList}
% The macro \cmdarg\fe@ProcessList\ processes a list of variables supplied by \cmdarg\fe@DefLevelVar.
%    \begin{macrocode}
\def\fe@ProcessList#1,
	{
	\def\fe@ProcessList@check{#1}
	\ifx\fe@ProcessList@check\empty
		\let\fe@ProcessList@next\relax
	\else
		\def\fe@ProcessList@next
			{
			\fe@ProcessList@act{#1}
			\fe@ProcessList
			}
	\fi
	\fe@ProcessList@next
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@DefLevelVar}
% The macro \cmdarg\fe@DefLevelVar\ redefines the expansion of the pointers \mbox{$\langle$\texttt{fe}$\vert$\texttt{fa}$\rangle$|@|\argsymb{pointer name}|@level|}.
%    \begin{macrocode}
\def\fe@DefLevelVar#1#2#3
	{
	\def\fe@ProcessList@act##1
		{
		\expandafter\expandafter\expandafter\def
		\expandafter\expandafter
		\csname #1@##1@level\endcsname
		\expandafter
		{\csname #1@##1@#2\endcsname}
		}
	\fe@ProcessList#3,{},
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@define@position}
% The macro \cmdarg\fe@define@position\ defines a variable that contains the absolute position of the current item in a list, an array, or a system of nested lists and/or arrays. At this point, it is not being used by the package 'forarray'.
%    \begin{macrocode}
\def\fe@define@position
	{
	\ifnum\fe@level=\@ne
		\expandafter\expandafter\expandafter
			\def\expandafter\expandafter
			\csname fe@position@abs@\fe@levelrn\endcsname
			\expandafter
			{
			\csname fe@position@abs@\fe@upperlevelrn\endcsname
			\number\thislevelcount
			}
	\else
		\expandafter\expandafter\expandafter
			\def\expandafter\expandafter
			\csname fe@position@abs@\fe@levelrn\endcsname
			\expandafter
			{
			\csname fe@position@abs@\fe@upperlevelrn\endcsname
			-\number\thislevelcount
			}
	\fi
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@AddToTokensX}
% The macro \cmdarg\fe@AddToTokensX\ adds the contents of a variable to a token list.
%    \begin{macrocode}
\def\fe@AddToTokensX#1#2
	{
	\expandafter\expandafter\expandafter#1
	\expandafter\expandafter\expandafter
	{\expandafter\the\expandafter#1#2}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@CollectLevelVar@}
% The macro \cmdarg\fe@CollectLevelVar@\ takes a list of variable names and assembles a corresponding list of pointer variables \mbox{$\langle$\texttt{fe}$\vert$\texttt{fa}$\rangle$@\argsymb{pointer name}@level}.
%    \begin{macrocode}
\def\fe@CollectLevelVar@#1#2#3
	{
	\expandafter\def\csname #1@level@#2\endcsname{}
	\def\fe@ProcessList@act##1{
		\expandafter\fe@AddToTokensX\expandafter
		\fe@toks\csname #1@##1@level\endcsname
		}
	\fe@toks{}
	\fe@ProcessList#3,{},
	\expandafter\expandafter\expandafter\def
		\expandafter\expandafter
		\csname #1@level@#2\endcsname\expandafter{\the\fe@toks}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fe@CollectLevelVar}
% The macro \cmdarg\fe@CollectLevelVar\ calls \cmdarg\fe@CollectLevelVar@.
%    \begin{macrocode}
\def\fe@CollectLevelVar{\fe@CollectLevelVar@{fe}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Macros for processing arrays}
%
% \subsubsection{User commands}
%
% This section contains the macros \cmdarg\ForArray\ and \cmdarg\ExitForEachLevels, as well as some macros associated with \cmdarg\ForArray\ that directly read information from the token stream following the call to \cmdarg\ForArray.
%
% \begin{macro}{\ForArray}
% When being called, the macro \cmdarg\ForArray\ checks whether a limit for the creation of pointers to levels relative to the current list or array level has been supplied, and whether an optional argument containing a separator for the list of separators is present.
%    \begin{macrocode}
\def\ForArray
	{
	\fe@aux@advancechardef\fa@arraylevel\@ne
	\expandafter\def\expandafter\fa@arraylevelrn\expandafter
		{\romannumeral\fa@arraylevel}
	\@ifnextchar(\fa@FA@WRelMax\fa@FA@WoRelMax
	}
\def\fa@FA@WRelMax(#1)
	{
	\expandafter\chardef
		\csname fa@relmax@\fa@arraylevelrn\endcsname#1\relax
	\ForArray@
	}
\def\fa@FA@WoRelMax
	{
	\expandafter\chardef
		\csname fa@relmax@\fa@arraylevelrn\endcsname\fe@relmax
	\ForArray@
	}
\def\ForArray@
	{\@ifnextchar[\fa@FA@WSepListSep\fa@FA@WoSepListSep}
\def\fa@FA@WSepListSep[#1]{\fa@FA@SepList#1}
\def\fa@FA@WoSepListSep{\fa@FA@SepList{}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fa@FA@SepList}
% The macro \cmdarg\fa@FA@SepList\ reads the list of separators and defines some variables used for processing the array.
%    \begin{macrocode}
\def\fe@aux@advancechardef#1#2
	{
	\count@#1
	\advance\count@#2
	\chardef#1\count@
	}
\def\fa@FA@SepList#1#2
	{
	\fe@DefLevelVar{fa}{\fa@arraylevelrn}
		{
		separatorcount,oldcatcode,baselevel,level,olddef,
		array,restore,next,separator,orientation,nextlevel,
		oldnextlevel,oldlowernextlevel
		}
	\expandafter\chardef
		\csname fa@level@\fa@arraylevelrn\endcsname\z@
	\ForEach
		{#1}
		{
			\expandafter\expandafter\expandafter\def
				\expandafter\expandafter
				\csname
					fa@separator@\fa@arraylevelrn @
					\romannumeral\thislevelcount
				\endcsname
				\expandafter
				{\thislevelitem}
		}
		{#2}
	\expandafter\chardef\fa@separatorcount@level\fe@count@total
	\fa@FA@MarkerList
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fa@FA@MarkerList}
% The macro \cmdarg\fa@FA@MarkerList\ checks for an optional argument containing a list of markers, possibly with an additional optional argument that contains a separator for this list.
%    \begin{macrocode}
\def\fa@FA@MarkerList
	{\@ifnextchar[\fa@FA@WMarkerList\fa@FA@SublevelToken}
\def\fa@FA@WMarkerList[
	{\@ifnextchar[\fa@FA@WMarkerListSep\fa@FA@WoMarkerListSep}
\def\fa@FA@WMarkerListSep[#1]#2]{\fa@FA@MarkerList@{#1}{#2}}
\def\fa@FA@WoMarkerListSep#1]{\fa@FA@MarkerList@{}{#1}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fa@FA@MarkerList@}
% The macro \cmdarg\fa@FA@MarkerList@\ reads the list of markers.
%    \begin{macrocode}
\def\fa@FA@MarkerList@#1#2
	{
	\ForEach
		{#1}
		{
			\expandafter\expandafter\expandafter\def
				\expandafter\expandafter
				\csname
					fa@orientation@\fa@arraylevelrn @
					\romannumeral\thislevelcount
				\endcsname
				\expandafter
				{\thislevelitem}
		}
		{#2}
	\fa@FA@SublevelToken
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fa@FA@SublevelToken}
% The macro \cmdarg\fa@FA@SublevelToken\ reads the token that is used to access sublevels and calls \cmdarg\fa@SublevelToken.
%    \begin{macrocode}
\def\fa@FA@SublevelToken#1
	{
	\expandafter\fa@SublevelToken\fa@array@level#1
	\fa@FA@Process
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fa@FA@Process}
% The macro \cmdarg\fa@FA@Process\ reads the functions applied to the respective levels of the array and processes the content of the array.
%    \begin{macrocode}
\long\def\fa@FA@Process#1#2#3
	{
	\ForEach
		{#1}
		{
			\expandafter\expandafter\expandafter\def
				\expandafter\expandafter
				\csname
					fa@function@\fa@arraylevelrn @
					\romannumeral\thislevelcount
				\endcsname
				\expandafter
				{\thislevelitem}
		}
		{#2}
	\long\def\thislevelitem{#3}
	\fe@cnt@i\fe@level
	\advance\fe@cnt@i\@ne
	\expandafter\chardef\fa@baselevel@level\fe@cnt@i
	\expandafter\def\fa@array@level
		{
		\ifnum\fa@level@level=\fa@separatorcount@level\relax
			\expandafter\def\fa@next@level{\thislevelitem}
		\else
			\expandafter\let\fa@next@level\fa@next@level@

		\fi
		\fa@next@level
		}
	\fa@array@level
	\fa@restore@level
	\fe@aux@advancechardef\fa@arraylevel\m@ne
	\expandafter\def\expandafter\fa@arraylevelrn\expandafter
		{\romannumeral\fa@arraylevel}
	}
\def\fa@next@level@
	{
	\fa@SetLevelVars\tw@
	\expandafter\expandafter\expandafter\def
		\expandafter\expandafter\expandafter\fa@i
		\expandafter\expandafter\expandafter
		{
		\csname
		fa@separator@\fa@arraylevelrn @
		\romannumeral\fa@level@level
		\endcsname
		}
	\expandafter\expandafter\expandafter\expandafter
		\expandafter\expandafter\expandafter
		\ForEachSublevel@
		\expandafter\expandafter\expandafter\expandafter
		\expandafter\expandafter
		\csname
			fa@relmax@\fa@arraylevelrn
		\endcsname
		\expandafter
		\fa@i
		\expandafter
		{
		\csname
			fa@function@\fa@arraylevelrn @
			\romannumeral\fa@level@level
		\endcsname
		}
	\fa@SetLevelVars\@ne
	}
\def\fa@SetLevelVars#1
	{
	\fe@cnt@i\fe@level
	\advance\fe@cnt@i-\fa@baselevel@level
	\advance\fe@cnt@i#1
	\expandafter\chardef\fa@level@level\fe@cnt@i
	\thislevelnr\fa@level@level
	\expandafter\let\expandafter\thislevelmarker
		\csname
			fa@orientation@\fa@arraylevelrn @
			\romannumeral\fa@level@level
		\endcsname
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\ExitForEachLevels}
% The macro \cmdarg\ExitForEachLevels\ redefines the kernel macros \cmdarg\fe@next@\argsymb{start level} \textellipsis\ \cmdarg\fe@next@\argsymb{start level plus number of levels} of the current position of the array that is being processed. It essentially works in the same way as \cmdarg\ExitForEach.
%    \begin{macrocode}
\def\ExitForEachLevels#1#2
	{
	\fe@cnt@i\fe@level
	\fe@cnt@ii\z@
	\advance\fe@cnt@i\@ne
	\advance\fe@cnt@i-#1\relax
	\def\fe@exitforeach
		{
		\ifnum\fe@cnt@ii<#2\relax
			\def\fe@exitforeach@next
				{
				\expandafter\let
					\csname fe@next@\romannumeral\fe@level\endcsname
					\fe@ExitForEach@base
				\advance\fe@cnt@i\m@ne
				\advance\fe@cnt@ii\@ne
				}
		\else
			\let\fe@exitforeach@next\relax
		\fi
		\fe@exitforeach@next
		}
	\fe@exitforeach
	}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Auxilliary macros}
%
% \begin{macro}{\fa@SublevelToken}
% The macro \cmdarg\fa@SublevelToken\ assigns a pointer to the control sequence or active character that is being used to access sublevels. It also defines how the expansion of this token is being reset after exiting a level of an array or nested list. The code at the end of this macro is taken from the \pname{inputenc} package.\footnote{\frenchspacing See A. Jeffrey and F. Mittelbach, inputenc.sty, v1.1b, May 5\textsuperscript{th}, 2006.}
%    \begin{macrocode}
\def\fa@SublevelToken#1#2
	{
	\expandafter\if\noexpand#2\relax
		\expandafter\let\fa@olddef@level#2
		\def#2{#1}
		\expandafter\def\fa@restore@level
			{\expandafter\let#2\fa@olddef@level}
	\else
		\chardef\fa@oldcatcode@level\catcode`#2\relax
		\ifnum\fa@oldcatcode@level=\active
			\expandafter\let\fa@olddef@level#2
		\else
			\catcode`#2\active
		\fi
		\expandafter\def\fa@restore@level
			{
			\ifnum\fa@oldcatcode@level=\active
				\expandafter\expandafter\expandafter
				\fa@SublevelToken
				\expandafter\expandafter\expandafter
				{\fa@olddef@level}{#2}
			\else
				\catcode`#2\fa@oldcatcode@level
			\fi
			}
			\bgroup
				\uccode`\~`#2\relax
				\uppercase{
			\egroup
					\def~{#1}
					}
	\fi
	}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Macros for defining variables}
%
% \begin{macro}{\DefineArrayVar}
% The macro \cmdarg\DefineArrayVar\ first collects the items from the content list in an array of numbered variables and then assigns the content of these variables to the new variables.
%    \begin{macrocode}
\def\DefineArrayVar#1#2#3#4#5#6
	{
	\ForEach{#5}
		{
		\expandafter\expandafter\expandafter
			\def\expandafter\expandafter
			\csname
				fe@item@nr@\number\thislevelcount
			\endcsname
			\expandafter{\thislevelitem}
		}
		{#6}
	\ForEach{#3}
		{
		\expandafter\ifx
			\csname
				fe@item@nr@\number\thislevelcount
			\endcsname
			\relax
			\fe@DefineArrayVar@Warning{#4}{#5}
			\ExitForEach
		\else
			\expandafter\expandafter\expandafter\def
			\expandafter\expandafter\expandafter
			\fa@ArrayVarContent
			\expandafter\expandafter\expandafter
				{
				\csname
					fe@item@nr@\number\thislevelcount
				\endcsname
				}
			\expandafter\ifx
				\csname
					fe@item@nr@\number\thislevelcount
				\endcsname
				\empty
				\typeout
					{Content of	\expandafter\string
					\csname #1#2\thislevelitem\endcsname\space
					is set to nothing.}
			\else
				\typeout
					{Content of	\expandafter\string
					\csname #1#2\thislevelitem\endcsname\space
					is set to %
					\expandafter\strip@prefix
					\meaning\fa@ArrayVarContent.}
			\fi
			\expandafter\expandafter\expandafter\def
				\expandafter\expandafter
				\csname #1#2\thislevelitem\endcsname\expandafter
				{\fa@ArrayVarContent}
		\fi
		}
		{#4}
	}
\def\fe@DefineArrayVar@Warning#1#2
	{
	\PackageWarning
		{fornext}
		{
		No more items available while %
			defining pointers!\MessageBreak
		Pointers: #1\MessageBreak
		Items:\space\space\space #2
		}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\DefineArrayVars}
% The macro \cmdarg\DefineArrayVars\ first defines a function that passes information read from its parameters to \cmdarg\DefineArrayVar, and then calls this function within a \cmdarg\ForEach\ loop.
%    \begin{macrocode}
\def\DefineArrayVars#1#2#3#4#5#6#7
	{
	\typeout{}\typeout{Defining Array Variables...}
	\def\fe@DefineArrayVar@##1#3##2#3##3#2
		{
		\typeout{-- Initializing new variable array: ##1}
		\DefineArrayVar
			{##1}{#5}{#1}{##3}{#4}{##2}
		}
	\ForEach
		{#2}
		{\expandafter\fe@DefineArrayVar@\thislevelitem#3#6#2}
		{#7}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\DefineArrayDefault}
% The macro \cmdarg\DefineArrayDefault\ assigns an |\ifx| \textellipsis\ |else| \textellipsis\ |\fi| structure to the pointers supplied with its last argument.
%    \begin{macrocode}
\def\DefineArrayDefault#1#2#3#4#5
	{
	\ForEach
		{#1}
		{
		\expandafter\edef\csname\thislevelitem\endcsname
			{
			\noexpand\expandafter\noexpand\ifx
			\noexpand\csname
				\thislevelitem #2\noexpand#3
			\noexpand\endcsname
			\noexpand\relax
				\noexpand\csname
					\thislevelitem #2#4
				\noexpand\endcsname
			\noexpand\else
				\noexpand\csname
					\thislevelitem #2\noexpand#3
				\noexpand\endcsname
			\noexpand\fi
			}
		}
		{#5}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\DefineArrayVarTo}
% The macro \cmdarg\DefineArrayVarTo\ assigns the same value to the variables supplied with its last argument.
%    \begin{macrocode}
\def\DefineArrayVarTo#1#2#3#4#5
	{
	\ForEach
		{#1}
		{\expandafter\expandafter\expandafter\def\expandafter
			\csname #3#2\thislevelitem\endcsname{#4}}
		{#5}
	}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\CommandForEach}
% The macro \cmdarg\CommandForEach\ places the items of the list immediately after the token list that is being supplied as the command.
%    \begin{macrocode}
\def\CommandForEach#1#2#3
	{\ForEach#1{\expandafter#2\thislevelitem}{#3}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\FunctionForEach}
% The macro \cmdarg\FunctionForEach\ expands the items of the list inside braces and immediately places the token group after the token list that is being supplied as the function.
%    \begin{macrocode}
\def\FunctionForEach#1#2#3
	{\ForEach#1{\expandafter#2\expandafter{\thislevelitem}}{#3}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Final commands}
%
%    \begin{macrocode}
\endlinechar\fe@aux@endlinecharrestore\relax
\makeatother
%</sty>
%    \end{macrocode}
%
% \section{Test page}
%
% The file |forarray-test.tex| contains the following code that generates a test page for the package \mbox{\fontfamily{cmss}\selectfont forarray}.
%
%    \begin{macrocode}
%<*test>
\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2cm]{geometry}
\usepackage[dvips, pdfborder={0 0 0}, pdfstartview={FitH}, 
	pdfpagelayout={OneColumn}, bookmarks=false, pdfnewwindow, 
	unicode=true]{hyperref}
\urlstyle{same}
\usepackage{examplep}
\usepackage{forarray}
\author
	{
	Christian Schr\"{o}ppel%
	\footnote%
		{
		Please send any comments or suggestions to %
		\protect\href{mailto:christian@schroeppel.com}%
{\mbox{\fontfamily{cmss}\selectfont christian@schroeppel.com}}.%
		}
	}
\title
	{
	Test page for the %
		{\fontfamily{cmss}\selectfont forarray} % 
		package\\ [.5ex]\Large Version 1.01 (2008/06/20)
	}
\def\ShowExample{
	\PexaShowBoth{
		yalign=b,
		allowbreak=yes,
		srcstyle=leftnumcol,
		}
	}
\arrayrulewidth=0pt
\begin{document}
\errorcontextlines=20\relax
\maketitle
\thispagestyle{empty}
\small
\section{Test of \texttt{ForEach} (Simple List)}
\begin{WBoth}
\begin{itemize}
\ForEach{,}
	{\item Item No.\ %
		\the\thislevelcount\ is:
		``\thislevelitem''\\{\footnotesize
		\meaning\thislevelitem}}
	{
	{Hello, World!},  Sec{ond},
	   {Thi}rd,{\bf Last}   item%
	}
\end{itemize}
\end{WBoth}
\ShowExample
\section{Test of \texttt{ForEach} (Nested)}
\begin{WBoth}
\begin{itemize}
\ForEach{;}
	{\item[\the\thislevelcount)]
		\raggedright\thislevelitem
	\begin{itemize}
	\ForEachX{,}
		{\item Item No.\ %
		\the\thislevelcount\ %
		is: \thislevelitem}
		{\thislevelitem}
	\end{itemize}}
	{$\alpha$,$\beta$,$\gamma$;
	{\Large A Large Item},
	Transparency \it test,
	Ends \rm here.}
\end{itemize}
\end{WBoth}
\ShowExample
\section{Test of \texttt{ForArray}}
\makeatletter
\begin{WBoth}
\parindent=0pt
\def\MyArray{\ForArray(3){;,}{*}{|}}
\MyArray
	{*\par\vskip 3ex|\parbox{8em}{*}}
	{
	A,B,C;
	\textit{A nested array:}\par
	\MyArray{[*]\par|(*)}{1,2;3,4},b,c;
	$\alpha$,$\beta$,$\gamma$
	}
\end{WBoth}
\ShowExample
\end{document}
%</test>
%    \end{macrocode}
%
% \section{Copyright Notice}
%
% The package \mbox{\fontfamily{cmss}\selectfont forarray} is \textcopyright\ 2008 by Christian Schr\"{o}ppel. It may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License (LPPL), version 1.3c. This licence allows you to distribute unmodified copies of the package, as long as you include all components of the package in your distribution. It also allows modification of the package under certain conditions. Please read the licence if you intend to modify any of the contents of this package.\par If any later version of the LPPL replaces this version, the package may be distributed and/or modified under the conditions of the current version of the LPPL at that time. The latest version of the LPPL is available at \href{http://www.latex-project.org/lppl.txt}{\mbox{\fontfamily{cmss}\selectfont www.latex-project.org/lppl.txt}}.\par The Author of the package is Christian Schr\"{o}ppel. You can contact the author at \href{mailto:christian@schroeppel.com}{\mbox{\fontfamily{cmss}\selectfont christian@schroeppel.com}}.\par This package has the LPPL maintenance status ``maintained''. The Current Maintainer is Christian Schr\"{o}ppel.\par The package \mbox{\fontfamily{cmss}\selectfont forarray} consists of the master file \mbox{\fontfamily{cmss}\selectfont forarray.dtm}, the file \mbox{\fontfamily{cmss}\selectfont README.txt}, and the derived files \mbox{\fontfamily{cmss}\selectfont forarray.dtx}, \mbox{\fontfamily{cmss}\selectfont forarray.sty}, \mbox{\fontfamily{cmss}\selectfont forarray.pdf}, \mbox{\fontfamily{cmss}\selectfont forarray-test.tex}, and \mbox{\fontfamily{cmss}\selectfont forarray-test.pdf}.\par The installation script \mbox{\fontfamily{cmss}\selectfont forarray} and the documentation style file \mbox{\fontfamily{cmss}\selectfont forarray.dts} are not part of the package \mbox{\fontfamily{cmss}\selectfont forarray}. Please note, however, that the provisions in the section ``No warranty'' of the \LaTeX\ Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.
%
%
% \iffalse
%<*readme>
Note: This file should be viewed with character map ISO-8859-1 (Latin1, Western).


Using array structures in LaTeX: The package 'forarray'


Version 1.01 (2008/06/20)

Abstract:
The package 'forarray' provides functionality for processing lists and array structures in LaTeX. Arrays can contain characters as well as TeX and LaTeX commands, nesting of arrays is possible, and arrays are processed within the same brace level as their surrounding environment. Array levels can be delimited by characters or control sequences defined by the user. Practical uses of this package include data management, construction of lists and tables, and calculations based on the contents of lists and arrays.

Copyright:
The package 'forarray' is (c) 2008 by Christian Schröppel, and distributed under the terms of the LaTeX Project Public License (LPPL), version 1.3c.

Content:
The package 'forarray' consists of the master file 'forarray.dtm', the file 'README.txt', and the derived files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf'.

Installation:
In order to use the package, you need to save the file 'forarray.sty' to a directory where your LaTeX installation will find it. This will often be <your local texmf directory>/tex/latex/forarray. Please consult the manuals for your LaTeX system for further information. In many cases, it will be possible to use a package manager provided with your LaTeX system to install the package. 
 
Documentation:
The file 'forarray.pdf' contains the documentation for the package 'forarray'.

The file 'README.txt' contains some basic information about the package.

The file 'forarray-test.tex' can be used to obtain a test page for the package. You can run this file with your LaTeX installation and compare the result with the file 'forarray-test.pdf' to check if everything works well.

DTM File:
You can obtain the files 'forarray.dtx', 'forarray.sty', 'forarray.pdf', 'forarray-test.tex', and 'forarray-test.pdf', as well as 'README.txt' by placing the files 'forarray.dtm', 'forarray.dts' and the Bourne shell script 'forarray' in a single directory and typing in forarray at the command prompt (after cd <your empty directory>). The installation script 'forarray' and the documentation style file 'forarray.dts' are not part of the package 'forarray'. Please note, however, that the provisions in the section "No warranty" of the LaTeX Project Public License (LPPL), version 1.3c, exempting the author and other parties from liability with regard to the work, apply to the contents of the package as well as to these files.
%</readme>
% \fi