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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content="HTML Tidy for Linux/x86 (vers 1st March 2002), see www.w3.org" />
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1" />
<title>Chapter 12. Bibliographies, Indexes, and
Glossaries</title>
<link rel="stylesheet" href="mtw.css" type="text/css" />
<meta name="generator"
content="DocBook XSL Stylesheets V1.53.0" />
<link rel="home" href="index.html" title="Making TeX Work" />
<link rel="up" href="pt02.html"
title="Part II. Elements of a Complex Document" />
<link rel="previous" href="ch11.html"
title="Chapter 11. Introducing MetaFont" />
<link rel="next" href="pt03.html"
title="Part III. A Tools Overview" />
</head>
<body>
<div class="navheader">
<table border="0" cellpadding="0" cellspacing="0"
width="100%" summary="Navigation table">
<tr>
<td align="left"> <a title="Making TeX Work"
href="index.html"><img src="figures/nav-home.png"
alt="Home" border="0" /></a> <a
title="Chapter 11. Introducing MetaFont"
href="ch11.html"><img src="figures/nav-prev.png"
alt="Prev" border="0" /></a> <a
title="Part II. Elements of a Complex Document"
href="pt02.html"><img src="figures/nav-up.png" alt="Up"
border="0" /></a> <a
title="Part III. A Tools Overview"
href="pt03.html"><img src="figures/nav-next.png"
alt="Next" border="0" /></a></td>
<td align="right"><i>Making TeX Work</i> Version 1.0.1
<span class="alpha-version">(<a
href="co01.html"><em>Alpha</em></a>)</span></td>
</tr>
</table>
</div>
<div class="chapter">
<div class="titlepage">
<div>
<h2 class="title"><a id="chap.bibtex"
name="chap.bibtex"></a>Chapter 12. Bibliographies,
Indexes, and Glossaries</h2>
</div>
<div>
<p class="releaseinfo">$Revision: 1.1 $</p>
</div>
<div>
<p class="pubdate">$Date: 2002/08/23 14:31:13 $</p>
</div>
<hr class="component-separator" />
</div>
<p>Bibliographies<a id="id2917618" class="indexterm"
name="id2917618"></a><a id="id2917626" class="indexterm"
name="id2917626"></a> and indexes<a id="id2917640"
class="indexterm" name="id2917640"></a><a id="id2917647"
class="indexterm" name="id2917647"></a> are typically
difficult to incorporate into a document. Bibliographies have
stringent, but varying, presentation requirements (the MLA
wants bibliographies to look one way, the Association of
Computing Machinery wants them another, etc.). Indexes don't
vary that much, but they are tedious to put together.</p>
<p>BibTeX provides a powerful mechanism for handling
bibliographies and citations. <b>Tib</b> is another
bibliography package for TeX. The <b>MakeIndex</b> program
helps manage the construction of one or more indexes for a
document. Glossaries are also constructed with the
<b>MakeIndex</b> program<a id="id2917542" class="indexterm"
name="id2917542"></a><a id="id2917549" class="indexterm"
name="id2917549"></a>.</p>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a
id="sec.indexeslooklike"
name="sec.indexeslooklike"></a>BibTeX</h2>
</div>
</div>
<p><a id="id2917577" class="indexterm"
name="id2917577"></a>What's wrong with doing bibliographies
by hand? Two things. First, it is tedious to typeset each
bibliography entry according to the strict requirements of
the publisher. Chances are, you'll have to look up the
requirements each time, and you're bound to make mistakes.
Second, no matter what field you work in, it's likely that
you'll cite some of the same articles and books in more
than one publication. Computers are supposed to reduce
effort, not replicate it.</p>
<p>BibTeX provides a powerful mechanism for dealing with
bibliographies in a mechanical way, considerably reducing
effort on your part. Rather than formatting each
bibliography entry, you build a database of bibliography
information<a id="id2920467" class="indexterm"
name="id2920467"></a>. Each time you want to make a
citation, you simply use BibTeX to build the bibliography
from your database into your document. That's easy to do,
as you'll see in a few minutes.</p>
<p>The idea of a bibliography database is introduced in
Appendix B of <span class="emphasis"><em>LaTeX: A
Document Preparation System</em></span> [<a
href="bi01.html#ll:latexbook">ll:latexbook</a>] and is
described in more detail in <span
class="emphasis"><em>\BibTeX{}ing</em></span> [<a
href="bi01.html#op:btxdoc">op:btxdoc</a>] and <span
class="emphasis"><em>Designing BibTeX
Styles</em></span> [<a
href="bi01.html#op:btxhak">op:btxhak</a>]. The purpose of
this chapter is to familiarize you with the concepts of a
bibliography database and to describe many of the freely
available tools for manipulating databases. It is not
intended to replace any of the preceding documents.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2920526"
name="id2920526"></a>How BibTeX Works</h3>
</div>
</div>
<p>The LaTeX command \cite inserts citations<a
id="id2920539" class="indexterm" name="id2920539"></a>
into your document.<sup>[<a id="id2920553"
name="id2920553" href="#ftn.id2920553">115</a>]</sup> You
use a short <span class="emphasis"><em>key</em></span><a
id="id2920570" class="indexterm" name="id2920570"></a> to
identify the publication you cite. For example, in this
book, when I want to cite <span class="emphasis"><em>The
TeXbook</em></span> [<a
href="bi01.html#kn:texbook">kn:texbook</a>], I use the
command <tt>FIXME:</tt>. The string <tt>kn:texbook</tt>
is the key. When you build your bibliography database,
you assign a key to each document in the database.</p>
<p>When LaTeX processes your document, it stores
information about the documents that you cite (including
the key for each document) in the <tt>AUX</tt> file<a
id="id2920623" class="indexterm" name="id2920623"></a>.
The following commands identify how the bibliography
should be formatted and what bibliography databases
contain the publications you cite. LaTeX also writes this
information to the <tt>AUX</tt> file:</p>
<pre class="screen">
\bibliographystyle{abbrv}
\bibliography{texpubs}
</pre>
<p>BibTeX examines the <tt>AUX</tt> file and extracts the
appropriate entries from the bibliography database. It
then formats those entries according to the <span
class="emphasis"><em>bibliography style</em></span> that
you specify. The bibliography style (stored in a plain
text file with the extension <tt>BST</tt>)<a
id="id2920687" class="indexterm" name="id2920687"></a>
tells BibTeX exactly how each entry should be formatted.
After formatting the entries, BibTeX writes a
<tt>BBL</tt> file<a id="id2920710" class="indexterm"
name="id2920710"></a> that LaTeX incorporates into your
document (at the place where the \bibliography command
occurs) the next time you process it.</p>
<p>Sometimes it seems confusing to use LaTeX to create a
bibliography. If LaTeX keeps warning you about
“unknown citations” for documents that you
<span class="emphasis"><em>know</em></span> are in the
database, try the following: run LaTeX, then BibTeX, then
LaTeX, and then LaTeX again.</p>
<p>The first time you run LaTeX, it writes the citation
keys to the <tt>AUX</tt> file (but it doesn't know what
publications they refer to). BibTeX writes the
<tt>BBL</tt> file, which includes the printable,
formatted bibliography and information about what
publication corresponds to each citation. The second time
you run LaTeX, it still doesn't know what publication
each citation refers to because it hasn't seen the
<tt>BBL</tt> file yet (bibliographies are usually at the
end of a document). During the second pass, LaTeX writes
the citation referents to the <tt>AUX</tt> file. Finally,
on the third LaTeX pass, it knows what each citation
refers to, so it can typeset the citations as well as the
bibliography!</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2920800"
name="id2920800"></a>Building a Bibliography
Database</h3>
</div>
</div>
<p>A bibliography database<a id="id2920809"
class="indexterm" name="id2920809"></a><a id="id2920817"
class="indexterm" name="id2920817"></a> is a plain text
file that contains information about a collection of
publications. Bibliography databases generally have the
extension <tt>.bib</tt>. Example <a
href="ch12.html#ex.bib.bibexample"
title="Example 12.1. A Sample BibTeX entry">Example 12.1</a>
is an example of a single database entry. This entry is
from a database of TeX-related publications that I put
together while writing this book.</p>
<div class="example">
<a id="ex.bib.bibexample" name="ex.bib.bibexample"></a>
<p class="title"><b>Example 12.1. A Sample
BibTeX entry</b></p>
<pre class="screen">
@book{kn:texbook,
author = "Donald E. Knuth",
title = "The {TeX}book",
publisher = "Addison-Wesley",
year = 1989,
edition = "Fifteenth",
}
</pre>
</div>
<p>The entry in Example <a
href="ch12.html#ex.bib.bibexample"
title="Example 12.1. A Sample BibTeX entry">Example 12.1</a>
describes <span class="emphasis"><em>The
{TeX}book</em></span> by Donald Knuth<a id="id2920892"
class="indexterm" name="id2920892"></a>. The key for this
entry is <tt>kn:texbook</tt>.</p>
<div class="note"
style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>All of the keys in a BibTeX database must be unique.
If you use multiple databases for a single document,
all of the keys in all of the databases must be
unique.</p>
</div>
<p>In database jargon, the bibliography database contains
a collection of records describing publications. There
may be several types of records in the same database.
Each record contains several fields, some of which are
required and some optional. The required fields vary
according to the type of record.</p>
<p>In English, this means that each entry in the database
describes a specific type of publication (book, article,
technical report, etc.). Every publication is described
by its characteristics. For example, books have a title,
an author or editor, a publisher, and a year of
publication. Some books also have a publisher's address,
a volume or number, a series, edition, or month of
publication (or some combination of these elements).
These characteristics are called <span
class="emphasis"><em>fields</em></span>, and they are
identified by their name.</p>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2920948"
name="id2920948"></a>Database entries</h4>
</div>
</div>
<p>This is the general structure<a id="id2920957"
class="indexterm" name="id2920957"></a><a
id="id2920968" class="indexterm" name="id2920968"></a>
of an entry in a bibliography database:</p>
<pre class="screen">
<tt>@</tt><span
class="emphasis"><em>type</em></span><tt>{</tt><span
class="emphasis"><em>key</em></span>,
<span class="emphasis"><em>field1</em></span> = "<span
class="emphasis"><em>value1</em></span>",
<span class="emphasis"><em>field2</em></span> = "<span
class="emphasis"><em>value2</em></span>",
. . .
<span class="emphasis"><em>fieldn</em></span> = "<span
class="emphasis"><em>valuen</em></span>"
<tt>}</tt>
</pre>
<p>Always enter complete bibliography information in
mixed case. Never abbreviate or set field values in all
upper or all lowercase, even if the bibliography style
that you most frequently use specifies, for example,
that book titles appear in uppercase or that only the
author's first initial should appear. BibTeX will take
care of formatting the entry according to the style. If
you store incomplete information in the database,
BibTeX can't work correctly if you change styles.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2921042"
name="id2921042"></a>Entry types</h4>
</div>
</div>
<p>Table <a href="ch12.html#tab.bib.entries"
title="Table 12.1. Types of Entries with Required and Optional Fields">
Table 12.1</a> shows the required and optional
fields for article and book entries. Similar lists
exist for the other standard entry types: booklet,
conference, inbook, incollection, inproceedings,
manual, mastersthesis, phdthesis, proceedings,
techreport, unpublished, and a catch-all miscellaneous
type.</p>
<div class="table">
<a id="tab.bib.entries" name="tab.bib.entries"></a>
<p class="title"><b>Table 12.1. Types of
Entries with Required and Optional Fields</b></p>
<table
summary="Types of Entries with Required and Optional Fields"
border="1">
<colgroup>
<col align="left" />
<col align="left" />
<col align="left" />
</colgroup>
<thead>
<tr>
<th align="left">\bf Type</th>
<th align="left">\bf Required Fields</th>
<th align="left">\bf Optional Fields</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">article</td>
<td align="left">author</td>
<td align="left">month</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">journal</td>
<td align="left">number</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">title</td>
<td align="left">pages</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">year</td>
<td align="left">volume</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="left">note</td>
</tr>
<tr>
<td align="left">book</td>
<td align="left">author or editor</td>
<td align="left">address</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">publisher</td>
<td align="left">edition</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">title</td>
<td align="left">month</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left">year</td>
<td align="left">volume or number</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="left">series</td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"> </td>
<td align="left">note</td>
</tr>
</tbody>
</table>
</div>
<p>Fields that are neither required nor optional are
ignored. Therefore, you can and should associate
arbitrary information about a publication in its entry.
Abstracts and keywords, for example, are two additional
pieces of information that you might keep for some
publications. They can be stored in <tt>abstract</tt>
and <tt>keyword</tt> fields in each entry, even though
it is unlikely that they will ever occur in a
bibliography.</p>
<div class="note"
style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>The types of records that are valid, and the
required and optional fields they contain are
determined solely by the bibliography style. There is
nothing in the BibTeX program that makes <span
class="emphasis"><em>book</em></span> and <span
class="emphasis"><em>article</em></span> entries more
legitimate than <span
class="emphasis"><em>reptile</em></span> or <span
class="emphasis"><em>cartoon</em></span> entries.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2921363"
name="id2921363"></a>Abbreviations</h4>
</div>
</div>
<p><a id="id2921371" class="indexterm"
name="id2921371"></a>The database entry structure that
I've shown isn't entirely accurate. In my example,
every field has a quoted string value. The truth is,
every value is either a quoted string or an
abbreviation or a number. An abbreviation is created
with the <tt>@string</tt> command. Typically,
<tt>@string</tt> commands are placed at the top of the
bibliography database. For example, the following
command defines <tt>ora</tt> to be an abbreviation for
O'Reilly & Associates.</p>
<pre class="screen">
<tt>@string{ora = "O'Reilly & Associates, Inc."}</tt>
</pre>
<p>The months of the year should always be specified
with abbreviations so that bibliography styles can
redefine how they appear in the bibliography (for this
reason, three-letter abbreviations for the months are
defined in the standard styles---you don't have to
define them yourself). The names of journals that you
cite frequently are also obvious candidates for
abbreviation.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2921436"
name="id2921436"></a>Preamble</h4>
</div>
</div>
<p><a id="id2921443" class="indexterm"
name="id2921443"></a>Sometimes it is helpful to define
TeX control sequences in a bibliography database.
BibTeX provides a <tt>@preamble</tt> entry for this
purpose.</p>
<p>Consider the following example, paraphrased from
<span
class="emphasis"><em>\BibTeX{}ing</em></span> [<a
href="bi01.html#op:btxdoc">op:btxdoc</a>]: You have a
database which contains entries for each volume of a
two-volume set by the same author. It happens that
Volume One has been reprinted, so it has a more recent
date than Volume Two. The standard styles sort by
author and then date, so as it stands, the bibliography
would list Volume Two before Volume One.</p>
<p>To correct this problem, you could specify the dates
for Volume One as:</p>
<pre class="screen">
year = "{\noopsort{1990a}}1992"
</pre>
<p>and for Volume Two:</p>
<pre class="screen">
year = "{\noopsort{1990b}}1990"
</pre>
<p>BibTeX will sort “1990a” before
“1990b,” so they will appear in the correct
order, and the following definition for \noopsort will
simply discard its argument, so nothing extra will
appear in the bibliography:<sup>[<a id="id2921530"
name="id2921530"
href="#ftn.id2921530">116</a>]</sup></p>
<pre class="screen">
\def\noopsort#1{}
</pre>
<p>The best place to put this definition is in the
database that uses it (so that it will always be
present when that database is used). The
<tt>@preamble</tt> command simply copies its argument
to the top of the <tt>BBL</tt> file, so this definition
at the top of the database will do exactly what we
want:</p>
<pre class="screen">
@preamble{"\def\noopsort#1{}"}
</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2921587"
name="id2921587"></a>Comments</h4>
</div>
</div>
<p><a id="id2921594" class="indexterm"
name="id2921594"></a>Anything that does not appear
inside a <tt>@</tt><span
class="emphasis"><em><tt>type</tt></em></span><tt>{}</tt>
command is a comment. However, many programs that
manipulate bibliography databases will misplace
comments appearing before or after an entry if the
entries are reordered.</p>
<p>BibTeX includes a <tt>@comment</tt> entry for
backwards compatibility with older systems. Unlike TeX,
the percent sign (\%) is <span
class="emphasis"><em>not</em></span> a comment
character in BibTeX.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2921649"
name="id2921649"></a>Special characters</h4>
</div>
</div>
<p>Inserting TeX control sequences<a id="id2921657"
class="indexterm" name="id2921657"></a><a
id="id2921671" class="indexterm"
name="id2921671"></a><a id="id2921681"
class="indexterm" name="id2921681"></a> (to form
accented characters, for example) into a bibliography
entry requires special care. Some styles specify that
entries should be shifted to upper or lowercase, and
shifting the case control sequence names would make
them different.</p>
<p>BibTeX is aware of the case sensitivity of TeX
control sequence names and will not change them. To
specify accents or other special characters, always
enclose them in <tt>{</tt> and <tt>}</tt> braces. The
same treatment should be given to portions of an
author's name that should remain in lowercase even if
the rest of the name is shifted to uppercase.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2921724"
name="id2921724"></a>Bibliography Styles</h3>
</div>
</div>
<p>BibTeX styles<a id="id2921733" class="indexterm"
name="id2921733"></a> are really programs written in a
simple but powerful stack-based language and interpreted
by BibTeX.<sup>[<a id="id2921744" name="id2921744"
href="#ftn.id2921744">117</a>]</sup> Don't confuse
bibliography styles (<tt>BST</tt> files)<a id="id2921775"
class="indexterm" name="id2921775"></a> with LaTeX styles
(<tt>STY</tt> files<a id="id2921796" class="indexterm"
name="id2921796"></a>); they are unrelated. Although a
complete description of the BibTeX language is not
presented here, a short example will help give you a
sense of the language.</p>
<p>Each <tt>BST</tt> file defines a number of functions.
The highest level functions determine how each entry is
formatted: when BibTeX needs to format a
“book” entry, it executes the <tt>book</tt>
function, which must be defined by the <tt>BST</tt> file
in use or an error will result.</p>
<p>Let's consider part of the task of formatting a book
entry. These code fragments are from the standard
bibliography style <tt>plain.bst</tt>. When the
<tt>book</tt> function is ready to output the book title,
it calls the <tt>format.btitle</tt> function, shown
here:</p>
<pre class="screen">
FUNCTION {format.btitle}
{ title emphasize
}
</pre>
<p>This function places the <span
class="emphasis"><em>title</em></span> field on top of
the stack and calls <tt>emphasize</tt>:</p>
<pre class="screen">
FUNCTION {emphasize}
{ duplicate$ empty$
{ pop$ "" }
{ "<span class="emphasis"><em>" swap$ * "</em></span>" * }
if$
}
</pre>
<p>This is what <tt>emphasize</tt> will do when the <span
class="emphasis"><em>title</em></span> is not an empty
field:</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>Duplicate what is on the top of the stack.</p>
</li>
<li>
<p>Test the value on the top of the stack. The
<tt>empty$</tt> function removes the top value from
the stack and places a boolean “true”
value there if what it removed was an empty field,
and a “false” value otherwise.</p>
</li>
<li>
<p>Push <tt>{ pop$ "" }</tt> onto the stack.</p>
</li>
<li>
<p>Push <tt>{ "<emphasis>" swap$ *
"</emphasis>" * }</tt> onto the stack.</p>
</li>
<li>
<p>Test the condition. The <tt>if$</tt> function
takes three values from the stack: a boolean value,
something to do if that value is true, and
something to do if that value is false. In this
case, the title is not an empty field, so the value
is false. The <tt>{ pop$ "" }</tt> value is
discarded, and <tt>{ "<emphasis>" swap$ *
"</emphasis>" * }</tt> is evaluated.</p>
</li>
<li>
<p>Push <tt>{\em</tt>  onto the top of the
stack.</p>
</li>
<li>
<p>Swap the top two items on the stack. Now
\em  is below the book title on the stack.</p>
</li>
<li>
<p>Concatenate the top two items on the stack. Now
the top of the stack holds the value <tt>\bs
em <i><tt>book title</tt></i></tt>.</p>
</li>
<li>
<p>Push <tt>}</tt> onto the top of the stack.</p>
</li>
<li>
<p>Concatenate the top two items on the stack. Now
the top of the stack holds the value
<tt>{\ttopenbrace\bs em <i><tt>{book
title}</tt></i><tt>}</tt>}</tt>.</p>
</li>
</ol>
</div>
<p>The resulting value left on top of the stack when
<tt>emphasize</tt> is finished is the TeX code required
to print the book title with emphasis.</p>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922142"
name="id2922142"></a>Special-purpose styles</h4>
</div>
</div>
<p>A number of styles<a id="id2922152"
class="indexterm" name="id2922152"></a> have been
written to allow you to develop special-purpose
bibliographies. A few of them are listed here:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p><tt>bibunits</tt> supports multiple
bibliographies in different sections of a single
document.</p>
</li>
<li>
<p><tt>chapterbib</tt> supports separate
bibliographies in each chapter of a single
document.</p>
</li>
<li>
<p><tt>makebst</tt> asks a number of questions
about the bibliography style you need and
constructs an appropriate BibTeX style.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2922224"
name="id2922224"></a>Bibliography Database Tools</h3>
</div>
</div>
<p><a id="id2922232" class="indexterm"
name="id2922232"></a><a id="id2922242" class="indexterm"
name="id2922242"></a>There are a lot of programs designed
to help you extract information from bibliography
databases, sort the entries, build subset-bibliographies
that contain only some of the entries from a larger
bibliography, and enter or edit information in an
existing or new database. A lot of these programs are
written in unix shell<a id="id2922253" class="indexterm"
name="id2922253"></a> script languages and rely on
existing text-processing tools like <b>awk</b>,
<b>sed</b>, <b>sort</b>, and <b>grep</b>. Of course, many
of these text-processing tools have been ported to other
operating systems. Most of the utilities written in shell
script languages can be modified to work in other
environments by an ambitious individual.</p>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922304"
name="id2922304"></a>bibsort</h4>
</div>
</div>
<p>The <b>bibsort</b><a id="id2922318"
class="indexterm" name="id2922318"></a> shell script
reorders the entries in a bibliography database into
alphabetical order by entry key name. <tt>@string</tt>
commands are reordered by macro name. This program
cannot deal correctly with comments that appear outside
of an entry. These comments are always associated with
the preceding entry, which is frequently incorrect.</p>
<p>Consider carefully before you reorder the entries in
a database. BibTeX places some restrictions on the
available orderings. Cross references, for example,
must appear before the entry to which they refer.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922350"
name="id2922350"></a>biblook</h4>
</div>
</div>
<p><b>biblook</b><a id="id2922362" class="indexterm"
name="id2922362"></a> is an interactive program that
searches rapidly through a bibliography database for
key words in specified fields. Compound conditions
(using “and” and “or”) can be
specified. The entries located by a search can be saved
into a separate file.</p>
<p>To use <b>biblook</b>, you must preprocess the
database with <b>bibindex</b><a id="id2922400"
class="indexterm" name="id2922400"></a>, which builds a
binary index of the entries. Differences in case are
removed, TeX control sequences are stripped out, and
non-alphanumeric characters are removed. This increases
the likelihood of correct matches.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922415"
name="id2922415"></a>bibclean</h4>
</div>
</div>
<p><b>bibclean</b><a id="id2922428" class="indexterm"
name="id2922428"></a> is a syntax checker for
bibliography databases. Running <b>bibclean</b> before
using <b>bibsort</b>, <b>biblook</b>, or any other
programs described here can eliminate a lot of the
problems these programs may encounter. Although
bibliography databases are plain text files with a very
loose structure, some tools are more easily confused
than others.</p>
<p><b>bibclean</b> identifies possible problems in the
database and pretty-prints it in a standard way. The
following formatting changes are made by
<b>bibclean</b>:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>The structure of each database entry is made
consistent with respect to the following
criteria: the “@” sign that begins
the entry type is moved into column 1; each line
in the entry is changed to contain exactly one
“field = value” pair; and the closing
right brace is placed in column 1 on a line of
its own. Additionally, outer parentheses are
converted into braces; tabs are expanded into
blanks; hyphens in a sequence of pages are
converted into en-dashes; and month names are
converted into standard abbreviations.</p>
</li>
<li>
<p>Long string values are split at a blank and
continued on the following line. The continuation
lines are indented.</p>
</li>
<li>
<p>Individual names in the author and editor
fields are normalized. A single space is placed
after periods that separate initials, and all
entries are converted into “first-name
middle-name last-name” form (instead of
“last-name, first-name” form, for
example).</p>
</li>
<li>
<p>The checksums of ISBN and ISSN numbers are
verified.</p>
</li>
<li>
<p>Uppercase letters that appear outside of
braces are enclosed in braces to prevent them
from being erroneously shifted to lowercase by
some bibliography styles.</p>
</li>
<li>
<p>Text outside of entries is not changed.
Entries are separated by a single blank line.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922594"
name="id2922594"></a>citetags</h4>
</div>
</div>
<p><a id="id2922602" class="indexterm"
name="id2922602"></a>When documents must be transmitted
in “source” form (meaning that the actual
TeX files will be shipped around), it's generally
unnecessary to include entire bibliography databases.
In these cases, it would be more convenient to send
only the bibliography entries that are actually
used.</p>
<p>The <b>citetags</b> program extracts the citations
from an <tt>AUX</tt> file. This list of citations can
be passed to the <b>citefind</b> program to build a
small bibliography database of just the required
entries.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922652"
name="id2922652"></a>citefind</h4>
</div>
</div>
<p><b>citefind</b><a id="id2922665" class="indexterm"
name="id2922665"></a> processes a list of citations and
a list of bibliography databases and writes out a new
database containing just the entries required to match
the citations present. This provides a minimal database
that can be shipped with the document if the TeX files
must be processed on another computer.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922681"
name="id2922681"></a>bibextract</h4>
</div>
</div>
<a id="id2922687" class="indexterm"
name="id2922687"></a>
<p>Given a list of fields and values (specified as
regular expressions), <b>bibextract</b> creates a new
database containing only the entries that match one or
more of the specified values in one or more of the
specified fields. The necessary <tt>@string</tt> and
<tt>@preamble</tt> commands are also included in the
new database.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922726"
name="id2922726"></a>lookbibtex</h4>
</div>
</div>
<p><b>lookbibtex</b><a id="id2922738" class="indexterm"
name="id2922738"></a> offers the same features as
<b>bibextract</b>. However, <b>lookbibtex</b> is
written in <b>Perl</b> rather than a shell script
language.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922771"
name="id2922771"></a>bibdestringify</h4>
</div>
</div>
<p>As the name implies, <b>bibdestringify</b><a
id="id2922786" class="indexterm" name="id2922786"></a>
replaces all <tt>@string</tt> macros in a database by
their textual expansions.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922804"
name="id2922804"></a>edb</h4>
</div>
</div>
<p><b>edb</b><a id="id2922817" class="indexterm"
name="id2922817"></a>, or the “Emacs
Database” is a powerful database programming
system built on top of GNU Emacs Lisp<a id="id2922831"
class="indexterm" name="id2922831"></a>. <b>edb</b> has
been used to write a database-editing mode for BibTeX
databases. It can be extended to handle new entry
types.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922854"
name="id2922854"></a>Emacs BibTeX mode</h4>
</div>
</div>
<p>BibTeX mode<a id="id2922863" class="indexterm"
name="id2922863"></a><a id="id2922876"
class="indexterm" name="id2922876"></a> is a mode for
editing BibTeX databases in emacs. It provides some
template expansion and alignment features, but is
essentially a text-editing mode (as opposed to
<b>edb</b>, which is specifically a database-entry
editor).</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922902"
name="id2922902"></a>bibview</h4>
</div>
</div>
<p><b>bibview</b><a id="id2922915" class="indexterm"
name="id2922915"></a> is an X Window-based program for
editing bibliography databases. Figure <a
href="ch12.html#fig.bib.bibview"
title="Figure 12.1. Editing an article entry with \program{bibview}">
Figure 12.1</a> shows an example of <b>bibview</b>
editing a database entry.</p>
<div class="figure">
<a id="fig.bib.bibview" name="fig.bib.bibview"></a>
<p class="title"><b>Figure 12.1. Editing an
article entry with \program{bibview}</b></p>
<pre class="screen">
FIXME:
</pre>
</div>
<p>Unlike the <b>xbibtex</b> program, <b>bibview</b>
can handle optional and ignored fields in bibliography
entries. It does not handle new entry types.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2922989"
name="id2922989"></a>xbibtex</h4>
</div>
</div>
<p><b>xbibtex</b><a id="id2923002" class="indexterm"
name="id2923002"></a> is an X Window-based program for
creating bibliography databases. Figure <a
href="ch12.html#fig.bib.xbibtex"
title="Figure 12.2. Editing an article entry with \program{xbibtex}">
Figure 12.2</a> shows an example of <b>xbibtex</b>
creating a bibliography entry.</p>
<div class="figure">
<a id="fig.bib.xbibtex" name="fig.bib.xbibtex"></a>
<p class="title"><b>Figure 12.2. Editing an
article entry with \program{xbibtex}</b></p>
<pre class="screen">
FIXME:
</pre>
</div>
<p>It does not appear that <b>xbibtex</b> can edit
existing entries. It also does not handle unexpected
fields or new entry types.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h4 class="title"><a id="id2923067"
name="id2923067"></a>bibdb</h4>
</div>
</div>
<p>The <b>bibdb</b><a id="id2923082" class="indexterm"
name="id2923082"></a> program is an MS-DOS-based
bibliography database editor. The screen capture in
Figure <a href="ch12.html#fig.bib.bibdb"
title="Figure 12.3. Editing an article entry with \program{bibdb}">
Figure 12.3</a> shows an example of <b>bibdb</b>
editing a bibliography entry. <b>bibdb</b> displays
only fields that have values.</p>
<div class="figure">
<a id="fig.bib.bibdb" name="fig.bib.bibdb"></a>
<p class="title"><b>Figure 12.3. Editing an
article entry with \program{bibdb}</b></p>
<pre class="screen">
FIXME:
</pre>
</div>
<p>Although it does not handle arbitrary fields,
<b>bibdb</b> has a large selection of optional fields.
It does not handle new entry types.</p>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2923157"
name="id2923157"></a>Tib</h2>
</div>
</div>
<p><b>Tib</b><a id="id2923170" class="indexterm"
name="id2923170"></a> is another tool for maintaining
bibliography databases. The format of a <b>Tib</b> database
is the same as the format for the <b>troff</b> <b>refer</b>
processor.<sup>[<a id="id2923201" name="id2923201"
href="#ftn.id2923201">118</a>]</sup> An example entry for
<span class="emphasis"><em>The TeXbook</em></span> is shown
in Example <a href="ch12.html#ex.tibdb"
title="Example 12.2. A Tib style database entry">Example 12.2</a>.</p>
<div class="example">
<a id="ex.tibdb" name="ex.tibdb"></a>
<p class="title"><b>Example 12.2. A Tib style
database entry</b></p>
<pre class="screen">
</pre>
</div>
<p>Unlike BibTeX, which relies on the citation macros to
format citations correctly, <b>Tib</b> actually replaces
the citations<a id="id2923270" class="indexterm"
name="id2923270"></a> with the appropriate information. In
other words, <b>Tib</b>-style citations are not control
sequences; they are just text strings. The <b>Tib</b>
processor creates an entirely new document file that should
be passed to TeX.</p>
<p>The general format of a <b>Tib</b> citation is
<tt>[.</tt><tt><i><tt>citation
key(s)</tt></i></tt><tt>.]</tt>. <b>Tib</b> databases do
not contain a key field; instead, the citation keys can
come from any fields in the database entry (you can exclude
some fields if you wish). The punctuation around citations
in square brackets is adjusted by <b>Tib</b>. An alternate
form of citation using angle brackets inserts a citation
without adjusting any of the surrounding punctuation.</p>
<p>The bibliography is inserted into your document wherever
the string “<tt>.[]</tt>” occurs at the
beginning of a line. Analogous to BibTeX, the format of the
reference list is controlled by a <b>Tib</b> style. Styles
for roughly fifteen technical journals are provided.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2923378"
name="id2923378"></a>Making Indexes</h2>
</div>
</div>
<p>Constructing an index<a id="id2923387" class="indexterm"
name="id2923387"></a><a id="id2923394" class="indexterm"
name="id2923394"></a> for a TeX document is relatively
straightforward. First, you must identify each occurrence
of each word or concept that you want indexed. To do this,
you must insert \index entries into your document.<sup>[<a
id="id2923416" name="id2923416"
href="#ftn.id2923416">119</a>]</sup> When you format your
document containing the index entries, an <tt>IDX</tt>
file<a id="id2923469" class="indexterm"
name="id2923469"></a> is created that contains all of the
entries along with the page number where each entry
occurred.</p>
<p>The <b>MakeIndex</b><a id="id2923488" class="indexterm"
name="id2923488"></a> program<sup>[<a id="id2923499"
name="id2923499" href="#ftn.id2923499">120</a>]</sup> reads
the <tt>IDX</tt> file, sorts and collates the entries, and
writes an <tt>IND</tt> file<a id="id2923532"
class="indexterm" name="id2923532"></a>. The
<b>MakeIndex</b> program can also load an index style file,
discussed in the next section.</p>
<p>When LaTeX processes your document, it inserts the
contents of the <tt>IND</tt> file into your document at the
point where you use the \printindex control sequence.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2923569"
name="id2923569"></a>Index Entries</h3>
</div>
</div>
<p>Index entries<a id="id2923578" class="indexterm"
name="id2923578"></a><a id="id2923588" class="indexterm"
name="id2923588"></a><a id="id2923598" class="indexterm"
name="id2923598"></a> use special characters to identify
different types of entries (simple entries,
multiple-level entries, see-also's, etc.). The exact
characters used are controlled by the index style file,
and it may be convenient to select an alternate style.
For example, <b>MakeIndex</b> uses the double-quote
character by default to identify literal characters in
the index entry, but the German<a id="id2923626"
class="indexterm" name="id2923626"></a> Babel style makes
the literal double quote character a shortcut for the
umlaut accent; this use makes it unavailable as the
quotation character in index entries.</p>
<p>Another point to consider when coding index entries is
that the arguments to the index macros are expanded by
TeX. This makes it difficult to insert some control
sequences<a id="id2923644" class="indexterm"
name="id2923644"></a> in an index entry (for example
<tt><a id="id2923661" class="indexterm"
name="id2923661"></a></tt>). In LaTeX, you can combat
this problem by using the control sequence: <tt><a
id="id2923682" class="indexterm"
name="id2923682"></a></tt>.</p>
<p>A complete list of the different kinds of index
entries that can be created is included in <span
class="emphasis"><em>{MakeIndex: An Index Processor for
LaTeX}</em></span> [<a
href="bi01.html#ll:makeindex">ll:makeindex</a>].</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2923830"
name="id2923830"></a>Index Format</h2>
</div>
</div>
<p>The format of the index is controlled by both the index
style (which specifies whether or not headings should be
present, what the delimiters should be, etc.) and the
definition of several control sequences:<sup>[<a
id="id2923841" name="id2923841"
href="#ftn.id2923841">121</a>]</sup></p>
<div class="variablelist">
<dl>
<dt><span class="term">\bs\texttt{theindex}</span></dt>
<dd>
<p>Controls what happens just before the index is
printed. This sequence should establish a new page,
set up running headers and footers, select multiple
columns, and do whatever other global setup is
desired.</p>
</dd>
<dt><span class="term">\bs\texttt{item}</span></dt>
<dd>
<p>Executed just before a first-level entry.</p>
</dd>
<dt><span class="term">\bs\texttt{subitem}</span></dt>
<dd>
<p>Executed just before a second-level entry.</p>
</dd>
<dt><span
class="term">\bs\texttt{subsubitem}</span></dt>
<dd>
<p>Executed just before a third-level entry.</p>
</dd>
<dt><span
class="term">\bs\texttt{indexspace}</span></dt>
<dd>
<p>Executed between alphabetical sections.</p>
</dd>
<dt><span
class="term">\bs\texttt{endtheindex}</span></dt>
<dd>
<p>Controls what happens just after the index is
printed. This sequence should undo anything that was
started by \theindex.</p>
</dd>
</dl>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2923963"
name="id2923963"></a>Special-purpose styles</h2>
</div>
</div>
<p>A number of styles have been written to allow you to
develop special-purpose indexes. <b>multind</b> and
<b>index</b> are described here.</p>
<p><tt>multind</tt> supports multiple indexes in a single
document.</p>
<p><tt>index</tt> is a reimplementation of the LaTeX
indexing commands. It stores index entries in the
<tt>AUX</tt> files so that portions of a document can be
reformatted without losing the entire index. It also
provides support for multiple indexes and replaces the
<span class="emphasis"><em>makeidx</em></span> style
option.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2924031"
name="id2924031"></a>Making Glossaries</h2>
</div>
</div>
<p><a id="id2924039" class="indexterm"
name="id2924039"></a><a id="id2924046" class="indexterm"
name="id2924046"></a>The LaTeX command \glossary can be
used to accumulate words and concepts for a document
glossary. The output, stored in a <tt>GLO</tt> file<a
id="id2924076" class="indexterm" name="id2924076"></a>, is
very similar to an <tt>IDX</tt> file<a id="id2924094"
class="indexterm" name="id2924094"></a>. Like an index, the
glossary file can be processed by <b>MakeIndex</b><a
id="id2924109" class="indexterm" name="id2924109"></a> to
produce a sorted list of terms. To produce a glossary, you
must create an index style for the glossary. Here is a
minimal <tt>glossary.ist</tt>:</p>
<pre class="screen">
keyword "\\glossaryentry"
preamble "\n\\begin{theglossary}\n"
postamble "\n\\end{theglossary}\n"
</pre>
<p>The output file that <b>MakeIndex</b> creates will have
to be edited by hand, naturally, in order to incorporate
the definitions of the entries. You will also have to
define an appropriate glossary environment by defining the
control sequences<a id="id2924153" class="indexterm"
name="id2924153"></a> used to make the glossary:</p>
<div class="variablelist">
<dl>
<dt><span
class="term">\bs\texttt{theglossary}</span></dt>
<dd>
<p>Controls what happens just before the glossary is
printed. This sequence should establish a new page,
set up running headers and footers, and do whatever
other global setup is desired.</p>
</dd>
<dt><span class="term">\bs\texttt{item}</span></dt>
<dd>
<p>Executed just before a glossary item.</p>
</dd>
<dt><span
class="term">\bs\texttt{endtheglossary}</span></dt>
<dd>
<p>Controls what happens just after the glossary is
printed. This sequence should undo anything that was
started by \theglossary.</p>
</dd>
</dl>
</div>
<p>Finally, you will have to \input or \include the
glossary in your document.</p>
</div>
<div class="footnotes">
<br />
<hr width="100" align="left" />
<div class="footnote">
<p><sup>[<a id="ftn.id2920553" name="ftn.id2920553"
href="#id2920553">115</a>]</sup> {For Plain TeX and other
formats derived from Plain, the <tt>btxmac.tex</tt>
macros provide these commands.}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2921530" name="ftn.id2921530"
href="#id2921530">116</a>]</sup> {This example uses Plain
TeX syntax rather than a LaTeX <tt>\bs newcommand</tt>,
because BibTeX databases can be used from Plain TeX as
well as LaTeX.}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2921744" name="ftn.id2921744"
href="#id2921744">117</a>]</sup> {A complete description
of BibTeX's programming language can be found in <span
class="emphasis"><em>Designing BibTeX
Styles</em></span> [<a
href="bi01.html#op:btxhak">op:btxhak</a>].}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2923201" name="ftn.id2923201"
href="#id2923201">118</a>]</sup> {<span
class="emphasis"><em>refer</em></span> databases can
reportedly be converted to and from BibTeX format.}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2923416" name="ftn.id2923416"
href="#id2923416">119</a>]</sup> {The format you use must
also provide support for indexing. In LaTeX<a
id="id2923420" class="indexterm" name="id2923420"></a>,
most of the support is built in, but you must use the
makeidx style option<a id="id2923437" class="indexterm"
name="id2923437"></a>. In Plain TeX and other
Plain-derived formats, input the <tt>idxmac.tex</tt>
macros at the top of your document. The rest of this
section assumes that you use LaTeX, although the
principles hold for any macro package that supports
indexing.}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2923499" name="ftn.id2923499"
href="#id2923499">120</a>]</sup> {Frequently called
<tt>makeidx</tt> on MS-DOS systems.}</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2923841" name="ftn.id2923841"
href="#id2923841">121</a>]</sup> {In LaTeX, these control
sequences have default definitions that you may not need
to change.}</p>
</div>
</div>
</div>
<div class="navfooter">
<table width="100%" summary="Navigation table">
<tr>
<td width="40%" align="left"><a
title="Chapter 11. Introducing MetaFont"
href="ch11.html"><img src="figures/nav-prev.png"
alt="Prev" border="0" /></a> </td>
<td width="20%" align="center"><a title="Making TeX Work"
href="index.html"><img src="figures/nav-home.png"
alt="Home" border="0" /></a></td>
<td width="40%" align="right"> <a
title="Part III. A Tools Overview"
href="pt03.html"><img src="figures/nav-next.png"
alt="Next" border="0" /></a></td>
</tr>
<tr>
<td width="40%" align="left">
Chapter 11. Introducing MetaFont </td>
<td width="20%" align="center"><a
title="Part II. Elements of a Complex Document"
href="pt02.html"><img src="figures/nav-up.png" alt="Up"
border="0" /></a></td>
<td width="40%" align="right"> Part III. A
Tools Overview</td>
</tr>
</table>
</div>
</body>
</html>
|