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
|
<!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:20--><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Formatting information: Chapter 4 — Typesetting, viewing and printing</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 4 — Typesetting, viewing and printing</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="current"><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=""><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="process">CHAPTER</a></b></i></small><br><table border="1">
<tr>
<td class="chapno">4</td>
</tr>
</table>
</td>
<td><pre class="spacing"></pre></td>
<td>
<p> </p>
<h1>Typesetting, viewing and printing</h1>
</td>
<td class="toc">
<p> </p>
<ol>
<li><a href="#setting">Typesetting</a></li>
<li><a href="#errmsg">Errors and warnings</a></li>
<li><a href="#dvi">Screen preview</a></li>
<li><a href="#print">Printer output</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="I59"></a><a name="I60"></a><a name="I61"></a><p>We've now got far enough to typeset what you've
entered. I'm assuming at this stage that you have typed
some sample text in the format specified in the previous
chapter, and you've saved it in a plain-text file with a
filetype of
<code class="literal">.tex</code> and a name of your own choosing.
</p><a name="I62"></a><blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 8</i>. Saving your file
</h4>
<p>If you haven't already saved your file, do so now
(some editors and interfaces let you typeset the document
without saving it!).
</p>
<p>Pick a sensible filename in a sensible directory. Names
should be short enough to display and search for, but
descriptive enough to make sense. See <a href="chapter4.html#filenames">the panel ‘Picking suitable filenames’ in this chapter</a> for more details.
</p>
<hr>
</blockquote>
<div align="center" class="sidebar">
<table width="75%">
<tr>
<td align="left" class="sidebar">
<h3><img src="ktip.png" align="middle"> <a name="filenames">Picking suitable filenames</a></h3>
<p>Never, ever use directories (folders) or file names
which contain spaces. Although your operating system
probably supports them, some don't, and they will
only cause grief and tears with <span class="TEX">T<span class="E">E</span>X</span>.
</p>
<p>Make filenames as short or as long as you wish, but
strictly avoid spaces. Stick to upper- and lower-case
letters without accents (A–Z and a–z), the
digits 0–9, the hyphen (<code class="literal">-</code>), and
the full point or period (<code class="literal">.</code>), (similar
to the conventions for a Web <small><a href="chapter6.html#URI" class="acroref" name="A86" title="Uniform Resource Indicator">URI</a></small>): it will let you refer to <span class="TEX">T<span class="E">E</span>X</span>
files over the Web more
easily and make your files more portable.
</p>
</td>
</tr>
</table>
</div>
<div class="sect1">
<h2><a href="#process"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.1 <a name="setting">Typesetting</a></h2>
<p>Typesetting your document is usually done by clicking
on a button in a toolbar or an entry in a menu. Which one you
click on depends on what output you want — there are two
formats available:
</p>
<ul>
<li>
<p>The standard (default) <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> program produces a
<a name="DVI" class="acroref">device-independent</a> (<small>DVI</small>) file which
can be used with any <span class="TEX">T<span class="E">E</span>X</span> previewer or printer driver on any
make or model of computer. There are dozens of these
available: at least one of each (previewer and printer
driver) should have been installed with your distribution
of <span class="TEX">T<span class="E">E</span>X</span>.
</p>
</li>
<li>
<p>The <i><a name="p118">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i> program
produces an Adobe Acrobat <small><a href="chapter4.html#PDF" class="acroref" name="A88" title="Portable Document Format">PDF</a></small>
file which can be used with any suitable previewer, such
as <i><a name="p119">GSview</a></i>,
<i><a name="p120">PDFview</a></i>,
<i><a name="p121">Xpdf</a></i>, the
<i><a name="p122">Opera</a></i> browser, or Adobe's
own <i><a name="p123">Acrobat Reader</a></i>.
</p>
</li>
</ul>
<p>Depending on which one you choose, you may have to
[re]configure your editor so that it runs the right program.
They can all do all of them, but they don't always come
pre-set with buttons or menus for every possible option,
because they can't guess which one you want.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.1.1 Standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></h3>
<p>There are also two ways of running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>: from the
toolbar or menu, or from the command line. Toolbars and
menus are most common in graphical systems, and are the
normal way to run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. Command lines are used in
non-graphical systems and in automated processes where
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is run
unattended (so-called ‘batch’ or
‘scripted’ processing).
</p>
<p>Whichever way you run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, it will process your
file and display a log or record of what it's doing
(see <a href="chapter4.html#terminal">the example ‘Running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in a terminal or console
window’ in section 4.1.2</a>: it looks the
same no matter what system you use). This is to let you see
where (if!) there are any errors or problems.
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 9</i>. Running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from the toolbar or menu
</h4>
<p>Run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> on your file. According to which system
you're using this will either be the
<span class="guiicon"><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></span> toolbar icon or the
<span class="guimenu"><span class="TEX">T<span class="E">E</span>X</span></span>→<span class="guimenuitem"><span class="TEX">T<span class="E">E</span>X</span>
File</span> menu item.
</p>
<p>Your editor may suggest you save your file if you
haven't already done so. Do it.
</p>
<hr>
</blockquote>
<p>If <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> reports any errors — easily identifiable
as lines in the log beginning with an exclamation mark
(!) — <em>don't panic!</em> Turn to <a href="chapter4.html#errmsg">section 4.2</a>, identify what went wrong, and fix it in
your input file. Then re-run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. If there were no
errors, your file is ready for displaying or
printing.
</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>4.1.2 <a name="cmdwin">Running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from a command window</a></h3>
<p>This is worth practising even if you normally use a
<small><a href="intro.html#GUI" class="acroref" name="A89" title="Graphical User Interface">GUI</a></small>, so that you understand what it
does. See <a href="chapter4.html#cliex">Figure 4.1</a> for an example.
</p>
<blockquote class="exercise"><a name="terminal"></a><hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 10</i>. Running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in a terminal or console
window
</h4>
<ul>
<li>
<p>Under graphical Unix-based systems (Linux and Mac)
you open a command (shell) window by clicking on the
shell or screen icon in the control panel at the
bottom of your screen.
</p>
</li>
<li>
<p>Under Microsoft Windows you open a command window
by clicking on the
<span class="guimenu">Start</span>→<span class="guisubmenu">Programs</span>→<span class="guimenuitem">MS-DOS</span>
or
<span class="guimenu">Start</span>→<span class="guisubmenu">Command
Prompt</span> menu item.
</p>
</li>
</ul>
<p>When the command window appears, type</p>
<blockquote><pre>
cd <code><u>documents</u></code>
latex <code><u>mybook</u></code>
</pre></blockquote>
<p>Substitute the relevant directory and file name.
Remember to press the <tt class="keycap">Enter</tt> key at the
end of each line.
</p>
<hr>
</blockquote>
<div class="figure" align="center">
<hr>
<caption><i>Figure 4.1</i>: <a name="cliex">Command-line usage</a></caption>
<div align="center" style="margin:12px"><img src="terminal.png" width="75%"></div>
<hr>
</div>
</div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.1.3 pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></h3>
<p>If your editor is set up to generate <small><a href="chapter4.html#PDF" class="acroref" name="A90" title="Portable Document Format">PDF</a></small> files direct instead of <small><a href="chapter4.html#DVI" class="acroref" name="A91" title="device-independent">DVI</a></small> files, then you can click the
<span class="guiicon">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></span> toolbar icon or type the
command <code class="literal">pdflatex
<code><u>filename</u></code></code> in a terminal
(console) window. <i><a name="p124">Emacs</a></i> does not
have a default menu configured for
<i><a name="p125">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i> but if you have
already run standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> on the file, you can type ther
<code class="literal">pdflatex</code> command in the
<code class="literal">*TeX-Shell*</code> pane.
</p>
</div>
</div>
<div class="sect1">
<h2><a href="#process"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.2 <a name="errmsg">Errors and warnings</a></h2>
<p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> describes what it's typesetting while it does it,
and if it encounters something it doesn't understand or can't
do, it will display a message saying what's wrong. It may
also display warnings for less serious conditions.
</p>
<p><em>Don't panic if you see error
messages</em>: it's very common for beginners to
mistype or mis-spell commands, forget curly braces, type a
forward slash instead of a backslash, or use a special
character by mistake. Errors are easily spotted and easily
corrected in your editor, and you can then run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> again
to check you have fixed everything. Some of the most common
errors are described in <a href="chapter4.html#errmsg">section 4.2</a> with an
explanation of how to fix them.
</p>
<div align="center" style="margin:12px"><img src="dontpanic.png" width="50%"></div>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.2.1 <a name="errs">Error messages</a></h3>
<p>The format of an error message is always the same. Error
messages begin with an exclamation mark at the start of the
line, and give a description of the error, followed by another
line starting with the number, which refers to the line-number
in your document file which <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> was processing when the
error was spotted. Here's an example, showing that the user
mistyped the <code class="command"><a name="c93">\tableofcontents</a></code>
command:
</p>
<blockquote><pre>
! Undefined control sequence.
l.6 \tableofcotnetns
</pre></blockquote>
<p>When <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> finds an error like this, it displays the
error message and pauses. You must type one of the following
letters to continue:
</p>
<div align="center">
<table>
<tr class="headfoot">
<th valign="bottom" align="center">Key</th>
<th valign="bottom" align="left" width="576">Meaning</th>
</tr>
<tr>
<td valign="top" align="center"><tt class="keycap">x</tt></td>
<td valign="top" width="576" align="left">Stop immediately and e<strong>x</strong>it the program.
</td>
</tr>
<tr>
<td valign="top" align="center"><tt class="keycap">q</tt></td>
<td valign="top" width="576" align="left">Carry on <strong>q</strong>uietly as best you can and
don't bother me with any more error
messages.
</td>
</tr>
<tr>
<td valign="top" align="center"><tt class="keycap">e</tt></td>
<td valign="top" width="576" align="left">Stop the program but re-position the text in my
<strong>e</strong>ditor at the point
where you found the error.<sup><a href="#F1a"><i>a</i></a></sup></td>
</tr>
<tr>
<td valign="top" align="center"><tt class="keycap">h</tt></td>
<td valign="top" width="576" align="left">Try to give me more <strong>h</strong>elp.
</td>
</tr>
<tr>
<td valign="top" align="center"><tt class="keycap">i</tt></td>
<td valign="top" width="576" align="left">(followed by a correction) means <strong>i</strong>nput the correction in
place of the error and carry on.<sup><a href="#F1b"><i>b</i></a></sup></td>
</tr>
</table>
<div align="left">
<ol class="footnotes" type="a">
<li><a name="F1a">This only works if you're using an editor
which <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> can communicate with.</a></li>
<li><a name="F1b">This is only a temporary fix to get the file
processed. You still have to make that
correction in the editor.</a></li>
</ol>
</div>
</div>
<p>Some systems (<i><a name="p126">Emacs</a></i> is one
example) run <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> with a
‘non-stop’ switch turned on, so it
will always process through to the end of the file,
regardless of errors, or until a limit is reached.
</p>
<ol class="footnotes" start="0"></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>4.2.2 <a name="warn">Warnings</a></h3>
<p>Warnings don't begin with an exclamation mark: they are
just comments by <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> about things you might want to look
into, such as
overlong or underrun lines (often caused by unusual hyphenations, for
example), pages running short or long, and other typographical
niceties (most of which you can ignore until later).
</p>
<p>Unlike other systems, which try to hide unevennesses in
the text — usually unsuccessfully — by interfering
with the letter-spacing, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> takes the view that the
author or editor should be able to contribute. While it is
certainly possible to set <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>'s parameters so that
the spacing is sufficiently sloppy that you will almost never
get a warning about badly-fitting lines or pages, you will
almost certainly just be delaying matters until you start to
get complaints from your readers or publishers.
</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>4.2.3 Examples
</h3>
<p>Only a few common error messages are given here: those
most likely to be encountered by beginners. If you find
another error message not shown here, and it's not
clear what you should do, ask for help.
</p>
<p>Most error messages are self-explanatory, but be aware
that the place where
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> spots and reports an error may be later in the file
than the place where it actually occurred. For example if
you forget to close a curly brace which encloses, say,
italics, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> won't report this until something else
occurs which can't happen until the curly brace is
encountered (eg the end of the document!) Some errors can
only be righted by humans who can read and understand what
the document is supposed to mean or look like.
</p>
<p>Newcomers should remember to check the list of special
characters in <a href="chapter2.html#specials" title="sect1"></a>: a very large
number of errors when you are learning <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> are due to
accidentally typing a special character when you didn't
mean to. This disappears after a few days as you get used to
them.
</p>
<div class="sect3">
<h4><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.2.3.1 <a name="toomany">Too many }'s</a></h4><a name="I63"></a><a name="I64"></a><blockquote><pre>
! Too many }'s.
l.6 \date December 2004}
</pre></blockquote>
<p>The reason <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> thinks there are too many
<code class="literal">}</code>'s here is that the opening curly
brace is missing after the <code class="command"><a name="c94">\date</a></code> control
sequence and before the word <code class="literal">December</code>,
so the closing curly brace is seen as one too many (which
it is!).
</p>
<p>In fact, there are other things which can follow the
<code class="command"><a name="c95">\date</a></code> command apart from a date in curly
braces, so <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> cannot possibly guess that
you've missed out the opening curly brace — until
it finds a closing one!
</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>4.2.3.2 <a name="undefcs">Undefined control sequence</a></h4><a name="I65"></a><a name="I66"></a><blockquote><pre>
! Undefined control sequence.
l.6 \dtae
{December 2004}
</pre></blockquote>
<p>In this example, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is complaining that it has
no such command (‘control
sequence’) as <code class="literal">\dtae</code>.
Obviously it's been mistyped, but only a human can
detect that fact: all <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> knows is
that <code class="literal">\dtae</code> is not a command it knows
about — it's undefined.
</p>
<p>Mistypings are the commonest source of error. If your
editor has drop-down menus to insert common commands and
environments, use them!
</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>4.2.3.3 <a name="runaway">Runaway argument</a></h4><a name="I67"></a><a name="I68"></a><blockquote><pre>
Runaway argument?
{December 2004 \maketitle
! Paragraph ended before \date was complete.
<to be read again>
\par
l.8
</pre></blockquote>
<p>In this error, the closing curly brace has been
omitted from the date. It's the opposite of the error in
<a href="chapter4.html#toomany">section 4.2.3.1</a>, and it results in
<code class="command"><a name="c96">\maketitle</a></code> trying to format the title
page while <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is still expecting more text for the
date! As
<code class="command"><a name="c97">\maketitle</a></code> creates new paragraphs on the
title page, this is detected and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> complains that
the
previous paragraph has ended but <code class="command"><a name="c98">\date</a></code>
is not yet finished.
</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>4.2.3.4 <a name="underfull">Underfull hbox</a></h4><a name="I69"></a><a name="I70"></a><blockquote><pre>
Underfull \hbox (badness 1394) in paragraph
at lines 28--30
[][]\LY1/brm/b/n/10 Bull, RJ: \LY1/brm/m/n/10
Ac-count-ing in Busi-
[94]
</pre></blockquote>
<p>This is a warning that <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> cannot stretch the
line wide enough to fit, without making the spacing bigger
than its currently permitted maximum. The
<b><i><a name="badness">badness</a></i></b> (0–10,000) indicates
how severe this is (here you can probably ignore a badness
of 1394). It says what lines of your file it was
typesetting when it found this, and the number in square
brackets is the number of the page onto which the
offending line was printed.
</p>
<p>The codes separated by slashes are the typeface and
font style and size used in the line. Ignore them for the
moment: details are in <a href="chapter8.html#fdfiles">step 11</a> if you're
curious.
</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>4.2.3.5 <a name="overfull">Overfull hbox</a></h4><a name="I71"></a><a name="I72"></a><blockquote><pre>
[101]
Overfull \hbox (9.11617pt too wide) in paragraph
at lines 860--861
[]\LY1/brm/m/n/10 Windows, \LY1/brm/m/it/10 see
\LY1/brm/m/n/10 X Win-
</pre></blockquote>
<p>And the opposite warning: this line is too
long by a shade over 9pt. The chosen hyphenation point
which minimises the error is shown at the end of the line
(<em>Win-</em>). Line numbers and page numbers
are given as before. In this case, 9pt is too much to
ignore (over 3mm or more than <span class="math">1/8</span>″), and a manual correction needs
making (such as a change to the hyphenation), or the
flexibility settings need changing (outside the scope of
this book).
</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>4.2.3.6 <a name="nopkg">Missing package</a></h4><a name="I73"></a><a name="I74"></a><blockquote><pre>
! LaTeX Error: File `paralisy.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
</pre></blockquote>
<p>When you use the <code class="command"><a name="c99">\usepackage</a></code> command
to request <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to use a certain package, it will look
for a file with the specified name and the filetype
<code>.sty</code>. In this case the user has
mistyped the name of the <span class="package"><a name="m29">paralist</a></span>
package, so it's easy to fix. However, if you get the name
right, but the package is not installed on your machine,
you will need to download and install it before continuing
(see <a href="chapter5.html#ctan">Chapter 5</a>).
</p>
</div>
</div>
</div>
<div class="sect1">
<h2><a href="#process"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.3 <a name="dvi">Screen preview</a></h2><a name="I75"></a><p>Once the file has been processed without errors (or even
if there are still errors, but you want to see what it's
doing with them), standard <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> will have created a
<small><a href="chapter4.html#DVI" class="acroref" name="A92" title="device-independent">DVI</a></small> file with the same name as your
document but the filetype
<code class="literal">.dvi</code>. If you're using
<i><a name="p127">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, a <small><a href="chapter4.html#PDF" class="acroref" name="A93" title="Portable Document Format">PDF</a></small> file will have been created, and you
can skip to
<a href="chapter4.html#pdfview">section 4.3.3</a>.
</p>
<div class="sect2">
<h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.3.1 <a name="dvipreview">Previewing DVI output</a></h3>
<p>To see the typeset output, click on the
<span class="guiicon">dvi</span> Preview toolbar icon or use the
<span class="guimenu">TeX</span>→<span class="guimenuitem">TeX View</span>
menu item. A <small><a href="chapter2.html#WYSIWYG" class="acroref" name="A94" title="What You See Is What You Get">WYSIWYG</a></small> preview window will appear with
your typeset display (see <a href="chapter4.html#dviview">Figure 4.1</a>).
</p>
<blockquote class="warning">
<h4><img src="warning.png" align="middle" alt="!!!"> <a name="bitmappreview">Bitmap preview fonts in DVI viewers</a></h4>
<p>The first time you display your <small><a href="chapter4.html#DVI" class="acroref" name="A95" title="device-independent">DVI</a></small> output with a new installation of
<span class="TEX">T<span class="E">E</span>X</span>, there may be a short pause if the previewer needs
to create the special bitmaps used for screen previews of
some fonts. These give greater accuracy on low-resolution
devices like screens. As you continue to work with
<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> and your system accumulates these font files, the
pause for generating them will disappear. Recent versions
of <span class="TEX">T<span class="E">E</span>X</span> work directly with Type 1 fonts, however,
and don't have this delay.
</p>
</blockquote>
<div class="figure" align="center">
<hr>
<caption><i>Figure 4.1</i>: <a name="dviview">DVI preview</a></caption>
<div align="center" style="margin:12px"><img src="xdvi.png" width="75%"></div>
<hr>
</div>
<p>Most previewers have a wide range of scaling, zooming,
and measuring functions, but remember this is a
<em>picture</em> of your output: you cannot edit
the image. To change it, you always edit your source text
and reprocess the file.
</p>
<p>With <i><a name="p128">xdvi</a></i> and its derivatives
like <i><a name="p129">dviview</a></i>, you can leave the
display window open, and after you've reprocessed your
document through <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, moving your mouse back into the
window will make the display update automatically (click
your mouse if your windowing system needs a
click to focus).
</p>
<p><a href="chapter4.html#dviview">Figure 4.1</a> shows
<i><a name="p130">xdvi</a></i> displaying a page. With a
standard three-button mouse you get three levels of
micro-zoom to let you inspect fine details.
</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>4.3.2 <a name="makeps">Previewing with PostScript</a></h3>
<p><a name="t7">PostScript</a> is a page description
language invented by Adobe and used in laser printers and
high-end typesetters. It's been the universal standard
for electronically-formatted print files for nearly two
decades, and all printers and publishers are accustomed to
using it. <small><a href="chapter4.html#PDF" class="acroref" name="A96" title="Portable Document Format">PDF</a></small> is a descendant of
PostScript, and is rapidly taking over, but
<a name="t8">PostScript</a> itself is still extremely
common, largely because it is very robust, and is usually an
<small><a href="chapter2.html#ASCII" class="acroref" name="A97" title="American Standard Code for Information Interchange">ASCII</a></small> file, which makes it very
portable and easy to generate (it is actually a programming
language in its own right). The drawback is the large size
of <a name="t9">PostScript</a> files, especially if
they contain bitmapped graphics.
</p>
<p>The <i><a name="p131">dvips</a></i> program which comes
with all <span class="TEX">T<span class="E">E</span>X</span> systems is used to generate
<a name="t10">PostScript</a> files directly from your
<small><a href="chapter4.html#DVI" class="acroref" name="A98" title="device-independent">DVI</a></small> output. These
<code>.ps</code> files can be viewed, printed, sent
to a platemaker or filmsetter, or put online for
downloading.
</p>
<p><small><a href="chapter4.html#DVI" class="acroref" name="A99" title="device-independent">DVI</a></small> viewers cannot render some
<a name="t11">PostScript</a> graphical manipulations
like rotating and deforming, so an alternative to viewing
the DVI file direct is to generate a
<a name="t12">PostScript</a> file and use a
<a name="t13">PostScript</a> viewer. You may have to to
do this for your publisher anyway, and many editors can be
configured to do this by default. Look for a
<span class="guiicon">dvips</span> toolbar icon or menu entry and
click on it.
</p>
<p>It's also very simple to do manually: let's
assume your <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> file was called
<code>mydoc.tex</code>, so processing it has created
<code>mydoc.dvi</code>. Just type:
</p>
<blockquote><pre>
dvips -o mydoc.ps mydoc
</pre></blockquote>
<p>in a command window (see <a href="chapter4.html#terminal">the example ‘Running <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in a terminal or console
window’ in section 4.1.2</a> for how to use one)
and <i><a name="p132">dvips</a></i> will create
<code>mydoc.ps</code> which can be used both for
previewing and printing.
</p>
<p>To view a <a name="t14">PostScript</a> file, you
need a <a name="t15">PostScript</a> previewer like
<i><a name="p133">GSview</a></i>, which works with the
<a name="t16">PostScript</a> interpreter
<i><a name="p134">Ghostscript</a></i>, which should have
been installed automatically along with your <span class="TEX">T<span class="E">E</span>X</span> system
(if not, install both now: <i><a name="p135">GSview</a></i>
is separately licensed and cannot legally be included in
some older <span class="TEX">T<span class="E">E</span>X</span> distributions, so you may have to download
it yourself).
</p>
<p><i><a name="p136">GSview</a></i> can be set to watch
the <a name="t17">PostScript</a> file and automatically
update the display any time the file is changed, without you
even having to click on the window.
</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>4.3.3 <a name="pdfview">Previewing with PDF</a></h3>
<p>The <a name="PDF" class="acroref">Portable Document Format</a> (<small>PDF</small>)
is a derivative of <a name="t18">PostScript</a>.
Whereas <a name="t19">PostScript</a> is a programming
language in itself, <small><a href="chapter4.html#PDF" class="acroref" name="A101" title="Portable Document Format">PDF</a></small> is in effect
the <em>result</em> of processing a document
through <a name="t20">PostScript</a>: it's a binary
file format, extremely compact, and well-supported on all
platforms.
</p>
<p>If your system is configured to generate <small><a href="chapter4.html#PDF" class="acroref" name="A102" title="Portable Document Format">PDF</a></small> files direct instead of <small><a href="chapter4.html#DVI" class="acroref" name="A103" title="device-independent">DVI</a></small> files, just open the
<code>.pdf</code> file using any <small><a href="chapter4.html#PDF" class="acroref" name="A104" title="Portable Document Format">PDF</a></small> previewer or browser.
</p>
<p>Most editors are configured to display a toolbar icon
which will pop up <i><a name="p137">Acrobat Reader</a></i>
or some other viewer with the current <small><a href="chapter4.html#PDF" class="acroref" name="A105" title="Portable Document Format">PDF</a></small> output file.
</p>
<p>Adobe's <i><a name="p138">Acrobat Reader</a></i>
cannot automatically update the view if you reprocess your
document, in the way that <i><a name="p139">xdvi</a></i>
and <i><a name="p140">GSview</a></i> can. You
have to close the display with <tt class="keycap">Ctrl</tt>–<tt class="keycap">W</tt> and reload the file with <tt class="keycap">Alt</tt>–<tt class="keycap">F</tt> <tt class="keycap">1</tt>.
</p>
<blockquote class="warning">
<h4><img src="warning.png" align="middle" alt="!!!"> <a name="">Bitmap preview fonts in Acrobat Reader</a></h4>
<p>Acrobat Reader is extremely poor at rendering
Type 3 (bitmap) fonts. If you are using these (either
in an old <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> installation which has not been
upgraded to Type 1, or with files using specialist
fonts only available in Type 3 format), you will see
a very fuzzy display at low magnifications. It will print
perfectly, but Acrobat Reader's display is
disappointing. The solution is to use a better previewer
or to upgrade to the Type 1 versions of the fonts
if possible, or both. If you need to
use Type 3 fonts in <small><a href="chapter4.html#PDF" class="acroref" name="A106" title="Portable Document Format">PDF</a></small>s,
you probably need to warn your readers to expect a fuzzy
display from Acrobat Reader (but good printout), and to
change to a better reader if they can.
</p>
</blockquote>
</div>
</div>
<div class="sect1">
<h2><a href="#process"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>4.4 <a name="print">Printer output</a></h2><a name="I76"></a><p><span class="TEX">T<span class="E">E</span>X</span> systems print on almost anything from the simplest
dot-matrix printers to the biggest phototypesetters, including
all the laser printers and a host of other devices in between.
<em>How</em> you do it varies slightly according
to how you do your typesetting and previewing:
</p>
<blockquote>
<dl>
<dt><b>If you are using DVI</b></dt>
<dd>
<p>and you have a previewer which has a
<b>print</b> function configured for your
printer, you can use that. If not, create a
<a name="t21">PostScript</a> file and use
<i><a name="p141">GSview</a></i> instead.
</p>
</dd>
<dt><b>If you are using PDF</b></dt>
<dd>
<p>you can print directly from your <small><a href="chapter4.html#PDF" class="acroref" name="A107" title="Portable Document Format">PDF</a></small> viewer. Be careful about using
the ‘Fit to page’ options, as they will
change the size of your document so all your
measurements will be different.
</p>
</dd>
<dt><b>Non-<a name="t22">PostScript</a> printers</b></dt>
<dd>
<p>You can create a <a name="t23">PostScript</a>
file with <i><a name="p142">dvips</a></i> (see <a href="chapter4.html#makeps">section 4.3.2</a>) and use
<i><a name="p143">GSview</a></i> to print it
(<i><a name="p144">GSview</a></i> can print
<a name="t24">PostScript</a> files to almost any
make or model of non-<a name="t25">PostScript</a>
printer).
</p>
<p></p>
</dd>
<dt><b>If you have a real <a name="t26">PostScript</a>
printer</b></dt>
<dd>
<p>or you are using a system with built-in
<a name="t27">PostScript</a> printing support (such
as Linux or Mac), you can create and send
<a name="t28">PostScript</a> output directly from
your editor to the printer without the need to open it
in a previewer first. In
<i><a name="p145">Emacs</a></i>, for example, this is
what happens when you use the
<span class="guimenu"><span class="TEX">T<span class="E">E</span>X</span></span>→<span class="guimenuitem"><span class="TEX">T<span class="E">E</span>X</span>
Print</span> menu item.
</p>
</dd>
</dl>
</blockquote>
<p>Both the <i><a name="p146">dvips</a></i> program and all
the previewers that print tend to have facilities for printing
selected pages, printing in reverse, scaling the page size,
<a name="I77"></a><a name="I78"></a><a name="I79"></a> and printing only odd or even pages for two-sided
work. If you are using <a name="t29">PostScript</a> there
are programs for manipulating the output
(<i><a name="p147">pstops</a></i>), for example to perform
page imposition to get 4, 8, or 16 pages to a sheet for making
booklets (<i><a name="p148">psnup</a></i>).
</p>
<blockquote class="exercise">
<hr>
<h4><img src="kwrite.png" align="middle"> <i>Exercise 11</i>. Print it!
</h4>
<p>Show that you have understood the process of
typesetting, previewing, and printing, by displaying your
document and printing it.
</p>
<hr>
</blockquote>
<p>If you need a
non-<a name="t30">PostScript</a>/<i><a name="p149">Ghostscript</a></i>
solution, install a separate <span class="TEX">T<span class="E">E</span>X</span> print driver for your
printer. Some
may be supplied with your <span class="TEX">T<span class="E">E</span>X</span> installation, and there are
dozens more on <small><a href="chapter5.html#CTAN" class="acroref" name="A108" title="Comprehensive Archive Network">CTAN</a></small>. Their names all
start with <code>dvi</code> and are followed by an
abbreviation for the printer make or model like
<i><a name="p150">dvieps</a></i> for Epson,
<i><a name="p151">dvihp</a></i> for Hewlett-Packard,
<i><a name="p152">dvialw</a></i> for Apple LaserWriters,
etc.. Configure the driver to print directly to the print
queue, or pipe it to the print queue manually. On Linux with
an HP printer, for example, this would be
</p>
<blockquote><pre>
dvihp mydoc | lpr
</pre></blockquote>
<p>Microsoft Windows has no easy way to bypass the print
spool, but you can do it from an MS-DOS command window
with (using a HP printer as an example):
</p>
<blockquote><pre>
dvihp mydoc -o mydoc.hp
copy /b mydoc.hp LPT1:
</pre></blockquote>
<p>Read the documentation for the driver, as the options and
defaults vary.
</p>
</div>
</div>
<hr>
<table width="100%">
<tr>
<td align="left"><a href="chapter3.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="chapter5.html"><img src="next.png" alt="Next" border="0"></a></td>
</tr>
</table>
</body>
</html>
|