2.1 Starting and ending

LaTeX files have a simple global structure, with a standard beginning and ending. This 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 on your system. A few document classes are defined by LaTeX itself, and vast array of others are widely 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 make available to you 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