






















Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Prepare-se para as provas
Estude fácil! Tem muito documento disponível na Docsity
Prepare-se para as provas com trabalhos de outros alunos como você, aqui na Docsity
Encontra documentos específicos para os exames da tua universidade
Prepare-se com as videoaulas e exercícios resolvidos criados a partir da grade da sua Universidade
Responda perguntas de provas passadas e avalie sua preparação.
Ganhe pontos para baixar
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
An introduction to latex2ε, a new release of latex that offers new features and improved compatibility. It discusses the new structure of latex documents, class and package options, and the new commands available to authors. It also covers how to process old latex documents with latex2ε.
Tipologia: Notas de estudo
1 / 30
Esta página não é visível na pré-visualização
Não perca as partes importantes!























©^ c Copyright 1995–1999, LATEX3 Project Team.
- 24 September All rights reserved. 4 LATEX 2.09 documents 24 4.1 Warning................................ 24 4.2 Font selection problems....................... 25 4.3 Native mode............................. 25
5 Local modifications 26
6 Problems 26 6.1 New error messages.......................... 27 6.2 Old internal commands....................... 28 6.3 Old files................................ 29 6.4 Where to go for more help...................... 29
7 Enjoy! 30
1 Introduction
Welcome to LATEX 2ε, the new standard version of the LATEX Document Prepa- ration System.
This document describes how to take advantage of the new features of LATEX, and how to process your old LATEX documents with LATEX 2ε. 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 not a reference manual for LATEX 2ε nor is it a complete introduction to LATEX.
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 New Font Selection Scheme (NFSS), SliTEX, AMS-LATEX, 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, LATEX 2ε has been produced; it brings all such extensions back under a single format and thus prevents the pro- liferation of mutually incompatible dialects of LATEX 2.09. With LATEX 2ε the ‘new font selection scheme’ is standard and, for example, amsmath (formerly the AMS-LATEX format) or slides (formerly the SliTEX format) are simply ex- tensions, 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.
Section 2 contains an overview of the new structure of LATEX documents. It describes how classes and packages work and how class and package op- tions can be used. It lists the standard packages and classes which come with LATEX.
Section 3 describes the new commands available to authors in LATEX 2ε.
Section 4 shows how to process old LATEX documents with LATEX 2ε.
Section 6 contains advice on dealing with problems you may encounter in run- ning LATEX 2ε. It lists some error messages which are new in LATEX 2ε and it describes some of the more common problems and how to cure them, or where to find further information.
For a general introduction to LATEX, including the new features of LATEX 2ε, you should read LATEX: A Document Preparation System by Leslie Lamport [5].
A more detailed description of the new features of LATEX, including an overview of more than 150 packages, is to be found in The LATEX Companion by Michel Goossens, Frank Mittelbach and Alexander Samarin [1].
Packages and programs for producing and manipulating graphics are discussed at length in The LATEX Graphics Companion by Michel Goossens, Sebastian Rahtz and Frank Mittelbach [2].
Solutions for publishing with LATEX on the World Wide Web are given in The LATEX Web Companion by Michel Goossens and Sebastian Rahtz [3].
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 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 LATEX 2ε for Class and Package Writers describes the new LATEX features for writers of document classes and packages; it is in clsguide.tex. The guide LATEX 2ε Font Selection 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 Cyrillic languages support in LATEX.
We are gradually turning the source code for LATEX into a LATEX document LATEX: the program. This document includes an index of LATEX commands and can be typeset from source2e.tex.
For more information about TEX and LATEX, please contact your local TEX Users Group, or the international TEX Users Group (see page 3).
2 Classes and packages
This section describes the new structure of LATEX documents and the new types of file: classes and packages.
The main difference between LATEX 2.09 and LATEX 2ε is in the commands before \begin{document}.
In LATEX 2.09, documents had styles, such as article or book, and options, such as twoside or epsfig. These were indicated by the \documentstyle command:
\documentstyle[〈options〉]{〈style〉}
For example, to specify a two-sided article with encapsulated PostScript figures, you said:
\documentstyle[twoside,epsfig]{article}
However, there were two different types of document style option: built-in op- tions such as twoside; and packages such as epsfig.sty. These were very different, since any LATEX document style could use the epsfig package but only document styles which declared the twoside option could use that option.
To avoid this confusion, LATEX 2ε differentiates between built-in options and packages. These are given by the new \documentclass and \usepackage com- mands:
\documentclass[〈options〉]{〈class〉} \usepackage[〈options〉]{〈packages〉}
For example, to specify a two-sided article with encapsulated PostScript figures, you now write:
\documentclass[twoside]{article} \usepackage{epsfig}
You can load more than one package with a single \usepackage command; for example, rather than writing:
\usepackage{epsfig} \usepackage{multicol}
you can specify:
\usepackage{epsfig,multicol}
Note that LATEX 2ε still understands the LATEX 2.09 \documentstyle command. This command causes LATEX 2ε to enter LATEX 2.09 compatibility mode, which is described in Section 4.
You should not, however, use the \documentstyle command for new documents because this compatibility mode is very slow and the new features of LATEX 2ε 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. packages work well with LATEX 2ε.
ltxdoc The document class for documenting the LATEX program, based on article.
ltxguide The document class for LATEX 2ε for Authors and LATEX 2ε for Class and Package Writers, 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.
ltnews The document class for the LATEX News information sheet, based on article. The layout for this class is likely to change in future releases of LATEX.
minimal This class is the bare minimum (3 lines) that is needed in a LATEX class New feature file. It just sets the text width and height, and defines \normalsize. It 1995/12/ 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.
The following packages are distributed with LATEX:
alltt This package provides the alltt environment, which is like the verbatim New feature environment except that , {, and } have their usual meanings. It is 1994/12/ described in alltt.dtx and LATEX: A Document Preparation System.
doc This is the basic package for typesetting the documentation of LATEX pro- grams. It is described in doc.dtx and in The LATEX Companion.
exscale This provides scaled versions of the math extension font. It is described in exscale.dtx and The LATEX Companion.
fontenc This is used to specify which font encoding LATEX should use. It is described in ltoutenc.dtx.
graphpap This package defines the \graphpaper command; this can be used New feature in a picture environment. 1994/12/
ifthen Provides commands of the form ‘if... then do... otherwise do... ’. It is described in ifthen.dtx and The LATEX Companion.
inputenc This is used to specify which input encoding LATEX should use. It is New feature described in inputenc.dtx. 1994/12/
latexsym LATEX 2ε 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 The LATEX Companion; see also Section 6.
makeidx This provides commands for producing indexes. It is described in LATEX: A Document Preparation System and in The LATEX Companion.
newlfont This is used to emulate the font commands of LATEX 2.09 with the New Font Selection Scheme. It is described in The LATEX Companion.
oldlfont This is used to emulate the font commands of LATEX 2.09. It is de- scribed in The LATEX Companion.
showidx This causes the argument of each \index command to be printed on the page where it occurs. It is described in LATEX: A Document Prepara- tion System.
syntonly This is used to process a document without typesetting it. It is described in syntonly.dtx and in The LATEX Companion.
tracefnt This allows you to control how much information about LATEX’s font loading is displayed. It is described in The LATEX Companion.
The following software should be available from the same distributor as your New description 1998/12/
copy of LATEX 2ε. You should obtain at least the graphics and tools collections in order to have all the files described in LATEX: A Document Preparation System. The amsmath package (part of amslatex and formerly known as amstex) and babel are also mentioned in the list of ‘standard packages’ in section C.5.2 of that book.
amslatex Advanced mathematical typesetting from the American Mathemat- ical Society. This includes the amsmath package; it provides many com- mands for typesetting mathematical formulas of higher complexity. It is produced and supported by the American Mathematical Society and it is described in The LATEX Companion.
babel This package and related files support typesetting in many languages. It is described in The LATEX Companion.
cyrillic Everything you need (except the fonts themselves) for typesetting with New feature Cyrillic fonts. 1998/12/
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 LATEX: A Document Preparation System.
psnfss Everything you need (except the fonts themselves) for typesetting with a large range of Type 1 (PostScript) fonts.
tools Miscellaneous packages written by the LATEX3 project team.
These packages come with documentation and each of them is also described in at least one of the books The LATEX Companion and LATEX: A Document Preparation System.
3 Commands
This section describes the new commands available in LATEX 2ε. They are cov- ered in more detail in LATEX: A Document Preparation System and in The LATEX Companion.
Initial commands can appear only before the \documentclass line.
\begin{filecontents} {〈file-name〉} 〈file-contents〉 \end{filecontents}
The filecontents environment is intended for bundling within a single docu- ment file the contents of packages, options, or other files. When the document file is run through LATEX 2ε 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.
The changes to the preamble commands are intentionally designed to make LATEX 2ε documents look clearly different from old documents. The commands should be used only before \begin{document}.
\documentclass [〈option-list〉] {〈class-name〉} [〈release-date〉]
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 〈option-list〉 is a list of options, each of which may modify the formatting of elements which are defined in the 〈class-name〉 file, as well as those in all following \usepackage commands (see below). The optional argument 〈release-date〉 can be used to specify the earliest de- sired release date of the class file; it should contain a date in the format 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:
\documentclass[twocolumn]{article}[1994/06/01]
\documentstyle [〈option-list〉] {〈class-name〉}
This command is still supported for compatibility with old files. It is essentially the same as \documentclass except that it invokes LATEX 2.09 compatibility mode. It also causes any options in the 〈option-list〉 that are not processed by the class file to be loaded as packages after the class has been loaded. See Section 4 for more details on LATEX 2.09 compatibility mode.
\usepackage [〈option-list〉] {〈package-name〉} [〈release-date〉]
Any number of \usepackage commands is allowed. Each package file (as de- noted by 〈package-name〉) defines new elements (or modifies those defined in the class file loaded by the 〈class-name〉 argument of the \documentclass com- mand). A package file thus extends the range of documents which can be pro- cessed. The 〈option-list〉 argument can contain a list of options, each of which can modify the formatting of elements which are defined in this 〈package-name〉 file. As above, 〈release-date〉 can contain the earliest desired release date of the package file in the format 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:
\usepackage[dvips]{graphics}[1994/06/01]
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 6 how to resolve this problem. As well as processing the options given in the 〈option-list〉 of the \usepackage command, each package processes the 〈option-list〉 of the \documentclass com- mand as well. This means that any option which should be processed by every
In LATEX 2.09 users could define commands with arguments, but these had to be mandatory arguments. With LATEX 2ε, users can now define commands and environments which also have one optional argument.
\newcommand {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉} \newcommand* {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉} \renewcommand {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉} \renewcommand* {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉}
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:
\newcommand{\example}[2][YYY]{Mandatory arg: #2; Optional arg: #1.}
This defines \example to be a command with two arguments, referred to as #1 and #2 in the {〈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:
\example{BBB}
which prints:
Mandatory arg: BBB; Optional arg: YYY.
or:
\example[XXX]{AAA}
which prints:
Mandatory arg: AAA; Optional arg: XXX.
The default value of the optional argument is YYY. This value is specified as the [〈default〉] argument of the \newcommand that created \example. As another more useful example, the definition:
\newcommand{\seq}[2][n]{\lbrace #2_{0},\ldots,,#2_{#1} \rbrace}
means that the input $\seq{a}$ produces the formula {a 0 ,... , an}, whereas the input $\seq[k]{x}$ produces the formula {x 0 ,... , xk}. In summary, the command:
\newcommand {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉}
defines 〈cmd 〉 to be a command with 〈num〉 arguments, the first of which is optional and has default value 〈default〉. Note that there can only be one optional argument but, as before, there can be up to nine arguments in total.
\newenvironment {〈cmd 〉} [〈num〉] [〈default〉] {〈beg-def 〉} {〈end-def 〉} \newenvironment* {〈cmd 〉} [〈num〉] [〈default〉] {〈beg-def 〉} {〈end-def 〉} \renewenvironment {〈cmd 〉} [〈num〉] [〈default〉] {〈beg-def 〉} {〈end-def 〉} \renewenvironment* {〈cmd 〉} [〈num〉] [〈default〉] {〈beg-def 〉} {〈end-def 〉}
LATEX 2ε 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.
\providecommand {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉} \providecommand* {〈cmd 〉} [〈num〉] [〈default〉] {〈definition〉}
This takes the same arguments as \newcommand. If 〈cmd 〉 is already defined then the existing definition is kept; but if it is currently undefined then the effect of \providecommand is to define 〈cmd 〉 just as if \newcommand had been used. All the above five ‘defining commands’ now have *-forms that are usually the New feature better form to use when defining commands with arguments, unless any of these 1994/12/ 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. The commands produced by the above five ‘defining commands’ are now robust. New feature 1995/12/
These next three commands for making LR-boxes all existed in LATEX 2.09. They have been enhanced in two ways.
\makebox [〈width〉] [〈pos〉] {〈text〉} \framebox [〈width〉] [〈pos〉] {〈text〉} \savebox {〈cmd 〉} [〈width〉] [〈pos〉] {〈text〉}
One small but far-reaching change for LATEX 2ε is that, within the 〈width〉 ar- gument only, four special lengths can be used. These are all dimensions of the box that would be produced by using simply \mbox{〈text〉}:
\height its height above the baseline;
\depth its depth below the baseline;
\newsavebox{\fmbox} \newenvironment{fmpage}[1] {\begin{lrbox}{\fmbox}\begin{minipage}{#1}} {\end{minipage}\end{lrbox}\fbox{\usebox{\fmbox}}}
The first of these next commands was in LATEX 2.09. The two new commands are the obvious analogues.
\settowidth {〈length-cmd 〉} {〈lr text〉} \settoheight {〈length-cmd 〉} {〈lr text〉} \settodepth {〈length-cmd 〉} {〈lr text〉}
The command \, which is used to indicate a line-end in various places, is now New description 1994/12/
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 \.
\tabularnewline [〈vertical-space〉] (^) New feature 1994/12/ One example of its use is when the text in the last column of a tabular en- vironment 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 array and longtable packages in the tools collection.
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. LATEX 2ε provides, in addition, commands which can produce longer pages as well as shorter ones.
\enlargethispage {〈size〉} \enlargethispage* {〈size〉}
These commands increase the height of a page (from its normal value of \textheight) by the specified amount 〈size〉, a rigid length. This change affects 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. These commands do not change the position of the footer text; thus, if a page New description 1995/12/
is lengthened too far, the main text may overprint the footer.
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.
\suppressfloats [〈placement〉]
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.
The extra float location specifier:!
This can be used, along with at least one of h, t, b and p, in the location optional argument of a float. If a! is present then, just for this particular float, whenever it is processed by the float mechanism the following are ignored:
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! specifier overrides the effect of any \suppressfloats command for this particular float.
The font selection scheme used in LATEX 2ε 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 The LATEX Companion, and the interface for class- and package-writers is described in LATEX 2ε Font Selection.
have their font changed, for example $\mathbf{\tilde A \times 1}$ produces A^ ˜ × 1.
\ensuremath {〈math commands〉}
In LATEX 2.09, if you wanted a command to work both in math mode and in text mode, the suggested method was to define something like:
\newcommand{\Gp}{\mbox{$G_p$}}
Unfortunately, the \mbox stops \Gp changing size correctly in (for instance) subscripts or a fraction. In LATEX 2ε you can define it thus:
\newcommand{\Gp}{\ensuremath{G_p}}
Now \Gp will work correctly in all contexts. This is because the \ensuremath does nothing, producing simply G_p, when \Gp is used within math mode; but it ensures that math mode is entered (and exited) as required when \Gp is used in text mode.
\textsuperscript {〈text〉}
In LATEX 2.09 textual superscripts such as footnote markers were produced by New feature internally entering math mode and typesetting the number as a math super- 1995/06/ script. This normally looked fine since the digits in math fonts are the same as those in text fonts when Computer Modern fonts are used. But when a different document font (such as Times) is selected, the results look rather strange. For this reason the command \textsuperscript has been introduced which type- sets its argument in the current text font, in a superscript position and in the correct size.
One of the main differences between LATEX 2ε and LATEX 2.09 is that LATEX 2ε New description 1994/12/
can deal with fonts in arbitrary encodings. (A font encoding is the sequence of characters in the font—for example a Cyrillic font would have a different encoding from a Greek font.) The two major font encodings that are used for Latin languages such as English or German are OT1 (Donald Knuth’s 7-bit encoding, which has been used during most of TEX’s lifetime) and T1 (the new 8-bit ‘Cork’ encoding).
LATEX 2.09 only supported the OT1 encoding, whereas LATEX 2ε has support for both OT1 and T1 built-in. The next section will cover the new commands which are available if you have T1-encoded fonts. This section describes new commands which are available in all encodings. Most of these commands provide characters which were available in LATEX 2. already. For example \textemdash gives an ‘em dash’, which was available in LATEX 2.09 by typing ---. However, some fonts (for example a Greek font) may not have the --- ligature, but you will still be able to access an em dash by typing \textemdash.
\r{〈text〉} New feature 1994/12/ This command gives a ‘ring’ accent, for example ‘˚o’ can be typed \r{o}.
\SS New feature 1994/12/ This command produces a German ‘SS’, that is a capital ‘ß’. This letter can hyphenate differently from ‘SS’, so is needed for entering all-caps German.
\textcircled{〈text〉} New feature 1994/12/ This command is used to build ‘circled characters’ such as \copyright. For example \textcircled{a} produces ©a.
\textcompwordmark New feature 1994/12/ This command is used to separate letters which would normally ligature. For example ‘fi’ is produced with f\textcompwordmark i. Note that the ‘f’ and ‘i’ have not ligatured to produce ‘fi’. This is rarely useful in English (‘shelfful’ is a rare example of where it might be used) but is used in languages such as German.
\textvisiblespace New feature 1994/12/ This command produces a ‘visible space’ character ‘ ’. This is sometimes used in computer listings, for example ‘type hello world’.
\textemdash \textendash \textexclamdown \textquestiondown \textquotedblleft \textquotedblright \textquoteleft \textquoteright New feature 1994/12/ These commands produce characters which would otherwise be accessed via ligatures: