forked from latex3/latex2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusrguide.tex
1815 lines (1531 loc) · 66.3 KB
/
usrguide.tex
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
% \iffalse meta-comment
%
% Copyright 1993-2015
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% Filename: usrguide.tex
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\documentclass{ltxguide}[2001/05/28]
\title{\LaTeXe~for authors}
\author{\copyright~Copyright 1995--2015, \LaTeX3 Project Team.\\
All rights reserved.}
\date{30 March 2015}
\begin{document}
\maketitle
\tableofcontents
\section{Introduction}
Welcome to \LaTeXe, the new standard version of the \LaTeX{} Document
Preparation System.
This document describes how to take advantage of the new features of
\LaTeX, and how to process your old \LaTeX{} documents with
\LaTeXe. However, this document is only a brief introduction to the
new facilities and is intended for authors who are already familiar
with the old version of \LaTeX{}. It is \emph{not} a reference manual
for \LaTeXe{} nor is it a complete introduction to \LaTeX.
It is somewhat of an historical document now, since \LaTeXe{} came into
existence in 1994.
\subsection[\LaTeXe---The new \LaTeX~release]
{\LaTeXe---The new \LaTeX~release\\ (well, for more than 10 years now)}
The previous version of \LaTeX{} was known as \LaTeX~2.09. Over the
years many extensions have been developed for \LaTeX. This is, of
course, a sure sign of its continuing popularity but it has had one
unfortunate result: incompatible \LaTeX{} formats came into use at
different sites. This included `standard \LaTeX~2.09', \LaTeX{} built
with the \emph{New Font Selection Scheme}~(\NFSS), \SLiTeX, \AmSLaTeX,
and so on. Thus, to process documents from various places, a site
maintainer was forced to keep multiple versions of the \LaTeX{}
program. In addition, when looking at a source file it was not always
clear for which format the document was written.
To put an end to this unsatisfactory situation, \LaTeXe{} has been
produced; it brings all such extensions back under a single format and
thus prevents the proliferation of mutually incompatible dialects of
\LaTeX~2.09. With \LaTeXe{} the `new font selection scheme' is
standard and, for example, \textsf{amsmath} (formerly the \AmSLaTeX{}
format) or \textsf{slides} (formerly the \SLiTeX{} format) are simply
extensions, which may be loaded by documents using the same base format.
The introduction of a new release also made it possible to add a small
number of often-requested features and to make the task of writing
packages and classes simpler.
\subsection{\LaTeX3---The long-term future of \LaTeX}
\label{Sec:ltx3}
\LaTeXe{} is the consolidation step in a comprehensive
reimplementation of the \LaTeX{} system. The next major release of
\LaTeX{} will be \LaTeX3, which will include a radical overhaul of the
document designers' and package writers' interface to \LaTeX.
\LaTeX3 is a long-term research project but, until it is completed,
the project team are committed to the active maintenance of \LaTeXe{}.
Thus the experience gained from the production and maintenance of
\LaTeXe{} will be a major influence on the design of \LaTeX3.
A brief description of the project can be found in the document
|ltx3info.tex|.
If you would like to support the project then you are welcome to send
donations to the \LaTeX3 Project Fund; this has been set up to help
the research team by financing various expenses associated with this
voluntary work of maintaining the current \LaTeX{} and developing
\LaTeX3.
The fund is administered by The \TeX{} Users Group and by various
local user groups. Information about making donations and joining
these groups is available from:
\begin{quote}\small\label{addrs}
\texttt{http://www.tug.org/lugs.html}
\end{quote}
The \LaTeX3{} project has its home page
on the World Wide Web at:
\begin{verbatim}
http://www.latex-project.org/
\end{verbatim}
This page describes \LaTeX{} and the \LaTeX3 project, and contains
pointers to other \LaTeX{} resources, such as the user guides, the
\TeX{} Frequently Asked Questions, and the \LaTeX{} bugs database.
Older articles covering aspects of the \LaTeX3 project are also
available for anonymous ftp from the Comprehensive \TeX{} Archive, in
the directory:
\begin{verbatim}
ctan:info/ltx3pub
\end{verbatim}
The file |ltx3pub.bib| in that directory contains an abstract of each
of the files.
\subsection{Overview}
This document contains an overview of the new structure and features
of \LaTeX. It is \emph{not} a self-contained document, as it contains
only the features of \LaTeX{} which have changed since version 2.09.
You should read this document in conjunction with an introduction to
\LaTeX{}.
\begin{description}
\item[Section~\ref{Sec:class+packages}]
contains an overview of the new structure of
\LaTeX{} documents. It describes how classes and packages work and
how class and package options can be used. It lists the standard
packages and classes which come with \LaTeX.
\item[Section~\ref{Sec:commands}] describes the new commands available
to authors in \LaTeXe.
\item[Section~\ref{Sec:209}] shows how to process old \LaTeX{}
documents with \LaTeXe.
\item[Section~\ref{Sec:problems}] contains advice on dealing with
problems you may encounter in running \LaTeXe.
It lists some error messages which are new in \LaTeXe{} and
it describes some of the more common problems and how to cure them,
or where to find further information.
\end{description}
\subsection{Further information}
For a general introduction to \LaTeX, including the new features of
\LaTeXe, you should read \emph{\LaTeXbook}
by Leslie Lamport~\cite{A-W:LLa94}.
A more detailed description of the new features of \LaTeX, including an
overview of more than 200 packages and nearly 1000 ready to run examples, is
to be found in \emph{\LaTeXcomp second edition} by Frank Mittelbach and
Michel Goossens~\cite{A-W:MG2004}.
Packages and programs for producing and manipulating graphics are
discussed at length in \emph{\LaTeXGcomp} by Michel Goossens,
Sebastian Rahtz and Frank Mittelbach~\cite{A-W:GRM97}.
Solutions for publishing with \LaTeX{} on the World Wide Web are given
in \emph{\LaTeXWcomp} by Michel Goossens and Sebastian
Rahtz~\cite{A-W:GR99}.
For more information about the many new \LaTeX{} packages you should
read the package documentation, which should be available from the
same source as your copy of \LaTeX.
There are a number of documentation files which accompany every copy
of \LaTeX. A copy of \emph{\LaTeX{} News} will come out with each
six-monthly release of \LaTeX; it will be found in the files
|ltnews*.tex|. The class- and package-writer's guide \emph{\clsguide}
describes the new \LaTeX{} features for writers of document classes
and packages; it is in |clsguide.tex|. The guide \emph{\fntguide}
describes the \LaTeX{} font selection scheme for class- and
package-writers; it is in |fntguide.tex|. Support for Cyrillic languages
in \LaTeX{} is described in \emph{\cyrguide}.
The documented source code (from the files used to produce the kernel
format via |latex.ltx|) is now available as
\emph{The \LaTeXe\ Sources}. ]
This very large document also includes an index of
\LaTeX{} commands. It can be typeset from the \LaTeX{} file
|source2e.tex| in the |base| directory, using the source files and
the class file |ltxdoc.cls| from this directory.
For more information about \TeX{} and \LaTeX{}, please contact your
local \TeX{} Users Group, or the international \TeX{} Users Group (see
page \pageref{addrs}).
\section{Classes and packages}
\label{Sec:class+packages}
This section describes the new structure of \LaTeX{} documents and the
new types of file: \emph{classes} and \emph{packages}.
\subsection{What are classes and packages?}
The main difference between \LaTeX~2.09 and \LaTeXe{} is in the
commands before |\begin{document}|.
In \LaTeX~2.09, documents had \emph{styles},
such as \textsf{article} or \textsf{book}, and \emph{options},
such as \textsf{twoside} or \textsf{epsfig}.
These were indicated by the |\documentstyle| command:
\begin{quote}
|\documentstyle|\oarg{options}\arg{style}
\end{quote}
For example, to specify a two-sided article with encapsulated
PostScript figures, you said:
\begin{verbatim}
\documentstyle[twoside,epsfig]{article}
\end{verbatim}
However, there were two different types of document style option:
\emph{built-in options} such as |twoside|; and \emph{packages} such as
|epsfig.sty|. These were very different, since any \LaTeX{} document
style could use the \textsf{epsfig} package but only document styles
which declared the \textsf{twoside} option could use that option.
To avoid this confusion, \LaTeXe{} differentiates between built-in
options and packages. These are given by the new |\documentclass| and
|\usepackage| commands:
\begin{quote}
|\documentclass|\oarg{options}\arg{class} \\
|\usepackage|\oarg{options}\arg{packages}
\end{quote}
For example, to specify a two-sided article with encapsulated
PostScript figures, you now write:
\begin{verbatim}
\documentclass[twoside]{article}
\usepackage{epsfig}
\end{verbatim}
You can load more than one package with a single |\usepackage|
command; for example, rather than writing:
\begin{verbatim}
\usepackage{epsfig}
\usepackage{multicol}
\end{verbatim}
you can specify:
\begin{verbatim}
\usepackage{epsfig,multicol}
\end{verbatim}
Note that \LaTeXe{} still understands the \LaTeX~2.09 |\documentstyle|
command. This command causes \LaTeXe{} to enter \emph{\LaTeX~2.09
compatibility mode}, which is described in Section~\ref{Sec:209}.
You should not, however, use the |\documentstyle| command for new
documents because this compatibility mode is very slow and the new
features of \LaTeXe{} are not available in this mode.
To help differentiate between classes and packages, document classes
now end with |.cls| rather than |.sty|. Packages still end with
|.sty|, since most \LaTeX~2.09 packages work well with \LaTeXe.
\subsection{Class and package options}
In \LaTeX~2.09, only document styles could have options such as
|twoside| or |draft|. In \LaTeXe{}, both classes and packages are
allowed to have options. For example, to specify a two-sided article
with graphics using the |dvips| driver, you write:
\begin{verbatim}
\documentclass[twoside]{article}
\usepackage[dvips]{graphics}
\end{verbatim}
It is possible for packages to share common options. For example,
you could, in addition, load the \textsf{color} package by specifying:
\begin{verbatim}
\documentclass[twoside]{article}
\usepackage[dvips]{graphics}
\usepackage[dvips]{color}
\end{verbatim}
But because |\usepackage| allows more than one package to be listed,
this can be shortened to:
\begin{verbatim}
\documentclass[twoside]{article}
\usepackage[dvips]{graphics,color}
\end{verbatim}
In addition, packages will also use each option given to
the |\documentclass| command (if they know what to do with it), so you
could also write:
\begin{verbatim}
\documentclass[twoside,dvips]{article}
\usepackage{graphics,color}
\end{verbatim}
Class and package options are covered in more detail in
\emph{\LaTeXcomp} and in \emph{\clsguide}.
\subsection{Standard classes}
The following classes are distributed with \LaTeX:
\begin{description}
\item[article] The |article| class described in \emph{\LaTeXbook}.
\item[book] The |book| class described in \emph{\LaTeXbook}.
\item[report] The |report| class described in \emph{\LaTeXbook}.
\item[letter] The |letter| class described in \emph{\LaTeXbook}.
\item[slides] The |slides| class described in \emph{\LaTeXbook},
formerly \SLiTeX.
\item[proc] A document class for proceedings, based on |article|.
Formerly the |proc| package.
\item[ltxdoc] The document class for documenting the \LaTeX{}
program, based on |article|.
\item[ltxguide] The document class for \emph{\usrguide} and
\emph{\clsguide}, based on |article|. The document you are reading
now uses the |ltxguide| class. The layout for this class is likely
to change in future releases of \LaTeX.
\item[ltnews] The document class for the \emph{\LaTeX{} News}
information sheet, based on |article|. The layout for this class
is likely to change in future releases of \LaTeX.
\item[minimal]
\NEWfeature{1995/12/01}
This class is the bare minimum (3 lines) that is needed in a
\LaTeX\ class file. It just sets the text width and height, and
defines |\normalsize|. It is principally intended for debugging
and testing \LaTeX\ code in situations where you do not need to
load a `full' class such as |article|. If, however, you are
designing a completely new class that is aimed for documents with
structure radically different from the structure supplied by the
article class, then it may make sense to use this as a base and add
to it code implementing the required structure, rather than
starting from |article| and modifying the code there.
\end{description}
\subsection{Standard packages}
\label{Sec:st-pack}
The following packages are distributed with \LaTeX:
\begin{description}
\item[alltt]
\NEWfeature{1994/12/01}
This package provides the |alltt| environment, which is like
the |verbatim| environment except that |\|, |{|, and |}|
have their usual meanings. It is described in |alltt.dtx| and
\emph{\LaTeXbook}.
\item[doc] This is the basic package for typesetting the documentation
of \LaTeX{} programs. It is described in |doc.dtx| and in
\emph{\LaTeXcomp}.
\item[exscale] This provides scaled versions of the math extension
font. It is described in |exscale.dtx| and \emph{\LaTeXcomp}.
\item[fontenc] This is used to specify which font encoding \LaTeX{}
should use. It is described in |ltoutenc.dtx|.
\item[graphpap]
\NEWfeature{1994/12/01}
This package defines the |\graphpaper| command; this
can be used in a |picture| environment.
\item[ifthen] Provides commands of the form `if\dots then do\dots
otherwise do\dots'.
It is described in |ifthen.dtx| and \emph{\LaTeXcomp}.
\item[inputenc]
\NEWfeature{1994/12/01}
This is used to specify which input encoding \LaTeX{} should use.
It is described in |inputenc.dtx|.
\item[latexsym] \LaTeXe{} no longer loads the \LaTeX{} symbol font by
default. To access it, you should use the |latexsym| package. It
is described in |latexsym.dtx| and in \emph{\LaTeXcomp}; see also
Section~\ref{Sec:problems}.
\item[makeidx] This provides commands for producing indexes. It is
described in \emph{\LaTeXbook} and in \emph{\LaTeXcomp}.
\item[newlfont] This is used to emulate the font commands of
\LaTeX~2.09 with the New Font Selection Scheme. It is described in
\emph{\LaTeXcomp}.
\item[oldlfont] This is used to emulate the font commands of
\LaTeX~2.09. It is described in \emph{\LaTeXcomp}.
\item[showidx]
This causes the argument of each |\index| command to
be printed on the page where it occurs.
It is described in \emph{\LaTeXbook}.
\item[syntonly] This is used to process a document without
typesetting it. It is described in |syntonly.dtx| and in
\emph{\LaTeXcomp}.
\item[tracefnt] This allows you to control how much information about
\LaTeX's font loading is displayed. It is described in
\emph{\LaTeXcomp}.
\end{description}
\subsection{Related software}
\NEWdescription{1998/12/01}
The following software should be available from the same distributor
as your copy of \LaTeXe. You should obtain at least the
\textsf{graphics} and \textsf{tools} collections in order to have all
the files described in \emph{\LaTeXbook}. The |amsmath| package (part
of \textsf{amslatex} and formerly known as |amstex|)
and \textsf{babel} are also mentioned in the list
of `standard packages' in section C.5.2 of that book.
\begin{description}
\item[amslatex] Advanced mathematical typesetting from the American
Mathematical Society. This includes the |amsmath| package; it
provides many commands for typesetting mathematical formulas of
higher complexity. It is produced and supported by the American
Mathematical Society and it is described in \emph{\LaTeXcomp}.
\item[babel] This package and related files support typesetting in
many languages. It is described in \emph{\LaTeXcomp}.
\item[cyrillic]
\NEWfeature{1998/12/01}
Everything you need (except the fonts themselves) for
typesetting with Cyrillic fonts.
\item[graphics] This includes the |graphics| package which
provides support for the inclusion and transformation of graphics,
including files produced by other software. Also included, is the
|color| package which provides support for typesetting in colour.
Both these packages are described in \emph{\LaTeXbook}.
\item[psnfss] Everything you need (except the fonts themselves) for
typesetting with a large range of Type~1 (PostScript) fonts.
\item[tools] Miscellaneous packages written by the \LaTeX3
project team.
\end{description}
These packages come with documentation and each of them is also
described in at least one of the books \emph{\LaTeXcomp} and
\emph{\LaTeXbook}.
\subsubsection{Tools}
This collection of packages includes, at least, the following (some
files may have slightly different names on certain systems):
\begin{description}
\item[array]
Extended versions of the environments |array|, |tabular|
and |tabular*|, with many extra features.
\item[calc]
\NEWfeature{1996/12/01}
Enables the use of certain algebraic notation when specifying
values for lengths and counters.
\item[dcolumn]
Alignment on `decimal points' in tabular entries. Requires the
|array| package.
\item[delarray]
Adds `large delimiters' around arrays. Requires |array|.
\item[hhline]
Finer control over horizontal rules in tables. Requires |array|.
\item[longtable]
Multi-page tables. (Does not require |array|, but it uses the
extended features if both are loaded.)
\item[tabularx]
Defines a |tabularx| environment that is similar to |tabular*|
but it modifies the column widths, rather than the inter-column
space, to achieve the desired table width.
\item[afterpage]
Place text after the current page.
\item[bm]
Access bold math symbols.
\item[enumerate]
Extended version of the |enumerate| environment.
\item[fontsmpl]
Package and test file for producing `font samples'.
\item[ftnright]
Place all footnotes in the right-hand column in two-column mode.
\item[indentfirst]
Indent the first paragraph of sections, etc.
\item[layout]
Show the page layout defined by the current document class.
\item[multicol]
Typeset text in columns, with the length of the columns
`balanced'.
\item[rawfonts]
Preload fonts using the old internal font names of \LaTeX~2.09.
See Section~\ref{Sec:oldinternals}.
\item[somedefs]
Selective handling of package options. (Used by the rawfonts
package.)
\item[showkeys]
Prints the `keys' used by |\label|, |\ref|, |\cite| etc.; useful
whilst drafting.
\item[theorem]
Flexible declaration of `theorem-like' environments.
\item[varioref]
`Smart' handling of page references.
\item[verbatim]
Flexible extension of the verbatim environment.
\item[xr]
Cross reference other `external' documents.
\item[xspace]
`Smart space' command that helps you to avoid the common mistake
of missing spaces after command names.
\end{description}
\section{Commands}
\label{Sec:commands}
This section describes the new commands available in \LaTeXe.
They are covered in more detail in \emph{\LaTeXbook} and in
\emph{\LaTeXcomp}.
\subsection{Initial commands}
Initial commands can appear only before the |\documentclass|
line.
\begin{decl}
|\begin{filecontents}| \arg{file-name} \\
\m{file-contents} \\
|\end{filecontents}|
\end{decl}
The |filecontents| environment is intended for bundling within a
single document file the contents of packages, options, or other
files. When the document file is run through \LaTeXe{} the body of
this environment is written verbatim (preceded by a comment line) to a
file whose name is given as the environment's only argument. However,
if that file already exists then nothing happens except for an
information message.
Only normal ASCII text characters (7-bit visible text) should be
included in a |filecontents| environment. Anything else, such as tab
characters, form-feeds or 8-bit characters, should not be included in a
|filecontents| environment.
Tabs and form feeds produce a warning, explaining that they are turned
into spaces or blank lines, respectively.
What happens to 8-bit characters depends on the \TeX{} installation and
is in general unpredictable.
The |filecontents| environment is used for including \LaTeX{} files.
For other plain text files (such as Encapsulated PostScript files),
you should use the |filecontents*| environment which does not add a
comment line.
These environments are allowed only before |\documentclass|. This
ensures that any packages that have been bundled in the document are
present when needed.
\subsection{Preamble commands}
\label{Sec:pre}
The changes to the preamble commands are intentionally designed to make
\LaTeXe{} documents look clearly different from old documents. The
commands should be used only before |\begin{document}|.
\begin{decl}
|\documentclass| \oarg{option-list} \arg{class-name}
\oarg{release-date}
\end{decl}
This command replaces the
\LaTeX~2.09 command |\documentstyle|.
There must be exactly one |\documentclass| command in a document; and
it must come after the |filecontents| environments, if any, but before
any other commands.
The \m{option-list} is a list of options, each of which may modify the
formatting of elements which are defined in the \m{class-name} file,
as well as those in all following |\usepackage| commands (see
below).
The optional argument \m{release-date} can be used to specify the
earliest desired release date of the class file; it should contain a
date in the format \textsc{yyyy/mm/dd}. If a version of the class
older than this date is found, a warning is issued.
For example, to specify a two-column article, using a version of
|article.cls| released after June 1994, you specify:
\begin{verbatim}
\documentclass[twocolumn]{article}[1994/06/01]
\end{verbatim}
\begin{decl}
|\documentstyle| \oarg{option-list} \arg{class-name}
\end{decl}
This command is still supported for compatibility with old files. It
is essentially the same as |\documentclass| except that it invokes
\emph{\LaTeX~2.09 compatibility mode}. It also causes any options in
the \m{option-list} that are not processed by the class file to be
loaded as packages after the class has been loaded. See
Section~\ref{Sec:209} for more details on \LaTeX~2.09 compatibility
mode.
\begin{decl}
|\usepackage| \oarg{option-list} \arg{package-name} \oarg{release-date}
\end{decl}
Any number of |\usepackage| commands is allowed. Each package file
(as denoted by \m{package-name}) defines new elements (or modifies
those defined in the class file loaded by the \m{class-name} argument
of the |\documentclass| command). A package file thus extends the
range of documents which can be processed.
The \m{option-list} argument can contain a list of options, each of
which can modify the formatting of elements which are defined in this
\m{package-name} file.
As above, \m{release-date} can contain the earliest desired release
date of the package file in the format \textsc{yyyy/mm/dd}; if an
older version of the package is found, a warning is issued.
For example, to load the |graphics| package for the |dvips| driver,
using a version of |graphics.sty| released after June 1994, you write:
\begin{verbatim}
\usepackage[dvips]{graphics}[1994/06/01]
\end{verbatim}
Each package is loaded only once. If the same package is requested
more than once, nothing happens in the second or following attempt
unless the package has been requested with options that were not given
in the original |\usepackage|. If such extra options are specified
then an error message is produced. See Section~\ref{Sec:problems} how
to resolve this problem.
As well as processing the options given in the \m{option-list} of the
|\usepackage| command, each package processes the
\m{option-list} of the |\documentclass| command as well. This
means that any option which should be processed by every package (to
be precise, by every package that specifies an action for it) can be
specified just once, in the |\documentclass| command, rather than
being repeated for each package that needs it.
\begin{decl}
|\listfiles|
\end{decl}
If this command is placed in the preamble then a list of the files
read in (as a result of processing the document) will be displayed
on the terminal (and in the log file) at the end of the run. Where
possible, a short description will also be produced.
\NEWdescription{1995/12/01}
\emph{Warning}: this command will list only files which were read
using \LaTeX{} commands such as |\input|\arg{file} or
|\include|\arg{file}. If the file was read using the primitive \TeX{}
syntax |\input |\emph{file} (without |{ }| braces around the file name)
then it will not be listed; failure to use the \LaTeX{} form with the
braces can cause more severe problems, possibly leading to overwriting
important files, so \textbf{always put in the braces}.
\begin{decl}
|\setcounter{errorcontextlines}| \arg{num}
\end{decl}
\TeX~3 introduced a new primitive |\errorcontextlines| which controls
the format of error messages. \LaTeXe\ provides an interface to this
through the standard |\setcounter| command. As most \LaTeX\ users do
not want to see the internal definitions of \LaTeX\ commands each time
they make an error, \LaTeXe{} sets this to $-1$ by default.
\subsection{Document structure}
The |book| document class introduces new commands to indicate
document structure.
\begin{decl}
|\frontmatter| \\ |\mainmatter| \\ |\backmatter|
\end{decl}
These commands indicate the beginning of the front matter (title page,
table of contents and prefaces), main matter (main text) and back
matter (bibliography, indexes and colophon).
\subsection{Definitions}
In \LaTeX, commands can have both mandatory and optional arguments,
for example in:
\begin{verbatim}
\documentclass[11pt]{article}
\end{verbatim}
the |11pt| argument is optional, whereas the |article| class name is
mandatory.
In \LaTeX~2.09 users could define commands with arguments, but these
had to be mandatory arguments. With \LaTeXe, users can now define
commands and environments which also have one optional argument.
\begin{decl}
|\newcommand| \arg{cmd} \oarg{num} \oarg{default} \arg{definition} \\
|\newcommand*| \arg{cmd} \oarg{num} \oarg{default} \arg{definition} \\
|\renewcommand| \arg{cmd} \oarg{num} \oarg{default} \arg{definition} \\
|\renewcommand*| \arg{cmd} \oarg{num} \oarg{default} \arg{definition}
\end{decl}
These commands have a new, second, optional argument; this is used for
defining commands which themselves take one optional argument. This
new argument is best introduced by means of a simple (and hence not
very practical) example:
\begin{verbatim}
\newcommand{\example}[2][YYY]{Mandatory arg: #2;
Optional arg: #1.}
\end{verbatim}
This defines |\example| to be a command with two arguments, referred
to as |#1| and |#2| in the \arg{definition}---nothing new so far. But
by adding a second optional argument to this |\newcommand| (the
|[YYY]|) the first argument (|#1|) of the newly defined command
|\example| is made optional with its default value being |YYY|.
Thus the usage of |\example| is either:
\begin{verbatim}
\example{BBB}
\end{verbatim}
which prints:
\begin{quote}
Mandatory arg: BBB;
Optional arg: YYY.
\end{quote}
or:
\begin{verbatim}
\example[XXX]{AAA}
\end{verbatim}
which prints:
\begin{quote}
Mandatory arg: AAA;
Optional arg: XXX.
\end{quote}
The default value of the optional argument is \texttt{YYY}.
This value is specified as the \oarg{default} argument of the
|\newcommand| that created |\example|.
As another more useful example, the definition:
\begin{verbatim}
\newcommand{\seq}[2][n]{\lbrace #2_{0},\ldots,\,#2_{#1} \rbrace}
\end{verbatim}
means that the input |$\seq{a}$| produces
the formula $\lbrace a_{0},\ldots,\,a_{n} \rbrace$,
whereas the input |$\seq[k]{x}$| produces the formula
$\lbrace x_{0},\ldots,\,x_{k} \rbrace$.
In summary, the command:
\begin{quote}
|\newcommand| \arg{cmd} \oarg{num} \oarg{default} \arg{definition}
\end{quote}
defines \m{cmd} to be a command with \m{num} arguments, the first of
which is optional and has default value \m{default}.
Note that there can only be one optional argument but, as before,
there can be up to nine arguments in total.
\begin{decl}
|\newenvironment|
\arg{cmd} \oarg{num} \oarg{default} \arg{beg-def} \arg{end-def} \\
|\newenvironment*|
\arg{cmd} \oarg{num} \oarg{default} \arg{beg-def} \arg{end-def} \\
|\renewenvironment|
\arg{cmd} \oarg{num} \oarg{default} \arg{beg-def} \arg{end-def} \\
|\renewenvironment*|
\arg{cmd} \oarg{num} \oarg{default} \arg{beg-def} \arg{end-def}
\end{decl}
\LaTeXe\ also supports the creation of environments that have one
optional argument. Thus the syntax of these two commands has
been extended in the same way as that of |\newcommand|.
\begin{decl}
|\providecommand| \arg{cmd} \oarg{num} \oarg{default} \arg{definition} \\
|\providecommand*| \arg{cmd} \oarg{num} \oarg{default} \arg{definition}
\end{decl}
This takes the same arguments as |\newcommand|. If \m{cmd} is already
defined then the existing definition is kept; but if it is currently
undefined then the effect of |\providecommand| is to define \m{cmd}
just as if |\newcommand| had been used.
\NEWfeature{1994/12/01}
All the above five `defining commands' now have \texttt{*}-forms that
are usually the better form to use when defining commands with
arguments, unless any of these arguments is intended to contain
whole paragraphs of text. Moreover, if you ever do find yourself
needing to use the non-star form then you should ask whether
that argument would not better be treated as the contents of a
suitably defined environment.
\NEWfeature{1995/12/01}
The commands produced by the above five `defining commands' are
now robust.
\subsection{Boxes}
These next three commands for making LR-boxes all existed in
\LaTeX~2.09. They have been enhanced in two ways.
\begin{decl}
|\makebox| \oarg{width} \oarg{pos} \arg{text} \\
|\framebox| \oarg{width} \oarg{pos} \arg{text} \\
|\savebox| \arg{cmd} \oarg{width} \oarg{pos} \arg{text}
\end{decl}
One small but far-reaching change for \LaTeXe\ is that, within the
\m{width} argument only, four special lengths can be used. These are
all dimensions of the box that would be produced by using simply
|\mbox|\arg{text}:
\begin{itemize}
\item [] |\height|\quad its height above the baseline;
\item [] |\depth|\quad its depth below the baseline;
\item [] |\totalheight|\quad the sum of |\height| and |\depth|;
\item [] |\width|\quad its width.
\end{itemize}
Thus, to put `hello' in the centre of a box of twice its natural
width, you would use:
\begin{verbatim}
\makebox[2\width]{hello}
\end{verbatim}
Or you could put \textit{f} into a square box, like
this:
\framebox{\makebox[\totalheight]{\itshape f\/}}
\begin{verbatim}
\framebox{\makebox[\totalheight]{\itshape f\/}}
\end{verbatim}
Note that it is the total width of the framed box, including the
frame, which is set to |\totalheight|.
The other change is a new possibility for \m{pos}: |s| has been added
to |l| and |r|. If \m{pos} is |s| then the text is stretched the full
length of the box, making use of any `rubber lengths' (including any
inter-word spaces) in the contents of the box. If no such `rubber
length' is present, an `underfull box' will probably be produced.
\begin{decl}
|\parbox| \oarg{pos} \oarg{height} \oarg{inner-pos} \arg{width}
\arg{text} \\
|\begin{minipage}|
\oarg{pos} \oarg{height} \oarg{inner-pos} \arg{width}\\
\m{text}\\
|\end{minipage}|
\end{decl}
As for the box commands above, |\height|, |\width|, etc.~may be used
in the \oarg{height} argument to denote the natural dimensions of the
box.
The \m{inner-pos} argument is new in \LaTeXe. It is the vertical
equivalent to the \m{pos} argument for |\makebox|, etc, determining
the position of \m{text} within the box. The \m{inner-pos} may be any
one of |t|, |b|, |c|, or |s|, denoting top, bottom, centered, or
`stretched' alignment respectively. When the \m{inner-pos} argument
is not specified, \LaTeX\ gives it same value as \m{pos} (this could be
the latter's default value).
\begin{decl}
|\begin{lrbox}| \arg{cmd}\\
\m{text}\\
|\end{lrbox}|
\end{decl}
This is an environment which does not directly print anything.
Its effect is to save the typeset \m{text} in the bin \m{cmd}. Thus
it is like |\sbox| \arg{cmd} \arg{text}, except that any white space
before or after the contents \m{text} is ignored.
This is very useful as it enables both the |\verb| command and the
\texttt{verbatim} environment to be used within \m{text}.
It also makes it possible to define, for example, a `framed box'
environment. This is done by first using this environment to save
some text in a bin \m{cmd} and then calling
|\fbox{\usebox{|\m{cmd}|}}|.
The following example defines an environment, called |fmpage|, that is
a framed version of |minipage|.
\begin{verbatim}
\newsavebox{\fmbox}
\newenvironment{fmpage}[1]
{\begin{lrbox}{\fmbox}\begin{minipage}{#1}}
{\end{minipage}\end{lrbox}\fbox{\usebox{\fmbox}}}
\end{verbatim}
\subsection{Measuring things}
The first of these next commands was in \LaTeX~2.09. The two new
commands are the obvious analogues.
\begin{decl}
|\settowidth| \arg{length-cmd} \arg{lr text} \\
|\settoheight| \arg{length-cmd} \arg{lr text} \\
|\settodepth| \arg{length-cmd} \arg{lr text}
\end{decl}
\subsection{Line endings}
\NEWdescription{1994/12/01}
The command |\\|, which is used to indicate a line-end in various
places, is now a robust command when used within arguments such as
section titles.
Also, because it is often necessary to distinguish which type of line
is to be ended, we have introduced the following new command; it
has the same argument syntax as that of |\\|.
\begin{decl}[1994/12/01]
|\tabularnewline| \oarg{vertical-space}
\end{decl}
One example of its use is when the text in the last
column of a |tabular| environment is set with |\raggedright|; then
|\tabularnewline| can be used to indicate the end of a row of the
|tabular|, whilst |\\| will indicate the end of a line of text in a
paragraph within the column. This command can be used in the |array|
environment as well as |tabular|, and also the extended versions of
these environments offered by the \textsf{array} and \textsf{longtable}
packages in the tools collection.
\subsection{Controlling page breaks}
Sometimes it is necessary, for a final version of a document, to
`help' \LaTeX\ break the pages in the best way. \LaTeX~2.09 had a
variety of commands for this situation: |\clearpage|, |\pagebreak|
etc. \LaTeXe\ provides, in addition, commands which can produce
longer pages as well as shorter ones.
\begin{decl}
|\enlargethispage| \arg{size} \\
|\enlargethispage*| \arg{size}
\end{decl}
These commands increase the height of a page (from its normal value of
|\textheight|) by the specified amount \m{size}, a rigid length. This
change affects \emph{only} the current page.
This can be used, for example, to allow an extra line to be fitted
onto the page or, with a negative length, to produce a page
shorter than normal.
The star form also shrinks any vertical white space on the page as
much as possible, so as to fit the maximum amount of text on the
page.
\NEWdescription{1995/12/01}
These commands do not change the position of the footer text; thus, if
a page is lengthened too far, the main text may overprint the footer.
\subsection{Floats}
There is a new command, |\suppressfloats|, and a new `float
specifier'. These will enable people to gain better
control of \LaTeX's float placement algorithm.
\begin{decl}
|\suppressfloats| \oarg{placement}
\end{decl}
This command stops any further floating environments from being placed
on the current page. With an optional argument, which should be either
|t| or |b| (not both), this restriction applies only to putting
further floats at the top or at the bottom. Any floats which would
normally be placed on this page are placed on the next page instead.
\begin{decl}
The extra float location specifier: \ \texttt{!}
\end{decl}
This can be used, along with at least one of \texttt{h}, \texttt{t},
\texttt{b} and \texttt{p}, in the location optional argument of a
float.
If a \texttt{!} is present then, just for this particular float,
whenever it is processed by the float mechanism the following are
ignored:
\begin{itemize}
\item all restrictions on the number of floats which can appear;
\item all explicit restrictions on the amount of space on a text page
which may be occupied by floats or must be occupied by text.
\end{itemize}
The mechanism will, however, still attempt to ensure that pages are
not overfull and that floats of the same type are printed in the
correct order.
Note that its presence has no effect on the production of float pages.
A \texttt{!} specifier overrides the effect of any |\suppressfloats|
command for this particular float.
\subsection{Font changing: text}
The font selection scheme used in \LaTeXe{} differs a lot from that
used in \LaTeX~2.09. In this section, we give a brief description of
the new commands. A more detailed description with examples is given
in \emph{\LaTeXcomp}, and the interface for class- and package-writers
is described in \emph{\fntguide}.
\begin{decl}
|\rmfamily|\\
|\sffamily|\\
|\ttfamily|\\
|\mdseries|\\
|\bfseries|\\
|\upshape|\\
|\itshape|\\
|\slshape|\\
|\scshape|
\end{decl}