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
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "/dtds/html4t.dtd">
<!--Generated from beginlatex.XML.xml with typebook-html.xslt on 2005-04-04T01:02:36--><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Formatting information: Chapter 7 — Textual tools</title>
<link rel="stylesheet" href="typebook.css" type="text/css">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<table width="100%">
<tr>
<th class="title" width="66%">
<h1><a name="doctitle">Formatting information</a></h1>
<h2>A beginner's introduction to typesetting with
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></h2>
<h3>Chapter 7 — Textual tools</h3>
<h3>Peter Flynn</h3>
<h4>Silmaril Consultants<br>Textual Therapy Division
</h4><br>v. 3.6 (March 2005)
</th>
<td class="toc" width="33%">
<h4><a name="doctoc">Contents</a></h4>
<dl>
<dd class=""><a href="intro.html#intro">Introduction</a></dd>
<dd class=""><a href="foreword.html#foreword">Foreword</a></dd>
<dd class=""><a href="preface.html#preface">Preface</a></dd>
</dl>
<ol>
<li class=""><a href="chapter1.html#get">Installing <span class="TEX">T<span class="E">E</span>X</span> and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></li>
<li class=""><a href="chapter2.html#plaintext">Using your editor to create documents</a></li>
<li class=""><a href="chapter3.html#basic">Basic document structures</a></li>
<li class=""><a href="chapter4.html#process">Typesetting, viewing and printing</a></li>
<li class=""><a href="chapter5.html#ctan">CTAN, packages, and online help</a></li>
<li class=""><a href="chapter6.html#otherdoc">Other document structures</a></li>
<li class="current"><a href="chapter7.html#texttools">Textual tools</a></li>
<li class=""><a href="chapter8.html#typo">Fonts and layouts</a></li>
<li class=""><a href="chapter9.html#macros">Programmability (macros)</a></li>
<li class=""><a href="chapter10.html#compat">Compatibility with other systems</a></li>
</ol>
<ol type="A">
<li class=""><a href="appendixA.html#cnf">Configuring <span class="TEX">T<span class="E">E</span>X</span> search paths</a></li>
<li class=""><a href="appendixB.html#tugform"><span class="TEX">T<span class="E">E</span>X</span> Users Group membership</a></li>
<li class=""><a href="appendixC.html#asciicharset">The ASCII character set</a></li>
<li class=""><a href="appendixD.html#gfdl">GNU Free Documentation License</a></li>
</ol>
<dl>
<dd class=""><a href="bibliography.html#biblio">References</a></dd>
<dd class=""><a href="index.html#index">Index</a></dd>
</dl>
</td>
</tr>
<tr>
<td class="credits">
<p>This edition of <cite>Formatting
Information</cite> was prompted by the generous help I
have received from <span class="TEX">T<span class="E">E</span>X</span> users too numerous to mention
individually. Shortly after TUGboat published the November
2003 edition, I was reminded by a spate of email of the
fragility of documentation for a system like <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> which is
constantly under development. There have been revisions to
packages; issues of new distributions, new tools, and new
interfaces; new books and other new documents; corrections to
my own errors; suggestions for rewording; and in one or two
cases mild abuse for having omitted package X which the author
felt to be indispensable to users. ¶ I am grateful as always to the people who sent me
corrections and suggestions for improvement. Please keep them
coming: only this way can this book reflect what people
want to learn. The same limitation still applies, however: no
mathematics, as there are already a dozen or more excellent
books on the market — as well as other online
documents — dealing with mathematical typesetting in
<span class="TEX">T<span class="E">E</span>X</span> and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in finer and better detail than I am
capable of. ¶ The structure remains the same, but I have revised and
rephrased a lot of material, especially in the earlier
chapters where a new user cannot be expected yet to have
acquired any depth of knowledge. Many of the screenshots have
been updated, and most of the examples and code fragments have
been retested. ¶ As I was finishing this edition, I was asked to review
an article for <cite><a href="http://www.tug.org/pracjourn/" name="C3">The Prac<span class="TEX">T<span class="E">E</span>X</span> Journal</a></cite>, which
grew out of the Practical <span class="TEX">T<span class="E">E</span>X</span> Conference in 2004. The
author specifically took the writers of documentation to task
for failing to explain things more clearly, and as I read
more, I found myself agreeing, and resolving to clear up some
specific problems areas as far as possible. It is very
difficult for people who write technical documentation to
remember how they struggled to learn what has now become a
familiar system. So much of what we do is second nature, and a
lot of it actually has nothing to do with the software, but
more with the way in which we view and approach information,
and the general level of knowledge of computing. If I have
obscured something by making unreasonable assumptions about
<em>your</em> knowledge, please let me know so
that I can correct it.
<p>Peter Flynn is author of <cite><a href="bibliography.html#htmlbook" name="C4">The HTML Handbook</a></cite> and <cite><a href="bibliography.html#sgmltools" name="C5">Understanding SGML and XML Tools</a></cite>, and editor of <cite><a href="http://www.ucc.ie/xml/" name="C6">The XML FAQ</a></cite>.
</p>
</p>
</td>
<td class="legal">
<p>
<p>This document is Copyright © 1999–2005 by
Silmaril Consultants under the terms of what is now the GNU
Free Documentation License (copyleft).
</p>
<p>Permission is granted to copy, distribute and/or modify
this document under the terms of the GNU Free Documentation
License, Version 1.2 or any later version published by the
Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts. A copy of the
license is included in the section entitled <cite><a href="http://www.fsf.org/copyleft/fdl.html" name="C1">The GNU Free Documentation License</a></cite>.
</p>
<p>You are allowed to distribute, reproduce, and modify it
without fee or further requirement for consent subject to the
conditions in <a href="appendixD.html#gfdl-4">section D.5</a>. The author has
asserted his right to be identified as the author of this
document. If you make useful modifications you are asked to
inform the author so that the master copy can be updated. See
the full text of the License in <a href="appendixD.html#gfdl">Appendix D</a>.
</p>
</p>
</td>
</tr>
</table>
<div class="chapter">
<table width="100%">
<tr>
<td align="center"><small><i class="chaphead"><b><a name="texttools">CHAPTER</a></b></i></small><br><table border="1">
<tr>
<td class="chapno">7</td>
</tr>
</table>
</td>
<td><pre class="spacing"></pre></td>
<td>
<p> </p>
<h1>Textual tools</h1>
</td>
<td class="toc">
<p> </p>
<ol>
<li><a href="#quotations">Quotations</a></li>
<li><a href="#footnotes">Footnotes and end-notes</a></li>
<li><a href="#marginals">Marginal notes</a></li>
<li><a href="#xrefs">Cross-references</a></li>
<li><a href="#indexes">Indexes and glossaries</a></li>
<li><a href="#multicols">Multiple columns</a></li>
</ol>
</td>
<td align="right"><a href="#doctoc"><img src="top.png" title="Table of Contents" width="32" alt="ToC" align="right" border="0"></a></td>
</tr>
</table><a name="I110"></a><p>Every text-handling system needs to support a repertoire of
tools for doing things with text. <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> implements many
dozens, of which a small selection of the most frequently used
is given here:
</p>
<ul>
<li>
<p>offset quotations (sometimes called ‘block
quotes’);
</p>
</li>
<li>
<p>footnotes and end-notes;</p>
</li>
<li>
<p>marginal notes;</p>
</li>
<li>
<p>cross-references, both normal ones and bibliographic
citations;
</p>
</li>
<li>
<p>indexes and glossaries;</p>
</li>
<li>
<p>typesetting in multiple columns.</p>
</li>
</ul>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.1 <a name="quotations">Quotations</a></h2>
<p>Direct speech and short quotes within a sentence
‘like this’ are done with simple
quotation marks as described in <a href="chapter2.html#quotes">section 2.6</a>. Sometimes, however, you may want longer
quotations set as a separate paragraph. Typically these are
indented from the surrounding text. <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has two
environments for doing this.
</p>
<p>Such quotations are often set in a smaller size of type,
although this is not the default, hence the use of the
<code class="command"><a name="c157">\small</a></code> command in the second example. The
inclusion of the bibliographic citation at the end is
optional: here it is done with a non-standard command
<code class="command"><a name="c158">\citequote</a></code> which I invented for this example
(there is more about how to do things like this in <a href="chapter9.html#macros">Chapter 9</a>).
</p>
<blockquote>
<dl>
<dt><b>The <span style="font-weight:normal; "><span class="package"><a name="m58">quote</a></span></span>
environment</b></dt>
<dd>
<p>is for up to a line of text each per (short)
quotation, with the whole thing indented from the
previous paragraph but with no additional indentation on
each quote;
</p>
<blockquote class="example"><pre>
\begin{quote}
Do, Ronny, Do. \textit{Nancy Reagan}
Da Do Ron Ron. \textit{The Crystals}
\end{quote}
</pre><p class="example">Do, Ronny, Do. <span style="font-style:italic; ">Nancy
Reagan</span></p>
<p class="example">Da Do Ron Ron. <span style="font-style:italic; ">The
Crystals</span></p>
</blockquote>
</dd>
<dt><b>The <span style="font-weight:normal; "><span class="package"><a name="m59">quotation</a></span></span>
environment</b></dt>
<dd>
<p>is for longer passages (a paragraph or more) of a
single quotation, where not only is the block of text
indented, but each paragraph of it also has its own
extra indentation on the first line.
</p>
<blockquote class="example"><pre>
\begin{quotation}\small
At the turn of the century William Davy,
a Devonshire parson, finding errors in
the first edition of his \titleof{davy},
asked for a new edition to be printed.
His publisher refused and Davy purchased
a press, type, and paper. He harnessed
his gardener to the press and apprenticed
his housemaid to the typesetting. After
twelve years' work, a new edition
of fourteen sets of twenty-six volumes
was issued---which surely indicates that,
when typomania is coupled with religious
fervour, anything up to a miracle may be
achieved.\citequote[p.76]{ryder}
\end{quotation}
</pre><blockquote class="citation"><a name="K33"> </a><p>At the turn of the century William Davy, a
Devonshire parson, finding errors in the first
edition of his <cite><a href="bibliography.html#davy" name="C34">A System of Divinity</a></cite>,
asked for a new edition to be printed. His publisher
refused and Davy purchased a press, type, and paper.
He harnessed his gardener to the press and
apprenticed his housemaid to the typesetting. After
twelve years' work, a new edition of fourteen
sets of twenty-six volumes was issued---which surely
indicates that, when typomania is coupled with
religious fervour, anything up to a miracle may be
achieved.
</p>
<p class="citation">John Ryder (1976), <cite><a href="bibliography.html#ryder">Printing for Pleasure</a></cite>, p.76
</p>
</blockquote>
</blockquote>
</dd>
</dl>
</blockquote>
</div>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.2 <a name="footnotes">Footnotes and end-notes</a></h2><a name="I111"></a><p>The command <code class="command"><a name="c159">\footnote</a></code>, followed by the
text of the footnote in curly braces, will produce an
auto-numbered footnote with a raised small number where you
put the command, and the numbered text automatically printed
at the foot of the page.<sup><a href="#F39">1</a></sup> The number is reset to 1 at the start of each
chapter (but you can override that and make them run
continuously throughout the document, or even restart at 1 on
each page or section).
</p>
<p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> automatically creates room for the footnote, and
automatically reformats it if you change your document in such
a way that the point of attachment and the footnote would move
to the next (or preceding) page.
</p>
<p>Because of the way <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> reads the whole footnote before
doing anything with it, you can't use
<code class="command"><a name="c160">\verb</a></code> (<a href="chapter6.html#inlineverb">section 6.6.1</a>) alone
in footnotes: either precede it with
<code class="command"><a name="c161">\protect</a></code> or use [abuse?] the
<code class="command"><a name="c162">\url</a></code> command instead, which you should be
using for Web and email addresses in any case).
</p>
<p>Footnotes inside minipages (see <a href="chapter6.html#boxes">section 6.7</a>) produce lettered notes instead of
numbered ones, and they get printed at the bottom of the
minipage, <em>not</em> the bottom of the physical
page (but this too can be changed).
</p>
<p>There is a package to hold over your footnotes and make
them print at the end of the chapter instead
(<span class="package"><a name="m60">endnote</a></span>) or at the end of the whole
document, and there is a package to print many short footnotes
in a single footnoted paragraph so they take up less space
(<span class="package"><a name="m61">fnpara</a></span>). It is also possible to have
several separate series of footnotes active simultaneously,
which is useful in critical editions or commentaries: a
numbered series may be used to refer to an original
author's notes; a lettered series can be used for notes
by a commentator or authority; and a third series is available
for your own notes. It is also possible to format footnotes
within footnotes.
</p>
<p>If your footnotes are few and far between, you may want to
use footnote symbols instead of numbers. You can do this by
redefining the output of the footnote counter to be the
<code class="command"><a name="c163">\fnsymbol</a></code> command:
</p>
<blockquote><pre>
\renewcommand{\thefootnote{\fnsymbol{footnote}}
</pre></blockquote>
<p>There are also ways to refer more than once to the
same footnote, and to defer the positioning of the footnote if
it occurs in a float like a Table or Figure, where it might
otherwise need to move to a different page.
</p>
<ol class="footnotes" start="1">
<li><a name="F39">Like this.</a></li>
</ol>
</div>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.3 <a name="marginals">Marginal notes</a></h2><a name="I112"></a><table width="100%">
<tr>
<td width="95%" valign="top">You can add marginal notes to your text<a href="#M6" title="See margin">↞</a> instead of
(or as well as) footnotes. You need to make sure that you have
a wide-enough margin, of course: use the
<span class="package"><a name="m62">geometry</a></span> package (see <a href="chapter5.html#colorpkg">section 5.1.1</a>) to allocate enough space, otherwise
the notes will be too cramped. There are several packages to
help with formatting marginal notes, but the simplest way is
to define it yourself. Add this new command to your
preamble:
</td>
<td width="5%" valign="top"><small><a name="M6">Like this.</a></small></td>
</tr>
</table>
<blockquote><pre>
\newcommand{\marginal}[1]{%
\leavevmode\marginpar{\tiny\raggedright#1\par}}
</pre></blockquote>
<table width="100%">
<tr>
<td width="95%" valign="top">Then you can use <code class="literal">\marginal{Some
text}</code><a href="#M7" title="See margin">↞</a> Be careful, however, because marginal
notes are aligned with the line where the command starts, so a
very long one followed too closely by another will cause
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to try and
adjust the position so they don't overlap.
</td>
<td width="5%" valign="top"><small><a name="M7">Some text where you need
it.</a></small></td>
</tr>
</table>
<p>We're jumping ahead a bit here, as we haven't
covered how to define your own commands yet. I won't even
try to explain it here, although the attentive reader can
probably deduce some of it by inspection. See <a href="chapter9.html#macros">Chapter 9</a> for more information about making up your
own commands.
</p>
</div>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4 <a name="xrefs">Cross-references</a></h2><a name="I113"></a><p>This is one of the most powerful features of <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. You
can label any point in a document with a name you make up, and
then refer to it by that name from anywhere else in the
document, and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will always work out the cross-reference
number for you, no matter how much you edit the text or move
it around.
</p>
<p>A similar method is used to cite documents in a
bibliography or list of references, and there are packages to
sort and format these in the correct manner for different
journals.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.1 <a name="normalxref">Normal cross-references</a></h3>
<p>You label a place in your document by using the command
<code class="command"><a name="c164">\label</a></code> followed by a short name you make
up, in curly braces:<sup><a href="#F40">2</a></sup> we've already seen this done for labelling
Figures and Tables.
</p>
<blockquote><pre>
\section{New Research}
\label{newstuff}
</pre></blockquote>
<p>You can then refer to this point from anywhere in the
same document with the command <code class="command"><a name="c165">\ref</a></code>
followed by the name you used, e.g.
</p>
<blockquote class="example"><pre>
In \S~\ref{newstuff} there is a list of recent
projects.
</pre><p class="example">In <a href="chapter7.html#normalxref">§ 7.4.1</a>
there is a list of recent projects.
</p>
</blockquote>
<p>(The <code class="command"><a name="c166">\S</a></code> command produces a section
sign (§) and the
<code class="command"><a name="c167">\P</a></code> command produces a paragraph sign
(¶).)
</p>
<p>If the label is in normal text, the reference will
provide the current chapter or section number or both
(depending on the current document
class).<sup><a href="#F41">3</a></sup> If the label
was inside a Table or Figure, the reference provides the
Table number or Figure number prefixed by the chapter
number. A label in an enumerated list will provide a
reference to the item number. If there is no apparent
structure to this part of the document, the reference will
be null. Labels must be unique (that is, each value must
occur only <em>once</em> as a label within a
single document), but you can have as many references to
them as you like.
</p>
<p>Note the use of the unbreakable space
(<code class="literal">~</code>) between the <code class="command"><a name="c168">\ref</a></code>
and the word before it. This prints a space but prevents the
line ever breaking at that point, should it fall close to
the end of a line.
</p>
<p>The command <code class="command"><a name="c169">\pageref</a></code> followed by any
of your label values will provide the page number where the
label occurred, regardless of the document structure. This
makes it possible to refer to something by page number as
well as its <code class="command"><a name="c170">\ref</a></code> number, which is useful
to readers in very long documents.
</p>
<p>Unresolved references are printed as two question
marks, and also cause a warning message at the end of the
log file. There's never any harm in having
<code class="command"><a name="c171">\label</a></code>s you don't refer to, but using
<code class="command"><a name="c172">\ref</a></code> when you don't have a matching
<code class="command"><a name="c173">\label</a></code> is an error.
</p>
<ol class="footnotes" start="2">
<li><a name="F40">This section is labelled
‘<code>normalxref</code>’,
for example.</a></li>
<li><a name="F41">Thus I can
refer here to
<code class="literal">\ref{normalxref}</code> and get the
value <a href="chapter7.html#normalxref">section 7.4.1</a>.</a></li>
</ol>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2 <a name="bib">Bibliographic references</a></h3><a name="I114"></a><a name="I115"></a><p>The mechanism used for references to reading lists and
bibliographies is almost identical to that used for normal
cross-references. Although it is possible to type the
details of each citation manually, there is a companion
program to <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> called <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>, which manages
bibliographic references automatically. This reduces the time
needed to maintain and format them, and dramatically
improves accuracy. Using <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> means you only ever have
to type the bibliographic details of a work once. You can
then cite it in any document you write, and it will get
formatted automatically to the style you specify.
</p>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2.1 <a name="citation">Citing references</a></h4>
<p><span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> works exactly the same way as other
bibliographic databases: you keep details of every
document you want to refer to in a separate file, using
<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>'s own format (see example below). Many
writers make a habit of adding the details of every book
and article they read, so that when they write a document,
these entries are always available for reference. You give
each entry a short label, just like you do with normal
cross-references (see <a href="chapter7.html#normalxref">section 7.4.1</a>), and
it is this label you use to refer to in your own documents
when you cite the work using the <code class="command"><a name="c174">\cite</a></code>
command:
</p>
<blockquote><pre>
...as has clearly been shown by Fothergill~\cite{fg}.
</pre></blockquote>
<p>By default, this creates a cross-reference number in
square brackets [1] which is a common style in the
Natural Sciences (see <a href="chapter7.html#othercite">section 7.4.2.5</a> for
details of how to change this). There are dozens of
alternative citation formats in extra packages, including
the popular author/year format:
</p>
<blockquote class="example"><pre>
...as has clearly been shown
by~\citeauthoryear{fg}.
</pre><p class="example">...as has clearly been shown by <a href="bibliography.html#fg" name="K35">Fothergill</a> (1929).
</p>
</blockquote>
<p>Note that in this case you don't type the
author's name because it is automatically extracted
by <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>. There are lots of variants on this technique
in many packages, allowing you to phrase your sentences
with references in as natural a way as possible, and rely
on <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> to insert the right data. (If you examine the
source of this document you'll find I use some
homebrew commands like <code class="command"><a name="c175">\authorof</a></code> and
<code class="command"><a name="c176">\titleof</a></code> which I use for a similar
purpose.)
</p>
<p>To print the bibliographic listing (usually called
‘References’ in articles and
‘Bibliography’ in books and
reports), add these two lines towards the end of your
document, or wherever you want it printed, substituting
the name of your own <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> file and the name of your
chosen bibliography style:
</p>
<blockquote><pre>
\bibliographystyle{ieeetr}
\bibliography{mybib}
</pre></blockquote>
<ul>
<li>
<p>The <code class="command"><a name="c177">\bibliography</a></code> command is
followed by the filename of your <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> file
<em>without</em> the
<code>.bib</code> extension.
</p>
</li>
<li>
<p>The <code class="command"><a name="c178">\bibliographystyle</a></code> command
is followed by the name of any of <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>'s
supported bibliography styles, of which there are many
dozens available from <small><a href="chapter5.html#CTAN" class="acroref" name="A184" title="Comprehensive Archive Network">CTAN</a></small>.<sup><a href="#F42">4</a></sup></p>
</li>
</ul>
<p>The styles <span class="option"><a name="o13">plain</a></span> and
<span class="option"><a name="o14">alpha</a></span> are two common generic styles used
for drafts. The example above uses <a name="IEEETR" class="acroref">Transactions of the Institute of Electrical
and Electronics Engineers</a> (<small>IEEETR</small>).
</p>
<ol class="footnotes" start="4">
<li><a name="F42">The style
shown in the example here provides formatting
according to the specifications for Transactions
of the IEEE (revised).</a></li>
</ol>
</div>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2.2 <a name="bibtex">Running <i><a name="p180">bibtex</a></i></a></h4>
<p>When you run the <i><a name="p181">bibtex</a></i>
program, the details of every document you have cited will
be extracted from your database, formatted according to
the style you specify, and stored in a temporary
bibliographic (<code>.bbl</code>) file with a
label corresponding to the one you used in your citation,
ready for <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to use. This is entirely automatic: all
you do is cite your references in your <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> document
using the labels you gave the entries in your <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>
file, and run the <i><a name="p182">bibtex</a></i>
program.
</p>
<p>After processing your file with <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, run
<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> on it by clicking on the
<span class="guiicon"><span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span></span> toolbar icon (if your editor
has one), or use the
<span class="guimenu">TeX</span>→<span class="guimenuitem">BibTeX
File</span> menu entry, or type the command
<code class="literal">bibtex</code> followed by the name of your
document (without the <code>.tex</code>
extension). When you run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> again it will use the
<code>.bbl</code> file which <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> created,
and subsequent runs of <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will format the correct
citation numbers (or author/year, or whatever format you
are using).
</p>
<blockquote><pre>
$ latex mybook
$ bibtex mybook
$ latex mybook
$ latex mybook
</pre></blockquote>
<p>Because of this three-stage process, you always get a
warning message about an ‘unresolved
reference’ the first time you add a new
reference to a previously uncited work. This will
disappear after subsequent runs of
<i><a name="p183">bibtex</a></i> and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.
</p>
<p>In practice, authors tend to run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from time to
time during writing anyway, so they can preview the
document. Just run <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> after adding a new
<code class="command"><a name="c179">\cite</a></code> command, and subsequent runs of
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will incrementally incorporate all references
without you having to worry about it. You only need to
follow the full formal sequence (<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>,
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>) when you have finished writing and
want to ensure that all references have been
resolved.
</p>
</div>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2.3 <a name="bibspec"><span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> format</a></h4>
<p>The format for the <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> file is specified in the
<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> documentation (see <a href="chapter5.html#packagedoc">section 5.1.2</a>
for how to find and print it). You create a file with a
name ending in <code>.bib</code>, and add your
entries, for example:
</p>
<blockquote><pre>
@book{fg,
title = {{An Innkeeper's Diary}},
author = {John Fothergill},
edition = {3rd},
publisher = {Penguin},
year = 1929,
address = {London}
}
</pre></blockquote>
<p>There is a prescribed set of fields for each of a
dozen or so types of document: book, article (in a
journal), article (in a collection), chapter (in a book),
thesis, report, paper (in a Proceedings), etc. Each entry
identifies the document type after the
‘<code class="literal">@</code>’ sign,
followed by the entry label that you make up, and then
each field (in any order), using the format:
</p>
<blockquote><pre>
keyword = {value},
</pre></blockquote>
<p>Most <span class="TEX">T<span class="E">E</span>X</span>-sensitive editors have a <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> mode
which understands these entries.
<i><a name="p184">Emacs</a></i> automatically uses its
<code>bibtex-mode</code> whenever you open a
filename ending in <code>.bib</code>. When editing
<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> databases, the rules are simple:
</p>
<ul>
<li>
<p>Omit the comma after the last field in the entry
(only — eg after <code class="literal">{London}</code> in
the example).
</p>
</li>
<li>
<p>Titles may have their case changed in some styles:
to prevent this, enclose the title in double curly
braces as in the example.
</p>
</li>
<li>
<p>Values which are purely numeric (e.g. years)
may omit the curly braces.
</p>
</li>
<li>
<p>Fields can occur in any order but the format must
otherwise be strictly observed.
</p>
</li>
<li>
<p>Fields which are not used do not have to be
included (so if your editor automatically inserts them
as blank or prefixed by <code class="literal">OPT</code>
[optional], you can safely delete them as unused
lines).
</p>
</li>
</ul>
<p>To help with this, there are several interfaces to
creating and maintaining <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> files, such as
<i><a name="p185">tkbibtex</a></i> (see <a href="chapter7.html#tkbibtex">Figure 7.1</a>), or
<i><a name="p186">pybliographic</a></i>.
</p>
<div class="figure" align="center">
<hr>
<caption><i>Figure 7.1</i>: <a name="tkbibtex">tk<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>, one of several graphical interfaces to
<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> databases</a></caption>
<div align="center" style="margin:12px"><img src="tkbibtex.png" width="75%"></div>
<hr>
</div>
</div>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2.4 <a name="bibstyle">Changing the layout</a></h4>
<p>To change the title printed over the reference
listing, just change the value of
<code class="command"><a name="c180">\refname</a></code> (articles) or
<code class="command"><a name="c181">\bibname</a></code> (books and reports) by adding a
line like this in your preamble:
</p>
<blockquote><pre>
\renewcommand{\bibname}{Reading List}
</pre></blockquote>
<p>The formatting specifications (<span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span> styles) are
based on standard settings for journals and books from
dozens of publishers: you just pick the one you want by
name. The <code>texmf/bib/bst</code> subdirectory
of your installation contains the ones installed by
default, and you can search on <small><a href="chapter5.html#CTAN" class="acroref" name="A186" title="Comprehensive Archive Network">CTAN</a></small>
for others (look for <code>.bst</code> files).
Many of them are named after university press styles
(e.g. <i><a name="p187">harvard</a></i>,
<i><a name="p188">oxford</a></i>) or the publisher or
journal which specified them (e.g.
<i><a name="p189">elsevier</a></i>,
<i><a name="p190">kluwer</a></i>, etc.).
</p>
<p>Some of them have an accompanying package
(<code>.sty</code>) file which
you need to include with the normal
<code class="command"><a name="c182">\usepackage</a></code> command in your preamble. In
this case the format may be distributed as
<code>.dtx</code> and <code>.ins</code>
files and will need installing in the same way as any
other package (see <a href="chapter5.html#pkginst">section 5.2</a>). Always read
the documentation, because most of the formats are very
specific to the journal they were designed for, and may have
fairly absolute requirements.
</p>
<blockquote class="warning"><a name=""></a><p><img src="warning.png" align="left" alt="!!!">If you are writing for a specific publisher, you
should remember that the rules or formats are laid down
by the typographic designer of that journal or
publisher: you cannot arbitrarily change the format just
because you don't happen to like it: it's not
your choice!
</p>
</blockquote>
<p>It is also possible to write your own <span class="BIBTEX">B<span class="I">I</span>B<span class="TEX">T<span class="E">E</span>X</span></span>
(<code>.bst</code>) style files, although it uses
a language of its own which really needs a computer
science background to understand. However, this is
rendered unnecessary in most cases: there is an extensive
program (actually written in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>) called
<i><a name="p191">makebst</a></i>, which makes
<code>.bst</code> files by asking you a (long)
series of questions about exactly how you want your
citations formatted. Just type
<code class="literal">latex makebst</code> in a command window, but
give it a dummy run first, because some of the questions
are very detailed, so you need to have thought through how
you want your citations to appear before you start.
</p>
</div>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.4.2.5 <a name="othercite">Other modes of citation</a></h4>
<p>The method of citing a work by numeric reference is
common in the Natural Sciences but is not used in Law or
the Humanities. In these fields, citations are usually
done with short references (author/short-title/year) in a
numbered footnote. Sometimes they are actually called
‘footnotes’ to the exclusion of
ordinary footnotes, although they are really citations
which happen by convention to be
<em>displayed</em> as footnotes: an important
distinction rarely appreciated by authors until they come
to need a normal footnote.
</p>
<p>For these fields, the bibliography at the back of the
document is printed <em>unnumbered</em> in
alphabetic order of author, or perhaps chronologically if
the time-frame is very large. This unnumbered format is
why it is conventionally called
‘References’ rather than
‘Bibliography’: a sufficient working
citation has already been provided in the footnote, and
the list at the back is for reference purposes only;
whereas in the Natural Sciences, the citation is just a
number, or possibly an author and year only, so the full
listing is called a Bibliography.
</p>
<p>The <span class="package"><a name="m63">jurabib</a></span> package
(originally intended for German law articles but now
extended to other fields in the Humanities, and to other
languages) has extensive features for doing this style of
citation and is strongly recommended.
</p>
</div>
<ol class="footnotes" start="4">
<li><a name="F42">The style
shown in the example here provides formatting
according to the specifications for Transactions
of the IEEE (revised).</a></li>
</ol>
</div>
</div>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.5 <a name="indexes">Indexes and glossaries</a></h2><a name="I116"></a><a name="I117"></a><p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has a powerful, automated indexing facility which
uses the standard <i><a name="p192">makeindex</a></i>
program. To use indexing, use the package
<span class="package"><a name="m64">makeidx</a></span> and include the
<code class="command"><a name="c183">\makeindex</a></code> command in your preamble:
</p>
<blockquote><pre>
\usepackage{makeidx}
\makeindex
</pre></blockquote>
<p>When you want to index something, using the command
<code class="command"><a name="c184">\index</a></code> followed by the entry in curly
braces, as you want it to appear in the index, using one of
the following formats:
</p>
<blockquote>
<dl>
<dt><b>Plain entry</b></dt>
<dd>
<p>Typing <code class="literal">\index{beer}</code> will create
an entry for ‘beer’ with the
current page
number.<a name="I118"></a></p>
</dd>
<dt><b>Subindex entry</b></dt>
<dd>
<p>For an entry with a subentry use an exclamation mark
to separate them:
<code class="literal">\index{beer!lite}</code>.<a name="I119"></a> Subsubentries like
<code class="literal">\index{beer!lite!American}</code> work to
another level deep.<a name="I120"></a></p>
</dd>
<dt><b>Cross-references</b></dt>
<dd>
<p>‘See’ entries are done with
the vertical bar (one of the rare times it does
<em>not</em> get interpreted as a math
character):
<code class="literal">\index{Microbrew|see{beer}}</code></p>
</dd>
<dt><b><a name="indextypo">Font changes</a></b></dt>
<dd>
<p>To change the style of an entry, use the @-sign
followed by a font change command:
</p>
<blockquote><pre>
\index{beer!Rogue!Chocolate
Stout@\textit{Chocolate Stout}}
</pre></blockquote>
<p>This example<a name="I122"></a> indexes ‘<i><a name="p193">Chocolate
Stout</a></i>’ and italicises it
at the same time. Any of the standard
<code class="literal">\text...</code> font-change commands work
here: see <a href="chapter8.html#fontcmds">the table in section 8.2.3</a> for details.
</p>
<p>You can also change the font of the index number on
its own, as for first-usage references, by using the
vertical bar in a similar way to the
‘see’ entries above, but
substituting a font-change command name
(<em>without</em> a backslash) such as
<code class="literal">textbf</code> for bold-face text (see the
index)<a name="I123"></a>:
</p>
<blockquote><pre>
\index{beer!Rogue!Chocolate Stout|textbf}
</pre></blockquote>
</dd>
<dt><b>Out of sequence</b></dt>
<dd>
<p>The same method can be used as for font changes,
but using the alternate index word instead of the font
command name, so
<code class="literal">\index{Oregon Brewing Company@Rogue}</code><a name="I124"></a> will add an entry for
‘Rogue’ in the
‘O’ section of the index, as if
it was spelled ‘Oregon Brewing
Company’.
</p>
</dd>
</dl>
</blockquote>
<p>When the document has been processed through <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> it
will have created a <code>.idx</code> file, which you
run through the <i><a name="p194">makeindex</a></i> program
by typing (for example):
</p>
<blockquote><pre>
makeindex mythesis
</pre></blockquote>
<p>Some editors may have a button or menu entry for this. The
program will look for the <code>.idx</code> file and
output a <code>.ind</code> file. This gets used by the
command <code class="command"><a name="c185">\printindex</a></code> which you put at the end
of your document, where you want the index printed. The
default index format is two columns.
</p>
<p>Glossaries are done in a similar manner using the command
<code class="command"><a name="c186">\makeglossary</a></code> in the preamble and the
command <code class="command"><a name="c187">\glossary</a></code> in the same way as
<code class="command"><a name="c188">\index</a></code>. There are some subtle differences in
the way glossaries are handled: both the books by <a href="bibliography.html#latexbook" name="K36">Lamport</a> (1994) and by <a href="bibliography.html#companion" name="K37">Mittelbach <i>et al</i></a> (2004) duck the issue, but
there is some documentation on <code>glotex</code> on
<small><a href="chapter5.html#CTAN" class="acroref" name="A187" title="Comprehensive Archive Network">CTAN</a></small>.
</p>
</div>
<div class="sect1">
<h2><a href="#texttools"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>7.6 <a name="multicols">Multiple columns</a></h2><a name="I125"></a><p>Use the <span class="package"><a name="m65">multicol</a></span> package: the
environment is called <span class="environment"><a name="e48">multicols</a></span> (note the
plural form) and it takes the number of columns as a separate
argument in curly braces:
</p>
<blockquote><pre>
\usepackage{multicol}
...
\begin{multicols}{3}
...
\end{multicols}
</pre></blockquote>
<p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has built-in support for two-column typesetting
via the <code class="literal">twocolumn</code> option in the standard
Document Class Declarations, but it is relatively inflexible
in that you cannot change from full-width to double-column
and back again on the same page, and the final page does not
balance the column heights. However, it does feature special
<span class="environment"><a name="e49">figure*</a></span> and <span class="environment"><a name="e50">table*</a></span>
environments which typeset full-width figures and tables
across a double-column setting.
</p>
<p>The more extensive solution is the
<span class="package"><a name="m66">multicol</a></span> package, which will set up
to 10 columns, and allows the number of columns to be
changed or reset to one in mid-page, so that full-width
graphics can still be used. It also balances the height of
the final page so that all columns are the same
height — if possible: it's not always
achievable — and you can control the width of the gutter
by setting the <code class="command"><a name="c189">\columnsep</a></code> length to a new
dimension.
</p>
<p>Multi-column work needs some skill in typographic
layout, though: the narrowness of the columns makes
typesetting less likely to fit smoothly because it's hard to
hyphenate and justify well when there is little space to
manœuvre in.
</p>
</div>
</div>
<hr>
<table width="100%">
<tr>
<td align="left"><a href="chapter6.html"><img src="previous.png" alt="Previous" border="0"></a></td>
<td align="center"><a href="#doctoc"><img src="top.png" alt="Top" border="0"></a></td>
<td align="right"><a href="chapter8.html"><img src="next.png" alt="Next" border="0"></a></td>
</tr>
</table>
</body>
</html>
|