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
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
|
% \def\fileversion{ver.~1.0g}
% \def\filedate{1994/12/12}
% \def\docdate {1994/12/07}
% \CheckSum{92}
%
%\iffalse
%
% Copyright (C) 1992-1994 by Frank Bennett. All rights reserved.
%
% This file contains the entire LexiBib package. The complementary
% LaTeX2e style package LexiTeX is contained in the separate file
% lexitex.doc.
%
%
% To get started with unpacking, run this file through DOCSTRIP
% giving `driver' as the extraction option, with the extension
% `ins'. Then run the resulting lexibib.ins file through LaTeX,
% which will strip the files. Run lexibib.man through LaTeX
% to print the documented file. I have tried to make the commented
% code as informative as possible; comments are welcome on the
% commentary as well as the code itself.
%
% IMPORTANT NOTICE:
%
% You are not allowed to change this file. You may however copy
% this file to a file with a different name and then change the
% copy if (a) you do not charge for the modified code, (b) you
% acknowledge LexiBib and its author(s) in the new file, if it
% is distributed to others, and (c) you attach these same
% conditions to the new file.
%
% You are not allowed to distribute this file alone. You are not
% allowed to take money for the distribution or use of this file
% (or a changed version) except for a nominal charge for copying
% etc.
%
% You are allowed to distribute this file under the condition that
% it is distributed with all of its contents, intact.
%
% For error reports, or offers to help make LexiTeX a more powerful,
% friendlier, and better package, please contact me on
% fbennett@clus1.ulcc.ac.uk
%\fi
%
% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
% \DoNotIndex{\@flushglue,\@gobble,\@input}
% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
% \DoNotIndex{\|,\~,\,\active,\advance,\aftergroup,\begingroup,\bgroup}
% \DoNotIndex{\cal,\csname,\def,\documentstyle,\dospecials,\edef}
% \DoNotIndex{\egroup}
% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
% \DoNotIndex{\ifcase}
% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
% \DoNotIndex{\strutbox}
% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
% \DoNotIndex{\nopagebreak}
% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
% \DoNotIndex{\[,\{,\},\]}
% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
% \DoNotIndex{\baselineskip,\begin,\tw@}
% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
% \DoNotIndex{\bfdefault}
% \setcounter{StandardModuleDepth}{1}
% \MakeShortVerb{\"}
% \title{\LexiBib\\a style file to link\\\BibTeX\ databases with
% the \\\LexiTeX\ style engine.\thanks{%
% This file has version number \fileversion{} dated
% \filedate{}.
% The documentation was last revised on \docdate.
% The documentation and the code for \LexiBib{} and \LexiTeX{}
% are \copyright{} 1992--94 Frank Bennett, Jr. Distribution
% and use are freely welcomed, on the sole condition that
% acknowledgement of the \LexiTeX{} package and of its author
% be made in any published using these utilities.
% }}
% \author{Frank G. Bennett, Jr.}
% \maketitle
%
% \begin{abstract}
% \LexiBib\ is a style for use with \BibTeX\ which permits
% legal and other citations to be stored in \BibTeX\ databases,
% and incorporated in documents in a manner similar to
% the normal operation of
% \BibTeX. Citations exported using \LexiBib\ are written in
% the syntax required for digestion by \LexiTeX, a citation
% engine that produces in-footnote, cross-referenced citations
% from nickname references to a single citation source list.
% \LexiTeX\ is currently a \LaTeX\ 2.09 style, which will be
% upgraded to \LaTeX2e form in due course.
% \end{abstract}
%
% \tableofcontents
% \lexiforcefoots
% \section*{Preface to Version 1.0b}
%
% This {\tt doc} package contains a \BibTeX\ style named
% {\tt lexibib.bst}. This style file can be used to
% export citations from a \BibTeX{} database in a form
% that can be used by the \LexiTeX\ citation engine.
% This permits a user to store citation details and
% annotations in a separate database, and incorporate
% those citations into a document using simple nickname
% tags. When the document is printed, the nickname tags
% will automagically be converted into properly formatted,
% Blue Book-conformant citations.\\
% The {\tt lexibib.bst} style file contains only a modest
% amount of code from the original 1988 release of {\tt
% btxbst.doc}
% by Oren Patashnik. While the original style is very
% efficient in its operation, its output, formatting and
% logical function are intertwined in a way that makes
% modification of the style rather difficult. At some cost
% in speed, in {\tt lexibib.bst} I have tried to provide
% a set of modular functions that can be more easily modified
% to suit specialized formatting requirements.\\
% Please note that this is a {\sf beta} release. Full support
% for databases prepared according the general conventions laid
% down by Oren Patashnik is not yet provided,
% so please don't rely on this style in the way you would rely
% on the standard styles (yet). Your comments will help to
% speed the development of \LexiBib\ into a reliable clone
% of the standard styles.
%
% \newpage
% \pagenumbering{arabic}
% \section{User Guide}
% \subsection{Introduction}
%
% An adage in office management is that you should
% only touch incoming paper once; to respond to it, to file
% it, to forward it, or to destroy it. A number of
% commercial citation
% database managers provide a facility for ``filing'' citations
% in a flexible form, the idea being to extend this principle
% to citations as well as paper. A hanging point for this
% strategy as been in-text context-sensitive citation styles.
% Database managers are at their best in exporting
% entire bibliographies
% and lists of authorities. Some packages are
% capable of scanning a document for citation ``tags'',
% which eliminates the need to separately select bibliography
% items in the database. Some, too, can replace ``tags''
% in the document with the formatted text of a citation.
% But once the text is replaced, the format of citations
% added in this way is fixed; conversion is a one-way process.
%
% A more serious problem is that, while the database manager
% can easily identify the {\em tag}, it cannot identify its
% {\em context\/}---whether it occurs in a footnote, how many
% items were in the preceding footnote, how many articles
% by the same author are cited in the document, and so forth.
% As a result, citation formatting of cross-referenced styles
% is still done by hand.
%
% One of the most demanding cross-referenced styles is that
% laid down in {\sl A Uniform System of Citation}, or ``the Blue
% Book'', for the citation of legal materials. This style
% has survived the era of computerization largely because
% most U.S. law journals using the style are edited by highly
% competitive law students. Staff members contribute their
% editorial time to their journal free of charge, because of
% the value of listing law journal membership on their resume.
% The Blue Book style minimizes the bulk of citation
% text, while conveying sufficient information to the reader
% for the location of cited material. It is also designed
% to provide all information required for the location of
% {\em primary\/} legal authority from the face of any citation
% to it, without tracing down cross-references.
%
% \LexiTeX{} and \LexiBib{} constitute the first attempt
% to allow documents requiring {\em cross-referenced},
% {\em in-text\/} citations in the demanding Blue Book style
% to draw all citation details
% from a separately maintained bibliography, with all
% citation formatting taking place automatically at print time.
% \LexiTeX{} is a style for use with the \LaTeX{} typesetting
% system.
%
% The implications of such a system are particularly interesting
% if it comes to be widely used, say, in the publication of
% law journals. The efficiency with which
% citations can be reported to citation services would be
% increased, since \LexiBib{}-format database entries
% are in a standard format that can
% be processed electronically. These same lists could
% be made available as text-searchable databases of authority.
% Network discussions of legal issues could be accompanied by
% growing lists of annotated authority, available for all to
% use.
%
% Even for personal use, the combination of \LexiTeX{} and
% \LexiBib{}
% Details on the use of \LexiTeX\ are contained in a separate
% manual. The purpose of this guide is to explain the
% preparation
% and processing of \BibTeX\ databases for use with \LexiBib{}
% and
% \LexiTeX. If you have any queries, please feel free to contact
% me on {\tt fbennett@clus1.ulcc.ac.uk}.
%
% \subsection{Preparing bibliography files}
%
% \subsection{Processing files using \LexiBib}
% \subsection{\LexiBib\ entry types}
% \subsection{\LexiBib\ entry fields}
%\StopEventually{}
% \section{The style code}
% \subsection{To prospective style hackers}
% The \BibTeX\ style language differs from \TeX\ both in style
% and in syntax. Whereas \TeX\ tears through a document from
% start to finish, clearing memory as it feeds out pages and
% terminating at the end of the input file, \BibTeX\ reads its
% own {\tt *.bst} file in a linear fashion, but the
% commands used in that file to not treat treat the {\em
% database\/} input file as a linear input stream.\\
% At startup, \BibTeX\ latches onto the
% {\tt *.aux} file at which it has been pointed, and scans it for
% certain strings, which are hardwired into \BibTeX's own code.
% These strings tell the program (a) which citation databases it
% must open, and (b) what citation nicknames it must search those
% databases for. A series of initializing operations are then
% performed, which define variables and functions much as one
% defines \TeX\ macros in advance of their use. Finally,
% the matching items from the database can be read for use by
% \BibTeX, and the defined functions can be invoked on each item.
% The entire list may be read several times if necessary. In the
% end, special functions which write formatted entries on an
% output file are invoked after which, having reached the end of
% the {\tt *.bst} file, the program terminates.
%
% The {\tt *.bst} style code below has been divided into logical
% sections which, I hope, will illustrate the logical phases of
% \BibTeX's progress.
%
% \subsection{About cross-referencing}
% About cross-referencing, Oren Patashnik wrote:
% \begin{quote}
% Now come the cross-referencing functions (these are invoked
% because one entry in the database file(s) cross-references
% another, by giving the other entry's database key in a
% "crossref"
% field). This feature allows one or more titled things that are
% part of a larger titled thing to cross-reference the larger
% thing. These styles allow for five posibilities:
%
% \begin{enumerate}
% \item an {\bf article} may cross-reference an {\bf article};
%
% \item a cross-reference to a {\bf book} may be made in an
% entry for:
%
% \begin{enumerate}
% \item a {\bf book};
% \item an {\bf inbook}; or
% \item an {\bf incollection}; and
% \end{enumerate}
%
% \item
% an {\bf inproceedings} may cross-reference a {\bf proceedings}.
% \end{enumerate}
% Each of
% these is explained in more detail later.
%
% An {\bf article} entry type may cross reference another
% {\bf article}
% (this
% is intended for when an entire journal is devoted to a single
% topic--- but since there is no {\bf journal} entry type, the
% journal,
% too, should be classified as an {\bf article} but without the
% author
% and title fields). This will result in two warning messages for
% the journal's entry if it's included in the reference list, but
% such is life. The other cross-referencing functions are
% similar,
% so no "comment version" will be given for them. We use just the
% last names of editors for a cross reference: either "editor",
% or
% "editor1 and editor2", or "editor1 et~al." depending on whether
% there are one, or two, or more than two editors.
% \end{quote}
% \def\option#1{\item\def\lawtemp{#1}\def\lawtemptwo{none}
% \ifx\lawtemp\lawtemptwo
% {\em none}
% \else{\small`{\bf#1}':}\fi}
% \newenvironment{Ventry}[1]%
% {\begin{list}{}{\renewcommand{\makelabel}[1]{\textsf{##1:}\hfil}%
% \settowidth{\labelwidth}{\textsf{#1:}}%
% \setlength{\leftmargin}{\labelwidth}
% \addtolength{\leftmargin}{1\labelsep}}}%
% {\end{list}}
% \changes{1.0f}{1994/12/08}{Rewrote the `spec' macro used in the
% documentation, which was not happy with either compatibility
% mode or 2e.}
% \changes{1.0f}{1994/12/08}{\LaTeX 2e version released!}
% \def\spec#1#2#3{\begin{Ventry}{Expected}
% \item[Expected] \begin{enumerate}
% #1
% \end{enumerate}
% \item[Left] \begin{enumerate}
% #2
% \end{enumerate}
% \item[Toggles] \begin{enumerate}
% #3
% \end{enumerate}
% \end{Ventry}}
% Each function defined using the {\tt FUNCTION} operator
% is accompanied by a brief description of what it is
% intended to do, followed by a box in the following form:
%
% \spec{\item What the function expects to find on the stack,
% numbered from the top (most recently pushed) to the bottom
% item.}
% {\item What the function will leave on the stack, numbered in
% the
% same fashion.}
% {\option{toggle name} What the effect of any toggles is on the
% behaviour of the function.}
%
% Happy reading.
% \subsection{Hello!}
% As ever, we start by telling the world who we are.
% \begin{macrocode}
%<*newbst>
FUNCTION { hello }
{ " ========================================="
" package, version 2.0g or later"
" Use with LateX2e and the LexiTeX style"
" -----------------------------------------"
" documentation last updated: 5 December 1994"
" code last updated: 12 December 1994"
" style version: 1.0g"
" This is the LexiBib style for BibTeX"
" ========================================="
stack$
}
% \end{macrocode}
% \subsection{Variable initializations}
% \DescribeEnv{ENTRY}
% This command takes three braced arguments, which in order are:
% \begin{enumerate}
% \item A list of field names;
% \item A list of integer variables; and
% \item A list of string variables.
% \end{enumerate}
% The field names created here include some not found in the
% standard \BibTeX\ styles. The use of both the standard and
% these new
% items is fully documented elsewhere, so no commentary is
% given here. Suffice to say that each item in the list creates
% a field that
% subsequent code can work on.
% \begin{macrocode}
ENTRY
% \end{macrocode}
%
% \DescribeEnv{field names}
% \mbox{}
% \begin{macrocode}
{ address
annote
author
booktitle
chapter
edition
editor
howpublished
institution
journal
key
month
note
number
organization
pages
publisher
school
series
title
type
volume
year
date
jurisdiction
court
division
divno
casedate
translator
booktranslator
}
% \end{macrocode}
%
% \DescribeEnv{entry integers}
% None are defined. Note that any integers or strings defined
% with the
% ENTRY command are created for {\em each\/} entry in the
% citation list.
% \begin{macrocode}
{}
% \end{macrocode}
%
% \DescribeEnv{entry strings}
% There are no general string variables, either. Such variables
% might be defined for use in building key labels for use in
% sorting, or in an end-of-document bibliography style.
% \begin{macrocode}
{}
% \end{macrocode}
%
% \DescribeEnv{STRINGS}
% A few string macros are needed to hold things
% temporarily removed from the stack.
% \BibTeX\ only allows ten such string variables; the named
% variables in this list will slowly be reduced in number
% through redesign of the functions that require them.
% Meanwhile, let's hope we don't find a sudden need for
% more \ldots
% \begin{macrocode}
STRINGS { s t u theyear themonth theday }
% \end{macrocode}
%
% \DescribeEnv{INTEGERS}
% The following list of integers is probably also larger than
% it needs to be. Again, optimization of stack usage will
% lead to the elimination of some of these variables.
% \begin{macrocode}
INTEGERS { itemcount date.specials charcount a b
nameptr namesleft numnames a.logical }
% \end{macrocode}
%
% \DescribeEnv{FUNCTIONS}
% These functions provide strings used in the parsing of
% Japanese legal citations. If the language of such citations
% is not English, these strings may need to be edited.
% \begin{macrocode}
FUNCTION {dc..} {"District Court"}
FUNCTION {sc..} {"Supreme Court"}
% \end{macrocode}
%
% \subsection{Function definitions}
% \subsubsection{Logic and measurement}
%
% \DescribeEnv{not}
% \DescribeEnv{and}
% \DescribeEnv{or}
% These have been copied verbatim from Oren Patashnik's 1988
% release.
% His commentary on these functions reads:
% {\em These three functions pop one or two (integer) arguments
% from the stack
% and push a single one, either "0" or "1".
% The {\tt 'skip\$} in the `"and"' and `"or"' functions are used
% because
% the corresponding {\tt if\$} would be idempotent.}
%
% \spec{\item The result of a logical test
% \item The result of a second logical test}
% {\item A single logical test result}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
FUNCTION {and}
{ 'skip$
{ pop$ #0 }
if$
}
FUNCTION {or}
{ { pop$ #1 }
'skip$
if$
}
% \end{macrocode}
%
% \DescribeEnv{times.ten}
% One of the date calculation routines requires
% string-to-integer conversion. \BibTeX\ primitives can only
% convert in this direction for single characters. Accordingly,
% we need to be able to raise by a power of ten.
%
% \spec{\item A single integer.}
% {\item A single integer.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {times.ten}
{ duplicate$ duplicate$ duplicate$ duplicate$ duplicate$
duplicate$ duplicate$ duplicate$ duplicate$
+ + + + + + + + +
}
% \end{macrocode}
%
% \DescribeEnv{character.length}
% \BibTeX\ provides a built-in command for measuring the length
% of a string in ``text units''. Sometimes it's nice to know
% the length of a string in {\em characters\/};
% this function provides
% that facility.
%
% \spec{\item A string.}
% {\item An integer giving the number of characters in the
% string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {character.length}
{ 'u :=
#0 'charcount :=
{ u empty$ not }
{ u #2 global.max$ substring$ 'u :=
charcount #1 + 'charcount :=
}while$
charcount
}
% \end{macrocode}
%
% \DescribeEnv{first.in.second}
% This function checks for a substring at the beginning or at the
% end of a given string. This facility is needed, for example,
% to provide an automated means of toggling the formatting of
% the court division string for Japanese cases.
% In the defintion below, {\tt t} is the substring length, and
% {\tt u} is the string length.
%
% \spec{\item A string toggle.
% \item A string (the string in which to look).
% \item A string (the substring to look for).}
% {\item A single integer ({\tt 0} or {\tt 1}), indicating
% whether
% the substring was found at the specified location in the
% string for search.}
% {\option{end} The function looks at the end of the
% given string.
% \option{start} The function looks at the start of the
% given string.}
%
% \begin{macrocode}
FUNCTION {first.in.second}
{ 's :=
duplicate$ empty$
{ pop$ pop$ #0 }
{ swap$ duplicate$ character.length 'a :=
swap$ duplicate$ character.length 'b :=
b a <
{ pop$ pop$ #0 }
{ s "end" =
{ b a - #1 + global.max$ substring$ =
{ #1 }
{ #0
}if$
}
{ #1 a substring$ =
{ #1 }
{ #0
}if$
}if$
}if$
}if$
}
% \end{macrocode}
%
% \DescribeEnv{get.character.type}
% This function returns one of three strings, `"letter"',
% `"numeral"' or `"other"` to indicate the type of the
% character it finds on the stack. This was written for
% use in the "gather.chars" function, but may find other
% uses as well.
% \begin{macrocode}
FUNCTION { get.character.type }
{ duplicate$ empty$
{ pop$ "other" }
{ duplicate$ chr.to.int$
duplicate$ #47 > swap$ #58 < and
{ pop$ "numeral" }
{ chr.to.int$
duplicate$ #64 > swap$ duplicate$ #91 < swap$
duplicate$ #96 > swap$ #123 < and 'a.logical :=
and a.logical or
{ "letter" }
{ "other"
}if$
}if$
}if$
}
% \end{macrocode}
%
% \subsubsection{Housekeeping}
% These functions are used to issue warning messages and avoid
% errors during processing.
%
% \DescribeEnv{empty.to.null}
% This is simply the "field.or.null" function from the standard
% styles, renamed so that I could more easily remember what it
% does. Invoked only by the output routines, it assures that
% empty field markers are replaced with the null string, to
% prevent smash-ups.
%
% \spec{\item The contents of a field, which may be an empty
% field marker.}
% {\item A string, possibly the null string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {empty.to.null}
{ duplicate$ empty$
{ pop$ "" }
'skip$
if$
}
% \end{macrocode}
%
% \DescribeEnv{check}
% This check function isolates the production of warning
% messages from the output routines, to enhance transparency.
% Note that this will not convert an empty field marker to
% the null string; that is left to the output routines.
%
% \spec{\item A string for
% use in an error message.
% \item The contents of a field.}
% {\item The field contents.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION { check }
{ 't :=
duplicate$ empty$
{ "empty " t * " in " * cite$ * warning$}
'skip$
if$
}
% \end{macrocode}
%
% \DescribeEnv{either.or}
% \changes{1.0c}{94/08/10}{Added the {\tt either.or}
% housekeeping function, for use in {\tt j.cases}.}
% This checks whether one of a two-item pair is empty.
% If at least one is empty, the other is returned to the
% stack. If both are non-empty, a warning is issued, and
% one item is arbitrarily selected.
%
% \spec{\item A string.
% \item A string.}
% {\item A single string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {either.or}
{ duplicate$ empty$
{ pop$ duplicate$ empty$
{ pop$ "" }
'skip$
if$
}
{ swap$ duplicate$ empty$
{ pop$ }
{ "both items in an either.or pair are non-empty in " cite$ *
warning$
" I'm using only ONE of these items (the second passed by the function)."
warning$
pop$
}if$
}if$
}
% \end{macrocode}
%
% \subsubsection{Output}
% In the interest of transparency, I have tried to make the
% output functions as simple to use and as flexible in their
% operation as possible. Every output routine expects to find
% three items on the stack, and the name of each routine
% describes how it will react to what it finds there.
% To keep things tidy, the empty field marker
% is replaced with the null string only by the output
% routines.\\
% The names
% are sometimes coincidentally comical, but I hope informative
% as well.
%
% \DescribeEnv{must.must.must}
% The simplest
% output routine is the "must.must.must" routine; it
% simply catenates the three strings, replacing any
% empty field markers it finds with the null string.
%
% \spec{\item A string.
% \item A string.
% \item A string.}
% {\item none}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {must.must.must}
{ empty.to.null 't :=
empty.to.null swap$ empty.to.null swap$ t
* *
write$
}
% \end{macrocode}
%
% \DescribeEnv{might.ifone.must}
% This output routine is heavily used for conditional
% output. If the deepmost of the three stack items is an empty
% field marker, the only the topmost item is written to the
% output file. If this is not the case, then the three items are
% written in order.
%
% \spec{\item A string.
% \item A string.
% \item A string.}
% {\item {\em none}}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {might.ifone.must}
{ empty.to.null 't :=
swap$ duplicate$ empty$
{ pop$ pop$ t }
{ swap$ empty.to.null t * * }
if$
write$
}
% \end{macrocode}
%
% \DescribeEnv{iftwo.might.iftwo}
% This function is typically used to output a formatted item
% in enclosing braces, where the entire item and its braces
% should be suppressed if the item is empty.
%
% \spec{\item A string.
% \item A string.
% \item A string.}
% {\item none}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {iftwo.might.iftwo}
{ 't :=
duplicate$ empty$
{ pop$ pop$ }
{ empty.to.null swap$ empty.to.null swap$
t empty.to.null
* * write$ }
if$
}
% \end{macrocode}
% \DescribeEnv{ifthree.ifthree.might}
% This outputs a pair of prefixes if the suffix to which they are
% to be attached exists. Otherwise it outputs a null string.
%
% \spec{\item A string.
% \item A string.
% \item A string.}
% {\item none}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {must.ifthree.might}
{ 't :=
duplicate$ empty$
{ pop$ write$ }
{ swap$ empty.to.null
swap$ empty.to.null
t * * write$ }
if$
}
% \end{macrocode}
%
% \subsubsection{Parsing and conversion}
%
% \DescribeEnv{field.tag.no.combine}
% The "no" here stands for ``number''.
% This function is typically used to simplify the task of
% building a numbered label for something (e.g.\ a technical
% report). It provides facilities for handling blank
% entries, so that these error-handling routines do not
% need to be drafted from scratch for every such
% situation.
%
% \spec{\item A string toggle.
% \item An identifier (i.e.\ a report number).
% \item A text prefix for the identifier.
% \item A string label (i.e.\ ``Technical Report'' or somesuch).}
% {\item A single string.}
% {\option{endlabel} Combines the text items in the same order
% in
% which they are found.
% \option{frontlabel} Places the label in front, followed by the
% identifier, followed by the first item pushed.}
%
% \begin{macrocode}
FUNCTION {field.tag.no.combine}
{ "endlabel" =
{ duplicate$ empty$
{ pop$ pop$ empty.to.null }
{ empty.to.null 's := empty.to.null
swap$ empty.to.null swap$ s * *
}if$
}
{ duplicate$ empty$
{ pop$ pop$ empty.to.null }
{ empty.to.null 's := empty.to.null
swap$ empty.to.null s swap$ * *
}if$
}if$
}
% \end{macrocode}
%
% \DescribeEnv{change.letter.case}
% This is a simple front-end to the {\tt change.case\$} built-in
% function, used to change characters in a string from upper to
% lower case. It slightly enhances the built-in function by
% providing an option that leaves the string alone.
%
% \spec{\item A single character---either
% an {\tt n}, a {\tt t}, an {\tt l}, or a {\tt u}.
% \item A string for conversion.}
% {\item One string, converted according to the option toggle
% pushed
% after the string.}
% {\option{n} yields the string unchanged.
% \option{t} yields
% all lower case letters except for the first.
% \option{l} yields all lower case letters.
% \option{u} yields all
% upper case letters.}
%
% \begin{macrocode}
FUNCTION {change.letter.case}
{ 't :=
duplicate$ empty$
'skip$
{ t chr.to.int$ "n" chr.to.int$ =
'skip$
{ t change.case$ }
if$
}
if$
}
% \end{macrocode}
%
% \DescribeEnv{n.dashify}
% The "n.dashify" function makes each single "-" in a string a
% double "--".
% if it's not already.\footnote{This comment by Oren Patashnik.}
%
% \spec{\item A single string for conversion.}
% {\item A single converted string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {n.dashify}
{ 't :=
""
{ t empty$ not }
{ t #1 #1 substring$ "-" =
{ t #1 #2 substring$ "--" = not
{ "--" *
t #2 global.max$ substring$ 't :=
}
{ { t #1 #1 substring$ "-" = }
{ "-" *
t #2 global.max$ substring$ 't :=
}
while$
}
if$
}
{ t #1 #1 substring$ *
t #2 global.max$ substring$ 't :=
}
if$
}
while$
}
% \end{macrocode}
%
% \DescribeEnv{gather.chars}
% The following function was designed for date parsing, but
% may find other uses as well. It finds the first letter or
% numeral in a given string, then proceeds to build a substring
% until it hits a different character type or the end of the
% string,
% at which point it
% stops parsing and terminates.
%
% \spec{\item A string for parsing.}
% {\item A string toggle showing the character type of the
% first homogenous substring in the string for parsing.
% \item A string of characters from the front of the given string
% which are letters or numbers only.
% \item The remainder of the string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION { gather.chars }
{ 't :=
{ t empty$ not
t #1 #1 substring$ get.character.type
"other" = and }
{ t #2 global.max$ substring$ 't :=
}while$
t #1 #1 substring$ duplicate$ get.character.type
"" swap$ duplicate$ 'u :=
t #2 global.max$ substring$ 't :=
{ u = }
{ * t #1 #1 substring$ duplicate$ get.character.type
duplicate$ u =
{ t #2 global.max$ substring$ 't := }
{ swap$ pop$
}if$
}while$
t swap$ u
}
% \end{macrocode}
%
% \DescribeEnv{tie.or.space.connect}
% We use this function from the standard styles. It
% adds a tie if the string it is applied to is three
% characters or less in length.
%
% \spec{\item A string
% \item A second string}
% {\item One string}
% {\item {none}}
%
% \begin{macrocode}
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
{ "~" }
{ " " }
if$
swap$ * *
}
% \end{macrocode}
%
% \DescribeEnv{format.pages}
% This function accepts one toggle option currently,
% but it is open to expansion. If the "short" toggle is
% fed to this function, it reads through the field until
% it hits a non-integer character. Otherwise, it "n.dashify"s
% the
% whole field. This needs robustification; the page number
% might be a roman numeral. Might it be simplest to just
% drop the scan when we hit a "-"? Deserves some thought.
%
% \spec{\item A toggle string.
% \item page number or possibly
% a range of pages.}
% {\item One string, constituting a finished page number, or {\tt
% empty\$}.}
% {\option{short} will return only the
% first number given in the string.
% \option{full}
% will return the page number, n-dashified.}
% \changes{1.0e}{94/12/05}{Altered {\tt format.pages} so
% that the {\tt short} scan stops at a {\tt-} character,
% rather than a non-integer. Simpler and more robust.}
% \begin{macrocode}
FUNCTION {format.pages}
{ swap$ duplicate$ empty$
{ pop$ pop$ "" }
{ swap$ duplicate$ "short" =
{ pop$
's :=
""
s #1 #1 substring$
{ "-" = not }
{ s #1 #1 substring$ *
s #2 global.max$ substring$ 's :=
s #1 #1 substring$
duplicate$ "" =
{ pop$ "-" }
'skip$
if$
}
while$
}
{ "full" =
{ pages n.dashify }
{ "invalid switch fed to the format.pages function"
warning$
}if$
}if$
}if$
}
% \end{macrocode}
%
% \paragraph{Names}
% The code for parsing and formatting names is extremely
% economical,
% thanks to the powerful built-in functions that \BibTeX\
% supplies
% for this purpose.
%
% \DescribeEnv{format.names}
% This is based on Oren Patashnik's original function of the same
% name. His comment was as follows:
% \begin{quote}
% The format.names function formats the argument (which should
% be in
% \BibTeX name format) into ``{\tt First Von Last, Junior}'',
% separated by commas
% and with an "and" before the last (but ending with "et~al." if
% the last
% of multiple authors is "others"). This function's argument
% should always
% contain at least one name.
% The format.authors function returns the result of
% format.names(author)
% if the author is present, or else it returns the null string.
% \end{quote}
%
% This function is used to format any name field that is
% thrown at it. It is based on the 1988 release, but with
% modifications
% to permit toggling, since the Blue Book requires different
% author
% formats for different types of material. The toggling strategy
% should also make modification of this style a pretty simple
% matter.
%
% \spec{\item The contents of one name field
% \item string toggle
% (either {\tt firstinitial}, {\tt lastonly} or {\tt full})}
% {\item A single string, containing a formatted name or names,
% or {\tt empty\$}}
% {\option{firstinitial} Yields the form ``F.~Bennett, Jr.''
% \option{lastonly}
% Yields the form ``Bennett''
% \option{full} yields ``Frank Bennett, Jr.''}
%
% \begin{macrocode}
FUNCTION {format.names}
{ 'u :=
duplicate$ empty$
'skip$
{ 's :=
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ u "lastonly" =
{ s nameptr "{vv~}{ll}" format.name$ 't := }
{ u "firstinitial" =
{ s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$
't := }
{ u "full" =
{ s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=}
{ "style error; invalid or non-existent toggle" warning$ }
if$
}
if$
}
if$
nameptr #1 >
{ namesleft #1 >
{ ", " * t * }
{ numnames #2 >
{ "," * }
'skip$
if$
t "others" =
{ " et~al." * }
{ " and " * t * }
if$
}
if$
}
't
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
if$
}
% \end{macrocode}
%
% \paragraph{Dates}
% The style code for parsing and formatting dates is much more
% complex than that for names. This is due to the need to
% build the necessary tools out of \BibTeX\ primitives, since
% no built-in tools for this task are supplied. There are
% two date formatting routines below. The simpler of the two
% is "format.month.year". This is basically just the function
% supplied with the standard \BibTeX\ styles, under a new name.
% The \LexiBib\ version of "format.date" is underpinned by
% a whole set of new
% functions, and allows great flexibility in the syntax
% for entering dates.
%
% \subparagraph{Old format routine}
%
% \DescribeEnv{format.month.year}
% The "format.date" function is for the month and year, but we
% give a warning if
% there's an empty year but the month is there, and we return the
% empty string
% if they're both empty.\footnote{This comment by Oren
% Patashnik.}
%
% This is not changed over the "format.date" function in the
% original standard \BibTeX{} styles. It is retained, although
% the distributed \LexiBib\ styles won't be making use of it.
%
% \spec{\item none}
% {\item A single string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {format.month.year}
{ year empty$
{ month empty$
{ "" }
{ "there's a month but no year in " cite$ * warning$
month
}
if$
}
{ month empty$
'year
{ month " " * year * }
if$
}
if$
}
% \end{macrocode}
%
% \subparagraph{New date parsing routines}
% The "format.date" function depends upon a number of
% supporting functions. Some of these are of general utility,
% and are presented above. Those presented here are specific
% to this particular function.
%
% \DescribeEnv{fillout.a.year}
% This adds a leading "19" to a year entered in two-digit
% form.
%
% \spec{\item A single string.}
% {\item A single string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {fillout.a.year}
{ duplicate$ character.length #2 =
{ pop$ "19" swap$ * }
'skip$
if$
}
% \end{macrocode}
%
% \DescribeEnv{parse.month}
% This function is a simple parser, used in converting
% database entries that have been identified as probable
% abbreviated month entries into numerical string form.
%
% \spec{\item A single string, which should consist of
% exactly three alphabetic characters.}
% {\item A single string of numbers.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {parse.month}
{ duplicate$ "jan" =
{ pop$ "1" }
{ duplicate$ "feb" =
{ pop$ "2" }
{ duplicate$ "mar" =
{ pop$ "3" }
{ duplicate$ "apr" =
{ pop$ "4" }
{ duplicate$ "may" =
{ pop$ "5" }
{ duplicate$ "jun" =
{ pop$ "6" }
{ duplicate$ "jul" =
{ pop$ "7" }
{ duplicate$ "aug" =
{ pop$ "8" }
{ duplicate$ "sep" =
{ pop$ "9" }
{ duplicate$ "oct" =
{ pop$ "10" }
{ duplicate$ "nov" =
{ pop$ "11" }
{ duplicate$ "dec" =
{ pop$ "12" }
{ "invalid month in " cite$ * warning$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}
% \end{macrocode}
%
%
% \DescribeEnv{extract.date}
% This function takes a labelled stack of numeric items,
% and places its contents into the appropriate variables
% representing elements of a date. It will probably
% tolerate further enhancement, and should probably
% deliver its result to the stack, rather than into
% variables.
%
% The behaviour of this function is a little too complex
% to describe its input and output behaviour using our
% usual description box, so we revert to prose here.
% The stack is always left empty, and there are no
% toggles that affect the overall behaviour of the
% function. The expectation of what will appear on the
% stack depends on the contents of the integer
% variable "itemcount". For each date item counted, the
% function expects to find two items on the stack: a
% string possibly flagging the variable into which the
% item should be placed; and a numerical string.
%
% If "itemcount" is "0", a warning of an empty date
% is issued.
%
% If "itemcount" is "1", the flag string is ignored,
% and the numerical item is assumed to be a year.
%
% If "itemcount" is "2", the flag strings are both
% ignored, and the numerical items are assumed to be
% a year and a month, in that order.
%
% If "itemcount" is "3", the first item is assumed to
% be a year. The assignment of the second two items
% depends first upon the contents of the integer
% variable "date.specials". If this is "0", then
% the flags are ignored, and the numerical items are
% assumed to be a day and a month, in that order.
% If "date.specials" is "1" (`true'), then the
% flag of the first item is checked to see whether it
% is ``"month"''. If so, the first item is assigned to
% the "themonth" variable, and the next to the "theday"
% variable. Otherwise the assignments are reversed.
%
% \begin{macrocode}
FUNCTION {extract.date}
{ "" 'theyear := "" 'themonth := "" 'theday :=
itemcount #0 =
{ "some date or other is COMPLETELY empty in " cite$ * warning$ }
{ itemcount #1 =
{ pop$ fillout.a.year 'theyear := "" 'theday := "" 'themonth := }
{ itemcount #2 =
{ pop$ fillout.a.year 'theyear :=
pop$ 'themonth :=
"" 'theday :=
}
{ itemcount #3 =
{ date.specials
{ pop$ fillout.a.year 'theyear :=
"month" =
{ 'themonth :=
pop$ 'theday := }
{ 'theday :=
pop$ 'themonth :=
}if$
}
{ pop$ fillout.a.year 'theyear :=
pop$ 'theday :=
pop$ 'themonth :=
}if$
}
{ "too many items for date in " cite$ * warning$
}if$
}if$
}if$
}if$
}
% \end{macrocode}
%
% \DescribeEnv{format.month.name}
% \changes{\LexiBib{} 1.0b}{94/08/09}{Added {\tt swap\$} as appropriate
% to expose string on stack for {\tt empty\$} check.}
% This takes a numerical string and converts it to either an
% abbrviated or a spelled-out month name.
%
% \spec{\item A toggle string.
% \item A numerical string.}
% {\item A string.}
% {\option{long} The month name placed on the stack will be
% spelled out.
% \option{short} The month name will be abbreviated.}
%
% \begin{macrocode}
FUNCTION { format.month.name }
{ swap$ duplicate$ empty$
{ pop$ pop$ "" }
{ swap$ "long" =
{ duplicate$ "1" =
{ "January" }
{ duplicate$ "2" =
{ "February" }
{ duplicate$ "3" =
{ "March" }
{ duplicate$ "4" =
{ "April" }
{ duplicate$ "5" =
{ "May" }
{ duplicate$ "6" =
{ "June" }
{ duplicate$ "7" =
{ "July" }
{ duplicate$ "8" =
{ "August" }
{ duplicate$ "9" =
{ "September" }
{ duplicate$ "10" =
{ "October" }
{ duplicate$ "11" =
{ "November" }
{ duplicate$ "12" =
{ "December" }
{ "invalid month in " cite$ * warning$ ""
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}
{ duplicate$ "1" =
{ "Jan." }
{ duplicate$ "2" =
{ "Feb." }
{ duplicate$ "3" =
{ "Mar." }
{ duplicate$ "4" =
{ "Apr." }
{ duplicate$ "5" =
{ "May" }
{ duplicate$ "6" =
{ "Jun." }
{ duplicate$ "7" =
{ "Jul." }
{ duplicate$ "8" =
{ "Aug." }
{ duplicate$ "9" =
{ "Sept." }
{ duplicate$ "10" =
{ "Oct." }
{ duplicate$ "11" =
{ "Nov." }
{ duplicate$ "12" =
{ "Dec." }
{ ""
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
}if$
swap$ pop$
}if$
}
% \end{macrocode}
%
% \DescribeEnv{topup.date}
% This is used to perform an addition operation on a
% string of numerals.
%
% \spec{\item An integer to be added.
% \item A string consisting of numerals only.}
% {\item A string consisting of the sum of the integer and
% the numeric string.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {topup.date}
{ 'a :=
duplicate$ character.length #2 =
{ duplicate$ #1 #1 substring$ chr.to.int$ #48 -
times.ten swap$ #2 #1 substring$ chr.to.int$ #48 -
+
}
{ duplicate$ character.length #1 =
{ chr.to.int$ #48 - }
{ pop$ #0 "I can't cope with more than two Japanese year digits in "
cite$ * warning$
}if$
}if$
a + int.to.str$
}
% \end{macrocode}
%
% \DescribeEnv{format.jdate}
% This rather specialized function converts a Japanese
% Imperial date written
% in a fixed syntax into the \LexiBib\ internal date stack,
% for onward handling by "extract.date".
%
% \spec{\item A string in the form: {\tt s57.9.27}, where
% the first letter indicates the Imperial reign of the year
% given, the first numeric item is the year, the second the
% month, and the third the day. Any non-alphabetic, non-numeric
% character may be used as a separator.}
% {\item {\tt itemcount} is set to {\tt 2} (one more is added
% by the {\tt format.date} function in which is function is
% nested).
% \item Six stack items are output---see {\tt extract.date}
% for details on stack syntax.}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {format.jdate}
{ duplicate$ #2 global.max$ substring$ gather.chars
pop$ 't := swap$
#1 #1 substring$ duplicate$ "s" =
{ pop$ t #1925 topup.date }
{ duplicate$ "m" =
{ pop$ t #1867 topup.date }
{ duplicate$ "t" =
{ pop$ t #1911 topup.date }
{ duplicate$ "h" =
{ t #1988 topup.date }
{ "invalid Imperial calendar code in " cite$ * warning$
}if$
}if$
}if$
}if$
swap$
gather.chars
pop$ swap$
gather.chars
pop$ swap$ pop$ 't := swap$ "default" swap$ t swap$ "default"
swap$ "default"
#2 'itemcount :=
}
% \end{macrocode}
%
% \DescribeEnv{format.date}
% This function makes use of "gather.chars" and other supporting
% functions to build a stack of date items, which it then parses
% using "extract.date". The syntax for entering dates is
% described in the user guide.
%
% \spec{\item A single string in appropriate date syntax.}
% {\item none}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {format.date}
{ empty.to.null 's :=
#0 'charcount :=
#0 'itemcount :=
#0 'date.specials :=
{ s empty$ not }
{ s gather.chars
duplicate$ "letter" =
{ pop$ duplicate$ character.length #1 = itemcount not and
{ pop$ pop$ s format.jdate "" 's := }
{ duplicate$ character.length #3 =
{ swap$ 's :=
parse.month "month" #1 'date.specials := }
{ swap$ 's :=
pop$ "1" "invalid date in " cite$ * warning$
"default"
}if$
}if$
}
{ "numeral" =
{ duplicate$ character.length #1 =
{ swap$ 's := "default" }
{ duplicate$ character.length #2 =
{ swap$ 's := "default" }
{ duplicate$ character.length #4 =
{ swap$ 's := "default" }
{ swap$ 's := pop$ "1"
"invalid numerical element in date for " cite$ * warning$
"default"
}if$
}if$
}if$
}
{ swap$ 's := pop$ "1"
"failed to parse date in " cite$ * warning$
"default"
}if$
}if$
itemcount #1 + 'itemcount :=
}while$
extract.date
}
% \end{macrocode}
%
% \subsubsection{Entry type specific functions}
% The functions below should not be used as general utilities;
% they are designed specifically for use with a particular entry
% type. While they could be placed directly into the entry
% functions to which they apply, defining them separately
% helps improve the transparency of the code.
%
% \DescribeEnv{j.format.division}
% This function assembles the various fields relevant to the
% division of a Japanese court into a single string.
%
% \spec{\item none}
% {\item A single string}
% {\option{none}}
%
% \begin{macrocode}
FUNCTION {j.format.division}
{ division empty$
{ "" }
{ dc.. court "end" first.in.second
{ " no.~" 's := "endlabel" 't := }
{ sc.. court "start" first.in.second
{ "No.\ " 's := "frontlabel" 't := }
{ " " 's := "endlabel" 't :=
}if$
}if$
}if$
division s divno t field.tag.no.combine
}
% \end{macrocode}
%
% \DescribeEnv{format.thesis.type}
% The function "format.thesis.type" returns either the
% (case-changed) type field,
% if it is defined, or else the default string already on the
% stack
% (like ``Master's thesis'' or ``PhD thesis'').\footnote{This
% comment by Oren Patashnik.}
%
% \spec{\item One string, representing the default label for a
% thesis}
% {\item One string, to stand as the label for a thesis}
% {\option{none}}
% \begin{macrocode}
%<*oldbdoc>
FUNCTION {format.thesis.type}
{ type empty$
'skip$
{ pop$
type "t" change.case$
}
if$
}
%</oldbdoc>
% \end{macrocode}
%
% \DescribeEnv{format.tr.number}
% The function "format.tr.number" makes a string starting with
% ``Technical Report''
% (or type, if that field is defined), followed by the number if
% there is one;
% it returns the starting part (with a case change) even if there
% is no number.
% This is used at the beginning of a sentence.\footnote{This
% comment by Oren Patashnik.}
%
% \spec{\item none}
% {\item One string, the label for a technical report}
% {\option{none}}
%
% \begin{macrocode}
%<*oldbdoc>
FUNCTION {format.tr.number}
{ type empty$
{ "Technical Report" }
'type
if$
number empty$
{ "t" change.case$ }
{ number tie.or.space.connect }
if$
}
%</oldbdoc>
% \end{macrocode}
%
% \subsubsection{Entry type functions}
% Now we define the type functions for all entry types that may
% appear
% in the {\tt*.bib} file---e.g., functions like `"article"' and
% `"book"'. These
% are the routines that actually generate the "*.bbl" file output
% for
% the entry. These must all precede the "READ" command. In
% addition, the
% style designer should have a function `"default.type"' for
% unknown types.\footnote{This comment by Oren Patashnik.}
%
% \DescribeEnv{article}
% This function performs the necessary operations for
% exporting a valid \LexiTeX\ citation to an article.
% For this and for all citation types defined in the
% \LexiBib{} style, the goal is to provide reasonably
% complete commentary, so that anyone wanting to
% alter the behaviour of the style can set to work
% with a fair degree of confidence about what needs to
% be done to achieve a particular result.
% \begin{macrocode}
FUNCTION { article }
% \end{macrocode}
% The "article" entry is used for all kinds of material, so
% it ends up as one of the most complex entries. Before we
% do anything, we have to check whether the default \LexiTeX{}
% bridges are acceptable. If the volume and the number are both
% non-empty, we need to add a special set of substitute bridges.
% \begin{macrocode}
{ volume empty$ number empty$ and not
{ "\bridges{,\ p.~}{,\ }{,\ }{\ at~}{\ at~}"
"" "" must.must.must
newline$ }
'skip$
if$
% \end{macrocode}
% Then we write the citation leader, to prepare for outputting the
% actual content of the citation text.
% \begin{macrocode}
"\lexibib{article}{" cite$ "}{" must.must.must
% \end{macrocode}
% The author name is pushed to the stack, followed by a toggle
% to trigger last-name-only formatting. Then the "format.names"
% reduces this to a single, appropriately-formatted string,
% possibly the null string. All that is left to do is push a
% set a braces, a null string to make up three arguments to the
% export routine, and write the lot on the output
% file unconditionally, using "must.must.must".
% \begin{macrocode}
author "lastonly" format.names
"}{"
""
must.must.must
% \end{macrocode}
% Next comes the title of the article. This is not specially
% formatted; we simply push the title field, then a warning
% string
% followed by a check for whether it is empty or not, then
% braces and a null string, and write again.
% \begin{macrocode}
title "title" check
"}{"
""
must.must.must
% \end{macrocode}
% The next bit is actually rather thorny. Our first
% formatting decision is based on whether or not there
% is a "volume" for this source. If not, we adopt a
% Commonwealth-style citation scheme, using the bracketed
% year for the volume. This will be coupled with suppression
% of the year in the final LexiTeX ``field''.
% \begin{macrocode}
volume empty$
{ "[" year format.date theyear "] " must.must.must
number "\ " journal "journal" check might.ifone.must
}
% \end{macrocode}
% If there {{\em is\/} a volume, we make different formatting
% decisions, depending on
% whether an issue number exists for this source.
% \begin{macrocode}
{ number empty$
% \end{macrocode}
% If there is no number, we do as follows. We
% push the volume, providing
% a warning if it it is empty, then
% a separating space, then the name of the journal, writing
% all three on the output, or just the journal name if the
% volume number is empty. This is a nice illustration of
% the utility of the "might.ifone.must" export routine.
% The braces are pushed and written separately.
% \begin{macrocode}
{ volume "volume" check
"\ "
journal "journal" check
might.ifone.must }
% \end{macrocode}
% If the "number" field was non-empty, then we do as follows.
% The journal name goes up first, and is checked. Then the
% bridge for the volume number, and the volume number itself
% go up, both being checked. The "must.ifthree.might" export
% routine will drop the bridge and number, if the volume number
% was empty, although this will probably leave us with an incomplete
% (but nice-looking) citation anyway. The we push a bridge to
% the number, the issue number, and a null string,
% and force all three on the
% output (no need for conditions in this last action, since we
% know already that "number" is non-empty.
% \begin{macrocode}
{ journal "journal" check
", \\vol.~"
volume "volume" check
must.ifthree.might
", no.~" number "\\" must.must.must
}if$
}if$
% \end{macrocode}
% Finally, we complete the second \LexiTeX{} argument
% and start the next. The emply strings just take up space
% of course.
% \begin{macrocode}
"}{" "" "" must.must.must
% \end{macrocode}
% The Blue Book does not like page ranges
% so we need to clean
% out anything following a dash in the "pages" field. The
% "short" option
% toggles this behaviour on. We also check to see that the page
% is not empty. This is followed by braces, a null string, and
% output.
% \begin{macrocode}
pages "short" format.pages "pages" check
"}{"
""
must.must.must
% \end{macrocode}
% We add the year next, but only if the "volume" field is
% non-empty (if "volume" is empty, we'll have put the year
% is as a bracketed volume number, Commonwealth-style.
% We could use just the year (this is normal for Blue Book
% style, but we'll add the month for good measure, if it's
% been provided in the "year" field.
% \begin{macrocode}
volume empty$
'skip$
{ year format.date themonth "short" format.month.name
"\ " theyear might.ifone.must
}if$
% \end{macrocode}
% Finally, we have to tangle with cross-references.
% Yuck. (Not a complaint about \BibTeX, just a general
% response to the design problems inherent in the task).
% Formatting depends on whether there is a "crossref" entry.
% Hear that, guys? If you don't use the "crossref" field,
% we'll short-change you on formatting service.
% \begin{macrocode}
crossref empty$
% \end{macrocode}
% If there is no "crossref", we just push a brace and a couple
% of nulls, and write. Done! Hurray!
% \begin{macrocode}
{ "}" "" "" must.must.must }
% \end{macrocode}
% But if there {\em was\/} a "crossref", we've go work to do.
% Darn. The first thing we do is have a look at "booktitle".
% This should be non-null in this situation; there's no sense
% setting up a cross-reference to an individual volume of
% a journal unless there's something special to be said
% about it.
% \begin{macrocode}
{ booktitle empty$
% \end{macrocode}
% So if no "booktitle" is found, we whinge and format
% as for a no-cross-reference entry.
% \begin{macrocode}
{ "no booktitle (name of special issue) for "
cite$ "/" crossref * * * warning$
"}" "" "" must.must.must }
% \end{macrocode}
% If there {\em is\/} a "booktitle", though,
% and if the "volume" field is non-empty (which
% means that we just printed, or at least should
% have printed, the year), we close the
% parens following the year (which is opened by \LexiTeX),
% and open another (which will be closed by \LexiTeX).
% That's it for conditional punctuation; we follow
% with "booktitle", which should be
% the title or subject description of the special
% issue of the journal.
% \begin{macrocode}
{ volume empty$ {""} {") ("} if$ booktitle "}" must.must.must}
if$
}if$
% \end{macrocode}
% Add a fresh new line in the export file, and we're done! Whew!
% \begin{macrocode}
newline$
}
% \end{macrocode}
%
% \DescribeEnv{book}
% This is the entry for books, which includes individual
% volumes in a series, and multi-volume works with a single
% title. Correct me if I'm wrong, but I think this latter
% citation type is not supported by \BibTeX. \LexiBib{}
% manages it by allowing the user to specify the volume
% number in the text using the optional ":<number>:" argument to
% the "\lexicite" tag.
% \begin{macrocode}
FUNCTION {book}
% \end{macrocode}
% After the opener, we push the opening macro tag for a book
% entry, the nickname of the citation, and a couple of
% braces. This is all mandatory and can safely be given
% unconditional export.
% \begin{macrocode}
{ "\lexibib{book}{" cite$ "}{" must.must.must
% \end{macrocode}
% A non-empty "volume" field means we need a leading
% volume number in the Blue Book style. If a volume
% number (or anything else) is found in the "volume"
% field of a book entry, we replace it with a
% "volno" macro. This will expand in the document to
% whatever the author has specified using the optional
% ":<number>" argument to "\lexicite". For example,
% volume 8 of "holdsworth" would be: "\lexicite:8:{holdsworth}".
% \begin{macrocode}
volume empty$
{ "" }
{ "\volno " }
if$
% \end{macrocode}
% The author comes first. We push the contents of the
% "author" field, then the toggle string ``"firstinitial"'',
% and run the "format.names" function to produce the name
% formatted properly for a book entry. Then we push
% fa couple of braces
% and force all three items ("\volno" or null, author, and
% braces) onto the output.
% \begin{macrocode}
author
"firstinitial" format.names "}{" must.must.must
% \end{macrocode}
% The title is very straightforward. We push the title, then
% check to be sure it's non-empty, then a couple of braces
% go up, filled out with a null string, and force all three
% onto the output.
% \begin{macrocode}
title "title" check "}{" "" must.must.must
% \end{macrocode}
% We're now in the final ``field'' of the \LexiTeX{} entry.
% This is mainly for the year, but we also give the
% name of the editor(s) or translator(s)
% if present. If there is no
% editor or translator, we'll put a series name here, to help identify
% the source. We don't put both, because this would
% confuse things (there can be book editors and
% series editors too, and the Blue Book style is
% too streamlined to distinguish the two elegantly).
% So our first task is to see if there is an editor\ldots
% \begin{macrocode}
editor empty$ translator empty$ and
% \end{macrocode}
% \ldots{} and if there is none, we put in a
% series name if it exists.
% The "series" \BibTeX{} field should be used for the
% name of the series of which a volume forms a part,
% but some folks might accidentally use "booktitle".
% We'll be forgiving and accept it anyway.
% \begin{macrocode}
{ series empty$ booktitle empty$ and
% \end{macrocode}
% If both
% "series" and "booktitle" are empty, we've nothing to do.
% \begin{macrocode}
'skip$
% \end{macrocode}
% If at least one is non-empty, we push both,
% and cull them to just one using the "either.or" function.
% If only one is non-empty, this function leaves that one;
% if both are non-empty, the "either.or" function whinges
% and chooses one arbitrarily.
%
% Next, we push a bridge and a series item number,
% and a toggle for the "field.tag.no.combine" function.
% The "endlabel" toggle causes this function to put
% the bridge and the number after the series name,
% if a number exists, and push the lot back as a single
% item on the stack. Otherwise it leaves just the series
% name.
%
% And last, we put up a comma to close, and do a mandatory
% export of the lot.
% \begin{macrocode}
{ series booktitle either.or " No.~" number
"endlabel" field.tag.no.combine ", " "" must.must.must }
if$
}
% \end{macrocode}
% If either the editor or the translator fields were not empty,
% we format the editor or translator name
% instead, and put those details here.
% \begin{macrocode}
{ editor translator either.or "firstinitial" format.names
% \end{macrocode}
% We need to append the correct designator, either ``ed.''\ or
% ``trans.''. The "either.or" function will use the second
% item pushed if both are non-empty, so we take advantage of
% this ``feature'' in making our choice of designators; the
% "ed." or "eds." strings are only used if the "translator"
% field is empty. And finally, we push a null string to
% round out, and do a compulsory export.
% \begin{macrocode}
translator empty$
{ editor num.names$ #1 >
{ " eds.\ " }
{ " ed.\ " }
if$
}
{ " trans.\ " }
if$
"" must.must.must
}if$
% \end{macrocode}
% We also need to indicate the edition, if any.
% \begin{macrocode}
edition " ed.\ " "" might.ifone.must
% \end{macrocode}
% The year itself is easy. We push the year, do a check to issue
% a warning if necessary, then run format.date over it,
% which yields the year in "theyear", which can be pushed
% back onto the stack. Then we fill out to six
% \LexiTeX{} fields in
% all, and do a compulsory export.
% \begin{macrocode}
year "year" check format.date theyear "}{}{}" "" must.must.must
% \end{macrocode}
% A new line for a new macro, and we're done! Rejoice!
% On to the next function definition!
% \begin{macrocode}
newline$
}
% \end{macrocode}
%
% \DescribeEnv{incollection}
% This is for those nasty entries that are created when someone
% publishes an article in a collection of essays edited by someone
% else.
% \begin{macrocode}
FUNCTION{incollection}
{ "\lexibib{article}{" cite$ "}{" must.must.must
author "lastonly" format.names "author" check
"}{" "" must.must.must
title "title" check
"}{" "" must.must.must
chapter empty$
{ "" }
{ "\\" chapter " of \\" * * }
if$
booktitle "booktitle" check
"}{" must.must.must
pages "short" format.pages "pages" check
"}{" "" must.must.must
% We're now in the final ``field'' of the \LexiTeX{} entry.
% The coding here is the same as for a "book" entry; the
% reader is referred to that entry for the commentary
% on the following code.
% \begin{macrocode}
editor empty$ translator empty$ and
{ series empty$ booktitle empty$ and
'skip$
{ series booktitle either.or " No.~" number
"endlabel" field.tag.no.combine ", " "" must.must.must }
if$
}
{ editor booktranslator either.or "firstinitial" format.names
booktranslator empty$
{ editor num.names$ #1 >
{ " eds.\ " }
{ " ed.\ " }
if$
}
{ " trans.\ " }
if$
"" must.must.must
}if$
edition " ed.\ " "" might.ifone.must
year "year" check format.date theyear "}" "" must.must.must
newline$
}
% \end{macrocode}
%
% \begin{macrocode}
FUNCTION{booklet}
{ "\lexibib{man}{" cite$ "}{" must.must.must
author "}{" "" must.must.must
"\\" title "\\}{" must.must.must
howpublished ", " "" might.ifone.must
year "year" check format.date theyear
"}{}{}" "" must.must.must
newline$
}
% \end{macrocode}
% \changes{1.0g}{1994/12/12}{Added the `techreport' function,
% to support draft article sent to Pedro Aphalo for comments.}
% \begin{macrocode}
FUNCTION {techreport}
{"\lexibib{man}{" cite$ "}{" must.must.must
author "full" format.names "author" check
"}{" title "title" check must.must.must
"}{"
type empty$
{ "Technical report" }
{ type
}if$
" no.~" number "endlabel" field.tag.no.combine
", " must.must.must
year format.date
themonth empty$
{ "" }
{ themonth "short" format.month.name "\ " * }
if$
theyear
"}{}{}{}" must.must.must
newline$
}
% \end{macrocode}
%
% \paragraph{Cases} Law cases are all entered using the
% {\tt\string@CASE} entry type. The formatting of citations
% varies from jurisdiction to jurisdiction, so the behaviour
% of citations of this type is controlled via a "jurisdiction"
% field. Supported jurisdictions are listed in the user
% guide. Below, the functions for each jurisdiction are
% defined first, followed by the "case" function itself.
%
% \DescribeEnv{j.case}
% This function applies to cases from Japan.
% \begin{macrocode}
FUNCTION { j.case }
{ "\lexibib{jcase}{" cite$ "}{" must.must.must
"Decision of the " court "court" check "" must.must.must
" (" j.format.division ")" iftwo.might.iftwo
", " "" "" must.must.must
casedate format.date themonth "short" format.month.name "\ "
theday must.must.must
", " theyear "}{" must.must.must
volume empty$ not number empty$ not and
{ journal "journal" check ", no.~" number must.must.must
", vol.~" volume "" must.must.must }
{ volume number either.or "\ " journal "journal" check
might.ifone.must
"}{" pages "}{" must.must.must
}if$
year "year" check empty.to.null format.date
themonth "short" format.month.name " " "" might.ifone.must
theday ", " "" might.ifone.must
theyear "}" "{}" must.must.must
newline$
}
% \end{macrocode}
%
% \DescribeEnv{e.case}
% This function applies to English cases.
% \begin{macrocode}
FUNCTION { e.case }
{ "\lexibib{ecase}{" cite$ "}{" must.must.must
title "title" check "}{" "" must.must.must
year "year" check format.date "[" theyear "] " must.must.must
journal "}{" "" must.must.must
pages "short" format.pages "}" "{}{}{}" must.must.must
newline$
}
% \end{macrocode}
%
% \DescribeEnv{p.case}
% This function applies to Pakistani cases.
% \begin{macrocode}
FUNCTION {p.case}
{e.case}
% \end{macrocode}
%
% \DescribeEnv{us.case}
% This function applies to U.S. cases.
% \begin{macrocode}
FUNCTION { us.case }
{"\lexibib{case}{" cite$ "}{" must.must.must
title "title" check "}{" "" must.must.must
volume "\ " journal must.must.must
"}{" pages "}{" must.must.must
court "court" check "\ " year format.date theyear
might.ifone.must
"}{}{}" "" "" must.must.must
newline$
}
% \end{macrocode}
% \DescribeEnv{case}
% This function simply reads the contents of the "jurisdiction"
% field, and invokes the appropriate case function.
% \begin{macrocode}
FUNCTION { case }
{ jurisdiction empty.to.null duplicate$ "jurisdiction (sine qua non!)" check
"japan" =
{ pop$ j.case }
{ duplicate$ "england" =
{ pop$ e.case }
{ duplicate$ "pakistan" =
{ pop$ p.case }
{ duplicate$ "singapore" =
{ pop$ e.case }
{ pop$ us.case
}if$
}if$
}if$
}if$
% \end{macrocode}
% The following item adds annotations; this may be eliminated by
% stripping with "noannotes".
% \begin{macrocode}
%<*!noannotes>
annote empty.to.null write$ newline$
%</!noannotes>
}
% \end{macrocode}
%
% \DescribeEnv{j.statute}
% This function applies to Japanese statutory materials.
% \changes{\LexiBib 1.0c}{94/08/03}{Added support for Japanese statutes.}
% \begin{macrocode}
FUNCTION {j.statute}
{ "\lexibib{jstatute}{" cite$ "}{" must.must.must
title "title" check "}{" "" must.must.must
"Law no.~" number "number" check " of "
iftwo.might.iftwo
year format.date theyear "}{}{}{}" "" must.must.must
newline$
}
% \end{macrocode}
%
% \DescribeEnv{s.statute}
% This function formats a statute entry for Singapore.
% \begin{macrocode}
FUNCTION { s.statute }
{ "\lexibib{statute}{" cite$ "}{" must.must.must
title "title" check ", No.~" number
"got it" warning$ "endlabel" field.tag.no.combine
number empty$
{ "\ " * }
{ "\ of " * }
if$
year format.date theyear "}{" must.must.must
"}{}{}{}{}" "" "" must.must.must
newline$
}
% \end{macrocode}
%
% \DescribeEnv{statute}
% This function selects the correct statute entry function.
% \begin{macrocode}
FUNCTION { statute }
{ jurisdiction empty.to.null duplicate$
"japan" =
{ pop$ j.statute }
{ duplicate$ "singapore" =
{ pop$ s.statute }
{ pop$ "IMPORTANT: unknown jurisdiction for " cite$ * warning$
}if$
}if$
}
% \end{macrocode}
%
% \DescribeEnv{default.type}
% We use the "book" type as our default type. When "manual" is
% completed, we should probably use that type instead.
% \begin{macrocode}
FUNCTION {default.type} { book }
%</newbst>
% \end{macrocode}
%
%
% \subsection{Macro definitions}
% We don't define any macros for abbreviating law journal
% names. Instead, we will use Blue Book abbreviations
% ``native'', with a special syntax (probably the full
% form in syntax:
% ``"\gobble{Accountant}{}"'' immediately after
% the abbreviation) for resolving
% ambiguous abbreviations. Meanwhile, trust me: use the
% Blue Book abbreviations and take this upcoming facility
% on faith. And besides, do you ever {\em need\/} to spell
% out journal and reporter names?
%
% \subsection{Execution}
% With all preliminaries out of the way, our first act is
% to read in the entries from {\tt *.bib}..
% \begin{macrocode}
%<*newbst>
READ
% \end{macrocode}
% Then we say ``Hi'' to the user. It would be nice to make this
% the first message, but the structure of \BibTeX{} style files
% dictates that it will follow any warnings about missing
% entries.
% \begin{macrocode}
EXECUTE {hello}
% \end{macrocode}
%
% \DescribeEnv{begin.bib}
% \DescribeEnv{end.bib}
% We need a couple of functions to write the starting and
% finishing strings on to output file.
% \begin{macrocode}
FUNCTION {begin.bib}
{ "\begin{lexilist}" write$ newline$
}
FUNCTION {end.bib}
{ "\end{lexilist}" write$ newline$
}
% \end{macrocode}
% Now we put it all together by running the entry-type
% function on each entry selected from the database in turn,
% bracketed by the starting and ending output functions
% just defined.
% \begin{macrocode}
EXECUTE {begin.bib}
ITERATE {call.type$}
EXECUTE {end.bib}
%</newbst>
% \end{macrocode}
% And, er, that's it!
%
% \section{Extraction utilities}
% \subsection{The Driver}
% Here is a simple driver for extracting the files in the
% package.
% \begin{macrocode}
%<*driver>
\def\batchfile{lexibib.ins}
\input docstrip
\preamble
%
\endpreamble
\generateFile{lexibib.man}{t}{\from{lexibib.doc}{manual}}
\generateFile{lexitest.tex}{t}{\from{lexibib.doc}{testdoc}}
\postamble
\endpostamble
\generateFile{lexitest.bib}{t}{\from{lexibib.doc}{testbib}}
\generateFile{lexibib.bst}{t}{\from{lexibib.doc}{newbst}}
%</driver>
% \end{macrocode}
% \subsection{The Manual}
% This is a simple driver that generates the documentation.
% \begin{macrocode}
%<*manual>
\let\lawhline=\hline
\documentclass{ltxdoc}
\usepackage{lexitexm}
% \makebooktable
\EnableCrossrefs
\RecordChanges % Gather update information
\CodelineIndex % Index code by line number
%\OnlyDescription % comment out for implementation details
\begin{document}
\DocInput{lexibib.doc}
\end{document}
%</manual>
% \end{macrocode}
% \begin{macrocode}
%<*testbib>
@STRING{tdc..="Tokyo District Court"}
@STRING{minjibu..="Civil Division"}
@STRING{ksh..="Kin'y{\=u} sh{\=o}ji hanrei"}
@PREAMBLE{ "\newcommand{\kk}{K.K. } "
# "\newcommand{\v}{v.~} " }
@book{tanaka-tekisuto,
author = {Akira Tanaka and others},
title = {Tekisutobukku Tegata, Kogitte H{\=o}},
year = {1987},
publisher = {Y{\=u}hikaku Bukkusu},
subject = {commtrans}
}
@case{tdc.s57.9.27,
journal = ksh..,
volume = {663},
annote = {
\holding{
\item The Business Suspension Sanction of the Notes
Clearing Center falls
within the terms of the explicit exemption of Notes and
Cheque Clearing
Centers from the terms of Anti-Monopoly Act section 8, as
a practice
necessary to the specialized function of such Centers.
}},
court = tdc..,
division = minjibu..,
divno = {30},
casedate = {s57.9.27},
page = {35},
jurisdiction = {j},
subject = {commtrans: aml attack on clearing system}
}
@book{horitsu-jiten,
title = {H\=oritsu jiten},
year = {s11.3.10},
editor = {? Suehiro and ? Tanaka},
publisher = {Iwanami sh\=oten},
volume = {1},
subject = {general}
}
%</testbib>
% \end{macrocode}
% \begin{macrocode}
%<*testdoc>
\documentclass{article}
\usepackage{lexitex}
\begin{document}
\bibliography{lexitest}
\bibliographystyle{lexibib}
Waffle burble.\footnote{\lexicite{tanaka-tekisuto}.}
More waffle and burble.\footnote{\lexicite:2:{horitsu-jiten}.}
\lexicite{tdc.s57.9.27}:
\theholding
\end{document}
%</testdoc>
% \end{macrocode}
% \changes{no ver}{84/12/16}{ (HWT) Original `plain'
% version, by Howard Trickey.}
% \changes{no ver}{84/12/23}{ (LL) Some comments made
% by Leslie Lamport.}
% \changes{no ver}{85/2/16}{ (OP) Changes based on
% LL's comments, Oren Patashnik.}
% \changes{no ver}{85/2/17}{ (HWT) Template file and
% other standard styles made.}
% \changes{0.98b}{85/3/28}{ (OP) First
% release, for BibTeX 0.98f.}
% \changes{0.98c}{85/5/9}{ (OP) for BibTeX
% 0.98i:
% fixed Theoretical Computer Science macro name;
% fixed the format.vol.num.pages function.}
% \changes{0.99a}{88/1/24}{ (OP) for BibTeX
% 0.99a, main changes:
% assignment operator (:=) arguments reversed;
% the preamble$ function outputs the database
% PREAMBLE;
% entry.max$ and global.max$ (built-in) variables
% replace
% entry.string.max and global.string.max functions;
% alphabetizing by year then title, not just title;
% many unnecessary ties removed; \it ==> \em;
% the `alpha' style uses a superscripted `+'
% instead of a
% `*' for unnamed names in constructing the label;
% the `abbrv' style now uses "Mar." and "Sept.";
% the functions calc.label and presort now look at
% just
% the fields they're supposed to;
% BOOKLET, MASTERSTHESIS, TECHREPORT use nonbook
% titles;
% INBOOK and INCOLLECTION take an optional type
% (e.g.
% type = "Section"), overriding the default
% "chapter";
% BOOK, INBOOK, INCOLLECTION, and PROCEEDINGS now
% allow
% either volume or number, not just volume;
% INCOLLECTION now allows an edition and series
% field;
% PROCEEDINGS and INPROCEEDINGS now use the address
% field
% to tell where a conference was held;
% INPROCEEDINGS and PROCEEDINGS now allow either
% volume
% or number, and also a series field;
% MASTERSTHESIS and PHDTHESIS accept types other
% than
% "Master's thesis" and "PhD thesis";
% UNPUBLISHED now outputs, in one block, note then
% date;
% MANUAL now prints out the organization in
% the first block if the author field is empty;
% MISC can't be empty---it requires some optional
% field.}
% \changes{0.99b}{88/3/23}{ (OP) For BibTeX
% 0.99c---changed the three
% erroneous occurrences of `{\tt cite }'
% to `{\tt cite\$ }';
% this
% change didn't affect the four standard styles,
% so the
% 0.99a versions of those styles are still
% current.}
%
% \changes{\LexiBib{} 1.0}{94/6/12}{ (FB) Copied into
% {\tt btxbst.doc} to {\tt lexibib.doc} and commenced editing.}
% \changes {\LexiBib{} 1.0a}{94/7/25}{(FB) First successful
% trial of \LexiBib.}
% \changes{\LexiBib{} 1.0b}{94/8/9}{(FB) Completed first
% operational version, with date parsing, for use with
% articles, books and Japanese case materials.}
% \Finale \PrintIndex \PrintChanges
|