next up previous
Next: Fancy Stuff Up: A Short Introduction to Previous: Basic Math

Document Structure

We've covered some of the essential facts about what you can put into a LATEX document, but we still need to look at how the document must be organized as a whole.

Every LATEX document should begin (except possibly for some comments) with a \documentclass command. This command has a parameter that specifies the type of document: article, report, letter, or book. The command can also specify some options for the document. The basic font size can be specified with the 10pt, 11pt, or 12pt options. The default is 10pt. Specify 11pt or 12pt for larger-sized characters. The twocolumn option will cause text to be set in a double-column format. Here is a typical example:

\documentclass[11pt,twocolumn]{article}

Following the \documentclass command comes the preamble, which can contain commands that influence the contents or appearance of the document. The preamble does not itself produce any output. The preamble often starts with some \usepackage commands. A package makes available a set of extra, non-standard commands for use in the document. For example, \usepackage{amsfonts} and \usepackage{amssymb} make a large number of extra mathematical symbols available. (In fact, the \therefor command, which was listed in a table earlier in this paper, requires these packages.) The preamble command \usepackage[dvips]{graphics} makes it possible to include graphics, as discussed later in this paper.

Commands that specify the title, author, and date of the paper are often given in the preamble. For example:

            \title{A Short Introduction to \LaTeX}
            \author{David J. Eck}
            \date{October 22, 2003}

The information in these commands is actually used later, in the body of the paper, when you give the \maketitle command.

Page layout in a document is partially controlled by the value assigned to various lengths, such as the size of the margins and the distance from one line of text to the next. The preamble can contain commands for customizing some of these lengths using the \setlength command. For example, for this paper, I use the commands

            \setlength{\topmargin}{0in}
            \setlength{\textheight}{8in}

to increase the vertical size of the text on the page from its default value. The first parameter is the name of the length that is being set. The second parameter is the value, which must be give in units such as in, cm, or pt. The distance between lines of text--the so-called baselineskip--is handled a little differently. You have to specify a factor by which the default baselineskip is multiplied. A factor of 2 will give double-spaced text, although a factor of about 1.8 probably looks better. The command that you would use in the preamble for double-spacing is: \renewcommand{\baselinestretch}{1.8}. You can actually use this command anywhere in your document to change the baselineskip for the following paragraphs.


LATEX is actually a programming language, in which you can define your own commands. The preamble often includes definitions of new commands that will be used in the paper. However, this aspect of LATEX will not be discussed here.


After the preamble comes the document content. The body of the document begins with \begin{document} and ends with \end{document}. The actual content of the document is typed between these commands. A document of any length is typically divided into parts, chapters, sections, subsections, and subsubsections. In LATEX, an article can have only sections, subsections, and subsubsections, while books and reports can also have parts and chapters. To start a new section, just say \section{title} where title is the title of the section. The same thing works for parts, chapters, subsections, and subsubsections. You can use \\ in a title to force a line break.

Sections, subsections, and so on will be automatically numbered for you by LATEX. If you don't want the numbering, you can add a $ *$ after the name of the command: \section*{title}. This will suppress the numbering.

If you include the command \pagestyle{headings} in the preamble of the document, LATEX will add running headings to the top of each page. The headings will contain the section or chapter titles. Sometimes, the heading will be too long to fit. In that case, you can provide a short title for the headings. The short title is given as an option to the command: \section[short-title]{long-title}.


next up previous
Next: Fancy Stuff Up: A Short Introduction to Previous: Basic Math
David Eck 2003-10-21