summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/arrayjobx/arrayjob.tex
blob: 899cfe39e7ea632f8b5091b42e951f8088403cf9 (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
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% arrayjob.doc --- Documentation of the `arrayjob' package from Zhuhan Jiang
%%
%% Author          : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
%% Created the     : Fri Jan  7 21:13:20 2000
%% Last mod. by    : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
%% Last mod. the   : Wed May 31 20:10:39 2000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{article}

\usepackage{arrayjob}              % Arrays management
\usepackage{fancyvrb}              % Fancy verbatims
\usepackage[width=18cm]{geometry}  % Page layout
\usepackage{graphics}              % Graphics LaTeX standard package
\usepackage{ifthen}                % Convenient conditionals in LaTeX
\usepackage{mflogo}                % For the MetaFont and MetaPost logos
\usepackage{multido}               % General loop macro
\usepackage{url}                   % URLs convenient typesetting
\usepackage{trace}

% For PSTricks examples
\newif\ifpstricks
\IfFileExists{pstricks.sty}{%
\pstrickstrue
%\usepackage{pstcol}                % PSTricks package with `color' interface
\usepackage{pst-node}              % PSTricks nodes     package
\usepackage{pst-plot}              % PSTricks plots     package
\usepackage{pst-grad}              % PSTricks gradients package
%\usepackage{pst-key}               % PSTricks interface to the `keyval' package
}{%
\usepackage{color}
}                % Color LaTeX standard package

% Definition of new colors
\definecolor{Khaki}       {rgb}{0.94,0.90,0.55}
\definecolor{LemonChiffon}{rgb}{1.,0.98,0.8}

% A unique string for TeX and LaTeX
\newcommand{\AllTeX}{%
{\rm(L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em)%
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

% Package names
\newcommand{\AlDraTeXPackage}{\textsf{(Al)Dra\TeX}}
\newcommand{\ArrayJobPackage}{`\textsf{arrayjob}'}
\newcommand{\FormLettPackage}{`\textsf{formlett}'}
\newcommand{\IfThenPackage}{`\textsf{ifthen}'}
\newcommand{\MetaFontPackage}{\MF}
\newcommand{\MetaPostPackage}{\MP}
\newcommand{\MultiDoPackage}{`\textsf{multido}'}
\newcommand{\PSTricksPackage}{\textsf{PSTricks}}
\newcommand{\RepeatPackage}{`\textsf{repeat}'}

% Aligned labels in a description environment
\newenvironment{Description}[1]{%
\begin{list}{nothing}{\setlength{\leftmargin}{#1}
\setlength{\labelwidth}{\leftmargin}\setlength{\labelsep}{1mm}}}
{\end{list}}

% If PSTricks is not available
\newcommand{\PSTricksExampleNotShown}{%
\vspace{2mm}
\centerline{\fbox{\textbf{Example not shown here because PSTricks is not
                          available on this platform.}}}}

% Character to define verbatim strings, with escape characters /?; (from `fancyvrb')
\DefineShortVerb[commandchars=/?;]{\!}

\VerbatimFootnotes % Allow verbatim material in footnotes (from `fancyvrb')

% Some advices from Rolf Niepraschk
\newcommand{\BS}{\texttt{\symbol{`\\}}}
\newcommand{\Macro}[1]{\texttt{\BS#1}}
\newcommand{\Variable}[1]{\textnormal{\textit{\(\langle\)#1\,\(\rangle\)}}}
\newcommand{\Parameter}[1]{\texttt{\symbol{`\{}#1\symbol{`\}}}}

% To format TeX macro strings
\newcommand{\FormatTeXMacro}[1]{\Macro{#1}\hfill :}

\makeatletter

% Example environments
% (do not use in them the /?; characters, that we will be used as escape characters!)

% For highlighting some verbatim sequences (array names, macro names and comments)
\def\HLReverse#1{{%
\setlength{\fboxsep}{1pt}%
\colorbox{black}{\textcolor{white}{\textbf{#1}}}}}
\def\HLMacro#1{\BS{}def\HLMacro@i#1\@nil}
\def\HLMacro@i#1def#2\@nil{{%
\setlength{\fboxsep}{1pt}%
\colorbox{black}{\textcolor{white}{\textbf{#2}}}}}
\def\HLComment#1{\textit{#1}}

\def\Example{\FV@Environment{}{Example}}
\def\endExample{%
\end{VerbatimOut}
\Below@Example{\input{\jobname.tmp}}
\endgroup}

\def\CenterExample{\FV@Environment{}{Example}}
\def\endCenterExample{%
\end{VerbatimOut}%
\begin{center}
\Below@Example{\input{\jobname.tmp}}
\end{center}
\endgroup}

\def\SideBySideExample{\FV@Environment{}{Example}}
\def\endSideBySideExample{%
\end{VerbatimOut}%
\SideBySide@Example{\input{\jobname.tmp}}
\endgroup}

\def\FVB@Example{%
\begingroup
\FV@UseKeyValues
\parindent=0pt
\multiply\topsep by 2
\VerbatimEnvironment
\begin{VerbatimOut}[codes={\catcode`\Z=12}]{\jobname.tmp}}

\def\Below@Example#1{%
\VerbatimInput[gobble=0,commentchar=Z,commandchars=/?;,numbersep=3pt,
               frame=single,numbers=left]%
              {\jobname.tmp}
\catcode`\Z=9\relax%
% We suppress the effect of the highlighting macros
\catcode`/=0\relax%
\catcode`?=1\relax%
\catcode`;=2\relax%
\def\HLReverse##1{##1}%
\def\HLMacro##1{##1}%
\def\HLComment##1{##1}%
#1\par}

\def\SideBySide@Example#1{%
\@tempdimb=\FV@XRightMargin
\advance\@tempdimb -5mm
\begin{minipage}[c]{\@tempdimb}
  \fvset{xrightmargin=0pt}
  \catcode`\Z=9\relax%
  % We suppress the effect of the highlighting macros
  \catcode`/=0\relax%
  \catcode`?=1\relax%
  \catcode`;=2\relax%
  \def\HLReverse##1{##1}%
  \def\HLMacro##1{##1}%
  \def\HLComment##1{##1}%
  #1
\end{minipage}%
\@tempdimb=\textwidth
\advance\@tempdimb -\FV@XRightMargin
\advance\@tempdimb 5mm
\begin{minipage}[c]{\@tempdimb}
  \VerbatimInput[gobble=0,commentchar=Z,commandchars=/?;,
                 numbersep=3pt,frame=single,numbers=left,
                 xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp}
\end{minipage}}

\makeatother

% Source codes must be indented by 2 spaces
\fvset{gobble=2,frame=single,numbers=left,numbersep=1mm}

\begin{document}

\title{The \ArrayJobPackage{} package\\Management of arrays in \AllTeX}
\author{Zhuhan Jiang\\School of Computing and Mathematics\\
        University of Western Sydney\\Sydney\\Australia\\
        {\footnotesize email: zhuhan@scm.uws.edu.au}\\[5mm]
        {\footnotesize (Documentation: Denis Girou%
                       \footnote{All errors and misunderstandings are mine.}
                       \hspace{1mm}(CNRS/IDRIS -- France) --
                       Denis.Girou@idris.fr)}}
\date{Version 1.03\\May 3, 2000\\
      {\small Documentation revised May 31, 2000, edited lightly May 3, 2010 by Michael Sharpe}}

\maketitle

\begin{abstract}
  This package provides array data structures in \AllTeX, in the meaning of
the classical procedural programming languages like Fortran, Ada or C, and
macros to manipulate them. Arrays can be mono or bi-dimensional.

  This is useful for applications which require high level programming
techniques, like algorithmic graphics programmed in \TeX. This version conflicts with some macros in the {\tt amsmath} package. Version 1.04 resolves those issues. It should be used for all new work.
\end{abstract}

\tableofcontents

\section{Introduction}

  One of the big advantages of the \AllTeX{} system over common interactive
software for text processing is that it offer, also, a programming language,
which give, to people who have some knowledge in the algorithmic and
programming fields, an exceptional flexibility and power.

  Nevertheless, \TeX{} is a rather specific programming language, based on
macro expansion, which implements a lot of unusual constructs but lacks some that are very familiar in the classical procedural languages, as
\emph{arrays} to store and retrieve arbitrary pieces of data, stored in a
structured way. The main reason why they were not integrated in \TeX{} was
perhaps that arrays did not seem very useful in a language focussed on text processing (but
\MetaFontPackage{}, for instance, does has them). Nevertheless, one of the few
applications where this is straightforward to use them is to program a mailing
system, where nearly the same information is to be formatted several times,
depending of values which can be simply retrieved from an array of data. This
was the goal of the \FormLettPackage{} package \cite{FORMLETT}, written in
1993-1995 by Zhuhan Jiang for dealing with mass letters, invoices and similar
tasks of some duplicative nature. It implemented a small but powerful set of
macros to manage arrays, which have been extracted to form the present
\ArrayJobPackage{} package. The arrays can be mono or bi-dimensional%
\footnote{You can use more than two dimensions, but not in the meaning of the
classical programming languages (see page \pageref{par:DataHeight})}
and they are dynamically allocated (so we do not have to declare their
dimension statically.)%
\footnote{Stephan von Bechtolsheim \cite[Volume \textsc{III}, paragraph 20.3,
page 136]{SVB93} also demonstrated such macros for array management in the
third volume of his huge book, but it was limited to mono-dimensional
arrays.}.

  Array structures are, at the opposite of text management, often very useful
in graphic programming. This is why the \AlDraTeXPackage{} package from Eitan
Gurari \cite{ALDRATEX} (see also \cite{Gur94}) integrate such functionality
(but which is bundled inside this package and could not be extracted easily
from it), and this is also the case for the \MetaPostPackage{} package
\cite{METAPOST} (but this one do not use \TeX{} as programming language)%
\footnote{Another required feature, used in conjunction with the managements
of arrays, is a generic loop mechanism. \TeX{} offer the \Macro{loop} macro
and \LaTeX{} the \Macro{whiledo} macro of the \IfThenPackage{} package (and
also the internal \Macro{@for}, \Macro{@whilenum}, etc. macros), but a more
high-level structure is to be preferred, as the ones defined too in the
\AlDraTeXPackage{} or \MetaPostPackage{} packages. We will use in our examples
the \MultiDoPackage{} package \cite{MULTIDO}, also written by Timothy van
Zandt, but others are available, like the \RepeatPackage{} package written by
Victor Eijkhout \cite{REPEAT}.}. This fact explain why most of our examples in
this documentation will concern the area of \emph{graphic programming} (here
using the \PSTricksPackage{} package from Timothy van Zandt \cite{PSTRICKS}).

\section{Command reference}

\begin{Description}{4cm}
  \item[\FormatTeXMacro{newarray}] Define a new array.

       Syntax: !\newarray/Macro?/Variable?ArrayName;;!

       Example: !\newarray\Values!

  \item[\FormatTeXMacro{delarray}] Delete an array.

       Syntax: !\delarray/Macro?/Variable?ArrayName;;!

       Example: !\delarray\Values!

       Remarks:
       \begin{enumerate}
         \item obviously, elements of a deleted array could not be accessed
         later,
         \item take care that the elements of a deleted array are not
         themselves deleted.\newline
         So, \verb+\delarray\Data \newarray\Data \Data(I)+ can produce 
         strange behavior. Just avoid  reusing deleted arrays.
       \end{enumerate}

  \item[\FormatTeXMacro{ArrayName}] Store or get the content of the array
  element specified by the index/indices. In the last case, the content is
  inserted at the current point.

       Syntax: !/Macro?/Variable?ArrayName;;(I)=/Parameter?/Variable?Content;;! or more
               generally\newline
               \hspace*{1.3cm}!/Macro?/Variable?ArrayName;;(I1,...,In)=/Parameter?/Variable?Content;;!
               to store a value

               \hspace{1.3cm}!/Macro?/Variable?ArrayName;;(I)! or more generally
               !/Macro?/Variable?ArrayName;;(I1,...,In)! to retrieve a value

       Examples: !\Data(6)={Paul Adams}!

                 \hspace{1.75cm}!\Values(19)!

  \item[\FormatTeXMacro{readarray}] Store consecutive values in an array,
       starting from the indice one.

       Syntax: !\readarray/Parameter?/Variable?ArrayName;;=/Parameter?/Variable?Content1;&...&/Variable?ContentM;;!

       Example: !\readarray{Actors}{Louise Brooks&Marlene Dietrich&Clark Gable}!

       Remarks:
       \begin{enumerate}
         \item the values must be separated by the \textbf{\&} character,
         \item take care that the trailing spaces are significant, so the
         previous definition is different from the following one:

         !\readarray{Actors}{Louise Brooks & Marlene Dietrich & Clark Gable}!
         \item you can use \AllTeX{} macros inside the values.
       \end{enumerate}
\end{Description}

\begin{SideBySideExample}[xrightmargin=6cm]
  \newarray\Values
  \readarray{/HLReverse?Values;}{A&B&C&D}
  \verb+\Values(3)+ = `\Values(3)'
  \newarray\Actors
  \readarray{/HLReverse?Actors;}{Louise Brooks&Marlene Dietrich&Clark Gable}
  Z\par
  \verb+\Actors(2)+ = `\Actors(2)'
  \readarray{/HLReverse?Actors;}{%
  Louise Brooks & Marlene Dietrich & Clark Gable}
  Z\par
  \verb+\Actors(2)+ = `\Actors(2)'
  \Actors(4)={\textit{\underline{Ida Lupino}}}
  Z\par
  \verb+\Actors(4)+ = `\Actors(4)'
\end{SideBySideExample}

\vspace{3mm}
\noindent If you really need to trim the unnecessary left and right spaces, you must
apply a special action, like this one:

\begin{Example}
  \def\BS{\texttt{\symbol{`\\}}}

  \newarray\Strings
  \readarray{/HLReverse?Strings;}{a& b&c c  &    d dd  ddd   }

  \multido{\iString=1+1}{4}{%
    \checkStrings(\iString)%
    \BS\texttt{Strings(\iString)}=`\cachedata'\qquad}

  \makeatletter

  % /HLComment?A \TrimSpaces macro adapted from Michael J. Downes <epsmjd@ams.org>;
  % /HLComment?(posted on c.t.t. June 19, 1998);
  % /HLComment?\number`\x reads past one following space (expanding as it goes);
  \long\def\TrimSpaces#1{\expandafter\TrimSpaces@i\number`\^^00#1| |}
  % /HLComment?Remove the "0" produced by \number`\^^00, and " |" at the end.;
  \long\def\TrimSpaces@i 0#1 |{\TrimSpaces@ii\empty#1|}
  % /HLComment?" |" was removed by \TrimSpaces@i, now remove a trailing "||" or "| |";
  \long\def\TrimSpaces@ii #1|#2|{#1}

  \makeatother 

  \multido{\iString=1+1}{4}{%
    \checkStrings(\iString)%
    \BS\texttt{Strings(\iString)}=`\TrimSpaces{\cachedata}'\qquad}
\end{Example}

\begin{Description}{4cm}
  \item[\FormatTeXMacro{check}] Get the content of the array element specified
  by the indice(s) and store the result in the macro !\cachedata!

       Syntax: !\check/Variable?ArrayName;(I)! or more generally
               !\check/Variable?ArrayName;(I1,..,In)!

       Example: !\checkActors(2)!
  \item[\FormatTeXMacro{cachedata}] Macro where the content is stored after
  a !\check! request.
  \item[\FormatTeXMacro{ifemptydata}] True if the last \Macro{check} request
  has given an empty result.
\end{Description}

\newarray\Values
\readarray{Values}{A&B&C&D}

\newarray\Actors
\newarray\Dates
\newarray\Sexes
\readarray{Actors}{Louise Brooks&%
                   Marlene Dietrich&%
                   Clark Gable}
\readarray{Dates}{1906--1985&%
                  1902--1992&%
                  1901--1960}
\readarray{Sexes}{2&2&1}

\begin{SideBySideExample}[xrightmargin=6cm]
  % /HLComment?Plain TeX usage;
  \checkValues(2)%
  \verb+\Values(2)+ = `\cachedata'
  Z\par
  \checkActors(3)%
  \verb+\Actors(3)+ = `\cachedata'
  Z\par
  \checkActors(5)%
  \ifemptydata
    \verb+\Actors(5)+ not defined.
  \fi
  Z\par
  % /HLComment?LaTeX usage;
  \newcommand{\IsEmptyElement}[2]{%
  \ifthenelse{\boolean{emptydata}}{#1}{#2}}
  \checkActors(3)%
  \verb+\Actors(3)+ = \IsEmptyElement{not defined}{`\cachedata'}
  Z\par
  \checkActors(5)%
  \verb+\Actors(5)+ \IsEmptyElement{not defined}{`\cachedata'}
\end{SideBySideExample}

\begin{Description}{4cm}
  \item[\FormatTeXMacro{ifnormalindex}] See below (Default: !\normalindexfalse!).

  \item[\FormatTeXMacro{dataheight}\label{par:DataHeight}] Counter containing
  the number of elements in the first dimension, if arrays are bi-dimensional.

       Syntax: !\dataheight=/Variable?Number;!

       Remarks:
       \begin{enumerate}
         \item arrays are monodimensional when !\dataheight!~$\leq~1$,
         \item if !\normalindexfalse! (which is the default value), we have:
           $$\hspace{-3cm}\Macro{\Variable{ArrayName}}(I_1,...,I_n)
             = \Macro{\Variable{ArrayName}}(I_n + (I_{n-1}-1) *
                 \Macro{dataheight} + \cdots
                                    + (I_1-1) * \Macro{dataheight}^{n-1})$$

               and if !\normalindextrue!, we have:
           $$\hspace{-3cm}\Macro{\Variable{ArrayName}}(I_1,...,I_n)
             = \Macro{\Variable{ArrayName}}(I_1 + (I_2-1) *
                 \Macro{dataheight} + \cdots
                                    + (I_n-1) * \Macro{dataheight}^{n-1})$$
       \end{enumerate}
\end{Description}

\begin{SideBySideExample}[xrightmargin=6cm]
  \newarray\Letters
  \readarray{/HLReverse?Letters;}{A&B&C&D&E&F&G&H&I&J}
  \dataheight=5

  Z\begin{tabular}{c|c|c|c|c|c|c|c|c|}
  Z \multicolumn{1}{c}{}  & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} &
  Z \multicolumn{1}{c}{3} & \multicolumn{1}{c}{4} & \multicolumn{1}{c}{5} \\ \cline{2-6}
  Z 1 & A & B & C & D & E \\ \cline{2-6}
  Z 2 & F & G & H & I & J \\ \cline{2-6}
  Z\end{tabular}
  Z\\[2mm]
  % /HLComment?Default is \normalindexfalse;
  \verb+\Letters(1,2)=+`\Letters(1,2)'
  Z\par
  \verb+\Letters(2,1)=+`\Letters(2,1)'
  Z\\[2mm]
  Z\begin{tabular}{c|c|c|}
  Z \multicolumn{1}{c}{} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} \\ \cline{2-3}
  Z 1 & A & F \\ \cline{2-3}
  Z 2 & B & G \\ \cline{2-3}
  Z 3 & C & H \\ \cline{2-3}
  Z 4 & D & I \\ \cline{2-3}
  Z 5 & E & J \\ \cline{2-3}
  Z\end{tabular}
  Z\\[2mm]
  \normalindextrue
  \verb+\Letters(1,2)=+`\Letters(1,2)'
  Z\par
  \verb+\Letters(2,1)=+`\Letters(2,1)'
\end{SideBySideExample}

\begin{Description}{4cm}
  \item[\FormatTeXMacro{ifexpandarrayelement}] Boolean macro to allow or not
  the element to be evaluated before to be stored in the array (Default:
  !\expandarrayelementfalse!).

       Syntax: !\expandarrayelementtrue! or !\expandarrayelementfalse!

       Remark: take care to the possible side effects if you store some macros
       as values of some array elements without evaluating them, as they can
       change of content later... (see the following examples).
\end{Description}

\begin{SideBySideExample}[xrightmargin=6cm]
  \newarray\Data
  \newcount\CounterP            % /HLComment?Plain TeX usage;
  \CounterP=3
  \newcounter{CounterL}         % /HLComment?LaTeX usage;
  \setcounter{CounterL}{3}
  \def\Town{Madrid}
  \Data(1)={\the\CounterP}
  \Data(2)={\the\value{CounterL}}
  \Data(3)={\Town}

  \expandarrayelementtrue
  \Data(4)={\the\CounterP}
  \Data(5)={\the\value{CounterL}}
  \Data(6)={\Town}

  \CounterP=5
  \setcounter{CounterL}{5}
  \def\Town{Roma}

  \multido{\iData=1+1}{6}{%
    \BS\texttt{Data(\iData)}=`\Data(\iData)'\\}
\end{SideBySideExample}

\vspace{3mm}
\noindent Some other macros exists for mono-dimensional arrays (and only for
them), but have little additional interest:

\begin{Description}{4cm}
  \item[\FormatTeXMacro{array}] Store or get the content of the array element
  specified by the index. In the last case, the content is inserted at the
  current point.\footnote{The macro name \verb|\array| conflicts with macros in {\tt amsmath}. This is changed in version 1.04.}

       Syntax: !\array/Parameter?/Variable?ArrayName;;(I)=/Parameter?/Variable?Content;;!
               to store a value

               \hspace{1.3cm}!\array/Parameter?/Variable?ArrayName;;(I)! to retrieve a value

       Examples: !\array{Actors}(6)={Joan Crawford}!

                 \hspace{1.75cm}!\array{Actors}(3)!

  \item[\FormatTeXMacro{clrarray}] Clear the content of the array element specified.
  A following inquiry on this element will give an empty content.

       Syntax: !\clrarray/Parameter?/Variable?ArrayName;;(I)!

       Example: !\clrarray{Actors}(2)!

  \item[\FormatTeXMacro{testarray}]  Get the content of the array element specified
  by the index and store the result in the macro !\temp@macro!%
  \footnote{In \LaTeX, this macro should be used inside a package or between
  the \verb+\makeatletter+ $\cdots$ \verb+\makeatother+ macro pair.}.

       Syntax: !\testarray/Parameter?/Variable?ArrayName;;(I)!

       Example: !\testarray{Actors}(1)\typeout{Actors(1)=`\temp@macro'}!
\end{Description}

\section{Examples}

\UndefineShortVerb{\!}          % We will use the ! character in the next examples

  We will first show some basic and easy examples, before  looking at more
advanced ones to solve some complex problems, which require more knowledge of
\TeX{} programming techniques.

\subsection{Basic examples}

  The immediate thing for which we can use arrays is to store and retrieve
information:

\vspace{2mm}
\begin{SideBySideExample}[xrightmargin=6cm]
  \newarray\Actors
  \newarray\Dates
  \newarray\Sexes

  \readarray{/HLReverse?Actors;}{Louise Brooks&Marlene Dietrich&Clark Gable}
  \readarray{/HLReverse?Dates;}{1906--1985&1902--1992&1901--1960}
  \readarray{/HLReverse?Sexes;}{2&2&1}

  \begin{description}
    \item[\Actors(1)] : \Dates(1)
    \item[\Actors(2)] : \Dates(2)
    \item[\Actors(3)] : \Dates(3)
  \end{description}
\end{SideBySideExample}

\vspace{2mm}
  But we can also use a general loop macro, as the one provided by the
\MultiDoPackage{} package, for more powerful usage and a management
independent of the number of elements:

\vspace{2mm}
\begin{SideBySideExample}[xrightmargin=6cm]
  \newcommand{\NumberActors}{3}

  \begin{description}
    \multido{\iActor=1+1}{\NumberActors}{%
      \item[\Actors(\iActor)] : \Dates(\iActor)}
  \end{description}
\end{SideBySideExample}

\vspace{2mm}
  This allow various usage in the formatting of texts. A common usage is for a
\emph{mailing} process, when we must compose some similar letters to various
people (as we said previously, this was the reason for which these macros were
developed in the \FormLettPackage{} package). Here, the usage of a programming
language allow a great flexibility, using some conditionals to format the text
differently or even to insert different pieces of text according to the person:

\newcommand{\NumberActors}{3}

\begin{CenterExample}
  \newcounter{iActor}

  \newcommand{\AccordingSexe}[2]{%
  \checkSexes(\the\value{iActor})%
  \ifthenelse{\equal{\cachedata}{1}}{#1}{#2}}

  \whiledo{\value{iActor} < \NumberActors}{%
    \stepcounter{iActor}%
    \fbox{%
      \begin{minipage}{0.985\textwidth}
        Dear \AccordingSexe{Mr}{Mrs} \Actors(\the\value{iActor}),

        I would like to tell you how I admire the great \AccordingSexe{actor}{actress}
        you are, etc.
      \end{minipage}}\\[5mm]}
\end{CenterExample}

  Nevertheless, people who know a little \TeX{} as a programming language know
that it behaviour is full of pitfalls... For instance, the following example,
which format a table according to the content of entries stored in external
arrays, can't work:

\begin{Verbatim}
  \begin{tabular}{|l|c|}
    \hline
    \multicolumn{1}{|c}{\textbf{Actors}} & \multicolumn{1}{|c|}{\textbf{Dates}} \\ \hline
    \multido{\iActor=1+1}{\NumberActors}{\Actors(\iActor) & \Dates(\iActor) \\ \hline}
  \end{tabular}
\end{Verbatim}

  This is because there is an implicit grouping of each entry in a tabular
environment and that it do not work with the grouping of the \verb+\multido+
loop. So, this must be program in a different way, storing all the content of
the table before really inserting it:

\begin{SideBySideExample}[xrightmargin=6cm,baselinestretch=0.9]
  \begin{tabular}{|l|c|}
    \hline
    \multicolumn{1}{|c}{\textbf{Actors}} &
      \multicolumn{1}{|c|}{\textbf{Dates}} \\ \hline
    \let\ListActors\empty
    \begingroup
      \let\Actors\relax
      \let\Dates\relax
      \let\\\relax
      \let\hline\relax
      \multido{\iActor=1+1}{\NumberActors}{%
        \xdef\ListActors{\ListActors
          \Actors(\iActor) & \Dates(\iActor) \\ \hline}}
    \endgroup
    \ListActors
  \end{tabular}
\end{SideBySideExample}

\subsubsection{Plot labels}

  A basic usage in graphic programming is to use arrays to retrieve the labels
to put on a drawing, as here to label the simple plot below. (Note the change from the original documentation. The axis labels used with \verb|\psaxes| must now be numeric, so it is necessary to bypass the automatic axis labeling.)
\ifpstricks                     % If PSTricks is available
\begin{CenterExample}[baselinestretch=0.9]
  \savedata{\Data}[(1,3)(2,1)(3,2)(4,1)(5,1)(6,3),(7,2)(8,1)(9,3)(10,3)(11,1)(12,1)]

  \newcommand{\PlotData}[1]{%
  \begin{pspicture}(-0.5,-0.5)(13,4)
    \psaxes[labels=none]{->}(13,4)
    \dataplot[plotstyle=dots,dotstyle=o,dotsize=0.3]{\Data}
    #1\end{pspicture}}
  \PlotData{\psaxes[showorigin=false]{->}(13,4)}

  \newarray{\Months}
  \readarray{/HLReverse?Months;}{January&February&March&April&May&June&July&August&September&%
  October&November&December}
  \newarray{\Levels}
  \readarray{/HLReverse?Levels;}{Low&Medium&High}
  %\renewcommand{\pshlabel}[1]{\tiny\Months(#1)}
  \PlotData{\psaxes[labels=y,showorigin=false]{->}(13,4)%
  \multido{\i=1+1}{12}{\rput[B](\i,-12pt){\tiny\Months(\i)}}}
  
  %\renewcommand{\psvlabel}[1]{\small\Levels(#1)}
  \PlotData{\multido{\i=1+1}{12}{\rput[B](\i,-12pt){\tiny\Months(\i)}}%
  \multido{\i=1+1}{3}{\rput[r](-12pt,\i){\small\Levels(\i)}}}
\end{CenterExample}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

\subsubsection{Checkboard drawing}

  Of course, a bi-dimensional array directly allow to store the state of a
checkboard of one of the numerous ones existing, like the reversi game that
we will show here (in fact, the only more difficult part to understand in this
example concern the definition of the elementary piece, but as this is not
related at all to the usage of \ArrayJobPackage, this point can be forgotten
by most of the readers).

\ifpstricks                     % If PSTricks is available
\begin{SideBySideExample}[xrightmargin=6cm,baselinestretch=0.89]
  /HLMacro?\def\Black;{B}
  /HLMacro?\def\White;{W}

  /HLMacro?\def\Piece;#1#2{{%
  \psset{unit=0.8}%
  \pspicture(0,-0.1)(1,0.8)
    \pscustom[fillstyle=gradient,gradmidpoint=0,gradangle=90,
              gradbegin=#2,gradend=#1]{%
      \psbezier(0,0.2)(0.1,-0.2)(0.9,-0.2)(1,0.2)
      \psline(1,0.2)(1,0.5)
      \psbezier(1,0.5)(0.9,0.9)(0.1,0.9)(0,0.5)
      \psline(0,0.5)(0,0.2)}
      \psbezier(0,0.5)(0.1,0.1)(0.9,0.1)(1,0.5)
  \endpspicture}}

  /HLMacro?\def\PieceBlack;{\Piece{black}{gray}}
  /HLMacro?\def\PieceWhite;{\Piece{white}{gray}}

  /HLMacro?\def\CheckboardHook;{}

  \newarray\Checkboard

  /HLMacro?\def\ShowCheckboard;{%
  \dataheight=8
  \pspicture(8,8)
    \psgrid[subgriddiv=0,gridlabels=0](8,8)
    \CheckboardHook
    \multido{\iColumn=1+1,\iColumnPos=0+1}{8}{%
      \multido{\iRow=1+1,\iRowPos=7+-1}{8}{%
        \checkCheckboard(\iRow,\iColumn)%
        \ifx\cachedata\Black
          \rput(\iColumnPos.5,\iRowPos.5){\PieceBlack}
        \else
          \ifx\cachedata\White
            \rput(\iColumnPos.5,\iRowPos.5){\PieceWhite}
          \fi
        \fi}}
  \endpspicture}

  \readarray{/HLReverse?Checkboard;}{%
  W& &B& & & & &B&%
   &W&B& & & & &B&%
  W&W&B& &W& & &B&%
  W&W&B&W&W&W&B&B&%
  B& &W&W&W&B&W&B&%
  B&B&W&W&W&B&W&B&%
  B&B&B&W&W&W&W&B&%
  W&B&B&B&B&B&B&B&%
  }

  \psset{unit=0.6}
  \ShowCheckboard

  \Checkboard(2,1)={B} % /HLComment?Black move;
  /HLMacro?\def\CheckboardHook;{%
  \psframe[linestyle=none,fillstyle=hlines](0,6)(1,7)}
  % /HLComment?White pieces changed by the black move;
  \Checkboard(3,1)={B}\Checkboard(4,1)={B}
  \Checkboard(2,2)={B}\Checkboard(3,2)={B}
  \vspace{1cm}
  \ShowCheckboard
\end{SideBySideExample}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

  Note also that, if \TeX{} is obviously not well suited to implement a
program to \emph{really} play at a game like reversi or chess, nevertheless
it can be used to solve internally some non trivial algorithmic problems,
where the usage of arrays help a lot. For such example (on the coloration of
the Truchet's tiling), see \cite{EG98}.

\subsection{Advanced examples}

  This section will show slightly more difficult to really complex examples,
and is mainly for \emph{advanced users} or for people who want to be able to
program complex tasks themselves.

\subsubsection{Example with recursion usage}

\begin{CenterExample}
  \makeatletter

  % /HLComment?The recursion macro used (from David Carlisle);
  /HLMacro?\def\Recursion;#1{%
  #1\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}

  \newcount\IndexRecursion
  \IndexRecursion=\z@

  /HLMacro?\def\PiFrac;#1{{%
  \Recursion
    {\ifnum#1>\@ne\relax}
    {\@tempcnta=#1
     \advance\@tempcnta\m@ne
     \advance\IndexRecursion\@ne
     \PiValues(\IndexRecursion)
       +\frac{\strut\displaystyle 1}{\strut\displaystyle\PiFrac{\@tempcnta}}}
    {\advance\IndexRecursion\@ne
     \PiValues(\IndexRecursion)}}}

  \makeatother

  \newarray\PiValues
  \readarray{/HLReverse?PiValues;}{3&7&15&1&292&1&1&1&2&1&3&1&14}

  \(\pi\approx\PiFrac{/HLReverse?4;}\approx\PiFrac{/HLReverse?13;}\)

  \textbf{\(\pi\) as a continued fraction}
\end{CenterExample}

\subsubsection{Structured dynamic diagrams on a grid}

  A very common case is when we must use some strutured data which are to be
drawn on a kind of abstract grid.

\ifpstricks                     % If PSTricks is available
  To draw a diagram like this one (such example illustrate the exchanges of
data between processors when using applications on multiprocessors computers
in parallel programming):

\vspace{2mm}
\begin{SideBySideExample}[xrightmargin=5.8cm]
  \psset{linestyle=none,fillstyle=solid,subgriddiv=0,gridlabels=0}
  \begin{pspicture}(-1,0)(4,4)
   % /HLComment?Line 0;
   \psframe[fillcolor=Khaki](0,3.1)(1,3.9)
   \psframe[fillcolor=LemonChiffon](1,3.1)(4,3.9)
   \rput(0,3.1){\psgrid[yunit=0.8](4,1)}
   \rput(-0.5,3.5){P0}
   \rput(0.5,3.5){A0}
   % /HLComment?Line 1;
   \psframe[fillcolor=Khaki](0,2.1)(2,2.9)
   \psframe[fillcolor=LemonChiffon](2,2.1)(4,2.9)
   \rput(0,2.1){\psgrid[yunit=0.8](4,1)}
   \rput(-0.5,2.5){P1}
   \rput(0.5,2.5){A0}\rput(1.5,2.5){A1}
   % /HLComment?Line 2;
   \psframe[fillcolor=Khaki](0,1.1)(3,1.9)
   \psframe[fillcolor=LemonChiffon](3,1.1)(4,1.9)
   \rput(0,1.1){\psgrid[yunit=0.8](4,1)}
   \rput(-0.5,1.5){P2}
   \rput(0.5,1.5){A0}\rput(1.5,1.5){A1}\rput(2.5,1.5){A2}
   % /HLComment?Line 3;
   \psframe[fillcolor=Khaki](0,0.1)(4,0.9)
   \rput(0,0.1){\psgrid[yunit=0.8](4,1)}
   \rput(-0.5,0.5){P3}
   \rput(0.5,0.5){A0}\rput(1.5,0.5){A1}
     \rput(2.5,0.5){A2}\rput(3.5,0.5){A3}
  \end{pspicture}
\end{SideBySideExample}

\vspace{2mm}
\noindent is easy but rather painful, as we must manage a lot of coordinates.
Nevertheless, even if we introduce a little more abstraction level using some
minor programming with a loop structure:
\vspace{2mm}


\begin{SideBySideExample}[xrightmargin=5.8cm]
  \psset{linestyle=none,fillstyle=solid,subgriddiv=0,gridlabels=0}
  \begin{pspicture}(-1,0)(4,4)
   \multido{\iLoop=1+1,\iRow=0+1,\iRowPos=3+-1}{4}{%
     \psframe[fillcolor=Khaki](0,\iRowPos.1)(\iLoop,\iRowPos.9)
     \psframe[fillcolor=LemonChiffon]
             (\iLoop,\iRowPos.1)(4,\iRowPos.9)
     \rput(0,\iRowPos.1){\psgrid[yunit=0.8](4,1)}
     \rput(-0.5,\iRowPos.5){P\iRow}
     \multido{\iColumn=0+1,\iLabel=1+1}{\iLoop}{%
       \rput(\iColumn.5,\iRowPos.5){A\iColumn}}}
  \end{pspicture}
\end{SideBySideExample}

\vspace{2mm}
\noindent we succeed to heavily reduce the number of lines of the code in this
specific case, but we gain nothing in genericity. If we have several such
diagrams to draw, with each that must be done differently according to the
empty and full cells of the array, we must proceed in a completely different
way, defining a \emph{generic object} which can obtain the different values of
a data structure previously filled. For such tasks, the \ArrayJobPackage{}
package allow to build very efficient and powerful tools.

\begin{Verbatim}[commandchars=/?;]
  % /HLComment?The grid;
  /HLMacro?\def\ArrayGrid;#1#2#3{{%
  % /HLComment?#1=array of data, #2=number of rows, #3=number of columns;
  \psset{dimen=middle,xunit=0.8}
  \dataheight=#3
  \pspicture(-1,-#2)(#3,0)
  \multido{\iRow=1+1,\iRowMinusOne=0+1}{#2}{%
    \rput(-1,-\iRow){\LineGrid{#1}{\iRow}{\iRowMinusOne}{#3}}}
  \endpspicture}}

  % /HLComment?One line of the grid;
  /HLMacro?\def\LineGrid;#1#2#3#4{%
  \rput(0.5,0.4){\AttributeLabel{P#3}}
  \multido{\iColumn=1+1}{#4}{%
    \expandafter\csname check#1\endcsname(#2,\iColumn)%
    \rput(\iColumn,0){%
      \ifemptydata
        \def\ColorBackground{\ColorBackgroundEmpty}%
      \else
        \ifx\cachedata\space
          \def\ColorBackground{\ColorBackgroundEmpty}%
        \else
          \def\ColorBackground{\ColorBackgroundFull}%
        \fi
      \fi
      \psframe[fillstyle=solid,fillcolor=\ColorBackground](1,0.8)
      \rput(0.5,0.4){\AttributeElement{\cachedata}}}}}
\end{Verbatim}

% The grid
\def\ArrayGrid#1#2#3{{%
% #1=array of data, #2=number of rows, #3=number of columns
\psset{dimen=middle,xunit=0.8}
\dataheight=#3
\pspicture(-1,-#2)(#3,0)
\multido{\iRow=1+1,\iRowMinusOne=0+1}{#2}{%
  \rput(-1,-\iRow){\LineGrid{#1}{\iRow}{\iRowMinusOne}{#3}}}
\endpspicture}}

% One line of the grid
\def\LineGrid#1#2#3#4{%
\rput(0.3,0.4){\AttributeLabel{P#3}}
\multido{\iColumn=1+1}{#4}{%
  \expandafter\csname check#1\endcsname(#2,\iColumn)%
  \rput(\iColumn,0){%
    \ifemptydata
      \def\ColorBackground{\ColorBackgroundEmpty}%
    \else
      \ifx\cachedata\space
        \def\ColorBackground{\ColorBackgroundEmpty}%
      \else
        \def\ColorBackground{\ColorBackgroundFull}%
      \fi
    \fi
    \psframe[fillstyle=solid,fillcolor=\ColorBackground](1,0.8)
    \rput(0.5,0.4){\AttributeElement{\cachedata}}}}}

\begin{SideBySideExample}[xrightmargin=6cm]
  % /HLComment?Default attributes;
  \def\ColorBackgroundEmpty{LemonChiffon}
  \def\ColorBackgroundFull{Khaki}
  \def\AttributeElement#1{\textcolor{red}{#1}}
  \def\AttributeLabel#1{\bf #1}

  % /HLComment?Example 1;
  \newarray\ArrayA

  % /HLComment?Data;
  \readarray{/HLReverse?ArrayA;}{%
  A0&  &  &  &%
  A0&A1&  &  &%
  A0&A1&A2&  &%
  A0&A1&A2&A3}

  \ArrayGrid{ArrayA}{4}{4}
\end{SideBySideExample}

\newarray\ArrayA

% Default attributes
\def\ColorBackgroundEmpty{LemonChiffon}
\def\ColorBackgroundFull{Khaki}
\def\AttributeElement#1{\textcolor{red}{#1}}
\def\AttributeLabel#1{\bf #1}

\begin{CenterExample}[baselinestretch=0.9]
  % /HLComment?Example 2;
  \newarray\ArrayB

  % /HLComment?Data;
  \readarray{/HLReverse?ArrayA;}{%
  A& & & &%
   & & & &%
   & & & &%
   & & & }
  \readarray{/HLReverse?ArrayB;}{%
  A& & & &%
  A& & & &%
  A& & & &%
  A& & & }

  \ArrayGrid{ArrayA}{4}{4}\hfill\ArrayGrid{ArrayB}{4}{4}
\end{CenterExample}

\newarray\ArrayB

\begin{CenterExample}[baselinestretch=0.9]
  % /HLComment?Example 3;
  \newarray\ArrayC

  % /HLComment?Data;
  \readarray{/HLReverse?ArrayA;}{%
  A0&  &  &%
  A1&  &  &%
  A2&  &  }
  \readarray{/HLReverse?ArrayB;}{%
  A0&A1&A2&%
  A0&A1&A2&%
  A0&A1&A2}
  \readarray{/HLReverse?ArrayC;}{%
  A0&  &  &%
    &A1&  &%
    &  &A2}

  % /HLComment?Attributes;
  \def\ColorBackgroundEmpty{green}
  \def\ColorBackgroundFull{red}
  \def\AttributeElement#1{\footnotesize\textcolor{white}{#1}}
  \def\AttributeLabel#1{\small\bf #1}

  \psset{unit=0.7}
  \ArrayGrid{ArrayA}{3}{3}\hfill\ArrayGrid{ArrayB}{3}{3}\hfill\ArrayGrid{ArrayC}{3}{3}
\end{CenterExample}

\begin{CenterExample}[baselinestretch=0.9]
  % /HLComment?Example 4;

  % /HLComment?Data;
  \readarray{/HLReverse?ArrayA;}{%
  A0&A1&A2&A3&%
  B0&B1&B2&B3&%
  C0&C1&C2&C3&%
  D0&D1&D2&D3}
  \readarray{/HLReverse?ArrayB;}{%
  A0&B0&C0&D0&%
  A1&B1&C1&D1&%
  A2&B2&C2&D2&%
  A3&B3&C3&D3}

  % /HLComment?Attributes;
  \def\AttributeElement#1{\textcolor{red}{#1}}
  \def\AttributeLabel#1{\Large\it #1}

  \ArrayGrid{ArrayA}{4}{4}\hfill\ArrayGrid{ArrayB}{4}{4}
\end{CenterExample}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

\vspace{5mm}
\subsubsection{Another example of a structured dynamic diagram on a grid}

  The preceding technique is in fact relevant for a lot of problems. Here we
give another example about the drawing of linked lists (but do not fail to
note that these ones have here no internal existence).

\ifpstricks                     % If PSTricks is available
\begin{CenterExample}
  \makeatletter

  \newpsstyle{LinkedListsArrowStyle}{linecolor=red,arrowscale=2} % /HLComment?Default arrow style;

  /HLMacro?\def\LinkedListsDraw;{\@ifnextchar[\LinkedListsDraw@i{\LinkedListsDraw@i[]}}

  /HLMacro?\def\LinkedListsDraw@i;[#1]#2#3{{%
  \setkeys{psset}{#1}
  \dataheight=#3
  %
  \pst@cnta=#3
  \multiply\pst@cnta\tw@
  \advance\pst@cnta\tw@
  \pspicture(0,-#2)(\pst@cnta,0)
    \multido{\iRow=1+1}{#2}{%
      \rput(0,-\iRow){%
        \psframe(1,1)
        \psline[dimen=middle,style=LinkedListsArrowStyle]{->}(0.5,0.5)(2,0.5)}
      \multido{\iColumn=1+1}{#3}{%
        \checkLinkedListsTable(\iRow,\iColumn)%
        \ifemptydata
        \else
          \pst@cnta=\iColumn
          \advance\pst@cnta\@ne
          \pst@cntb=\@ne
          \checkLinkedListsTable(\iRow,\pst@cnta)%
          \ifemptydata                      % /HLComment?We test if it is empty;
          \else
            \ifnum\multidocount=#3          % /HLComment?We test if it is the last one;
            \else
              \pst@cntb=\z@
            \fi
          \fi
          %
          \pst@cnta=\iColumn
          \multiply\pst@cnta\tw@
          \rput(\the\pst@cnta,-\iRow){%
            \LinkedListsDraw@ii{\LinkedListsTable(\iRow,\iColumn)}{\the\pst@cntb}}
      \fi}}
    \endpspicture}}%}

  /HLMacro?\def\LinkedListsDraw@ii;#1#2{{%
  \rput(0,0.1){%
    \psset{unit=0.8}
    \psgrid[subgriddiv=0,gridlabels=0](2,1) % /HLComment?Element;
    \rput(0.5,0.5){#1}                      % /HLComment?Label for this element;
    \ifnum#2=\@ne
      \psline(1,0)(2,1)                     % /HLComment?Mark of the end of the list;
    \else
      \psline[style=LinkedListsArrowStyle]{->}(1.5,0.5)(2.5,0.5) % /HLComment?Link to the next element;
    \fi}}}

  \makeatother

  \newarray\LinkedListsTable
  \readarray{/HLReverse?LinkedListsTable;}{%
  11&12&13&14&%
  21&&&&%
  31&32&33&&}

  \LinkedListsDraw{3}{4}

  \vspace{1cm}
  \newpsstyle{LinkedListsArrowStyle}{linecolor=green,doubleline=true}

  \readarray{/HLReverse?LinkedListsTable;}{%
  a&&&&&%
  A&B&C&D&E&%
  0&1&2&3&4&%
  +&$\times$&&&&}

  \LinkedListsDraw{4}{5}
\end{CenterExample}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

\subsubsection{Management of heaps and linked lists}

  Here we will demonstrate a really more complex usage, but very useful.
In fact, if the \ArrayJobPackage{} package primarily allow to manage only
arrays, it allow a lot more with some efforts. Above it, we can implement the
common internal data structures frequently used in programming, like heaps,
simple or double linked lists, trees, associative arrays, etc. Here we will
show how to define macros to build and manage heaps and simple linked lists.

\ifpstricks                     % If PSTricks is available
\vspace{1cm}                    % Poor hack to force a page break...
\begin{CenterExample}[baselinestretch=0.98]
  \makeatletter

  /HLMacro?\def\PstDebug;{\z@}              % /HLComment?For debugging, set \def\PstDebug{1};

  % /HLComment?Code for heaps management;
  % /HLComment?-------------------------;

  /HLMacro?\def\HeapMaxDepth;{100}          % /HLComment?No more than 100 elements in the heap;

  \newarray\Heap

  % /HLComment?Add an element at top of the heap;
  /HLMacro?\def\HeapPush;#1{%
  \multido{\iElem=1+1}{\HeapMaxDepth}{%
    \checkHeap(\iElem)%
    \ifemptydata
      \ifnum\PstDebug=\@ne\typeout{Push Heap(\iElem)=#1}\fi% /HLComment?Debug;
      \Heap(\iElem)={#1}%
      \multidostop
    \fi}}

  % /HLComment?Get (in the \cachedata macro) and delete the element at top of the heap;
  /HLMacro?\def\HeapPop;{%
  \Multido{\iElem=\HeapMaxDepth+-1}{\HeapMaxDepth}{%
    \checkHeap(\iElem)%
    \ifemptydata
    \else
      \ifnum\PstDebug=\@ne\typeout{Delete Heap(\iElem)=\cachedata}\fi% /HLComment?Debug;
      \Heap(\iElem)={}%
      \multidostop
    \fi}}

  % /HLComment?Print the current state of the heap;
  /HLMacro?\def\HeapPrint;{%
  \checkHeap(\@ne)%
  \ifemptydata
    \typeout{The heap is empty!}% /HLComment?Empty heap;
  \else
    \multido{\iElem=\HeapMaxDepth+-1}{\HeapMaxDepth}{%
      \checkHeap(\iElem)%
      \ifemptydata
      \else
        \typeout{Heap(\iElem)=\cachedata}%
      \fi}
  \fi
  \typeout{}}

  % /HLComment?Draw the current state of the heap;
  /HLMacro?\def\HeapDraw;{%
  % /HLComment?To compute the size of the picture;
  \Multido{\iSize=0+1}{\HeapMaxDepth}{%
    \checkHeap(\the\multidocount)%
    \ifemptydata
      \multidostop
    \fi}
  %
  \ifnum\iSize=\z@
    % /HLComment?Empty heap;
    \typeout{The heap is empty!^^J}%
  \else
    \pspicture(1,\iSize)
      \psgrid[subgriddiv=0,gridlabels=0](1,\iSize)
      \multido{\iPos=0+1}{\HeapMaxDepth}{%
        \checkHeap(\the\multidocount)%
        \ifemptydata
          \multidostop
        \else
          \rput(0.5,\iPos.5){\cachedata}
        \fi}
    \endpspicture%
  \fi}

  \makeatother

  \psset{unit=1.5}\footnotesize

  \HeapPush{Germany}\HeapPrint\HeapDraw
  \hfill
  \HeapPush{France}\HeapPrint\HeapDraw
  \hfill
  \HeapPush{Italy}\HeapPrint\HeapDraw
  \hfill
  \HeapPush{Spain}\HeapPrint\HeapDraw
  \hfill
  \HeapPop\typeout{Popped element: `\cachedata'}\HeapPrint\HeapDraw
  \hfill
  \HeapPop\typeout{Popped element: `\cachedata'}\HeapPrint\HeapDraw
  \hfill
  \HeapPop\typeout{Popped element: `\cachedata'}\HeapPrint\HeapDraw
  \hfill
  \HeapPop\typeout{Popped element: `\cachedata'}\HeapPrint\HeapDraw
\end{CenterExample}

\begin{Example}[baselinestretch=0.95]
  \makeatletter

  /HLMacro?\def\PstDebug;{\z@}%                   /HLComment?For debugging, set \def\PstDebug{1};

  % /HLComment?Code for linked lists management;
  % /HLComment?--------------------------------;

  /HLMacro?\def\LinkedListMaxDepth;{100}%         /HLComment?No more than 100 elements in the list;

  \newarray\LinkedList

  \dataheight=2%                        /HLComment?Two cells by element: the content and the pointer;

  % /HLComment?Add an element at the end of the list;
  % /HLComment?In fact, we define it here as a simple heap, but the difference is that;
  % /HLComment?we will be able to get and to delete any element in it;
  /HLMacro?\def\LinkedListAdd;#1{%
  \edef\@tempa{\@ne}% /HLComment?Pointer initialization;
  \multido{\iElem=2+1}{\LinkedListMaxDepth}{%
    \checkLinkedList(\@tempa,2)%        /HLComment?We got the content of this element;
    \ifemptydata
      % /HLComment?No pointed element, so we will insert the new one here;
      \LinkedList(\iElem,1)={#1}%
      % /HLComment?We update the pointer for the last preceding element;
      \expandarrayelementtrue%          /HLComment?We must evaluate the content of the counter;
      \LinkedList(\@tempa,2)={\iElem}%
      \expandarrayelementfalse
      \ifnum\PstDebug=\@ne
        \typeout{Add LinkedList(\@tempa)->\iElem}% /HLComment?Debug;
        \typeout{\space\space\space\space LinkedList(\iElem)=#1}% /HLComment?Debug;
      \fi
      \multidostop
    \else
      \edef\@tempa{\cachedata}%
    \fi}}

  % /HLComment?Get (in the \cachedata macro) the next element in the list;
  /HLMacro?\def\LinkedListGetNext;#1{%
  \checkLinkedList(1,2)%                /HLComment?We got the pointer for the first element;
  \edef\@tempa{\@ne}%
  \ifx\cachedata\empty
  \else
    \edef\@tempc{#1}%
    \Multido{}{\LinkedListMaxDepth}{%
      \edef\@tempb{\@tempa}%
      \edef\@tempa{\cachedata}%
      \checkLinkedList(\cachedata,1)%   /HLComment?We got the pointed element;
      \ifx\cachedata\@tempc
        % /HLComment?This is the element for which we want the next one: we got it pointer;
        % /HLComment?to the next element in the list, then the content of it;
        \checkLinkedList(\@tempa,2)%
        \ifemptydata
          \typeout{Element `#1' has no successor!^^J}%
        \else
          \checkLinkedList(\cachedata,1)%
        \fi
        \multidostop
      \else
        \checkLinkedList(\@tempa,2)%    /HLComment?We got the pointer to the next element;
        \ifemptydata
          % /HLComment?We have reach the end of the list without finding the element;
          \typeout{Element `#1' not found!^^J}%
          \multidostop%                 /HLComment?No pointed element: end of the list;
        \fi
      \fi}
  \fi}

  % /HLComment?Delete an element in the list (the code is very close to \LinkedListGetNext);
  /HLMacro?\def\LinkedListDelete;#1{%
  \checkLinkedList(1,2)%                /HLComment?We got the pointer for the first element;
  \edef\@tempa{\@ne}%
  \ifx\cachedata\empty
  \else
    \edef\@tempc{#1}%
    \multido{}{\LinkedListMaxDepth}{%
      \edef\@tempb{\@tempa}%
      \edef\@tempa{\cachedata}%
      \checkLinkedList(\cachedata,1)%   /HLComment?We got the pointed element;
      \ifx\cachedata\@tempc
        % /HLComment?This is the element to delete: we will update the pointer of;
        % /HLComment?the preceding element to the value of the pointer of the deleted one;
        \checkLinkedList(\@tempa,2)%
        \expandarrayelementtrue
        \LinkedList(\@tempb,2)={\cachedata}%
        \expandarrayelementfalse
        \ifnum\PstDebug=\@ne
          \typeout{Delete LinkedList(\@tempa)=#1}% /HLComment?Debug;
          \typeout{\space\space\space\space\space\space\space %
                          LinkedList(\@tempb)->\cachedata}% /HLComment?Debug;
        \fi
        \multidostop
      \else
        \checkLinkedList(\@tempa,2)%    /HLComment?We got the pointer to the next element;
        \ifemptydata
          % /HLComment?We have reach the end of the list without finding the element;
          \typeout{Element `#1' not found and so not deleted!^^J}%
          \multidostop%                 /HLComment?No pointed element: end of the list;
        \fi
      \fi}
  \fi}

  % /HLComment?Print the current state of the list;
  /HLMacro?\def\LinkedListPrint;{%
  \checkLinkedList(1,2)%                /HLComment?We got the pointer for the first element;
  \ifx\cachedata\empty
    % /HLComment?Empty list;
    \typeout{The list is empty!}%
  \else
    \multido{}{\LinkedListMaxDepth}{%
      \edef\@tempa{\cachedata}%
      \checkLinkedList(\cachedata,1)%   /HLComment?We got the pointed element;
      \typeout{LinkedList=\cachedata}%
      \checkLinkedList(\@tempa,2)%      /HLComment?We got the pointer to the next element;
      \ifemptydata
        \multidostop%                   /HLComment?No pointed element: end of the list;
      \fi}
  \fi
  \typeout{}}

  % /HLComment?Draw the current state of the list;
  /HLMacro?\def\LinkedListDraw;{{%
  \psset{subgriddiv=0,gridlabels=0}
  \checkLinkedList(1,2)%                /HLComment?We got the pointer for the first element;
  \ifx\cachedata\empty
    % /HLComment?Empty list;
    \typeout{The list is empty!^^J}%
  \else
    % /HLComment?To compute the size of the picture;
    \Multido{\iSize=3+3}{\LinkedListMaxDepth}{%
      \checkLinkedList(\cachedata,2)%   /HLComment?We got the pointer to the next element;
      \ifemptydata
        \multidostop
      \fi}
    %
    \checkLinkedList(1,2)%              /HLComment?We got the pointer for the first element;
    \pspicture(\iSize,1.5)
      \multido{\iPos=0+3}{\LinkedListMaxDepth}{%
        \edef\@tempa{\cachedata}%
        \checkLinkedList(\cachedata,1)% /HLComment?We got the pointed element;
        \rput(\iPos,0){%
          \psgrid(2,1)
          \rput(0.5,0.5){\cachedata}
          \ifnum\iPos=\z@
          \else
            \rput(-1.5,0.5){\psline[linecolor=red,arrowscale=2]{->}(1.5,0)}
          \fi}
        \checkLinkedList(\@tempa,2)%    /HLComment?We got the pointer to the next element;
        \ifemptydata
          \rput(\iPos,0){\psline[linecolor=red](1,0)(2,1)} % /HLComment?End of the list;
          \multidostop%                 /HLComment?No pointed element: end of the list;
        \fi}
    \endpspicture%
  \fi}}

  \makeatother

  \psset{unit=1.5}

  \LinkedListPrint\LinkedListDraw

  \LinkedListAdd{Germany}\LinkedListPrint\LinkedListDraw

  \LinkedListAdd{France}\LinkedListPrint\LinkedListDraw

  \LinkedListAdd{Italy}\LinkedListPrint\LinkedListDraw

  \LinkedListAdd{Spain}\LinkedListPrint\LinkedListDraw

  \LinkedListGetNext{France}\typeout{Next element after `France' is: `\cachedata'}%
  \LinkedListGetNext{Germany}\typeout{Next element after `Germany is: `\cachedata'}%
  \LinkedListGetNext{Spain}
  \LinkedListGetNext{Unknown}

  \LinkedListDelete{Unknown}

  \LinkedListDelete{France}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{Germany}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{Spain}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{Italy}\LinkedListPrint\LinkedListDraw
\end{Example}

\makeatletter

\def\PstDebug{\z@}%                 For debugging, set \def\PstDebug{1}

\def\LinkedListMaxDepth{100}%       No more than 100 elements in the heap

\newarray\LinkedList

\dataheight=2%                      Two cells by element: the content and the pointer

% Delete an element in the list
\def\LinkedListDelete#1{%
\checkLinkedList(1,2)%              We got the pointer for the first element
\edef\@tempa{\@ne}%
\ifx\cachedata\empty
\else
  \edef\@tempc{#1}%
  \multido{}{\LinkedListMaxDepth}{%
    \edef\@tempb{\@tempa}%
    \edef\@tempa{\cachedata}%
    \checkLinkedList(\cachedata,1)% We got the pointed element
    \ifx\cachedata\@tempc
      % This is the element to delete: we will update the pointer of
      % the preceding element to the value of the pointer of the deleted one
      \checkLinkedList(\@tempa,2)%
      \expandarrayelementtrue
      \LinkedList(\@tempb,2)={\cachedata}%
      \expandarrayelementfalse
      \ifnum\PstDebug=\@ne
        \typeout{Delete LinkedList(\@tempa)=#1}%Debug
        \typeout{\space\space\space\space\space\space\space %
                                   LinkedList(\@tempb)->\cachedata}%Debug
      \fi
      \multidostop
    \else
      \checkLinkedList(\@tempa,2)%  We got the pointer to the next element
      \ifemptydata
        % We have reach the end of the list without finding the element
        \typeout{Element `#1' not found and so not deleted!^^J}%
        \multidostop%               No pointed element: end of the list
      \fi
    \fi}
\fi}

% Print the current state of the list
\def\LinkedListPrint{%
\checkLinkedList(1,2)%              We got the pointer for the first element
\ifx\cachedata\empty
  % Empty list
  \typeout{The list is empty!}%
\else
  \multido{}{\LinkedListMaxDepth}{%
    \edef\@tempa{\cachedata}%
    \checkLinkedList(\cachedata,1)% We got the pointed element
    \typeout{LinkedList=\cachedata}%
    \checkLinkedList(\@tempa,2)%    We got the pointer to the next element
    \ifemptydata
      \multidostop%                 No pointed element: end of the list
    \fi}
\fi
\typeout{}}

% Draw the current state of the list
\def\LinkedListDraw{{%
\psset{subgriddiv=0,gridlabels=0}
\checkLinkedList(1,2)%                We got the pointer for the first element
\ifx\cachedata\empty
  % Empty list
  \typeout{The list is empty!^^J}%
\else
  % To compute the size of the picture
  \Multido{\iSize=3+3}{\LinkedListMaxDepth}{%
    \checkLinkedList(\cachedata,2)%   We got the pointer to the next element
    \ifemptydata
      \multidostop
    \fi}
  %
  \checkLinkedList(1,2)%              We got the pointer for the first element
  \pspicture(\iSize,1.5)
    \multido{\iPos=0+3}{\LinkedListMaxDepth}{%
      \edef\@tempa{\cachedata}%
      \checkLinkedList(\cachedata,1)% We got the pointed element
      \rput(\iPos,0){%
        \psgrid(2,1)
        \rput(0.5,0.5){\cachedata}
        \ifnum\iPos=\z@
        \else
          \rput(-1.5,0.5){\psline[linecolor=red,arrowscale=2]{->}(1.5,0)}
        \fi}
      \checkLinkedList(\@tempa,2)%    We got the pointer to the next element
      \ifemptydata
        \rput(\iPos,0){\psline[linecolor=red](1,0)(2,1)} % End of the list
        \multidostop%                 No pointed element: end of the list
      \fi}
  \endpspicture%
\fi}}

\makeatother

% We clear the linked list
\multido{\iElem=1+1}{\LinkedListMaxDepth}{%
  \checkLinkedList(\iElem,1)%
  \ifemptydata
  \else
    \LinkedList(\iElem,1)={}%
    \LinkedList(\iElem,2)={}%
  \fi}

\vspace{2mm}
  We can write an extended version of the inclusion of an element, where we do
not still store each element at the end of the list, but insert it at a
special position. For instance, we can decide to use the list to sort the
elements, inserting a new one at it sorted position. In the next example, we
will manage integer numbers in this way (of course, we can do the same thing
with arbitrary strings, but it would be more difficult to program in \TeX{},
mainly if we want to be able to use accentuated letters).

\vspace{2mm}
\begin{Example}
  \makeatletter

  % /HLComment?Add an element at the end of the list, linked in it ordered place;
  % /HLComment?(this version work only with contents as numbers);
  /HLMacro?\def\LinkedListSortedAdd;#1{%
  % /HLComment?Initializations;
  \edef\@tempa{\@ne}%
  \edef\@tempb{\@ne}%
  \edef\@tempc{\z@}%
  %
  \multido{\iElem=2+1}{\LinkedListMaxDepth}{%
    \checkLinkedList(\@tempa,2)% /HLComment?We got the pointer of this element;
    \ifemptydata
      % /HLComment?No pointed element, so we will insert the new one here;
      \LinkedList(\iElem,1)={#1}%
      % /HLComment?We update the pointer for the last element;
      \expandarrayelementtrue
      \LinkedList(\@tempb,2)={\iElem}%
      \ifnum\PstDebug=\@ne
        \typeout{Add LinkedList(\@tempb)->\iElem}% /HLComment?Debug;
        \typeout{\space\space\space\space LinkedList(\iElem)=#1}% /HLComment?Debug;
      \fi
      % /HLComment?We update the pointer of the new element to the position;
      % /HLComment?of the next greater one, if it exist;
      \ifnum\@tempc=\z@
      \else
        \LinkedList(\iElem,2)={\@tempc}%
        \ifnum\PstDebug=\@ne
          \typeout{Update LinkedList(\iElem)->\@tempc}% /HLComment?Debug;
        \fi
      \fi
      \expandarrayelementfalse
      \multidostop
    \else
      \edef\@tempa{\cachedata}%
      \checkLinkedList(\cachedata,1)%
      \ifnum#1<\cachedata
        \edef\@tempc{\@tempa}% /HLComment?New element less than this one;
      \else
        \edef\@tempb{\@tempa}% /HLComment?New element greater or equal than this one;
      \fi
    \fi}}

  \makeatother

  \LinkedListPrint

  \LinkedListSortedAdd{732}\LinkedListPrint\LinkedListDraw

  \LinkedListSortedAdd{487}\LinkedListPrint\LinkedListDraw

  \LinkedListSortedAdd{718}\LinkedListPrint\LinkedListDraw

  \LinkedListSortedAdd{962}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{487}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{732}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{500}

  \LinkedListDelete{962}\LinkedListPrint\LinkedListDraw

  \LinkedListDelete{718}\LinkedListPrint\LinkedListDraw
\end{Example}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

\subsubsection{Associative arrays}

  To finish, we will give a complete solution to a classical problem: to count
the number of occurrences of the various letters in a sentence. For this, we
will first build some macros to deal with \emph{associative} arrays, as they
have been popularized by scripting languages like \texttt{AWK} and
\texttt{Perl}.

\begin{Example}
  \makeatletter

  % /HLComment?Internally, we use two "standard" arrays to define one associative array;
  \newarray\AssociativeArray@Names
  \newarray\AssociativeArray@Values

  \newcount\AssociativeArrayNbValues
  \AssociativeArrayNbValues=\z@

  \newif\ifAssociativeArray@ElementFound

  % /HLComment?To store one element;
  /HLMacro?\def\AssociativeArray;(#1)=#2{%
  \expandarrayelementtrue
  \AssociativeArray@ElementFoundfalse
  \edef\@tempa{#1}%
  \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Names(\iValue)%
    \ifx\@tempa\cachedata
      % /HLComment?This element already exist: we replace it current value;
      % /HLComment?\checkAssociativeArray@Values(\iValue)% Debug;
      % /HLComment?\typeout{In #1, replace `\cachedata'\space by `#2'}% Debug;
      \AssociativeArray@Values(\iValue)={#2}%
      \AssociativeArray@ElementFoundtrue
      \multidostop
    \fi}
  \ifAssociativeArray@ElementFound
  \else
    % /HLComment?New element;
    \advance\AssociativeArrayNbValues\@ne
    \AssociativeArray@Names(\AssociativeArrayNbValues)={#1}%
    \AssociativeArray@Values(\AssociativeArrayNbValues)={#2}%
  \fi}

  % /HLComment?To get one element;
  /HLMacro?\def\checkAssociativeArray;(#1){%
  \edef\@tempa{#1}%
  \edef\@tempb{999999}%
  \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Names(\iValue)%
    \ifx\@tempa\cachedata
      % /HLComment?We have found it by name;
      \edef\@tempb{\iValue}%
      \multidostop
    \fi}
  % /HLComment?We have now to get it value;
  \checkAssociativeArray@Values(\@tempb)}

  % /HLComment?Simple macro to print all the associative array;
  /HLMacro?\def\printAssociativeArray;{%
  \multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Names(\iValue)%
    \iValue: \BS\texttt{FirstNames(\cachedata)}=`\AssociativeArray@Values(\iValue)'\space}}

  \makeatother

  \let\FirstNames\AssociativeArray
  \let\checkFirstNames\checkAssociativeArray
  \let\printFirstNames\printAssociativeArray

  \FirstNames(Crawford)={Joan}
  \FirstNames(Tierney)={Gene}
  \FirstNames(Lake)={Veronika}

  \printFirstNames

  \checkFirstNames(Lake)
  \verb+\FirstNames(Lake)+=`\cachedata'

  \checkFirstNames(Monroe)
  \ifemptydata
    \verb+\FirstNames(Monroe) undefined!+
  \else
    \verb+\FirstNames(Monroe)+=`\cachedata'
  \fi
\end{Example}

\makeatletter

% Internally, we use two "standard" arrays to define one associative array
\newarray\AssociativeArray@Names
\newarray\AssociativeArray@Values

\newcount\AssociativeArrayNbValues
\AssociativeArrayNbValues=\z@

\newif\ifAssociativeArray@ElementFound

% To store one element
\def\AssociativeArray(#1)=#2{%
\expandarrayelementtrue
\AssociativeArray@ElementFoundfalse
\edef\@tempa{#1}%
\Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
  \checkAssociativeArray@Names(\iValue)%
  \ifx\@tempa\cachedata
    % This element already exist: we replace it current value
    % \checkAssociativeArray@Values(\iValue)% debug
    % \typeout{In #1, replace `\cachedata'\space by `#2'}% Debug
    \AssociativeArray@Values(\iValue)={#2}%
    \AssociativeArray@ElementFoundtrue
    \multidostop
  \fi}
\ifAssociativeArray@ElementFound
\else
  % New element
  \advance\AssociativeArrayNbValues\@ne
  \AssociativeArray@Names(\AssociativeArrayNbValues)={#1}%
  \AssociativeArray@Values(\AssociativeArrayNbValues)={#2}%
\fi}

% To get one element
\def\checkAssociativeArray(#1){%
\edef\@tempa{#1}%
\edef\@tempb{999999}%
\Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
  \checkAssociativeArray@Names(\iValue)%
  \ifx\@tempa\cachedata
    % We have found it by name
    \edef\@tempb{\iValue}%
    \multidostop
  \fi}
% We have now to get it value
\checkAssociativeArray@Values(\@tempb)}

% Simple macro to print all the associative array
\def\printAssociativeArray{%
\multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
  \checkAssociativeArray@Names(\iValue)%
  \iValue: \BS\texttt{FirstNames(\cachedata)}=`\AssociativeArray@Values(\iValue)'}}

\makeatother

\vspace{2mm}
  Now, we can define the macros to read a sentence, to cut it letter by letter,
to count the occurrences of each of them, and finally to draw a summary plot of
the results.

\makeatletter                   % Problem with the \ifpstricks conditional if not set...

\ifpstricks                     % If PSTricks is available
\begin{CenterExample}
  \makeatletter

  % /HLComment?A \PerChar style macro adapted from Juergen Schlegelmilch;
  % /HLComment?(<schlegel@Informatik.Uni-Rostock.de> - posted on c.t.t. January 27, 1998);
  /HLMacro?\def\PerChar;#1#2{\DoPerChar#1#2\@nil}

  /HLMacro?\def\DoPerChar;#1#2#3\@nil{%
  #1#2%
  \edef\@tempa{#3}%
  \ifx\@tempa\empty
  \else
    \DoPerChar#1#3\@nil
  \fi}

  % /HLComment?The action to do for each character: we increase the counter;
  % /HLComment?for this character by one;
  /HLMacro?\def\ActionPerChar;#1{% /HLComment?#1=character;
  \checkAssociativeArray(#1)%
  \ifemptydata
    \@tempcnta=\@ne
  \else
    \@tempcnta=\cachedata
    \advance\@tempcnta\@ne
  \fi
  \AssociativeArray(#1)={\the\@tempcnta}}

  % /HLComment?To store in an associative array the number of occurrences by characters;
  % /HLComment?(spaces are not counted);
  /HLMacro?\def\StatSentence;#1{% /HLComment?#1=sentence;
  \AssociativeArrayNbValues=\z@
  \PerChar{\ActionPerChar}{#1}}

  % /HLComment?To draw a plot of the number of occurrences of the characters of a sentence;
  /HLMacro?\def\DrawOccurrences;#1{% /HLComment?#1=sentence;
  \StatSentence{#1}
  %
  \pst@cnta=\AssociativeArrayNbValues
  \advance\pst@cnta\@ne
  %
  % /HLComment?To know the maximum of the numbers;
  \pst@cntb=\z@
  \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Values(\iValue)%
    \ifnum\cachedata>\pst@cntb
      \pst@cntb=\cachedata
    \fi}
  \advance\pst@cntb\@ne
  %
  % /HLComment?The drawing itself;
  \pspicture(-0.5,-0.5)(\pst@cnta,\pst@cntb)
    \psaxes[axesstyle=frame,labels=y](\pst@cnta,\pst@cntb)
    \multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
      \Draw@OneOccurrence{\iValue}}
  \endpspicture}

  % /HLComment?To draw the value for one occurrence;
  /HLMacro?\def\Draw@OneOccurrence;#1{% /HLComment?#1=Letter;
  \checkAssociativeArray@Values(#1)%
  \psdot(#1,\cachedata)
  \rput[B](\iValue,-0.5){\AssociativeArray@Names(#1)}}

  \makeatother

  \let\Names\AssociativeArray
  \let\checkNames\checkAssociativeArray

  \psset{dotstyle=o,dotsize=0.4}

  \DrawOccurrences{We are Wednesday}
\end{CenterExample}

\makeatletter

%% A \PerChar style macro adapted from Juergen Schlegelmilch
%% (<schlegel@Informatik.Uni-Rostock.de> - posted on c.t.t. Jan. 27, 1998)
\def\PerChar#1#2{\DoPerChar#1#2\@nil}

\def\DoPerChar#1#2#3\@nil{%
#1#2%
\edef\@tempa{#3}%
\ifx\@tempa\empty
\else
  \DoPerChar#1#3\@nil
\fi}

% The action to do for each character: we increase the counter
% for this character by one
\def\ActionPerChar#1{% #1=character
\checkAssociativeArray(#1)%
\ifemptydata
  \@tempcnta=\@ne
\else
  \@tempcnta=\cachedata
  \advance\@tempcnta\@ne
\fi
\AssociativeArray(#1)={\the\@tempcnta}}

% To store in an associative array the number of occurrences by characters
% (spaces are not counted)
\def\StatSentence#1{% #1=sentence
\AssociativeArrayNbValues=\z@
\PerChar{\ActionPerChar}{#1}}

% To draw a plot of the number of occurrences of the characters of a sentence
\def\DrawOccurrences#1{%
\StatSentence{#1}
%
\pst@cnta=\AssociativeArrayNbValues
\advance\pst@cnta\@ne
%
% To know the maximum of the numbers
\pst@cntb=\z@
\Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
  \checkAssociativeArray@Values(\iValue)%
  \ifnum\cachedata>\pst@cntb
    \pst@cntb=\cachedata
  \fi}
\advance\pst@cntb\@ne
%
% The drawing itself
\pspicture(-0.5,-0.5)(\pst@cnta,\pst@cntb)
  \psaxes[axesstyle=frame,labels=y](\pst@cnta,\pst@cntb)
  \multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \Draw@OneOccurrence{\iValue}}
\endpspicture}

% To draw the value for one occurrence
\def\Draw@OneOccurrence#1{%
\checkAssociativeArray@Values(#1)%
\psdot(#1,\cachedata)
\rput[B](\iValue,-0.5){\AssociativeArray@Names(#1)}}

\let\Names\AssociativeArray
\let\checkNames\checkAssociativeArray

\psset{dotstyle=o,dotsize=0.4}

\makeatother

\vspace{8mm}                    % Poor hack to force a page break...
  We will now write another version, using another array to store indexes,
to allow us to sort the letters found in the sentence read.

\begin{CenterExample}
  \makeatletter

  % /HLComment?To get in #2 the ASCII code of the #1 character;
  /HLMacro?\def\Character@AsciiCode;#1#2{\chardef#2=`#1\relax}

  % /HLComment?A new "standard" array to store the sorted indexes;
  \newarray\AssociativeArray@Indexes

  % /HLComment?A simple macro to print the array of indexes (for debugging);
  /HLMacro?\def\PrintIndexes;{%
  \multido{\iIndexes=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Indexes(\iIndexes)%
    \BS\texttt{indexes(\iIndexes)}=`\cachedata'\space}}

  % /HLComment?We redefine the macro to store an element in the associative array,;
  % /HLComment?to allow to sort it elements, using an additional array of indexes;
  /HLMacro?\def\AssociativeArray;(#1)=#2{%
  \expandarrayelementtrue
  \AssociativeArray@ElementFoundfalse
  \edef\@tempa{#1}%
  \edef\@tempb{#2}%
  \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Names(\iValue)%
    \ifx\@tempa\cachedata
      % /HLComment?This element already exist: we replace it current value;
      % /HLComment?\checkAssociativeArray@Values(\iValue)% Debug;
      % /HLComment?\typeout{In #1, replace `\cachedata'\space by `#2'}% Debug;
      \AssociativeArray@Values(\iValue)={\@tempb}%
      \AssociativeArray@ElementFoundtrue
      \multidostop
    \fi}
  \ifAssociativeArray@ElementFound
  \else
    % /HLComment?New element: we must insert it at it sorted position;
    \@tempcnta=\@ne
    \expandafter\Character@AsciiCode\@tempa\@tempx
    \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
      \checkAssociativeArray@Names(\iValue)%
      \expandafter\Character@AsciiCode\cachedata\@tempy
      \ifnum\@tempx<\@tempy
        % /HLComment?The new element must be before this one: we will exchange their values;
        \checkAssociativeArray@Indexes(\iValue)%
        \@tempcntb=\cachedata
        \advance\@tempcntb\@ne
        \AssociativeArray@Indexes(\iValue)={\the\@tempcntb}%
      \else
        \advance\@tempcnta\@ne
      \fi}
    %
    \advance\AssociativeArrayNbValues\@ne
    \AssociativeArray@Names(\AssociativeArrayNbValues)={\@tempa}%
    \AssociativeArray@Values(\AssociativeArrayNbValues)={\@tempb}%
    \AssociativeArray@Indexes(\AssociativeArrayNbValues)={\the\@tempcnta}%
  \fi}

  % /HLComment?We change the way we draw each number of occurrences;
  /HLMacro?\def\Draw@OneOccurrence;#1{%
  \checkAssociativeArray@Indexes(#1)%
  \pst@cnta=\cachedata
  \checkAssociativeArray@Values(#1)%
  \psdot(\the\pst@cnta,\cachedata)
  \rput[B](\the\pst@cnta,-0.5){\AssociativeArray@Names(#1)}}

  \makeatother

  \DrawOccurrences{We are Wednesday}

  \PrintIndexes
\end{CenterExample}

\makeatletter

% To get in #2 the ASCII code of the #1 character
\def\Character@AsciiCode#1#2{\chardef#2=`#1\relax}%

% A new "standard" array to store the sorted indexes
\newarray\AssociativeArray@Indexes

% We redefine the macro to store an element in the associative array,
% to allow to sort it elements, using an additional array of indexes
\def\AssociativeArray(#1)=#2{%
\expandarrayelementtrue
\AssociativeArray@ElementFoundfalse
\edef\@tempa{#1}%
\edef\@tempb{#2}%
\Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
  \checkAssociativeArray@Names(\iValue)%
  \ifx\@tempa\cachedata
    % This element already exist: we replace it current value
    % \checkAssociativeArray@Values(\iValue)% Debug
    % \typeout{In #1, replace `\cachedata'\space by `#2'}% Debug
    \AssociativeArray@Values(\iValue)={\@tempb}%
    \AssociativeArray@ElementFoundtrue
    \multidostop
  \fi}
\ifAssociativeArray@ElementFound
\else
  % New element: we must insert it at it sorted position
  \@tempcnta=\@ne
  \expandafter\Character@AsciiCode\@tempa\@tempx
  \Multido{\iValue=\@ne+\@ne}{\AssociativeArrayNbValues}{%
    \checkAssociativeArray@Names(\iValue)%
    \expandafter\Character@AsciiCode\cachedata\@tempy
    \ifnum\@tempx<\@tempy
      % The new element must be before this one: we will exchange their values
      \checkAssociativeArray@Indexes(\iValue)%
      \@tempcntb=\cachedata
      \advance\@tempcntb\@ne
      \AssociativeArray@Indexes(\iValue)={\the\@tempcntb}%
    \else
      \advance\@tempcnta\@ne
    \fi}
  %
  \advance\AssociativeArrayNbValues\@ne
  \AssociativeArray@Names(\AssociativeArrayNbValues)={\@tempa}%
  \AssociativeArray@Values(\AssociativeArrayNbValues)={\@tempb}%
  \AssociativeArray@Indexes(\AssociativeArrayNbValues)={\the\@tempcnta}%
\fi}

% We change the way we draw each number of occurrences
\def\Draw@OneOccurrence#1{%
\checkAssociativeArray@Indexes(#1)%
\pst@cnta=\cachedata
\checkAssociativeArray@Values(#1)%
\psdot(\the\pst@cnta,\cachedata)
\rput[B](\the\pst@cnta,-0.5){\AssociativeArray@Names(#1)}}

\makeatother

\begin{CenterExample}
  \DrawOccurrences{Tuesday 8 February}
\end{CenterExample}

\noindent Now, we can easily redefine the internal macro which plot each
occurrence, to obtain various kinds of graphics:

\begin{CenterExample}
  \makeatletter

  /HLMacro?\def\Draw@OneOccurrence;#1{%
  \checkAssociativeArray@Indexes(#1)%
  \pst@cnta=\cachedata
  \checkAssociativeArray@Values(#1)
  \psline[linestyle=dotted](\the\pst@cnta,0)(\the\pst@cnta,\cachedata)
  \psdot(\the\pst@cnta,\cachedata)
  \rput[B](\the\pst@cnta,-0.5){\AssociativeArray@Names(#1)}}

  \makeatother

  \psset{xunit=0.5,dotstyle=*,dotsize=0.3}
  \DrawOccurrences{I do not believe that it can be correct}
\end{CenterExample}

\begin{CenterExample}
  \makeatletter

  \SpecialCoor

  /HLMacro?\def\Draw@OneOccurrence;#1{%
  \checkAssociativeArray@Indexes(#1)%
  \pst@cnta=\cachedata
  \checkAssociativeArray@Values(#1)%
  \pspolygon*[linecolor=red](! \the\pst@cnta\space 0.3 sub 0)
                            (! \the\pst@cnta\space 0.3 sub \cachedata)
                            (! \the\pst@cnta\space 0.3 add \cachedata)
                            (! \the\pst@cnta\space 0.3 add 0)
  \rput[B](\the\pst@cnta,-0.5){\AssociativeArray@Names(#1)}}

  \makeatother

  \psset{xunit=0.5,ticks=y}
  \DrawOccurrences{I don't know a better solution than this one}
\end{CenterExample}
\else
  \PSTricksExampleNotShown
\fi                             % End \pstrickstrue

\section{Thanks}

  I would like to thank Rolf Niepraschk \verb+<niepraschk@ptb.de>+ to have
carefully read a preliminary version of this document and to have sent me
several good advices to clarify and improve some points.

\begin{thebibliography}{9}
  \bibitem{SVB93} Stephan von  \textsc{Bechtolsheim}, \emph{\TeX{} in
  Practice}, four volumes, Springer-Verlag, New York, 1993 (see also
  \url{CTAN: macros/tip/arraymac.tip}).
  \bibitem{REPEAT} \RepeatPackage, by Victor \textsc{Eijkhout}, University of
  Illinois, Urbana-Champaign, USA, \url{CTAN: macros/generic/eijkhout/repeat}
  \bibitem{EG98} Philippe \textsc{Esperet} and Denis \textsc{Girou},
  \emph{Coloriage du pavage dit de Truchet}, Cahiers GUTenberg, Number~31,
  December 98, pages 5-18, in french (see
  \url{http://www.gutenberg.eu.org/pub/GUTenberg/publicationsPS/31-girou.ps.gz}).
  \bibitem{ALDRATEX} \AlDraTeXPackage, by Eitan M. \textsc{Gurari}, Ohio State
  University, Columbus, USA, \url{CTAN: graphics/dratex} (see also
  \url{http://www.cis.ohio-state.edu/~gurari/systems.html}).
  \bibitem{Gur94} Eitan M. \textsc{Gurari}, \emph{\TeX{} and \LaTeX: Drawing
  and Literate Programming}, McGraw-Hill, New-York, 1994.
  \bibitem{METAPOST} \MetaPostPackage, by John D. \textsc{Hobby}, AT\&T Bell
  Laboratories, USA, \url{CTAN: graphics/metapost} (see also
  \url{http://cm.bell-labs.com/who/hobby/MetaPost.html}).
  \bibitem{FORMLETT} \FormLettPackage, by Zhuhan \textsc{Jiang}, University of
  New England, Armidale, Australia, \url{CTAN: macros/generic/formlett.sty} (see
  also \url{http://maths.une.edu.au/~zhuhan/util.html#computer}).
  \bibitem{MULTIDO} \MultiDoPackage, by Timothy van \textsc{Zandt}, INSEAD,
  Fontainebleau, France, \url{CTAN: macros/generic/multido}
  \bibitem{PSTRICKS} \PSTricksPackage, by Timothy van \textsc{Zandt}, INSEAD,
  Fontainebleau, France, \url{CTAN: graphics/pstricks} (see also
  \url{http://www.tug.org/applications/PSTricks}).
\end{thebibliography}

\end{document}