summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ktv-texdata/doc/ktv-texdata.dtx
blob: f6173607a0b38e32320b714931b6abdd31f6ea70 (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
% \iffalse
% File: ktv-texdata.dtx
% Copyleft 2003 Ky Anh
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% See the GNU General Public License for more details.
%
% For error reports,
% or offers to help improve the `ktv-texdata' package,
% please mail to
%               Ky` Anh, kyanh@linuxmail.org
% \fi
%
% \iffalse
%<*dtx>
\ProvidesFile{ktv-texdata.dtx}
    [2003/11/20 v1468 KTV, Data Manager]
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{ktv-texdata}
%<package>[2003/10/06 v05.34 KTV, Data Manager]
%<*driver>
\documentclass[oneside]{ltxdoc}
\usepackage{ktv-buildnum}
\CodelineIndex
\RecordChanges
\DocInput{ktv-texdata.dtx}
\begin{thebibliography}{VE}
\addcontentsline{toc}{section}{References}
\bibitem[VE]{VE}
    Victor EIJKHOUT, {\it \TeX\ by Topic}, Addison-Wesley, 1992.
\end{thebibliography}
\end{document}
%</driver>
%
% \fi
%
% \GetFileInfo{ktv-texdata.dtx}
%
% \def\docversion{\the\buildnum}
% \def\docdate{\filedate}
%
% \makeatletter
% \let\@afterindentfalse\@afterindenttrue
% \@afterindenttrue
% \makeatother
%
% \def\pkg{{\bf ktv-texdata}}
% \def\back:{$\backslash$}
% \def\trick:{\DescribeMacro{Trick}{:: \bf TRICK}\hrulefill\par}
%
% \begin{document}
% \title{\pkg\ package}
% \author{K\`{y} Anh\\(\ttfamily{kyanh@inic.biz, kyanh@linuxmail.org})}
% \date{\begin{tabular}{rll}
%   \texttt{package:}
%       &version 05.34,         & last update 2003/10/06
% \\
%   \texttt{documentation:}
%       &version \docversion,   & last update \docdate
% \end{tabular}}
% \maketitle
%
% ^^M\CheckSum{656}
%
% \begin{abstract}
%
% This package provides a simple way to use
% the \TeX\ input files whose contents
% are in the numbered environments.
%
% This package is useful for
% \underline{\bf the teachers of mathematics},
% who often work with large libraries of mathematical exercises.
%
% \end{abstract}
%
% \tableofcontents
%
% \section{How will you do?}
% \label{sec:howwillyoudo}
%
% Assume that you have an input file (named `|foo.tex|')
% that specifies 16 exercies
% \begin{verbatim}
% % --- first line of `foo.tex'
% \begin{exercice}\label{ex:1}
%       This is the first exercice.
% \end{exercice}
%
% \begin{exercice}\label{ex:2}
%       This is the second exercice.
% \end{exercice}
%
% ...
% \begin{exercice}[*]\label{ex:16}
%       This is the 16th exercice
%       (with a star mark *).
% \end{exercice}
% % --- last line of `foo.tex'
% \end{verbatim}
% On Tuesday, for e.g., you want to create a student test
% that contains the first  8 exercises of the `|foo.tex|'.
% However, on Wednesday, you want to create another test
% that contains the last 8 exercises of the `|foo.tex|'.
%
% Of course, the simplest way to do that
% is \emph{copying} and \emph{pasting}.
% Of course, this way becomes too complex in case,
% for e.g., you need only the exercies that are numbered oddly
% (1, 3, 5, 7, 9, 11, 13, 15).
%
% You may think of a solution like this
% \begin{verbatim}
%   \getonly{1,2,3,4,5,6,7,8}        % on Tuesday
%   \getonly{9,10,11,12,13,14,15,16} % on Wednesday
%   \getonly{1,3,5,7,9,11,13,15}     % on Friday
% \end{verbatim}
%
% Yes, here we go....
%
% \section{Introduction}
%
% \subsection{Convention}
%
% Instead of using |#1|, |#2|, etc., to specify
% the first, the second,... parameter or argument of a macro,
% we will use |#foo|, |#xfoo|,... where |#foo| is
% a short description of |#1|,
% and |#xfoo| is a short description of |#2|, etc.
%
% \emph{Parameter} is something declared in the macro's definitons.
%
% \emph{Argument} is something you pass to a macro when you call it.
%
% The optional parameters are enclosed in the brackets (`|[|' and `|]|'). 
% 
% \subsection{Data item `bxx'}
%
% \subsubsection{Form}
% \label{ssec:bxx.form}
%
% Each `|bxx|', or a \emph{data item}, is of the form
% \begin{center}
% \begin{tabular}{l}
%  |\bxx(#env)[#thm]ID;|\\
%  \emph{something to typeset}\\
%  |\exx|
% \end{tabular}
% \end{center}
% Note that `|\exx|' must be located at
% \emph{the beginning of a new line}\\
% and the semicolon `|;|' is mandatory.
%
% \DescribeMacro{ID}
% |ID| is any non-empty string of
% characters, numbers or punctuations:
% \begin{center}
% \begin{tabular}{rl}
% |ID|      &$\longrightarrow$ |char-num| / |xpunct| / |ID|\,|ID|\\
% |char-num|&$\longrightarrow$ |a..z| / |A..Z| / |0..9|\\
% |xpunct|  &$\longrightarrow$ |:| / |.| / |,|
% \end{tabular}
% \end{center}
% For example, `|ex:1|', `|Ex:2003|' are the |ID|s, but `|ex;1|' isnot.
%
% \DescribeMacro{#env}
% |#env| is any predefined environment.
% Parameter |(#env)| is \emph{optional}.
% 
% \DescribeMacro{#thm}
% |#thm|\, is the \emph{optional argument} for the environment |#env|.
% It is also the \emph{optional parameter} for the macro |\bxx|,
% because it is enclosed in the brackets;
% so you can specify a `|bxx|' like this
% \begin{center}
% \begin{tabular}{l}
%  |\bxx(#env)ID;|\\
%  \emph{something to typeset}\\
%  |\exx|\\
% \end{tabular}
% \end{center}
% or more simply (because |(#env)| is optional)
% \begin{center}
% \begin{tabular}{l}
%  |\bxx ID;|\\
%  \emph{something to typeset}\\
%  |\exx|\\
% \end{tabular}
% \end{center}
%
% \subsubsection{Meaning}
%
% \DescribeMacro{\bxx}
% \DescribeMacro{\exx}
% What does `|bxx|' mean?
%
% Yes, it's very familar with |\begin{#env}| and |\end{#env}|.
% \begin{center}
% \begin{tabular}{r@{\hspace{5mm}\emph{means}\hspace{5mm}}l}
%   |\bxx(#env)[#thm]ID;| & |\begin{#env}[#thm]|\\
%   \emph{something to typeset} & \emph{itself}\\
%   |\exx|                & |\end{#env}|
% \end{tabular}
% \end{center}
%
% \subsubsection{Identifying the `bxx'}
% \label{ssec:bxx.identify}
%
% We use |ID| and |#env| to identify a `|bxx|'
% by associating that `|bxx|' with the string |#envID|.
% This string is named \emph{string-id} of the `|bxx|'.
% Then two `|bxx|'s are different
% if their \emph{string-id}s are different.
% For e.g., after the declaration
% \begin{center}
% \begin{verbatim}
% \bxx(exercise)100;
% ...
% \exx
% \end{verbatim} 
% \end{center}
% the \emph{string-id} of the `|bxx|' is `|exercise100|'.
%
% \subsection{Data file. Example}
%
% An input file containing one or more `|bxx|'
% is called a \emph{data fille}.
% Using the `|bxx|', we reedit the `foo.tex' in the first section.
% Then, `|foo.tex|' becomes a \emph{data file}.
% \begin{verbatim}
% % --- first line of the new `foo.tex'
% \bxx(exercice)ex:1;
% \label{ex:1}
%       This is the first exercice.
% \exx
% \bxx(exercice)ex:2; \label{ex:2}
%       This is the second exercice.
% \exx
% ...
% \bxx(exercice)ex:16;\label{ex:16}
%       This is the 16th exercice.
% \exx
% % --- last line of the new `foo.tex'
% \end{verbatim}
%
% \section{User's macros}
%
% \subsection{Turning on/off the detail(s)}
%
% \DescribeMacro{\xdetailon}
% \DescribeMacro{\xdetailoff}
% Syntax
% \begin{center}
% |\xdetailon| \\ |\xdetailoff|
% \end{center}
%
% By default, the package shows \emph{string-id} of the `|bxx|'
% you want to get on the margin. You can turn this feature
% on/off by these marcos. The macros can be put anywhere in your
% document. See the package's test for an illustration.
%
% You can also pass an option to the package, like this
% \begin{center}
% |\usepackage[detailon]{ktv-texdata}|, or\\
% |\usepackage[detailoff]{ktv-texdata}|\phantom{xx}
% \end{center}
%
% \subsection{Specifying the default environment} 
%
% \DescribeMacro{\xenv}
% Syntax
% \begin{center}
% |\xenv(#env)|
% \end{center}
% This macro specifies the default environment used for the macros
% `|bxx|', `|\xget|', `|\xgetall|', etc.
% Here |#env| is any predefined environment.
%
% This macro can be put anywhere.
% It keeps the effect until the next |\xenv|.
%
% \subsection{Getting/Ignoring the `bxx'}
% 
% There are 7 macros used to get/remove the `bxx' from the data file.
% \begin{center}
% \begin{tabular}{l@{ \ }l@{ \ }l}
% |\xget|   & |\xgetall|    & |\xgetallbut|\\
% |\xkill|  & |\xkillall|   & |\xkillallbut|\\
%           & |\xspec|      &
% \end{tabular}
% \end{center}
% The macro |\xspec| is described in subsection \ref{ssec:xspec}.
% 
% \DescribeMacro{\xgetall}
% \DescribeMacro{\xkillall}
% Syntax
% \begin{center}
% |\xgetall|\\ |\xkillall|
% \end{center}
% |\xgetall| means that
% you want to \emph{get all the data items from the data file},
% while |\xkillall| means that you want to \emph{ignore all...}.
% These macros remove the effects of any |\xget|, |\xkill|
% that is called before them.
%
% \DescribeMacro{\xget}
% Syntax
% \begin{center}
% |\xget(#env){#ID-list}|
% \end{center}
% where
% \begin{itemize}
% \item
%   |#env| is an environment name. The parameter |(#env)| is optional.
% \item
%   |#ID-list| is a list of |ID|s that're seperated by the comma (`|,|'),
%   each |ID| can be prefixed by a plus sign (`|+|')
%   or by a minus sign (`|-|').
% \end{itemize}
% For e.g., the specification
% \begin{center}
% |\xget(exercise){-12,-3,+5,6,-99,+100}|
% \end{center}
% means that you want to get from the data file all the `|bxx|'s
% whose \emph{string-id}s are
% \begin{center}
% |exercise5|, |exercise6|, |exercise100|
% \end{center}
% Because you specified |-12|, |-3|, |-99|,
% all the `|bxx|' whose \emph{string-id}s are
% |exercise12|, |exercise3|, |exercise99| are ignored.
% Of course, |exercise7| is ignored, too.
%
% \trick:
% The parameter |(#env)| is optional; so if you specified
% \begin{center}
% |\xenv(exercise)|
% \end{center}
% then you can write shortly
% \begin{center}
% |\xget{-12,-3,+5,6,-99,+100}|
% \end{center}
%
% \trick:
% A sequence of two |\xget|s can be replaced by one |\xget|, for e.g.,
% \begin{center}
% |\xget{1,6}| |\xget{3,-4}|
% $\longrightarrow$ |\xget{1,6,3,-4}|
% \end{center}
%
% \DescribeMacro{\xkill}
% The syntax and tricks are the same as |\xget|.
% Try to guess the usage of this macro.
%
% \DescribeMacro{\xgetallbut}
% \DescribeMacro{\xkillallbut}
% The syntax is the same as |\xget|.
%
% The macro |\xgetallbut| means that you want to
% \emph{get all the data items} \underline{but}
% \emph{the data items specified in the} |#ID-list|.
%
% Inversely, the macro |\xkillallbut| means that you want to
% \emph{ignore all the data items} \underline{but}
% \emph{the data items specified in the} |#ID-list|.
%
% \trick:
% These macros are affected by |\xget| and |\xkill|.
% For e.g., the sequence
% \begin{center}
% |\xget{1,2,3}| |\xgetallbut{3,4,7}|
% \end{center}
% will be understood as |\xgetallbut{1,2,3,4,7}|.
%
% Here're some other examples (may be useless for you)
% \begin{center}
% \begin{tabular}{r@{  }l@{ $\longrightarrow$ }l}
% |\xget{1,2}|  &|\xgetallbut{2,3,4}|  &|\xgetallbut{1,2,3,4}|\\
% |\xkill{1,2}| &|\xgetallbut{2,3,4}|  &|\xgetallbut{2,3,4}|\\
% |\xget{1,2}|  &|\xkillallbut{2,3,4}| &|\xkillallbut{1,2,3,4}|\\
% |\xkill{1,2}| &|\xkillallbut{2,3,4}| &|\xkillallbut{2,3,4}|\\[2mm]
% |\xgetallbut{2,3,4}| &|\xget{1,2}|   &|\xgetallbut{1,2,3,4}|\\
% |\xgetallbut{2,3,4}| &|\xkill{1,2}|  &|\xgetallbut{3,4}|\\
% |\xkillallbut{2,3,4}|&|\xget{1,2}|   &|\xkillallbut{1,2,3,4}|\\
% |\xkillallbut{2,3,4}|&|\xkill{1,2}|  &|\xkillallbut{3,4}|\\
% \end{tabular}
% \end{center}
%
% \subsection{Openning the data file}
%
% \DescribeMacro{\xopenlib}
% Syntax
% \begin{center}
% |\xopenlib foo;|
% \end{center}
% where |foo|\footnote{The extension
% `|.tex|' may be omitted, so \back:|xopenlib foo;|
% is the same as \back:|xopenlib foo.tex;|.}
% is a data file.
% The semicolon `|;|' is mandatory.
%
% The  commands |\xget|, |\xkill|, etc.,
% in the previous section play no rule with the data file.
% They just tell |\xopenlib| that the `|bxx|' should be got/ignored.
% It's |\xopenlib| that opens the data file, looks for the `|bxx|'
% and does many other things. So if you want to |\xget{1,3,2}|,
% the really code is
% \begin{center}
% |\xget{1,3,2}| |\xopenlib foo;|
% \end{center}
% See subsection \ref{ssec:xlib} for a trick.
% 
% \subsection{Specifying the default data file}
% \label{ssec:xlib}
%
% \DescribeMacro{\xlib}
% It's convenient to specify a default data file. Let's do it by
% \begin{center}
% |\xlib foo;|
% \end{center}
% The file extension `|.tex|' can be omitted.
%
% \trick:
% After specifying the default data file, you can open that file by
% \begin{center}
% |\xopenlib;|
% \end{center}
%
% \subsection{Getting orderly the data items}
% \label{ssec:xspec}
%
% Do you have any questions about the order of the `bxx's?
%
% Yes, if you had, the answer is:
% the calling of |\xget|, |\xgetall|, |\xkill|, etc.,
% will produce the output in which the order of the data items
% is same as the order of data items in the data file.
% More concretely, if in `|foo.tex|' you specify
% \begin{verbatim}
% \bxx 15;
%       ITEMA.
% \exx
% \bxx 14;
%       ITEMB.
% \exx
% \end{verbatim}
% then |\xget{14,15}| |\xopenlib foo;|\\
% or\phantom{en} |\xget{15,14}| |\xopenlib foo;|\\
% gives the same results:
% `|ITEMA|' is put before `|ITEMB|'.
%
% So we need the macro described below.
%
% \DescribeMacro{\xspec}
% Syntax (same as |\xget|)
% \begin{center}
% |\xspec(#env){#ID-list}|
% \end{center}
% |(#env)| is also an optional parameter.
%
% This macro opens the data file (so you needn't to
% specify a |\xopenlib...| after it), extract the data items
% from the data file within the order in the |#ID-list|.
%
% So if you want to put `|ITEMB|' before the `|ITEMA|'
% (see above example), you should call
% \begin{center}
% |\xspec{14,15}|
% \end{center}
%
% \section{Advanced features}
%
% \subsection{Enabling/Disabling section in data file}
%
% A data file may be divided into sections.
% But when looking for data file, this package
% will be typeset normally anything that isnot inside any a `|bxx|'
% (for e.g, a |\section| command),
% so you can see some strange outputs.
%
% \DescribeMacro{\xenablesection}
% \DescribeMacro{\xdisablesection}
% Syntax
% \begin{center}
% |\xdisablesection|\\|\xenablesection|
% \end{center}
% The first macro disables three commands
% \begin{center}
% |\section| |\subsection| |\subsubsection|
% \end{center}
% The second enables three above section commands
% by restoring them to the values that this package
% captured at the beginning of the document.
% (So if you redefine a section command inside
% |\begin{document}| and |\end{document}|,
% you may lost that new command after using the sequence
% |\xdisablesection| |\xenablesection|.
%
% {\bf NOTE:}
%
% |\xdisablesection| cannot disable the command
% \begin{center}
% |\section[optional]{...}|
% \end{center}
%
% \subsection{Data item followed by `hint' environment}
%
% \DescribeEnv{hint}
% If a data item, or a `|bxx|', in data file is an exercise,
% it is often followed by a hint (a solution).
% All the hints should be collected in a private place.
% The `|hint|' environment helps you in this behaviour.
% You put `|hint|' just after the declaration of a data item,
% like this
% \begin{verbatim}
% \bxx 100;
%       This is Exercise A
% \exx
% \begin{hint}
%       This is the hint of excercise A.
% \end{hint}
% \end{verbatim}
% When you get the above `|bxx|', for e.g., by |\xget{100}|,
% the content of the hint, here's \emph{\lq\lq This is the hint...\rq\rq}
% will be written automatically to a file called `|hintfile|'.
%
% \DescribeMacro{\xopenhint}
% If you want to open the hint file, just call
% \begin{center}
% |\xopenhint|
% \end{center}
%
% {\bf IF YOU WANT TO KNOW MORE...}
%
% The `|hintfile|' is really a data file, whose name is
% \begin{center}
% |\jobname.KTVhint|
% \end{center}
% |\jobname| is the name of current job,
% and `|.KTVhint|' is the extension\footnote{If your system
% doesnot support the long extension file name,
% please report to the author.} provided by the author.
%
% By default, all the contents
% of the `|hintfile|' will be loaded (|\xgetall|).
%
% It's too complex to explain the structure of the `|hintfile|'.
% Let's typset the test, look for the `|hintfile|'
% and the results for more details. Thank you!
%
% \section{Important notes (to the users)}
%
% \begin{itemize}
% \item[a)]
%   (bug)
%   You must put |\xenv(#env)| before any calling |\xget|, |\xkill|, etc.
%   Try this bug to know how the package works.
% \item[b)]
%   Donot put |\xdisablesection| just before |\tableofcontents|.
%   (Otherwise, an error will be reported.)
% \item[c)]
%   The environment(s) of the data items in the data file must be predefined.
% \item[d)]
%   |\xopenhint| should be called at the very end of the document,
%   and must be called after any |\xspec|, |\xopenlib| commands.
%   (|\xopenhint| will closed the `|hintfile|';
%   after that the writting operations have no effect on this file.)
% \item[e)]
%   (bug)
%   Labelling the `|bxx|' maynot work well.
%   If you try to load twice a `|bxx|',
%   then two loadings will have a same label.
%   In next version, we will redefine the |\label| and |\ref| to fix this bug.
% \end{itemize}  
%
%
% \section{Generating package and example}
%
% Excuting
% \begin{center}
% {{\bf latex} \ttfamily ktv-texdata.ins}
% \end{center}
% to generate the package ({\tt ktv-texdata.sty})
% and a test
% ({\it two files:} {\tt ktv-test.tex}; {\tt ktv-data.tex}).
% Then typeset file {\ttfamily ktv-test.tex}.
%
% \section{Implementation}
%
% \subsection{Notes}
%
% \emph{The implementation} is the document
% {\bf used only} by the package's hacker!!!
%
% This package is written by |top-down| technique:
% A macro |\fooA| sometimes calls the macro |\fooB|
% whose the definitions appears after the defintions of |\fooA|.
%
% This package uses some advanced and interesting macro techniques
% (\emph{unknown-number-of-parameters-macro},
% \emph{two-optional-parameters-macro}, and much more).
% If you're a newbie of \LaTeX\ programming,
% you will learn some new things by learning the code of package.
%
% \subsection{Requirements. Options}
%
%    \begin{macrocode}
%<*package>
\RequirePackage{verbatim}
%    \end{macrocode}
%
% \begin{macro}{\@@xdetail}
% This macro shows \emph{string-id} of the current `|bxx|'
% on the margin.
%    \begin{macrocode}
\def\@@xdetail{\marginpar{{\bf\@xenv}\@xlbl}}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{detailon}
% |detailon| is the default option.
% Anything else means |detailoff|.
%    \begin{macrocode}
\DeclareOption{detailon}{\let\@xdetail\@@xdetail}
\DeclareOption*{\let\@xdetail\relax}
\ExecuteOptions{detailon}
\ProcessOptions
%    \end{macrocode}
% \end{environment}
%
% \subsection{General purpose macros}
%
% \begin{macro}{\b@sy}
% |\b@sy| means `not |\relax|'.
%    \begin{macrocode}
\def\b@sy{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@xNIL}
% Check if string |#1| is empty.
%
%    \begin{macrocode}
\def\if@xNIL#1;{\ifx\relax#1\relax}
%    \end{macrocode}
% \end{macro} 
%
% \subsection{Scanning and setting flag for \emph{string-id}}
% \label{ssec:scanning}
%
% First, consider the example when the user calls
% \begin{center}
% |\xget(exercise){ex:1,-ex:3,ex:5,ex:7,ex:9,ex:11,ex:13,ex:15}|
% \end{center}
% Here he (the user) wants to get the `|bxx|'
% that is numbered oddly,
% and that uses the environment `|exercise|'
% from the data file
% (\underline{\bf but} he doesn't want to get |ex:3|).
%
% Because the number of exercises he wants to get is unknown
% (he just specifies a list of the items he needs),
% we must design a macro that scans for all the items in the list.
% Moreover, this macro will set the flag `|get|' or `|donotget|'
% for each item (in the above example, the flag for |ex:3|
% is `|donotget|', for the others is `|get|').
%
% \begin{macro}{\usr@xenv}
% \begin{macro}{\usr@xlbl}
% These macros are used to store the result of the scanning.
%    \begin{macrocode}
\def\usr@xenv{}
\def\usr@xlbl{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@multact}
% Scan and set the flag (|get|, |donotget|) for the items of a list.
% The syntax is
% \begin{center}
%       |\@multact(#usr-env){#ID-list}|
% \end{center}
% where |#ID-list| is a list of |ID|(s)\footnote{%
% see subsection \ref{ssec:bxx.form}.}
% that're seperated by the comma (`|,|').
% Moreover, each |ID| can be prefixed by a plus/minus sign (|+|, |-|).
% \begin{center}
% \begin{tabular}{rl}
%    |#ID-list| &$\longrightarrow$ |XID| / |#ID-list|, |XID| \\
%    |XID|      &$\longrightarrow$ |ID| / |+ID| / |-ID|
% \end{tabular}
% \end{center}
% If |ID| is prefixed by a |+| (resp., a |-|), it means
% that this |ID| has a `{\it positive}' (resp., `{\it negative}')
% meaning\footnote{%
% If the user wants to get something,
% the |+| means `{\it he wants}', but |-| means `{\it he doesn't want}'.
% If the user doesn't want to get someting,
% the |+| means `{\it no, he doesn't want}',
% while the |-| means `{\it yes, he wants}'.}
% in the current context.
% An |ID| without prefix is the same as |+ID|.
%
% The |#usr-env| is any environment (maynot be predefined).
% This |#usr-env| is concatenated with every |ID| in the |#ID-list|.
% The concatenation will create the \emph{string-id}(s)
% for which we will later set the flag.
%
% Here we use (|#usr-env|) instead of (|#env|)
% because the environment |#usr-env| is used at the time the user
% wants to \emph{get some thing} from the data file (for e.g.,
% by the command |\xget{ex:1,ex:2}|).
% This environment may be different from the environment we
% specify in the data file, it maynot even be predefined.
%
% Note that |(#usr-env)| is optional parameter of macro |\@multact|.
% In case that |(#usr-env)| is omitted,
% |#usr-env| will get the default value saved in |\@@xenv|.
%    \begin{macrocode}
\def\@multact{\futurelet\@tchar\chk@multact}
%    \end{macrocode}
% We first check if the next char is a `|(|'.
%    \begin{macrocode}
\def\chk@multact{%
    \ifx(\@tchar
        \let\@txen\opt@multact
    \else
        \let\@txen\nop@multact
    \fi
    \@txen}
%    \end{macrocode}
% If the next char is a `|(|'
%    \begin{macrocode}
\def\opt@multact(#1)#2{%
    \def\usr@xenv{#1}%
%    \end{macrocode}
% then read the |#ID-list| by calling |\@xmultarg|%
% (see subsection \ref{ssec:ID.extract} below)
%    \begin{macrocode}
    \@xmultarg{#2}}
%    \end{macrocode}
% If the next char is not a `|(|', |\usr@xenv| gets the default value
%    \begin{macrocode}
\def\nop@multact#1{%
    \def\usr@xenv{\@@xenv}
%    \end{macrocode}
% then read the |#ID-list|  by calling |\@xmultarg|
%    \begin{macrocode}
    \@xmultarg{#1}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Extracting ID from the \#ID-list}
% \label{ssec:ID.extract}
%
% \begin{macro}{\@action}
% |\@action| is \emph{something} we want to affect
% each \emph{string-id}\footnote{\emph{string-id}%
% is created by concatenation |\#usr-env| and |ID|.
% See subsection \ref{ssec:bxx.identify}.
% } found.
% We first let |\@action| to |\relax|,
% so we avoid seeing the error `|! Undefined control...|'.
% (This letting existed in some previous versions of package.
% Now the author doesnot know what's going on if this line is removed!)
%    \begin{macrocode}
\let\@action\relax
%    \end{macrocode} 
% \end{macro}
% \begin{macro}{\@@MINUS}
% \begin{macro}{\@@MINUS}
% \begin{macro}{\@@ZERO}
% There are three kinds of actions
% (|plus| action, |minus| action, and |nosign| action).
% We'll see in subsection \ref{ssec:action.collection} that
% every action is named `|MINUS|\emph{something}',
% or `|ZERO|\emph{something}', or `|PLUS|\emph{something}'.
%    \begin{macrocode}
\def\@@MINUS{MINUS}
\def\@@PLUS{PLUS}
\def\@@ZERO{ZERO}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@xmultarg}
% |\@xmultarg| is used to extract the |ID|(s) from the |#ID-list|.
% Here we use the macro technique specified in \cite{VE}.
% First, we add to the argument |#1| the terminator\footnote{Because
% that `|@|' is never used to create an |ID|,
% the terminator `|@@@|' works well.} |\@endlbl| (`|@@@|').
% Then we call |\@@xmultarg|.
%    \begin{macrocode}
\def\@xmultarg#1{\@@xmultarg#1,@@@,}
\def\@endlbl{@@@}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@xmultarg}
% Now is the extracting.
%    \begin{macrocode}
\def\@@xmultarg#1,{%
    \def\@xtempi{#1}
    \ifx\@endlbl\@xtempi
        % do nothing
    \else\@@@xmultarg#1,
        \expandafter\@@xmultarg
    \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@@xmultarg}
% Every |ID| extracted will be concatenated
% with the |#usr-env| to create the \emph{string-id}.
% The \emph{string-id} will be affected
% by one of three actions (|plus|, |minus| or |nosign|/|zero|).
% We first check the sign of the |ID| in the |#ID-list|.
%    \begin{macrocode}
\def\@@@xmultarg{\futurelet\@tchar\chk@@@xmultarg}
\def\chk@@@xmultarg{% 2003/05/14
    \ifx-\@tchar\relax
        \let\@txen\@@MINUS
    \else\ifx+\@tchar\relax
            \let\@txen\@@PLUS
        \else
            \let\@txen\@@ZERO
        \fi
    \fi
%    \end{macrocode}
% To affect |\@action| on the \emph{string-id},
% we must specify `|type|' of the action.
% The type is saved in |\@txen| (see previous codes).
%    \begin{macrocode}
\csname\@txen\@action\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Comment creator macro}
%
% \begin{macro}{\c@mm@nt}
% If we donot want to get a `|bxx|' from the data file,
% we just let temporarily macro `|\bxx|'  to `|\c@mm@nt|'.
% This macro scans and passes (or {\it ignore})
% the input \emph{line by line}, until it finds the fisrt `|\exx|'.
% That's why every `|bxx|' must be ended by a `|\exx|' in a single line!
% And that's why `|bxx|' cannot be nested!
%    \begin{macrocode}
\gdef\c@mm@nt{%
    \begingroup
    \catcode`\^^M=12 %
    \x@comment}
{\catcode`\^^M=12 \endlinechar=-1 %
\gdef\x@comment#1^^M{%
    \def\@xtest{#1}%
    \ifx\@xtest\exx
        \let\@txen=\endgroup
    \else
        \let\@txen\x@comment
    \fi
    \@txen}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Hint file. Hint creator environment}
%
% An exercise, for e.g., may be followed by a hint (or  a solution).
% In a test, a book of excercises,
% all hints should be collected in a single file
% (named `|hint file|') that is genererated automatically by the package.
% The |hint file| is also a data file; of course, it contains
% only the hint that follows the `|bxx|' we want to get from the data file
% (the \emph{active} `|bxx|'s).
%
% Because a hint sometimes will be disabled,
% we need a boolean test |\if@xhint|.
%    \begin{macrocode}
\newif\if@xhint
%    \end{macrocode}
% The name of hint file is `|\jobname.KTVhint|'.
%    \begin{macrocode}
\newwrite\@xfhint
\immediate\openout\@xfhint=\jobname.KTVhint
%    \end{macrocode}
% We put some information in the first two lines of hint file.
%    \begin{macrocode}
{\catcode`\%=12
\immediate\write\@xfhint{%% File created automatically by `ktv-texdata'.}
\immediate\write\@xfhint{%% DONOT EDIT THIS FILE MANUALLY.}}
%    \end{macrocode}
%
% \begin{environment}{hint}
% Here is a trick about `hint' environment.
% We collect hints in a same file.
% So we need something to know exactly what `|bxx|'
% a `hint' (in the hint file) associates with.
% \emph{So.... we assume} that `|#env|'
% specified in `|bxx|' (in the data file) is a numberable environment.
% Then when a `hint' follows a `|bxx|' (named |bxxA|) is written to hint file,
% its number is the same as the number of `|bxx|A' in the output.
% So we need a counter\footnote{Please try to figure out this counter.}
% to index the active `|bxx|'.
%    \begin{macrocode}
\newcount\c@bxx
%    \end{macrocode}
%    \begin{macrocode}
\newenvironment{hint}{% begin-part of `hint'
%    \end{macrocode}
% If the hint is enabled
%    \begin{macrocode}
\if@xhint
    \let\exx\relax
%    \end{macrocode}
% In the numbered environment `|#env|',
% \LaTeX\ automatically creates a counter\footnote{%
% We should not check for the existing of this counter:
% the checking may eat so much time!}%
% named `|c@#env|'.
% We let `|c@bxx|' to the current value of `|c@#env|',
% then subtract `|c@bxx|' by 1 (\LaTeX\ will increase `|c@bxx|' later).
% We create an data item in the hint file,
% whose \emph{string-id} is the same as the current `|bxx|'.
%    \begin{macrocode}
    \c@bxx=\csname c@\@xenv\endcsname%
    \advance\c@bxx by-1 %
    \immediate\write\@xfhint{\string\setcounter{\@xenv}{\the\c@bxx}}
    \immediate\write\@xfhint{\string\bxx(\@xenv)\@xlbl;}
%    \end{macrocode}
% The contents of the hint environment now will be written to the hint file.
%    \begin{macrocode}
    \let\do\@makeother\dospecials\catcode`\^^M\active%
    \def\verbatim@processline{%
        \immediate\write\@xfhint{\the\verbatim@line}}%
    \expandafter\verbatim@start
%    \end{macrocode}
% If the hint is disable, let it start a comment environment.
% Here we use `|\comment|' defined in |verbatim| package,
% not the `|\c@mm@nt|' defined in this package\protect\footnote{%
% \emph{A fun story:} in the first version of package, the author
% used `\back:|comment|' by a mistake, but package ran very well.
% He later found this error, and changed `\back:|comment|'
% to `\back:|c@mm@nt|', then the package dumped into the errors!}.
%    \begin{macrocode}
\else
    \def\exx{\exx}%
    \expandafter\comment
\fi}%
%    \end{macrocode}
% Now the end-part of hint environment. If the hint is enabled,
% we put an `|\exx|' to terminate `|\bxx|' in the hint file.
% The line |\noexpand\exx| was added here but the author forgot the reason.
% Please help him!
%    \begin{macrocode}
{%
\noexpand\exx
\if@xhint
    \immediate\write\@xfhint{\string\exx}
\fi}
%    \end{macrocode}
% \end{environment}
%
% \subsection{Replacements of macro \back:bxx}
%
% Macro |\bxx| will be replaced by one of these macros
% |\@bxx|, |\@bxy|, |\@ball|, |\@bnone|, |\@bnonebut|, |\@ballbut|.
% The replacement depends on what the macro |\xgetfoo|, |\xkillfoo|, ...
% are specified by the user.
%
% For e.g., if the user calls |\xgetall|,
% then |\bxx| is replaced by |\@ball|;
% if they call |\xkillall|, then |\@bnone| takes place.
%
% For more details about the replacement,
% see the definition of |\xget|, |\xgetall|, |\xkill|, |xkillall|, etc.
% in the subsection \ref{ssec:user.macros}.
%
% Here's the summary of the replacements.
% \begin{center}
% \begin{tabular}{rl}
% {Calling } & {The replacement of |\bxx|}
% \\[3mm]\hline\\
% |\xget|        & |\@bxx|\\
% |\xgetall|     & |\@ball|\\
% |\xgetallbut|  & |\@ballbut|\\[3mm]
% |\xkill|       & |\@bxx|\\
% |\xkillall|    & |\@bnone|\\
% |\xkillallbut| & |\@bnonebut|\\[3mm]
% |\xspec|       & |\@bxy| 
% \\\\\hline
% \end{tabular}
% \end{center}
%
% The common syntax for the macros |\@bfoo| is
% \begin{center}
%     |\@bfoo(#env)[#thm]{#ID}|;
% \end{center}
% Here |#thm| is the optional argument of the environment |#env|.
% Both `|[#thm]|' and `|(#env)|' are the optional parameters
% of the |\@bfoo| (this means you can omit `|[#thm]|' or `|(#env)|'
% or both of them while callling `|\@bfoo|').
% \begin{macro}{\@bxx, \@bxy}
% Each macro |\@bxx|, |\@bxy| does two things.
%
% \emph{Firstly,} it gets the information about the current `|bxx|'
% (information contains: |#env|, |#thm| and |#ID|).
% We use the |\@bxxarg| macro .
%
% \emph{Secondly,}
% it calls |\@bfoodone| to typeset the content of the `|bxx|'.
%    \begin{macrocode}
\def\@bxx#1;{%
    \@bxxarg#1;%
    \@bxxdone}
\def\@bxy#1;{%
    \@bxxarg#1;%
    \@bxydone}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@ball}
% Macro |\@ball| first gets the information about the `|bxx|'
% (like |\@bxx|), but then it calls `|\@bdone@kern|',
% the kernel of the |\@bdone|.
%    \begin{macrocode}
\def\@ball#1;{%
    \@bxxarg#1;%
    \@bdone@kern}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@bnone}
% Macro |\@bnone| starts the comment by calling |\c@mm@nt|.
% This macro also disable the hint environment that follows the `|bxx|'.
%    \begin{macrocode}
\def\@bnone#1;{%
  \@xhintfalse
  \def\exx{\exx}
  \expandafter\c@mm@nt}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@bnonebut}
% Macro |\@bnonebut| ignores the contents of the `|bxx|'
% if and only if the command `|\csname\@xenv\@xlbl\endcsname|'
% equals to `|\relax|'.
%
% First, the macro scans for information.
%    \begin{macrocode}
\def\@bnonebut#1;{%
    \@bxxarg#1;%
%    \end{macrocode}
% Then it checks the status of the command
% `|\csname\@xenv\@xlbl\endcsname|'.
% If this command is undefined, we turn off the next `hint'
% and start the comment command (to ignore the content of the `|bxx|').
%    \begin{macrocode}
    \expandafter\ifx\csname\@xenv\@xlbl\endcsname\relax
        \@xhintfalse
        \def\exx{\exx}
    \expandafter\c@mm@nt
%    \end{macrocode}
% If this command is defined, the contents of the
% `|bxx|' will be typeset. Before calling `|\@bdone@kern|',
% we let the status of the command `|...\@xenv\@xlbl...|'
% to `|\relax|'. By doing this, we ensure that two `|bxx|'s in the
% data file that have the same \emph{string-id} will be typeset only once.
%    \begin{macrocode}
    \else
        \expandafter\let\csname\@xenv\@xlbl\endcsname\relax
        \expandafter\@bdone@kern
    \fi}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@ballbut}
% Macro |\@ballbut| is inverse from the macro `|\@bnonebut|'.
%    \begin{macrocode}
\def\@ballbut#1;{%
    \@bxxarg#1;
    \expandafter\ifx\csname\@xenv\@xlbl\endcsname\relax
        \expandafter\@bdone@kern
    \else
        \expandafter\let\csname\@xenv\@xlbl\endcsname\relax
        \@xhintfalse
        \def\exx{\exx}
        \expandafter\c@mm@nt
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Getting information from `bxx'}
%
% \begin{macro}{\@bxxarg}
% This macro reads the information about the `|bxx|'.
% The information contains |#env| (saved in `|\@xenv|'),
% |#thm| (saved in `|\xhead|'), |#ID| (saved in `|\xlbl|').
%
% We first set the initial value for three macros:
%    \begin{macrocode}
\def\@xenv{}
\def\@xhed{}
\def\@xlbl{}
%    \end{macrocode}
% We define two macros that save the default values
% for the |#env| and |#thm|. The default value of |#thm|
% should be null (why?). Now the default |#thm|
% is aslo null, but in the subsection \ref{ssec:user.macros},
% we define macro |\xenv| to change this behaviour.
%    \begin{macrocode}
\def\@@xenv{}
\def\@@xhed{}
%    \end{macrocode}
% Now we define |\@bxxarg|.
%    \begin{macrocode}
\def\@bxxarg{\futurelet\@tchar\chk@bxxarg}
%    \end{macrocode}
% We check if the next char is a `|(|'.
%    \begin{macrocode}
\def\chk@bxxarg{%
    \ifx(\@tchar
        \let\@txen\env@bxxarg
    \else
        \let\@txen\nop@bxxarg
    \fi
    \@txen}
%    \end{macrocode}
% If the next char is a `|(|', we hope that
% the `|bxx|' specifies the `|(#env)|'.
% Here the author uses an `|\edef|', but he really
% doesnot know the reasons.
% The `|\def|' version sometimes causes a strange error.
%    \begin{macrocode}
\def\env@bxxarg(#1)#2;{%
    \edef\@xenv{#1}%
%    \end{macrocode}
% Now we look for the rest of the argument by calling |\@@bxxarg|.
%    \begin{macrocode}
  \@@bxxarg#2;}
%    \end{macrocode}
% If the next char isnot a `|(|',
% `|bxx|' uses the default environment.
%    \begin{macrocode}
\def\nop@bxxarg#1;{%
    \edef\@xenv{\@@xenv}%
%    \end{macrocode}
% Now we look for the rest of the argument (call |\@@bxxarg|).
%    \begin{macrocode}
  \@@bxxarg#1;}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@@bxxarg}
% The calling of |\@@bxxarg| will first check if
% the next char is a `|[|'.
%    \begin{macrocode}
\def\@@bxxarg{\futurelet\@tchar\chk@@bxxarg}
%    \end{macrocode}
%    \begin{macrocode}
\def\chk@@bxxarg{%
    \ifx[\@tchar
        \let\@txen\hed@@bxxarg
    \else
        \let\@txen\nop@@bxxarg
    \fi
    \@txen}
%    \end{macrocode}
% If the next char is a `|[|',
% we hope that `|bxx|' specifies the `|[#thm]|'
%    \begin{macrocode}
\def\hed@@bxxarg[#1]#2;{%
    \edef\@xhed{#1}%
    \edef\@xlbl{#2}}
%    \end{macrocode}
% If the next char isnot a `|[|', the `|#thm|' gets the default value.
%    \begin{macrocode}
\def\nop@@bxxarg#1;{%
    \edef\@xhed{\@@xhed}%
    \edef\@xlbl{#1}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Typesetting the content of `bxx'}
%
% \begin{macro}{\@bxxdone}
% This macro starts a |\c@mm@nt| (if the command
% `|...\@xenv\@xlbl...|' is `|\relax|'),
% or calls |\@bdone@kern| (the kernel of the |\@bxxdone|).
%    \begin{macrocode}
\def\@bxxdone{%
    \expandafter\ifx\csname\@xenv\@xlbl\endcsname\relax
        \@xhintfalse
        \def\exx{\exx}
        \expandafter\c@mm@nt
    \else
        \expandafter\let\csname\@xenv\@xlbl\endcsname\relax
        \expandafter\@bdone@kern
   \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@bdone@kern}
% This macro typesets the contents of the `|bxx|'
% by starting the environment `|#env|'. It also turns on the
% next hint environment.
%
% If the `|bxx|' specifies the `|#thm|',
% we should call `|\begin{#env}[#thm]|';
% otherwise, we just call `|\begin{#env}|'.
% (Then the `|\exx|' equals to `|\end{#env}|'.)
%
% \emph{Note that} `|\begin{#env}[]|' is different from `|\begin{#env}|.
% So we must check if the `|#thm|' is empty.
%    \begin{macrocode}
\def\@bdone@kern{%
    \@xhinttrue%
    \def\exx{\end{\@xenv}}
    \expandafter\if@xNIL\@xhed;
        \def\@txen{%
            \begin{\@xenv}\@xdetail}
    \else
        \def\@txen{%
            \begin{\@xenv}[\@xhed]\@xdetail}
    \fi
    \@txen}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@bxydone}
% This macro just passes the arguments to |\@bxy@kern|.
%    \begin{macrocode}
\def\@bxydone{\@bxy@kern(\@xenv){\@xlbl}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@bxy@kern}
% This macro is the kernel of |\@bxydone|.
% It opens the data file, searchs for the `|bxx|'
% whose \emph{string-id} is `|\@bxy@id|'.
% If such `|bxx|' is found, the macro stops the seaching\footnote{%
% We really donot stop the searching. We just ignore the other
% `|bxx|'(s) in the data file.
% \emph{Trick:} Each time this macro opens the data file,
% it gets at most one data item,
% while, for e.g., \back:|\@bdone@kern| may get more than one.}
% and calls `|\@bdone@kern|' to typeset the contents of that `|bxx|'.
% Any `|bxx|' in the data file whose \emph{string-id} doesnot match
% the string saved in |\@bxy@id| will be ignored.
%
% Because a \emph{string-id} never accepts the value `@',
% we just let |\@bxy@id| to `@' to stop the searching.
%    \begin{macrocode}
\def\@bxy@id{@}
\def\@bxy@kern(#1)#2{%
    \edef\@xtempi{#1#2}
    \ifx\@bxy@id\@xtempi
        \def\@bxy@id{@}
        \expandafter\@bdone@kern
    \else
        \@xhintfalse
        \def\exx{\exx}
        \expandafter\c@mm@nt
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xspec@i}
% If you read the above codes carefully,
% you donot see anything about the `\emph{openning the data file}'.
% Yes, the truth is that |\@bxy|, |\@bxydone| and aslo |\@bxy@kern|
% are always used within the |\@xspec@i|.
% This macro does the openning.
%    \begin{macrocode}
\def\@xspec@i(#1)#2{
    \let\bxx\@bxy
    \edef\@bxy@id{#1#2}
%    \end{macrocode}
% Now start the searching (openning)
%    \begin{macrocode}
    \input \@xlib}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Actions affect on the \emph{string-id}}
% \label{ssec:action.collection}
%
% Each action |foo| must be associated with 3 routines
% \begin{center}
%    |PLUSfoo+#1|,\,\, |MINUSfoo-#1|,\,\, |ZEROfoo#1|,
% \end{center}
%
% \begin{macro}{@@@setflag}
% The positive meanings of this action is to define the command
% \begin{center}
%    |\csname\usr@xenv#1\endcsname| 
% \end{center}
% by letting this command to `|\b@sy|'.
%    \begin{macrocode}
\def\PLUS@@@setflag+#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\b@sy}
\def\MINUS@@@setflag-#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\relax}
\def\ZERO@@@setflag#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\b@sy}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{@@@killflag}
% The positive meanings of this action is to undefine the command
% \begin{center}
%    |\csname\usr@xenv#1\endcsname| 
% \end{center}
% by letting this command to `|\relax|'.
%    \begin{macrocode}
\def\PLUS@@@killflag+#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\relax}
\def\MINUS@@@killflag-#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\b@sy}
\def\ZERO@@@killflag#1,{%
    \expandafter\let\csname\usr@xenv#1\endcsname\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{@@@xspec}
% This action associates with the |\xspec| (see subsection
% \ref{ssec:user.macros} for details).
% This action, unlike |@@@killflag| nor |@@@setflag|,
% doesnot define/undefine the command `|...\usr@xenv#1...|'.
% The positive meaning of this action is
% \emph{openning data file
% and getting the specified {\normalfont `|bxx|'}}.
%    \begin{macrocode}
\def\PLUS@@@xspec+#1,{%
    \@xspec@i(\usr@xenv){#1}}
\def\MINUS@@@xspec-#1,{}
\def\ZERO@@@xspec#1,{%
    \@xspec@i(\usr@xenv){#1}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Openning the data file}
% \label{ssec:data.file.open}
%
% \begin{macro}{\@xlib}
% \begin{macro}{\@@xlib}
% |\@xlib| stores the data file specified by users.\\
% |\@@xlib| stores the data file used by the |\@openlib|.\\
% Currently, two macros save the null values.
%    \begin{macrocode}
\def\@xlib{}
\def\@@xlib{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@openlib}
% Open the data file. The syntax of this macro is |\@openlib#1;|,
% where |#1| is the file name. If |#1| is omitted, the |\@openlib|
% uses the data file whose name is stored in |\@xlib|. Note that
% in this case, the calling of macro is |\@openlib;|.
%    \begin{macrocode}
\def\@openlib#1;{%
    \if@xNIL#1;
        \expandafter\if@xNIL\@xlib;
            % do nothing
        \else
            \def\@@xlib{\@xlib}
        \fi
    \else
        \def\@@xlib{#1}
    \fi
    \input \@@xlib}
%    \end{macrocode}
% \end{macro}
%
% \subsection{User's macros}
% \label{ssec:user.macros}
%
% \begin{macro}{\xspec}
% This macro provides a special ways to read the data file.
% After its scanning the data file, the order of the `|bxx|'s in the
% ouput is the same the order of the |ID|s specified in the |#ID-list|.
%    \begin{macrocode}
\def\xspec{%
    \def\@action{@@@xspec}%
    \@multact}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xlib}
% \begin{macro}{\xopenlib}
% |\xlib| specifies the data file.
% |\xopenlib| opens the data file.
%    \begin{macrocode}
\def\xlib#1;{%
    \edef\@xlib{#1}}
\let\xopenlib\@openlib
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\xkill}
% \begin{macro}{\xkillall}
% \begin{macro}{\xkillallbut}
% Macro's names speak that...
%    \begin{macrocode}
\def\xkill{%
    \let\bxx\@bxx
    \def\@action{@@@killflag}%
    \@multact}
\def\xkillall{%
    \let\bxx\@bnone}
\def\xkillallbut{%
    \let\bxx\@bnonebut
    \def\@action{@@@setflag}%
    \@multact}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xget}
% \begin{macro}{\xgetall}
% \begin{macro}{\xgetallbut}
% Macro's names speak that...
%    \begin{macrocode}
\def\xget{%
    \let\bxx\@bxx
    \def\@action{@@@setflag}%
    \@multact}
\def\xgetall{%
    \let\bxx\@ball}
\def\xgetallbut{%
    \let\bxx\@ballbut
    \def\@action{@@@setflag}%
    \@multact}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xhintready}
% The hint file must be closed (`ready') before being opened.
%    \begin{macrocode}
{\catcode`\%=12
\gdef\xhintready{
    \begingroup\catcode`\%=12
    \immediate\write\@xfhint{\string\endinput}
    \immediate\write\@xfhint{%% END OF FILE %%}
    \endgroup\immediate\closeout\@xfhint}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xopenhint}
% Open the hint file.
%    \begin{macrocode}
\def\xopenhint{%
    \xhintready
    \xgetall
    \xlib \jobname.KTVhint;
    \xopenlib;}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\xenv}
% Specify the default environment.
%    \begin{macrocode}
\def\xenv(#1){%
    \edef\@@xenv{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xdetailon}
% \begin{macro}{\xdetailoff}
% Turn the details on/off.
%    \begin{macrocode}
\def\xdetailon{%
    \let\@xdetail\@@xdetail}
\def\xdetailoff{%
    \let\@xdetail\relax}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xenablesection}
% \begin{macro}{\xdisablesection}
% If we put some `|\section|' commands in the data file,
% we may want to disable/enable them.
%
% First, we define a null section.
%    \begin{macrocode}
\def\nil@section#1{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% Then we save the old values of section-relatives
% just before |\begin{document}|.
% We mention only |\section|, |\subsection|, |\subsubsection|.
%    \begin{macrocode}
\AtBeginDocument{%
    \let\old@section\section
    \let\old@subsection\subsection
    \let\old@subsubsection\subsubsection}
%    \end{macrocode}
% Everytime you want to disable the section,
% we let |\section| to |\nil@section|.
%    \begin{macrocode}
\def\xdisablesection{%
    \let\section\nil@section%
    \let\subsection\nil@section%
    \let\subsubsection\nil@section}
%    \end{macrocode}
% To restore, let |\section| to his old value
% (that we captured at the beginning of document).
% If you redefine |\section|  inside |\begin{document}|
% and |\end{document}|, you cannot get that new |\section|
% after using any |\xdisablesection|.
%    \begin{macrocode}
\def\xenablesection{%
    \let\section\old@section%
    \let\subsection\old@subsection%
    \let\subsubsection\old@subsubsection}
%    \end{macrocode}
%
% \subsection{Initialization}
%
% See section \ref{sec:history} for a reason.
%    \begin{macrocode}
\let\bxx\@bxx
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \section{History}
% \label{sec:history}
%
% \begin{tabular}{ccl}
%   {\bf v01}.xx &2002/12/xx &the first design\\[2mm]
%   {\bf v02}.xx &2002/12/yy &\emph{changes forgotten}\\[2mm]
%   {\bf v03}.14 &2002/12/18 &the first good version\\
%   v03.15 &2003/03/26 &some litle changes\\
%   v03.17 &2003/04/19 &use two-step macro technique\\
%          &           &|\bxx|,|\xlib|,|\xopenlib|
%                      needn't any ended-char\\[2mm]
%   {\bf v04}.18 &2003/04/22 &modify: |\@bxy@kern|\\
%   v04.19 &2003/04/23 &change: use |\par| instead of
%                      |\enlinechar| in def. of |\bxx|\\
%   v04.19 &2003/05/06 &use `|;|'  as delimiter
%                      in definition of |\bxx|\\
%   v04.20 &2003/05/11 &optimize: |\@bnone|\\
%   v04.21 &2003/05/12 &\emph{changes forgotten}\\[2mm]
%   {\bf v05}.23 &2003/05/13 &add: |\xgetallbut|, |\xkillallbut|;
%                       optimize\\
%   v05.24 &2003/05/13 &remove: |\ifdetail|, |\if@xnil| (boolean var.)\\
%          &           &and optimize\\
%   v05.25 &2003/05/14 &fix: some litle bugs;
%                       remove: |\@act|\\
%   v05.26 &2003/05/14 &remove: bad options\\
%   v05.27 &2003/05/15 &bug: |\bxx(verbatim)...;| failed\\
%   v05.28 &2003/05/17 &bug: |\foo-section| cause error\\
%          &           &move: |\foo-section| to the very end of package\\
%   v05.29 &2003/05/18 &bug: |\bxx| canot be nested.\\
%          &           &(nesting: |deactive bxx| causes error)\\
%          &           &(nesting: |\xgetall| works well, but\\
%          &           &contents of |hint| is too bad.)\\
%   v05.30 &2003/08/xx &rewrite: document (vietnamese), optimize\\
%   v05.31 &2003/09/20 &rewrite: document (english), optimize\\
%   v05.32 &2003/09/20 &rewrite: document (english), optimize\\
%          &           &remove: token list |\everyactivebxx| \\
%          &           &bug: cannot use |\xgetallbut|, |\xkillallbut|,\\
%          &           &|\xget|, etc., before any |\xenv(#env)|\\
%   v05.33 &2003/09/21 &remove: initialization\\
%          &           &add: |\xopenhint|\\
%   v05.34 &2003/09/22 &bug: otions donot work.\\
%          &           &fix: put |\@@xdetail|
%                       before |\DeclareOption{detailon}|\\
%          &           &bug: if |\xopenlib;| before any |\xget...|\\
%          &           &then |\bxx| is |unknown control sequence|\\
%          &           &fix: |\let\bxx\@bxx| to initialize\\
%   v05.39 &2003/09/20 &(future) optimize: |\@xspec|
% \end{tabular}
%
% \section{Miscellanea}
%
% The author write this package because he
% has some big libraries of mathematical exercises,
% but he really doesn't like |copying| and |pasting|
% everytime he edits a new test for students.
%
% This package may contains some bugs.
% So the author hopes that you can help him, even a bit.
% 
% In section \ref{sec:howwillyoudo},
% the author mentioned the ability of getting the data items
% whose |ID|s are numbered oddly....
% Currently this feature is unsupported .
% Please wait for the next version,
% or you should do something by yourself!
%
% The author's English isnot quite well.
% He often mis-spells and dumps into error.
% He would like to be sorry!\\[1mm]
%
% If you find out that the package is useful for your private works,
% please send to the author a little notice. Thank you very much!
%
% The emails of the author is\\
% \centerline{\ttfamily kyanh@inic.biz, kyanh@linuxmail.org}
%
% \Finale
%
% \iffalse
%
%<*example>
\documentclass{article}
\usepackage{ktv-texdata}

\usepackage{amsthm}

\def\back:{$\backslash$}

\begin{document}

\begin{center}
\Large\bf TEST :: package == {\tt ktv-texdata.sty}
\end{center}

\section{Create a data file}
See file {\tt ktv-data.tex}.
There're three part in the data file.
In the first and the last part, all `\verb~bxx~'
specify their own environment. In the second part,
the data items omit the enrironment (use default).

There're some special data items:
the \verb~\bxx(yyy)2;..\exx~ is followed by a hint,
the \verb~\bxx(yyy)[TT]5;..\exx~ specifies
an optional argument for enrivonment \verb~yyy~.

\section{Define the envrinoment}
\begin{verbatim}
\theoremstyle{definition}
\newtheorem{xxx}{XX}
\newtheorem{zzz}{ZZ}
\newtheorem{yyy}{YY}
\end{verbatim}
\theoremstyle{definition}
\newtheorem{xxx}{XX}
\newtheorem{zzz}{ZZ}
\newtheorem{yyy}{YY}

\section{Specified default environment by \back:env(xxx)}

\xenv(xxx)

\begin{verbatim}
\xenv(xxx)
\end{verbatim}
You should specify the default enrironment
before any calling to \back:xget, \back:xkill, \back:xgetll,
\back:xkillall, etc.

Otherwise, if your data file contains some `\verb|bxx|'
that doesnot specify the environment, you will receive an error!
(In the source code of the test, remove the line \back:env(xxx)
to see what will be going.)

\section{Specified data file by \back:env(xxx)}
\xlib ktv-data;

\begin{verbatim}
\xlib ktv-data;
\end{verbatim}
You also specify the the library, or data file.
The above specification affects on any \back:xopenlib;
that's put after this line in the source code of the test.

\section{\back:xget\{2,4\}}
\begin{verbatim}
\xget{2,4}
\xopenlib;
\end{verbatim}
\xget{2,4}
\xopenlib;

\section{Uneffect \back:xenv(zzz) after \back:xget\{1,4\}}
\begin{verbatim}
\xget{1,4}
\xenv(zzz)
\xopenlib;
\end{verbatim}
This example illustrate that any \back:xenv(...)
that follows a \back:xget doesnot take any affect on that \back:xget.
Try to figure out this illustration.
\xget{1,4}
\xenv(zzz)
\xopenlib;

\section{Now use \back:xenv(yyy)}
...to change the default environment to zzz.
\begin{verbatim}
\xenv(yyy)
\end{verbatim}
\xenv(yyy)

\section{Use \back:xgetallbut(zzz)\{1,2\}}
\begin{verbatim}
\xgetallbut(zzz){1,2}
\xopenlib;
\end{verbatim}
\xgetallbut(zzz){1,2}
\xopenlib;

\section{Use \back:xkillallbut(zzz)\{1,2\}}
\begin{verbatim}
\xkillallbut(zzz){1,2}
\xopenlib;
\end{verbatim}
\xkillallbut(zzz){1,2}
\xopenlib;

\section{Use \back:xspec}
This macro reserves the order of the `bxx'
that you specify in the argument.

\subsection{This is \back:xspec\{1,5,2\}}
\begin{verbatim}
\xspec{1,5,2}
\end{verbatim}
This calling uses default environment  \verb~zzz~.
\xspec{1,5,2}

\subsection{This is \back:xspec(zzz)\{1,5,2\}}
\begin{verbatim}
\xspec(zzz){1,5,2}
\end{verbatim}
\xspec(zzz){1,5,2}

\section{Turn off the details by \back:xdetailoff}
\xdetailoff
\begin{verbatim}
\xdetailoff
\end{verbatim}
You now cannot see anything on the right margin.

\section{Hint}
\begin{verbatim}
\xopenhint
\end{verbatim}
Some exercise should have a hint.\\
Of course, only hints of the active `bxx' will be accepted.
\xopenhint

\section{Now the time you try the package yourself!}
Thank you for your enjoying.\\[3mm]
Please send any bug, report,... to the author at
\begin{verbatim}
                      kyanh@linuxmail.org
\end{verbatim}
\end{document}
%</example>
%
%<*datafile>
\bxx(yyy)1;
This is {\it yyyyy}.one.
\exx
\bxx(yyy)2;
This is {\it yyyyy}.two with hint.
\exx
\begin{hint}
This is HINT of {\it yyyyy}.2
\end{hint}
\bxx(yyy)3;
This is {\it yyyyy}.three.
\exx
\bxx(yyy)4;
This is {\it yyyyy}.four.
\exx
\bxx(yyy)[TT]5;
This is {\it yyyyy}.six with header TT
\exx

^^M % ------------------------------------------------------------------

\bxx1;
This is one.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\exx
\bxx2;
This is two with hint.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\exx
\begin{hint}
This is hint of two.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\end{hint}
\bxx3;
This is three.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\exx
\bxx4;
This is four.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\exx
\bxx5;
This is six.
\\In the data file, this `bxx' doesnot specify the enrvironment.
\\So this used default environment.
\exx

^^M % ------------------------------------------------------------------

\bxx(zzz)1;
This is ZZZZZZZ.one.
\exx
\bxx(zzz)2;
This is ZZZZZZZ.two.
\\Containning an equation:
\begin{equation}
\int_{0}^{\infty}f(x)\,dx = \pi
\end{equation}
\exx
\bxx(zzz)3;
This is ZZZZZZZ.three.
\exx
\bxx(zzz)4;
This is ZZZZZZZ.four.
\exx
\bxx(zzz)[TT]5;
This is ZZZZZZZ.six with header TT.
\exx
%</datafile>
% \fi