LaTeX:Layout

Revision as of 19:39, 10 July 2007 by Chris_bayhill (talk | contribs)
LaTeX
About - Getting Started - Diagrams - Symbols - Downloads - Basics - Math - Examples - Pictures - Layout - Commands - Packages - Help

This article outlines some of the basics of layout in LaTeX.

Note: Rather than typing up all the examples, you can copy-paste the examples into your TeXnicCenter files. We highly recommend opening up your TeXnicCenter and trying out each of the examples as you go. It takes almost no time at all to just copy-paste, compile, and view the results.

Source File Format

The source file of a LaTeX broadly consists of two parts, the preamble and the document itself. The preamble consists of everything before the \begin{document} command. Things like margin settings, document style definitions, paragraph spacing settings, custom function definition and page numeration style are items that are set in the preamble. Often, much of the preamble is placed in a separate file and included using the \usepackage statement. This allows you to use the same code in many source files by just including a single line in each source file.

Our next three sections deal primarily with preamble items, while the rest cover tools you might use within your document.

Preamble Formatting

Document Class

The first line of your source code sets the document class with the cleverly named command \documentclass. While LaTeX supports several classes, such as book, report, and letter, we will be focusing on the document class article in these webpages. Using \documentclass, we can also set the general font size for the document (which we can reset for parts of the document as required). Thus, the first line of your source code will almost always look like this:

\documentclass[11pt]{article}

If you want a slightly larger font, try 12pt. If smaller, go for 10pt.

Should you decide to use one of the other classes, for example if you chose to write a book with LaTeX, we suggest getting a book on LaTeX.

Including Packages You'll Need

Immediately following the \documentclass statement we usually include all the packages we'll need using \usepackage. The two most common packages to include are the amsmath package, which defines many new mathematical symbols, and the graphicx package, which allows you to include images in your document. So, for instance, many of your documents may begin:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[pdftex]{graphicx}

The pdftex in brackets is an optional argument to the graphicx package. In general, for many commands, we can add optional arguments in brackets; we'll be describing some of these as we go along.

After you have become more comfortable with LaTeX, read about how to create your own packages to simplify your source files and to allow you to easily use the same style and commands in multiple source files without having to copy over all the commands from one source file to the next.

Layout of the Page

Starting Your Document

Document Formatting

Paragraphs

Sections

Font Sizes and Styles

Spacing

Justification (Centering, etc).

Tables

Boxes

Lists

Referencing

Comments

See Also