Next: Document structure Up: Commands Previous: Initial commands

Preamble commands

The changes to the preamble commands are intentionally designed to make LaTeX2e 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 desired 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 denoted by <package-name>) defines new elements (or modifies those defined in the class file loaded by the <class-name> argument of the \documentclass command). A package file thus extends the range of documents which can be processed.

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 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.

\listfiles

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.

Warning: this command will list only files which were read using LaTeX commands such as \input{<file>} or \include{<file>}. If the file was read using the primitive TeX syntax \input 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 always put in the braces.

\setcounter{errorcontextlines} {<num>}

TeX 3 introduced a new primitive \errorcontextlines which controls the format of error messages. LaTeX2e 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, LaTeX2e sets this to -1 by default.

Next: Document structure Up: Commands Previous: Initial commands

Rainer Schoepf
Thu Jul 31 16:46:28 MEST 1997