1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
|
<!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:30--><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Formatting information: Chapter 6 — Other document structures</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 6 — Other document structures</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="current"><a href="chapter6.html#otherdoc">Other document structures</a></li>
<li class=""><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="otherdoc">CHAPTER</a></b></i></small><br><table border="1">
<tr>
<td class="chapno">6</td>
</tr>
</table>
</td>
<td><pre class="spacing"></pre></td>
<td>
<p> </p>
<h1>Other document structures</h1>
</td>
<td class="toc">
<p> </p>
<ol>
<li><a href="#briefstruct">A little think about structure</a></li>
<li><a href="#lists">Lists</a></li>
<li><a href="#tables">Tables</a></li>
<li><a href="#figures">Figures</a></li>
<li><a href="#images">Images</a></li>
<li><a href="#verbatim">Verbatim text</a></li>
<li><a href="#boxes">Boxes, sidebars, and panels</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>
<p>It is perfectly possible to write whole documents using
nothing but section headings and paragraphs. As mentioned in
<a href="chapter3.html#sections">section 3.5</a>, novels, for example, usually consist
just of chapters divided into paragraphs. However, it's more
common to need other features as well, especially if the
document is technical in nature or complex in structure.
</p>
<p>It's worth pointing out that
‘technical’ doesn't necessarily mean
‘computer technical’ or
‘engineering technical’: it just means it
contains a lot of τηχνε (<i>tekne</i>), the
specialist material or artistry of its field. A literary
analysis such as <cite><a href="bibliography.html#macnamara" name="C28">La Textualisation de Madame
Bovary</a></cite> (on the
marginal notes in the manuscripts of Flaubert's novel) is every bit as
technical in the literary or linguistic field as the maintenance
manual for the Airbus 380 is in the aircraft engineering
field.
</p>
<p>This chapter covers the most common features needed in
writing structured documents: lists, tables, figures (including
images), sidebars like boxes and panels, and verbatim text
(computer program listings). In <a href="chapter7.html#texttools">Chapter 7</a> we
will cover footnotes, cross-references, citations, and other
textual tools.
</p>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.1 <a name="briefstruct">A little think about structure</a></h2>
<p>It's very easy to sit down at a keyboard with a
traditional wordprocessor and just start typing. If it's
a very short document, or something transient or relatively
unimportant, then you just want to type it in and make it look
‘right’ by highlighting with the mouse
and clicking on font styles and sizes.
</p>
<p>In doing so, you may achieve the effect you wanted, but
your actions have left no trace behind of
<em>why</em> you made these changes. This is
usually unimportant for trivial or short-term documents, but
if you write longer or more complex documents, or if you often
write documents to a regular pattern, then making them
consistent by manual methods becomes a nightmare.
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>'s facilities for automation are based on you
providing this ‘why’
information.
</p>
<p>If your documents have any of the features below, then you
have probably already started thinking about structure.
</p>
<ul>
<li>
<p>The document naturally divides into sections (parts,
chapters, etc.).
</p>
</li>
<li>
<p>The document is long.</p>
</li>
<li>
<p>There is lots of repetitive formatting in the
document.
</p>
</li>
<li>
<p>The document is complex (intellectually or
visually).
</p>
</li>
<li>
<p>There are lots of figures or tables (or examples,
exercises, panels, sidebars, etc.).
</p>
</li>
<li>
<p>Accuracy is important in formatting the
document.
</p>
</li>
<li>
<p>A master copy is needed for future reference or
reprinting.
</p>
</li>
<li>
<p>This is a formal or official document needing special
care and attention.
</p>
</li>
<li>
<p>It's <em>my</em> thesis, book,
leaflet, pamphlet, paper, article, etc.
<em>That</em>'s why I care.
</p>
</li>
<li>
<p>The document (or part of it) may need ongoing or
occasional re-editing and republishing.
</p>
</li>
</ul>
<p>If you've got that far, you're over half-way
done. Using a structural editor — even a simple
outliner — can make a huge difference to the quality of
your thinking because you are consciously organising your
thoughts before setting them down. And it can make just as big
a difference to your formatting as well: more consistent,
better presented, easier for the reader to navigate through,
and more likely to be read and understood — which is
presumably why you are writing the document in the first
place.
</p>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2 <a name="lists">Lists</a></h2><a name="I88"></a><p>Lists are useful tools for arranging thoughts in a
digestible format, usually a small piece of information at a
time. There are four basic types of list, shown in <a href="chapter6.html#listtypes">Table 6.1</a>.
</p>
<div align="center" class="table">
<table>
<caption><i>Table 6.1</i>. <a name="listtypes">Types of lists</a></caption>
<tr>
<td valign="top" width="48%" align="left" style="">
<dl>
<dt><b>Random or arbitrary lists</b></dt>
<dd>(sometimes called
‘itemized’ or
‘bulleted’ lists) where the
order of items is unimportant. The
items are often prefixed with a bullet or other
symbol for clarity or decoration, but are
sometimes simply left blank, looking like
miniature paragraphs (when they are known as
‘simple’ or
‘trivial’ lists).
</dd>
</dl>
</td>
<td valign="top" width="48%" align="left" style="">
<dl>
<dt><b>Enumerated or sequential lists</b></dt>
<dd>(sometimes called
‘numbered’ lists) where the
order of items is critical, such as sequences of
instructions or rankings of importance. The
enumeration can be numeric (Arabic or Roman), or
lettered (uppercase or lowercase), and can even be
programmed to be hierarchical (1.a.viii, 2.3.6,
etc.).
</dd>
</dl>
</td>
</tr>
<tr>
<td valign="top" width="48%" align="left" style="">
<dl>
<dt><b>Descriptive or labelled lists</b></dt>
<dd>(sometimes called
‘discussion’ lists), which
are composed of subheadings or topic labels
(usually unnumbered but typographically distinct),
each followed by one or more indented paragraphs
of discussion or explanation.
</dd>
</dl>
</td>
<td valign="top" width="48%" align="left" style="">
<dl>
<dt><b>Inline lists</b></dt>
<dd>which are sequential in nature, just like
enumerated lists, but are
<i>a</i>) formatted <em>within</em>
their paragraph; and <i>b</i>) usually labelled with letters, like this example. The items
are often mutually inclusive or exclusive, with
the final item prefixed by
‘and’ or
‘or’ respectively.
</dd>
</dl>
</td>
</tr>
</table>
</div>
<p>There are actually two other types, segmented lists and
reference lists, but these are much rarer, and outside the
scope of this document.
</p><a name="I89"></a><p>The structure of lists in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is identical for each
type, but with a different environment name. Lists are another
example of this <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> technique (environments), where a pair
of matched commands surrounds some text which needs special
treatment.
</p>
<p>Within a list environment, list items are always
identified by the command <code class="command"><a name="c104">\item</a></code> (followed by
an item label in [square brackets] in the case of labelled
lists). You don't type the bullet or the number or the
formatting, it's all automated.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2.1 Itemized lists
</h3><a name="I90"></a><a name="I91"></a><p>To create an itemized list, use the the
<span class="environment"><a name="e13">itemize</a></span> environment:
</p>
<blockquote class="example"><pre>
\begin{itemize}
\item Itemized lists usually have a bullet;
\item Long items use `hanging indentation',
whereby the text is wrapped with a margin
which brings it clear of the bullet used in
the first line of each item;
\item The bullet can be changed for any other
symbol, for example from the \textsf{bbding}
or \textsf{pifont} package.
\end{itemize}
</pre><ul>
<li>
<p>Itemized lists usually have a bullet;</p>
</li>
<li>
<p>Long items use ‘hanging
indentation’, whereby the text is
wrapped with a margin which brings it clear of the
bullet used in the first line of each item;
</p>
</li>
<li>
<p>The bullet can be changed for any other symbol,
for example from the <span class="package"><a name="m41">bbding</a></span>
or <span class="package"><a name="m42">pifont</a></span> package.
</p>
</li>
</ul>
</blockquote>
<p>The default list bullet is round and solid<sup><a href="#F33">1</a></sup> (舦) which is also available with the
command <code class="command"><a name="c105">\textbullet</a></code> if you load the
<span class="package"><a name="m43">textcomp</a></span> package. See <a href="chapter9.html#bullets">section 9.6.1</a> for details of how to change the
settings for list item bullets.
</p>
<ol class="footnotes" start="1">
<li><a name="F33">If your browser font doesn't show it, don't
worry: most don't. <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will.</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>6.2.2 Enumerated lists
</h3><a name="I92"></a><a name="I93"></a><p>To create an enumerated list, use the
<span class="environment"><a name="e14">enumerate</a></span> environment:
</p>
<blockquote class="example"><pre>
\begin{enumerate}
\item Enumerated lists use numbering on each
item (can also be letters or roman numerals);
\item Long items use `hanging indentation'
just the same as for itemized lists;
\item The numbering system can be changed for
any level.
\end{enumerate}
</pre><ol type="1">
<li>
<p>Enumerated lists use numbering on each
item (can also be letters or roman numerals);
</p>
</li>
<li>
<p>Long items use ‘hanging
indentation’, just the same as for
itemized lists;
</p>
</li>
<li>
<p>The numbering system can be changed for any
level.
</p>
</li>
</ol>
</blockquote>
<p>See <a href="chapter6.html#numberschemes">section 6.2.6</a> for details of how
to change the numbering schemes for each level.
</p>
<p>In standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> document classes, the vertical
spacing between items, and above and below the lists as a
whole, is more than between paragraphs. If you want
tightly-packed lists, use the
<span class="package"><a name="m44">mdwlist</a></span> package, which provides
‘starred’ versions
(<span class="environment"><a name="e15">itemize*</a></span>,
<span class="environment"><a name="e16">enumerate*</a></span>, etc).
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2.3 <a name="desc">Description lists</a></h3><a name="I94"></a><a name="I95"></a><p>To create a description list, use the
<span class="environment"><a name="e17">description</a></span> environment:
</p>
<blockquote class="example"><pre>
\begin{description}
\item[Identification:] description lists
require a topic for each item given in
square brackets;
\item[Hanging indentation:] Long items use
this in the same way as all other lists;
\item[Reformatting:] Long topics can be
reprogrammed to fold onto multiple lines.
\end{description}
</pre><blockquote>
<dl>
<dt><b>Identification:</b></dt>
<dd>
<p>description lists require a topic for each item
given in square brackets;
</p>
</dd>
<dt><b>Hanging indentation:</b></dt>
<dd>
<p>Long items use this in the same way as all other
lists;
</p>
</dd>
<dt><b>Reformatting:</b></dt>
<dd>
<p>Long topics can be reprogrammed to fold onto
multiple lines.
</p>
</dd>
</dl>
</blockquote>
</blockquote>
<p>All three of these types of lists can have multiple
paragraphs per item: just type the additional paragraphs in
the normal way, with a blank line between each. So long as
they are still contained within the enclosing environment,
they will automatically be indented to follow underneath their
item.
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2.4 <a name="inlinelists">Inline lists</a></h3><a name="I96"></a><p>Inline lists are a special case as they require the use
of the <span class="package"><a name="m45">paralist</a></span> package which
provides the <span class="environment"><a name="e18">inparaenum</a></span> environment
(with an optional formatting specification in square
brackets):
</p>
<blockquote class="example"><pre>
\usepackage{paralist}
...
\textbf{\itshape Inline lists}, which are
sequential in nature, just like enumerated
lists, but are \begin{inparaenum}[\itshape
a\upshape)]\item formatted within their
paragraph; \item usually labelled with
letters; and \item usually have the final
item prefixed with `and' or
`or'\end{inparaenum}, like this example.
</pre><p class="example"><b><i><a name="inlines">Inline lists</a></i></b>,
which are sequential in nature, just like enumerated
lists, but are <i>a</i>) formatted within their paragraph; <i>b</i>) usually labelled with letters; and <i>c</i>) usually have the final
item prefixed with ‘and’ or
‘or’, like this example.
</p>
</blockquote>
<p>See <a href="chapter8.html#typo">Chapter 8</a> for details of the
font-changing commands used in the optional argument to
<span class="environment"><a name="e19">inparaenum</a></span>.
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 15</i>. List practice
</h4>
<p>Add some lists to your document. Pick any two of the
ones described here to practice with.
</p>
<p>If you successfully installed
<span class="package"><a name="m46">paralist</a></span> in <a href="chapter5.html#insttest">the example ‘Install a package’ in section 5.2.2</a> then you can use inline lists as
described in <a href="chapter6.html#inlinelists">section 6.2.4</a>.
</p>
<hr>
</blockquote>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2.5 Reference lists and segmented lists
</h3>
<p>Reference lists are visually indistinguishable from
numbered or lettered lists, but the numbering or lettering
does <em>not</em> imply a sequence. The numbers
or letters are just used as labels so that the items can be
referred to from elsewhere in the text (as in ‘see
item 501(c)3’). In this sense they are really a
kind of sub-sectional division, and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>'s
<code class="command"><a name="c106">\paragraph</a></code> or
<code class="command"><a name="c107">\subparagraph</a></code> commands (with appropriate
renumbering) would probably be a far better solution than
using a list. Label them and refer to them with
<code class="command"><a name="c108">\label</a></code> and <code class="command"><a name="c109">\ref</a></code> as for
any other cross-reference (see <a href="chapter7.html#xrefs">section 7.4</a>).
</p>
<p>Segmented lists are a highly specialised structure and
outside the scope of this document. For details of their
usage, see the the chapter ‘Segmentation and
Alignment’ in <cite><a href="bibliography.html#teiguide" name="C30">Guidelines for the Text Encoding Initiative</a></cite>.
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.2.6 <a name="numberschemes">Lists within lists</a></h3>
<p>You can start a new list environment within the item of
an existing list, so you can embed one list inside another
up to four deep. The lists can be of any type, so you can
have a description list containing an item in which there is
a numbered sub-list, within which there is an item
containing a bulleted sub-sub-list.
</p>
<ol type="1">
<li>
<p>by default an outer enumerated list is numbered in
Arabic numerals;
</p>
<ol type="a">
<li>
<p>an embedded enumerated list is lettered in
lowercase;
</p>
<ol type="i">
<li>
<p>a third level is numbered in lowercase Roman
numerals;
</p>
<ol type="A">
<li>
<p>the fourth level uses uppercase
alphabetic letters.
</p>
</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>Multiple embedded lists automatically change the bullet
or numbering scheme so that the levels don't get
confused, and the spacing between levels is adjusted to
become fractionally tighter for more deeply nested
levels.
</p>
<p>These are only defaults and can easily be changed by
redefining the relevant set of values. You could also add a
fifth and further levels, although I suspect that would mean
your document structure needed some careful analysis, as
lists embedded five deep will probably confuse your
readers.
</p>
<p>The values for lists come in pairs: for each level there
is a counter to count the items and a command to produce the
label:<sup><a href="#F34">2</a></sup></p>
<div align="center">
<table>
<tr class="headfoot">
<th valign="bottom" align="right">Level</th>
<th valign="bottom" align="center">Default</th>
<th valign="bottom" align="left">Counter</th>
<th valign="bottom" align="left">Label command</th>
</tr>
<tr>
<td valign="top" align="right">1</td>
<td valign="top" align="center">digit.</td>
<td valign="top" align="left"><tt><i><a name="l21">enumi</a></i></tt></td>
<td valign="top" align="left"><code class="command"><a name="c110">\theenumi</a></code></td>
</tr>
<tr>
<td valign="top" align="right">2</td>
<td valign="top" align="center">(letter)</td>
<td valign="top" align="left"><tt><i><a name="l22">enumii</a></i></tt></td>
<td valign="top" align="left"><code class="command"><a name="c111">\theenumii</a></code></td>
</tr>
<tr>
<td valign="top" align="right">3</td>
<td valign="top" align="center">roman.</td>
<td valign="top" align="left"><tt><i><a name="l23">enumiii</a></i></tt></td>
<td valign="top" align="left"><code class="command"><a name="c112">\theenumiii</a></code></td>
</tr>
<tr>
<td valign="top" align="right">4</td>
<td valign="top" align="center">LETTER.</td>
<td valign="top" align="left"><tt><i><a name="l24">enumiv</a></i></tt></td>
<td valign="top" align="left"><code class="command"><a name="c113">\theenumiv</a></code></td>
</tr>
</table>
</div>
<p>Note that each counter and command ends with the Roman
numeral value of its level (this is to overcome the rule
that <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> commands can only be made of
letters — digits wouldn't work here). To
change the format of a numbered list item counter, just
renew the meaning of its label:
</p>
<blockquote><pre>
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\roman{enumii}}
\renewcommand{\theenumiii}{\arabic{enumiii}}
</pre></blockquote>
<p><a name="thecounter"></a>This would make the
outermost list use uppercase letters, the second level use
lowercase roman, and the third level use ordinary Arabic
numerals. The fourth level would remain unaffected.
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 16</i>. Nesting
</h4>
<p>Extend your use of lists by nesting one type inside a
different one.
</p>
<hr>
</blockquote>
<blockquote class="warning">
<h4><img src="warning.png" align="middle" alt="!!!"> <a name="">Lists: a caution to the unwary</a></h4>
<p>Treat lists with care: people sometimes use tables for
labelled information which is really a list and would be
better handled as such. They often do this because their
wordprocessor has no way to do what they want (usually to
place the item label level with the description or
explanation) <em>except</em> by using a table,
hence they are misled into believing that their text is
really a table when it's actually not.
</p>
</blockquote>
<ol class="footnotes" start="2">
<li><a name="F34">In fact, any time you define a counter in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>,
you automatically get a command to reproduce its value.
So if you defined a new counter <tt><i><a name="l19">example</a></i></tt> to use in a teaching
book, by saying <code class="literal">\newcounter{example}</code>,
that automatically makes available the command
<code class="literal">\theexample</code> for use when you want to
display the current value of <tt><i><a name="l20">example</a></i></tt>.</a></li>
</ol>
</div>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.3 <a name="tables">Tables</a></h2><a name="I97"></a><p>Tabular typesetting is the most complex and time-consuming
of all textual features to get right. This holds true whether
you are typing in plain-text form, using a wordprocessor,
using <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, using <small><a href="chapter10.html#HTML" class="acroref" name="A133" title="HyperText Markup Language">HTML</a></small> or
<small><a href="chapter10.html#XML" class="acroref" name="A134" title="Extensible Markup Language">XML</a></small>, using a <small><a href="preface.html#DTP" class="acroref" name="A135" title="desktop publishing">DTP</a></small> system, or some other text-handling
package. Fortunately, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> provides a
table model with a mixture of defaults and configurability to
let it produce very high quality tables with a minimum of
effort.
</p>
<blockquote class="warning">
<h4><img src="warning.png" align="middle" alt="!!!"> <a name="">Terminology</a></h4>
<p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, in common with standard typesetting
practice, uses the word ‘Table’ to
mean a formal textual feature, numbered and with a caption,
referred to from the text (as in ‘See
Table 5’). Sometimes you can get
‘informal’ tables, which simply occur
between two paragraphs, without caption or number.
</p>
<p>The arrangement of information in rows and columns
<em>within</em> either of these structures is
called a ‘tabulation’ or
‘tabular matter’.
</p>
<p>It is important to keep this distinction firmly in mind
for this section.
</p>
</blockquote>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.3.1 <a name="floats">Floats</a></h3><a name="I98"></a><p>Tables and Figures are what printers refer to as
‘floats’. This means they are not
part of the normal stream of text, but separate entities,
positioned in a part of the page to themselves (top, middle,
bottom, left, right, or wherever the designer specifies).
They always have a caption describing them and they are
always numbered so they can be referred to from elsewhere in
the text.
</p>
<p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> automatically floats Tables and Figures,
depending on how much space is left on the page at the point
that they are processed. If there is not enough room on the
current page, the float is moved to the top of the next
page. This can be changed by moving the Table or Figure
definition to an earlier or later point in the text, or by
adjusting some of the parameters which control automatic
floating.
</p>
<p>Authors sometimes have many floats occurring in rapid
succession, which raises the problem of how they are
supposed to fit on the page and still leave room for text.
In this case, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> stacks them all up and prints them
together if possible, or leaves them to the end of the
chapter in protest. The skill is to space them out within
your text so that they intrude neither on the thread of your
argument or discussion, nor on the visual balance of the
typeset pages. But this is a skill few authors have, and
it's one point at which professional typographic advice
or manual intervention may be needed.
</p>
<p>There is a <span class="environment"><a name="e20">float</a></span> package which lets
you create new classes of floating object (perhaps Examples
or Exercises).
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.3.2 Formal tables
</h3>
<p>To create a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> Table, use the <span class="environment"><a name="e21">table</a></span>
environment containing a <code class="command"><a name="c114">\caption</a></code> command
where you type the caption, and a <code class="command"><a name="c115">\label</a></code>
command to give the Table a label by which you can refer to
it.
</p>
<blockquote><pre>
\begin{table}
\caption{Project expenditure to year-end 2006}
\label{ye2006exp}
...
\end{table}
</pre></blockquote>
<p>Numbering is automatic, but the <code class="command"><a name="c116">\label</a></code>
command <em>must follow</em> the
<code class="command"><a name="c117">\caption</a></code> command, not precede it. The
numbering automatically includes the chapter number in
document classes where this is appropriate (but this can of
course be overridden). The <code class="command"><a name="c118">\caption</a></code>
command has an optional argument to provide a short caption
if the full caption would be too long for the <a href="chapter3.html#loflot" title="para">List of Tables</a>:
</p>
<blockquote><pre>
\caption[Something short]{Some very long caption that
will only look reasonable in the full figure.}
</pre></blockquote>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.3.3 Tabular matter
</h3>
<p>Within a Table, you can either typeset the tabular
matter using <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, or include a table captured as an
image from elsewhere. We will see how to include images in
<a href="chapter6.html#figures">section 6.4</a> on Figures, where they are more
common.
</p>
<p>To typeset tabular matter, use the
<span class="environment"><a name="e22">tabular</a></span> environment. The
<code class="literal">\begin{tabular}</code> command must be followed
by a compulsory second argument in curly braces giving the
alignment of the columns. These are specified for each
column using one of single letters <code class="literal">l</code>,
<code class="literal">c</code>, and <code class="literal">r</code> for
left-aligned, centered, or right-aligned text, or the letter
<code class="literal">p</code> followed by a width argument if you
want a long entry to wrap to several lines (a miniature
paragraph as a single cell on each row).
</p>
<p><span class="TEX">T<span class="E">E</span>X</span>'s original tabular settings were designed
for classical numerical tabulations, where each cell
contains a single value. The <code class="literal">p</code>
specification allows a cell to be a miniature paragraph set
to a specific width. These are <code class="literal">p</code> column
specifications are <em>not</em> multi-row
entries, they are single cells which contain multiple lines
of typesetting: the distinction is very important.
Auto-adjusting space between columns is possible with the
<span class="package"><a name="m47">tabularx</a></span> package, but the
auto-resizing column widths used in web pages are not
available in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.
</p>
<p>The <span class="package"><a name="m48">array</a></span> package provides for
many other typographic variations such as left-aligned,
right-aligned, and centred multi-line columns, and other
packages provide decimal-aligned columns, row-spanning and
column-spanning, multi-page, and rotated (landscape format)
tables.
</p>
<div align="center" class="table">
<table>
<caption><i>Table 6.1</i>. <a name="ye2006exp">Project expenditure to year-end 2006</a></caption>
<tr class="headfoot">
<th valign="bottom" align="center"></th>
<th valign="bottom" align="left">Item</th>
<th valign="bottom" align="right">€ Amount</th>
</tr>
<tr>
<td valign="top" align="center">a)</td>
<td valign="top" align="left">Salaries (2 research assistants)</td>
<td valign="top" align="right">28,000</td>
</tr>
<tr>
<td valign="top" align="center"></td>
<td valign="top" align="left">Conference fees and travel expenses</td>
<td valign="top" align="right">14,228</td>
</tr>
<tr>
<td valign="top" align="center"></td>
<td valign="top" align="left">Computer equipment (5 workstations)</td>
<td valign="top" align="right">17,493</td>
</tr>
<tr>
<td valign="top" align="center"></td>
<td valign="top" align="left">Software</td>
<td valign="top" align="right">3,562</td>
</tr>
<tr>
<td valign="top" align="center">b)</td>
<td valign="top" align="left">Rent, light, heat, etc.</td>
<td valign="top" align="right">1,500</td>
</tr>
<tr class="headfoot">
<th valign="top" align="center"></th>
<th valign="top" align="left">Total</th>
<th valign="top" align="right">64,783</th>
</tr>
</table>
<div align="left">
<p><small>The Institute also contributes to (a) and
(b).</small></p>
</div>
</div>
<p>As an example, a tabular setting with three columns, the
first one centered, the second left-aligned, and the third
one right-aligned, would therefore be specified as
<code class="literal">{clr}</code>, as in the example below. Note the
use of indentation to make the elements of the table clear
for editing, and note also how the typeset formatting is
unaffected by this (see <a href="chapter6.html#ye2006exp">Table 6.1</a>).
</p>
<blockquote><pre>
\begin{table}
\caption{Project expenditure to year-end 2006}
\label{ye2006exp}
\begin{center}
\begin{tabular}{clr}
&Item&\EUR\ Amount\\
\hline
a)&Salaries (2 research assistants)&28,000\\
&Conference fees and travel expenses&14,228\\
&Computer equipment (5 workstations)&17,493\\
&Software&3,562\\
b)&Rent, light, heat, etc.&1,500\\\cline{3-3}
&Total&64,783
\end{tabular}
\par\medskip\footnotesize
The Institute also contributes to (a) and (b).
\end{center}
\end{table}
</pre></blockquote>
<p>You do not need to format the tabular data in your
editor: <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> does this for you when it typesets the
table, using the column specifications you provided. Extra
space is automatically added between columns, and can be
adjusted by changing the <tt>\<a name="d25">tabcolsep</a></tt> dimension.
<a name="tak">Takaaki Ota</a> provides an excellent Tables mode for
<i><a name="p159">Emacs</a></i> which provides a
spreadsheet-like interface and can generate <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> table
source code (see <a href="chapter6.html#tabmode">Figure 6.1</a>).
</p>
<div class="figure" align="center">
<hr>
<caption><i>Figure 6.1</i>: <a name="tabmode">Tables mode for
<i><a name="p160">Emacs</a></i></a></caption>
<div align="center" style="margin:12px"><img src="table.png" width="75%"></div>
<hr>
</div>
<p>It is conventional to centre the tabular setting within
the Table, using the <span class="environment"><a name="e23">center</a></span> environment
(note US spelling) or the <code class="command"><a name="c119">\centering</a></code>
command. The entries for each cell are separated by an
ampersand character (<code class="literal">&</code>) and the end
of a row is marked by
the double-backslash (<code class="literal">\\</code>).
</p>
<p>The <code class="command"><a name="c120">\hline</a></code> command draws a rule across
all columns and the <code class="command"><a name="c121">\cline</a></code> command draws a
rule across a range of columns (here, under column three
only — the argument needs a range). If used, these commands <em>follow</em>
the
<code class="literal">\\</code> of the row they apply to. There are
some extra formatting commands after the tabular material in
the example. These are explained in
<a href="chapter8.html#typo">Chapter 8</a>.
</p>
<p>If there is no data for a cell, just don't type
anything — but you still need the
<code class="literal">&</code> separating it from the next
column's data. The astute reader will already have
deduced that for a table of
<span class="math"><i>n</i></span> columns, there must always be
<span class="math"><i>n</i>−1</span> ampersands in each row. The exception to
this is when the <code class="command"><a name="c122">\multicolumn</a></code> command is
used to create cells which span multiple columns. There is
also a package (<span class="environment"><a name="e24">multirow</a></span>) to enable
cells to span multiple rows, but both of these techniques
are outside the scope of this document.
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.3.4 Tabular techniques for alignment
</h3>
<p>As mentioned earlier, it's also perfectly possible
to typeset tabular matter outside a formal Table, where you
want to lay out an informal tabulation between paragraphs
where a fully floating formal Table would be unnecessary
(these are usually quite short: there are several of them in
this document).
</p>
<p>Tabular mode can also be used wherever you need to align
material side by side, such as in designing letterheads,
where you may want your company logo and address on one side
and some other information on the other.
</p>
<p>By default, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> typesets
<span class="environment"><a name="e25">tabular</a></span> environments inline to the
surrounding text, so if you want your alignment displayed by
itself, put it inside a positioning environment like
<span class="environment"><a name="e26">center</a></span>,
<span class="environment"><a name="e27">flushright</a></span>, or
<span class="environment"><a name="e28">flushleft</a></span>, or leave a blank line or
<code class="command"><a name="c123">\par</a></code> before and after so it gets typeset
separately.
</p>
<p>There is much more to tabular setting:
full details are in the manuals mentioned in
<a href="foreword.html#docs">the last paragraph in the Foreword</a>. One final note to remind you of the
automated crossreferencing features: because the example
table is labelled, it can be referenced from anywhere in the
document as <a href="chapter6.html#ye2006exp">Table 6.1</a> just by using
<code class="literal">\ref{ye2006exp}</code>, regardless of how much
the surrounding document or structure is moved or
edited.
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 17</i>. Create a tabulation
</h4>
<p>Create one of the following in your document:</p>
<ul>
<li>
<p>a formal Table with a caption showing the number
of people in your class broken down by age and
sex;
</p>
</li>
<li>
<p>an informal tabulation showing the price for three
products;
</p>
</li>
<li>
<p>the logo <img src="y2klogo.png" align="middle" height="10px" alt="\setlength{\fboxsep}{-3pt}\setlength{\fboxrule}{.4pt} \fbox{\begin{tabular}{cc}\tiny YEAR\\[-.8em]\tiny 2 0 0 0\vrule depth1em width0pt\end{tabular}}" width="48"> (hint: <a href="chapter6.html#fbox">section 6.7.2</a>)
</p>
</li>
</ul>
<hr>
</blockquote>
</div>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.4 <a name="figures">Figures</a></h2><a name="I99"></a><a name="I100"></a><p>As explained in <a href="chapter6.html#floats">section 6.3.1</a>, Figures and
Tables float to a vacant part of the page, as they are not
part of the sequence of sentences making up your text, but
illustrative objects that you refer to.
</p>
<p>Figures can contain text, diagrams, pictures, or any other
kind of illustration. To create a figure, use the
<span class="environment"><a name="e29">figure</a></span> environment: like Tables, they
automatically get numbered, and must include a caption (with a
label after the caption, if needed, exactly the same as for
Tables)
</p>
<blockquote><pre>
\begin{figure}
\caption{Total variable overhead variance (after
\citeauthor[p.191]{bull}}
\label{workeff}
\begin{center}
\includegraphics[width=.75\columnwidth]{diagram}
\end{center}
\end{figure}
</pre></blockquote>
<div class="figure" align="center">
<hr>
<caption><i>Figure 6.1</i>: <a name="workeff">Total variable overhead variance (after <a href="bibliography.html#bull" name="K31">Bull</a> (1972) p.191)</a></caption>
<div align="center" style="margin:12px"><img src="diagram.png" width="75%"></div>
<hr>
</div>
<p>You can see that the structure is very similar to the
<span class="environment"><a name="e30">table</a></span> environment, but in this case we
have a graphic included. Details of this command
(<code class="command"><a name="c124">\includegraphics</a></code>) are in the next section.
Details of the bibliographic citation mechanism are in <a href="chapter7.html#bib">section 7.4.2</a></p>
<p>The content of the Figure could of course also be textual,
in the form of a list or a text diagram. <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has a simple
drawing environment called <span class="environment"><a name="e31">picture</a></span>, which
lets you create a limited set of lines and curves, but for a
diagram of any complexity, you should use a standard vector
drawing program (see <a href="chapter6.html#graphictypes">section 6.5.1</a>).
</p>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.5 <a name="images">Images</a></h2><a name="I101"></a><a name="I102"></a><p>Images (graphics) can be included anywhere in a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
document, although in most cases of formal documents they will
occur in Figures (see preceding section). To use graphics, you
need to use the <span class="package"><a name="m49">graphicx</a></span> package in
your preamble:
<code class="literal">\usepackage{graphicx}</code><sup><a href="#F35">3</a></sup></p>
<p>This enables the command
<code class="command"><a name="c125">\includegraphics</a></code> which is used to insert an
image in the document. The command is followed by the name of
your graphics file <em>without the filetype</em>,
for example: <code class="literal">\includegraphics{myhouse}</code>
(we'll see in a minute why you don't include the
filetype).
</p>
<p>In most cases you should just make sure the image file is
in the same folder (directory) as the document you use it in.
This avoids a lot of messing around remembering where you put
the files. If you have images you want to use in several
different documents in different places on your disk, there is
a way to tell <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> where to look (see <a href="chapter6.html#graphicsdir">section 6.5.2</a>).
</p>
<p>For standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> with
<i><a name="p161">dvips</a></i>, graphics files
<em>must</em> be in <a name="EPS" class="acroref">Encapsulated
PostScript</a> (<small>EPS</small>) format: this has been the publishing
industry standard for portable graphics for many years, and no
other format will work portably in standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.<sup><a href="#F36">4</a></sup></p>
<p>All good graphics packages can save images as <small><a href="chapter6.html#EPS" class="acroref" name="A141" title="Encapsulated PostScript">EPS</a></small>, but be very careful because some
packages, especially on Microsoft Windows platforms, use a
very poor quality driver, which creates very poor quality
<small><a href="chapter6.html#EPS" class="acroref" name="A142" title="Encapsulated PostScript">EPS</a></small> files. If in doubt, check with
an expert. If you find an <small><a href="chapter6.html#EPS" class="acroref" name="A143" title="Encapsulated PostScript">EPS</a></small>
graphic doesn't print, the chances are it's been
badly made by the graphics software. Download Adobe's own
PostScript driver from their Web site instead.
</p>
<p>For <i><a name="p162">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, graphics files
can be in <a name="PNG" class="acroref">Portable Network
Graphic</a> (<small>PNG</small>), <a name="JPG" class="acroref">Joint Photographic
Experts Group</a> (<small>JPG</small>), or <small><a href="chapter4.html#PDF" class="acroref" name="A146" title="Portable Document Format">PDF</a></small>
format, <em>not</em> <small><a href="chapter6.html#EPS" class="acroref" name="A147" title="Encapsulated PostScript">EPS</a></small>. This means if you want to use both
standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> as well
as <i><a name="p163">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, you need to keep
your graphics in two formats, <small><a href="chapter6.html#EPS" class="acroref" name="A148" title="Encapsulated PostScript">EPS</a></small>
and one of the others. This is why you don't include the
filetype in the filename you give with
<code class="command"><a name="c126">\includegraphics</a></code>: <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will assume
<small><a href="chapter6.html#EPS" class="acroref" name="A149" title="Encapsulated PostScript">EPS</a></small> and
<i><a name="p164">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i> will look for <small><a href="chapter6.html#JPG" class="acroref" name="A150" title="Joint Photographic Experts Group">JPG</a></small>, <small><a href="chapter6.html#PNG" class="acroref" name="A151" title="Portable Network Graphic">PNG</a></small> or
<small><a href="chapter4.html#PDF" class="acroref" name="A152" title="Portable Document Format">PDF</a></small> files matching the name.
</p>
<p>The <code class="command"><a name="c127">\includegraphics</a></code> command can take
optional arguments within square brackets before the filename
to specify either the height or width, and the other dimension
will automatically change to scale. If you specify both, the
image will be distorted to fit. You can scale an image by a
factor instead of specifying height or width; clip it to
specified coordinates; and rotate it in either direction.
Multiple optional arguments are separated with commas.
</p>
<blockquote class="example"><pre>
\begin{center}
\includegraphics[width=3cm]{twithcat}
\end{center}
</pre><div align="center" style="margin:12px"><img src="twithcat.png" width="168"></div>
</blockquote>
<p>For details of all the arguments, see the documentation on
the <span class="package"><a name="m51">graphicx</a></span> package or a copy of the
<cite><a href="bibliography.html#companion" name="C32">The <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> Companion</a></cite>. This package also
includes commands to <img src="rotate.png" align="middle" height="10px" alt="\raisebox{1ex}{\rotatebox{180}{rotate}}">,
<img src="mirror.png" align="middle" height="10px" alt="\scalebox{-1}[1]{mirror}">, and
<img src="scale.png" align="middle" height="10px" alt="\scalebox{2}[1]{scale}"> text.
<a name="I103"></a><a name="I104"></a><a name="I105"></a></p>
<p>It is in fact possible to tell <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to generate the
right file format by itself, but this requires an external
command-line graphics converter, and as it gets done afresh
each time, it slows things down rather a lot.
</p>
<p><small><a href="chapter6.html#EPS" class="acroref" name="A153" title="Encapsulated PostScript">EPS</a></small> files, especially bitmaps,
can be very large indeed, because they are stored in <small><a href="chapter2.html#ASCII" class="acroref" name="A154" title="American Standard Code for Information Interchange">ASCII</a></small> format.
<a name="sw">Staszek Wawrykiewicz</a> has drawn my attention to a useful MS-DOS program to
overcome this, called <i><a name="p165">cep</a></i>
(‘Compressed Encapsulated Postscript’) available
from <small><a href="chapter5.html#CTAN" class="acroref" name="A155" title="Comprehensive Archive Network">CTAN</a></small> in the
<code>support/pstools</code> directory, which can
compress <small><a href="chapter6.html#EPS" class="acroref" name="A156" title="Encapsulated PostScript">EPS</a></small> files to a fraction of
their original size. The original file can be replaced by the
new smaller version and still used directly with
<code class="command"><a name="c128">\includegraphics</a></code>.
</p>
<ol class="footnotes" start="3">
<li><a name="F35">You may find a lot of old files which use a package
called <span class="package"><a name="m50">epsf</a></span>. Don't use it.
It's obsolete.</a></li>
</ol>
<ol class="footnotes" start="4">
<li><a name="F36">Some distributions of <span class="TEX">T<span class="E">E</span>X</span> systems allow other
formats to be used, such as <small><a href="chapter6.html#PNG" class="acroref" name="A137" title="Portable Network Graphic">PNG</a></small>,
<a name="BMP" class="acroref">Microsoft Bitmap</a> (<small>BMP</small>) files,
Hewlett-Packard's <a name="PCL" class="acroref">Printer Control
Language</a> (<small>PCL</small>) files, and others; but you cannot
send such documents to other <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> users and expect
them to work if they don't have the same distribution
installed as you have. Stick to <small><a href="chapter6.html#EPS" class="acroref" name="A140" title="Encapsulated PostScript">EPS</a></small>.</a></li>
</ol>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.5.1 <a name="graphictypes">Making images</a></h3>
<p>There are two types of image: bitmaps and
vectors.
</p>
<blockquote>
<dl>
<dt><b>Bitmaps</b></dt>
<dd>
<p>Bitmap images are made of coloured dots, so if you
enlarge them, they go jagged at the edges, and if you
shrink them, they go blurry. Bitmaps are fine for
photographs, where every dot is a different colour,
and no-one will notice if you don't shrink or enlarge
too much. Bitmaps for diagrams and drawings, however,
are almost always the wrong choice, and
often disastrously bad.
</p>
</dd>
<dt><b>Vectors</b></dt>
<dd>
<p>Vector drawings are made from instructions (eg
‘draw this from here to here, using a line this
thick’). They can be enlarged or shrunk as
much as you like, and never lose accuracy, because
they <em>get redrawn</em> automatically at
any size. You can't do photographs as vectors, but
it's the only acceptable method for drawings or
diagrams.
</p>
</dd>
</dl>
</blockquote>
<p>Vector graphic packages are also better suited for
saving your image directly in <small><a href="chapter6.html#EPS" class="acroref" name="A157" title="Encapsulated PostScript">EPS</a></small>
or <small><a href="chapter4.html#PDF" class="acroref" name="A158" title="Portable Document Format">PDF</a></small> format (both of which use
vectors internally). All the major graphics-generating
packages in all disciplines output vector formats:
<i><a name="p166">AutoCAD</a></i>,
<i><a name="p167">ChemDraw</a></i>,
<i><a name="p168">MathCAD</a></i>,
<i><a name="p169">Maple</a></i>,
<i><a name="p170">Mathematica</a></i>,
<i><a name="p171">ArcInfo</a></i>, and so on. <small><a href="chapter6.html#EPS" class="acroref" name="A159" title="Encapsulated PostScript">EPS</a></small> is the universally-accepted format
for creating vector graphics for publication, with <small><a href="chapter4.html#PDF" class="acroref" name="A160" title="Portable Document Format">PDF</a></small> a close second. Most of the major
graphics (drawing) packages can also save as <small><a href="chapter6.html#EPS" class="acroref" name="A161" title="Encapsulated PostScript">EPS</a></small>, such as
<i><a name="p172">PhotoShop</a></i>, <i><a name="p173">PaintShop
Pro</a></i>, Adobe
<i><a name="p174">Illustrator</a></i>, Corel
<i><a name="p175">Draw</a></i>, and
<i><a name="p176">GIMP</a></i>. There are also some free
vector plotting and diagramming packages available like
<i><a name="p177">tkPaint</a></i> and
<i><a name="p178">GNUplot</a></i> which do the same. Never,
ever (except in the direst necessity) save any
<em>diagram</em> as a bitmap.
</p>
<div class="figure" align="center">
<hr>
<caption><i>Figure 6.1</i>: <a name="">The diagram from <a href="chapter6.html#workeff">Figure 6.1</a> shrunk and
enlarged</a></caption>
<div align="center" style="margin:12px"><img src="diagram.png" style="border:thin solid black;" width="221.20000000000002"> <img src="diagram.png" style="border:thin solid black;"></div>
<hr>
</div>
<p>Bitmap formats like <small><a href="chapter6.html#JPG" class="acroref" name="A162" title="Joint Photographic Experts Group">JPG</a></small> and
<small><a href="chapter6.html#PNG" class="acroref" name="A163" title="Portable Network Graphic">PNG</a></small> are ideal for photographs, as
they are also able to compress the data substantially
without too much loss of quality. However, compressed
formats are bad for screenshots, if you are documenting
computer tasks, because too much compression makes them
blurry. The popular <a name="GIF" class="acroref">Graphics Interchange
Format</a> (<small>GIF</small>) is good for screenshots, but is not
supported by <span class="TEX">T<span class="E">E</span>X</span>: use <small><a href="chapter6.html#PNG" class="acroref" name="A165" title="Portable Network Graphic">PNG</a></small>
instead, with the compression turned down to minimum. Avoid
uncompressible formats like <small><a href="chapter6.html#BMP" class="acroref" name="A166" title="Microsoft Bitmap">BMP</a></small> as
they produce enormous and unmanageable files. The <a name="TIFF" class="acroref">Tagged Image File Format</a> (<small>TIFF</small>), popular with
graphic designers, should also be avoided because far too
many companies have designed and implemented non-standard,
conflicting, proprietary extensions to the format, making it
virtually useless for transfer between different types of
computers (except in faxes, where it's still used in a
much stricter version).
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 18</i>. Adding pictures
</h4>
<p>Add <code class="literal">\usepackage{graphicx}</code> to the
preamble of your document, and copy or download an image
you want to include. Make sure it is a <small><a href="chapter6.html#JPG" class="acroref" name="A168" title="Joint Photographic Experts Group">JPG</a></small>, <small><a href="chapter6.html#PNG" class="acroref" name="A169" title="Portable Network Graphic">PNG</a></small>, or
<small><a href="chapter4.html#PDF" class="acroref" name="A170" title="Portable Document Format">PDF</a></small> image if you use
<i><a name="p179">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, or an <small><a href="chapter6.html#EPS" class="acroref" name="A171" title="Encapsulated PostScript">EPS</a></small> image if you use standard
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.
</p>
<p>Add <code class="command"><a name="c129">\includegraphics</a></code> and the
filename in curly braces (without the filetype), and
process the document and preview or print it.
</p>
<p>Make it into a figure following the example in <a href="chapter6.html#figures">section 6.4</a>.
</p>
<p>Be aware that some <small><a href="chapter4.html#DVI" class="acroref" name="A172" title="device-independent">DVI</a></small>
previewers are not able to display all types of graphics,
and some cannot display colour. For best results, use
<small><a href="chapter4.html#PDF" class="acroref" name="A173" title="Portable Document Format">PDF</a></small> or
<a name="t31">PostScript</a> preview.
</p>
<hr>
</blockquote>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.5.2 <a name="graphicsdir">Graphics storage</a></h3>
<p>I mentioned earlier that there was a way to tell
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> where to look if you had stored images centrally
for use in many different documents. The answer is in a
command <code class="command"><a name="c130">\graphicspath</a></code> which you supply
with an argument giving the name of an additional directory
path you want searched when a file uses the
<code class="command"><a name="c131">\includegraphics</a></code> command, for
example:
</p>
<blockquote><pre>
\graphicspath{c:\mypict~1\camera}
\graphicspath{/var/lib/images}
\graphicspath{HardDisk:Documents:Reports:Pictures}
</pre></blockquote>
<p>I've used the ‘safe’
(MS-DOS) form of the Windows <code>My
Pictures</code> folder because it's A Bad Idea to
use directory names containing spaces (see <a href="chapter4.html#filenames">the panel ‘Picking suitable filenames’ in chapter 4</a>). Using
<code class="command"><a name="c132">\graphicspath</a></code> does make your file less
portable, though, because file paths tend to be specific
both to an operating system and to your computer, like the
examples above.
</p>
</div>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.6 <a name="verbatim">Verbatim text</a></h2><a name="I106"></a><p>If you are documenting computer procedures, you probably
need fixed-width type for examples of programming or data
input or output. Even if you are writing about completely
non-computer topics, you may often want to quote a <small><a href="chapter6.html#URI" class="acroref" name="A174" title="Uniform Resource Indicator">URI</a></small> or email address which needs to be
typeset specially. It is particularly important in these two
examples to avoid hyphenating them if they have to break over
a line-end, because the hyphen might be taken by the user as a
part of the address.
</p>
<p>Standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> includes two features for handling
fixed-format text, and there are many more available in
packages.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.6.1 <a name="inlineverb">Inline verbatim</a></h3>
<p>To specify a word or phrase as verbatim text in
typewriter type within a sentence, use the special command
<code class="command"><a name="c133">\verb</a></code>, followed by your piece of text
surrounded by any suitable character which does
<em>not</em> occur in the text itself. This is a
very rare exception to the rule that arguments go in curly
braces. I often use the plus sign for this, for example to
show a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> command, I type
<code class="literal">\verb+\includegraphics[width=3in]{myhouse}+</code>
in order to display
<code class="literal">\includegraphics[width=3in]{myhouse}</code>, but
sometimes I use the
<b><i><a name="grave">grave accent</a></i></b> (<b><i><a name="backtick">backtick</a></i></b> or open-quote) or the
vertical bar when the phrase already has a plus sign in it,
like <code class="literal">\verb|\(y=a+2x^2\)|</code> when
illustrating the <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> equation
<code class="literal">\(y=a+x^2\)</code>.
</p>
<p>This command has the advantage that it turns off all
special characters (see <a href="chapter2.html#specials">section 2.5</a>) except
the one you use as the delimiter, so you can easily quote
sequences of characters in any computer syntax without
problems. However, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will never break the argument of
<code class="command"><a name="c134">\verb</a></code> at a line-end when formatting a
paragraph, even if it contains spaces, so if it happens to
be long, and falls towards the end of a line, it will stick
out into the margin. See <a href="chapter2.html#hyph">section 2.8.2</a> for more
information on line-ends and hyphenation.
</p>
<p>The <span class="package"><a name="m52">url</a></span> package avoids this by
providing the command <code class="command"><a name="c135">\url</a></code> which works in
the same way as <code class="command"><a name="c136">\verb</a></code>, with the argument
enclosed in a pair of characters, but performs a hyphenless
break at punctuation characters, as in <code>http://www.ucc.ie:8080/cocoon/cc/<br>docs/siteowner.xml</code>.
It was designed for Web <small><a href="chapter6.html#URI" class="acroref" name="A175" title="Uniform Resource Indicator">URI</a></small>s,<sup><a href="#F37">5</a></sup> so it understands their syntax and will never
break mid-way through an unpunctuated word, only at slashes
and full points. Bear in mind, however, that spaces are
forbidden in <small><a href="chapter6.html#URI" class="acroref" name="A179" title="Uniform Resource Indicator">URI</a></small>s, so using spaces
in <code class="command"><a name="c137">\url</a></code> arguments will fail, as will using
other non-<small><a href="chapter6.html#URI" class="acroref" name="A180" title="Uniform Resource Indicator">URI</a></small>-valid
characters.
</p>
<ol class="footnotes" start="5">
<li><a name="F37">The original term <a name="URL" class="acroref">Uniform Resource
Locator</a> (<small>URL</small>) is now strongly deprecated in the Web
community in favour of the more accurate <a name="URI" class="acroref">Uniform Resource Indicator</a> (<small>URI</small>). For
details see <a href="http://www.w3.org/Addressing/"><tt>http://www.w3.org/Addressing/</tt></a>.
Unfortunately the older term still persists, especially
in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> and <small><a href="chapter10.html#XML" class="acroref" name="A178" title="Extensible Markup Language">XML</a></small>
markup.</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>6.6.2 Display verbatim
</h3>
<p>For longer (multiline) chunks of fixed-format text, use
the <span class="environment"><a name="e32">verbatim</a></span> environment:
</p>
<blockquote><pre>
\begin{verbatim}
\documentclass[11pt,a4paper,oneside]{report}
\begin{document}
\title{Practical Typesetting}
\author{Peter Flynn\\Silmaril Consultants}
\date{December 2004}
\maketitle
\end{document}
\end{verbatim}
</pre></blockquote>
<p>Like <code class="command"><a name="c138">\verb</a></code>, this turns off all special
characters, so you can include anything at all in the
verbatim text except the exact line
<code class="literal">\end{verbatim}</code></p>
<p>For more control over formatting, however, I recommend
the use of the <span class="package"><a name="m53">fancyvrb</a></span> package,
which provides a <span class="environment"><a name="e33">Verbatim</a></span> environment
(note the capital letter) which lets you draw a rule round
the verbatim text, change the font size, and even have
typographic effects inside the <span class="environment"><a name="e34">Verbatim</a></span>
environment. It can also be used in conjunction with the
<span class="package"><a name="m54">fancybox</a></span> package (see <a href="chapter6.html#fancybox">section 6.7.3</a>), and it can add reference line numbers
(useful for chunks of data or programming), and it can even
include entire external files.
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 19</i>. Try some fixed-format text
</h4>
<p>Add your email address and home page <small><a href="chapter6.html#URI" class="acroref" name="A181" title="Uniform Resource Indicator">URI</a></small> using the <code class="command"><a name="c139">\verb</a></code>
and <code class="command"><a name="c140">\url</a></code> commands. You'll need to
<code class="literal">\usepackage{url}</code> for the latter.
</p>
<p>If you know some programming, try a few lines enclosed
in <span class="environment"><a name="e35">verbatim</a></span> and
<span class="environment"><a name="e36">Verbatim</a></span> environments.
</p>
<hr>
</blockquote>
</div>
</div>
<div class="sect1">
<h2><a href="#otherdoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.7 <a name="boxes">Boxes, sidebars, and panels</a></h2><a name="I107"></a><a name="I108"></a><a name="I109"></a><p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, like most typesetting systems, works by setting
text into boxes. The default box is the width of the current
page, and works like an old compositor's galley (tray)
from the days of metal type: it accumulates typeset text until
it's a bit longer than the specified page height. At this
stage <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> works out how much of it really will fit on a
page, snips it off and ships it out to the <small><a href="chapter4.html#DVI" class="acroref" name="A182" title="device-independent">DVI</a></small> or <small><a href="chapter4.html#PDF" class="acroref" name="A183" title="Portable Document Format">PDF</a></small> file,
and puts the rest back into the galley to accumulate towards
the following page.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.7.1 <a name="boxtext">Boxes of text</a></h3>
<p>Because of this ‘box’ model,
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> can typeset any text into a box of any width
wherever on the page you need it.
</p>
<p>The simplest command for small amounts of text is
<code class="command"><a name="c141">\parbox</a></code>. This command needs two arguments
in curly braces: the first is the width you want the text
set to, and the second is the text itself, for
example:
</p>
<blockquote class="example"><pre>
\parbox{1in}{Please make sure you send in your
completed forms by January 1st
next year, or the penalty clause
2(a) will apply}
</pre><div align="center">
<table>
<tr>
<td valign="top" width="144" align="left">Please make sure you send in your completed
forms by January 1st next year, or the penalty
clause 2(a) will apply
</td>
</tr>
</table>
</div>
</blockquote>
<p>The text is typeset to the required width, and the box
is extended downwards for as long as is required to fit the
text. Note that the baseline of a <code class="command"><a name="c142">\parbox</a></code>
is set to the midpoint of the box; that is, if you include a
<code class="command"><a name="c143">\parbox</a></code> in mid-sentence, the centre of the
box will be lined up with the line of type currently being
set.<img src="parbox1.png" width="28" align="middle"> You can specify that it should be the top or
bottom by adding an optional <span class="option"><a name="o11">t</a></span> or
<span class="option"><a name="o12">b</a></span> in square brackets before the width. For
example,
<code class="literal">\parbox[t]{1in}{...}</code> will produce
<img src="parbox2.png" width="72" align="top"></p>
<p>Notice that when setting very narrow measures with type
that is too large, the spacing may become uneven and there
may be too much hyphenation. Either use
<code class="command"><a name="c144">\raggedright</a></code> or reduce the type size, or
(in extreme cases) reword the text or break each line by
hand. It is rare for <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to need this: the example above
was deliberately chosen to be obtuse as an
illustration.
</p>
<p>Where the contents is more extensive or more
complicated, you can use the <span class="environment"><a name="e37">minipage</a></span>
environment.
</p>
<p>Within this you can use virtually everything
that occurs in normal text (e.g. lists, paragraphs,
tabulations, etc.) with the exception of floats like
tables and figures. The <span class="environment"><a name="e38">minipage</a></span>
environment has an argument just like
<code class="command"><a name="c145">\parbox</a></code> does, and it means the same: the
width you want the text set to.
</p>
<p>Note that in <span class="environment"><a name="e39">minipage</a></span>s and
<code class="command"><a name="c146">\parbox</a></code>es, the paragraph indentation
(<tt>\<a name="d26">parindent</a></tt>) is
reset to zero. If you need to change it, set it inside the
<span class="environment"><a name="e40">minipage</a></span> or <code class="command"><a name="c147">\parbox</a></code>
using the <code class="command"><a name="c148">\setlength</a></code> command (see <a href="chapter3.html#paragraphs">section 3.6</a>).
</p>
<blockquote class="example"><pre>
\begin{minipage}{3in}
Please make sure you send in your completed
forms by January 1st next year, or the
penalty clause 2(a) will apply.
\begin{itemize}
\item Incomplete forms will be returned to
you unprocessed.
\item Forms must be accompanied by the
correct fee.
\item There is no appeal. The adjudicators'
decision is final.
\end{itemize}
\end{minipage}
</pre><div align="center">
<table>
<tr>
<td valign="top" width="432" align="left">
<p>Please make sure you send in your
completed forms by January 1st next year, or the
penalty clause 2(a) will
apply.
</p>
<ul>
<li>
<p>Incomplete forms will be returned to you
unprocessed.
</p>
</li>
<li>
<p>Forms must be accompanied by the correct
fee.
</p>
</li>
<li>
<p>There is no appeal. The
adjudicators' decision is final.
</p>
</li>
</ul>
</td>
</tr>
</table>
</div>
</blockquote>
<p>There are two other ways of typesetting text to widths
other than the normal text width: you can use a one-row,
one-cell <span class="environment"><a name="e41">tabular</a></span> environment with the
<code>p</code> column type specification, or you
can use the <code class="command"><a name="c149">\vbox</a></code> command, which is raw
<span class="TEX">T<span class="E">E</span>X</span>, and outside the scope of this document.
</p>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>6.7.2 <a name="fbox">Framed boxes</a></h3>
<p>To put a frame round <img src="fbox.png" align="middle" height="10px" alt="\fbox{some text}" width="64">, use the
<code class="command"><a name="c150">\fbox</a></code> command:
<code class="literal">\fbox{some text}</code>. This works for a few
words in mid-line, but the framed box and its contents
won't break over the end of a line. To typeset
multiline text in a box, put it in a
<code class="command"><a name="c151">\parbox</a></code>, or use a
<span class="environment"><a name="e42">minipage</a></span> or
<span class="environment"><a name="e43">tabular</a></span> environment as described above,
and enclose the whole thing in a
<code class="command"><a name="c152">\fbox</a></code>.
</p>
<blockquote class="example"><pre>
\fbox{\begin{minipage}{3in}
This multiline text is more flexible than
a tabular setting:
\begin{itemize}
\item it can contain any type of normal
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> typesetting;
\item it can be any specified width;
\item it can even have its own
footnotes\footnote{Like this}.
\end{itemize}
\end{minipage}}
</pre><p>This multiline text is more flexible than a
tabular setting:
</p>
<ul>
<li>
<p>it can contain any type of normal <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
typesetting;
</p>
</li>
<li>
<p>it can be any specified width;</p>
</li>
<li>
<p>it can even have its own footnotes.<sup><a href="#F38">6</a></sup></p>
</li>
</ul>
</blockquote>
<p>The spacing between text and box is controlled by the
value of <tt>\<a name="d27">fboxsep</a></tt>, and
the thickness of the line by <tt>\<a name="d28">fboxrule</a></tt>. The following values
were used above:
</p>
<blockquote><pre>
\setlength{\fboxsep}{1em}
\setlength{\fboxrule}{2pt}
</pre></blockquote>
<p>As we saw before, setting justified text in narrow
measures will produce poor spacing: either use the
<code class="command"><a name="c153">\raggedright</a></code> command, or change the font
size, or add explicit extra hyphenation points.
</p>
<p>Note the <code class="literal">\begin{tabular}</code> and
<code class="literal">\begin{minipage}</code> commands still need the
width specifying: in the case of the
<code class="literal">\begin{tabular}</code> by the use of the
<code class="literal">p</code> column type with its width
specification, and in the case of
<code class="literal">\begin{minipage}</code> by the second
argument.
</p>
<blockquote class="example"><pre>
\fbox{\begin{tabular}{p{1in}}
Multiline text in a box typeset using
\textsf{tabular}
\end{tabular}}
</pre><div align="center">
<table border="1" cellpadding="6pt">
<tr>
<td valign="top" width="144" align="left">Multiline text in a box typeset using
<span class="package"><a name="m55">tabular</a></span></td>
</tr>
</table>
</div>
</blockquote>
<ol class="footnotes" start="6">
<li><a name="F38">Like this.</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>6.7.3 <a name="fancybox">Sidebars and panels</a></h3>
<p>The <span class="package"><a name="m56">fancybox</a></span> package lets you
extend the principle of <code class="command"><a name="c154">\fbox</a></code> with
commands to surround text in square, oval (round-cornered),
and drop-shadow boxes (e.g. <code class="command"><a name="c155">\ovalbox</a></code>,
<code class="command"><a name="c156">\shadowbox</a></code>, etc.: see the documentation
for details).
</p>
<p>You can create panels of any size with these borders by
using the <span class="environment"><a name="e44">minipage</a></span> environment to
typeset the text inside a special <span class="environment"><a name="e45">Sbox</a></span>
environment which <span class="package"><a name="m57">fancybox</a></span> defines.
The <span class="environment"><a name="e46">minipage</a></span> formats the text but the
<span class="environment"><a name="e47">Sbox</a></span> ‘captures’
it, allowing you to put the frame round it as it
prints.
</p>
<p>The printed version of this document uses this extensively and
there is a useful example shown in <a href="chapter9.html#macenv">section 9.5</a>.
</p>
</div>
</div>
</div>
<hr>
<table width="100%">
<tr>
<td align="left"><a href="chapter5.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="chapter7.html"><img src="next.png" alt="Next" border="0"></a></td>
</tr>
</table>
</body>
</html>
|