2.1 Starting and ending

LaTeX files have a simple global structure, with a standard beginning and ending. Here is a small example:

\documentclass{article}
\begin{document}
Hello, \LaTeX\ world.
\end{document}

Every LaTeX document has a \begin{document} line and an \end{document} line.

Here, the ‘article’ is the document class. It is implemented in a file article.cls. You can use any document class available on your system. A few document classes are defined by LaTeX itself, and a vast array of others are available. See Document classes.

You can include other LaTeX commands between the \documentclass and the \begin{document} commands. This area is called the preamble.

The \begin{document}\end{document} pair defines an environment; the ‘document’ environment (and no others) is required in all LaTeX documents (see document). LaTeX provides many environments that are documented here (see Environments). Many more are available to you from external packages, most importantly those available at CTAN (see CTAN: The Comprehensive TeX Archive Network).

The following sections discuss how to produce PDF or other output from a LaTeX input file.


Unofficial LaTeX2e reference manual