28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12 Chapter 1. Introduction<br />

1.5.2 Contents of a L AT E X source file<br />

Every L AT E X file contains a preamble <strong>and</strong> a body.<br />

The preamble is a collection of comm<strong>and</strong>s that specify the global<br />

processing parameters for the following text, such as the paper format,<br />

the height <strong>and</strong> width of the text, the form of the output page with its<br />

pagination <strong>and</strong> au<strong>to</strong>matic page heads <strong>and</strong> footlines. As a minimum, the<br />

preamble must contain the comm<strong>and</strong> \documentclass <strong>to</strong> specify the<br />

document’s overall processing type. This is the first comm<strong>and</strong> in the<br />

preamble.<br />

If there are no other comm<strong>and</strong>s in the preamble, L AT E X selects st<strong>and</strong>ard<br />

values for the line width, margins, paragraph spacing, page height <strong>and</strong><br />

width, <strong>and</strong> much more. By default, these specifications are tailored <strong>to</strong><br />

the American norms. For European requirements, built-in options exist <strong>to</strong><br />

alter the text height <strong>and</strong> width <strong>to</strong> the A4 st<strong>and</strong>ard. Furthermore, there are<br />

language-specific packages <strong>to</strong> translate certain headings such as ‘Chapter’<br />

<strong>and</strong> ‘Abstract’.<br />

The preamble ends with \begin{document}. Everything that follows<br />

this comm<strong>and</strong> is interpreted as body. It consists of the actual text mixed<br />

with markup comm<strong>and</strong>s. In contrast <strong>to</strong> those in the preamble, these<br />

comm<strong>and</strong>s have only a local effect, meaning they apply only <strong>to</strong> a part of<br />

the text, such as indentation, equations, temporary change of font, <strong>and</strong> so<br />

on. The body ends with the comm<strong>and</strong> \end{document}. This is normally<br />

the end of the file as well.<br />

The general syntax of a L AT E X file is as follows:<br />

\documentclass[options]{class}<br />

Further global comm<strong>and</strong>s <strong>and</strong> specifications<br />

\begin{document}<br />

Text mixed with additional comm<strong>and</strong>s of local effect<br />

\end{document}<br />

The possible options <strong>and</strong> classes that may appear in the \documentclass<br />

comm<strong>and</strong> are presented in Section 3.1.1.<br />

A minimal L AT E X file named hi.tex contains just the following lines:<br />

\documentclass{article}<br />

\begin{document}<br />

Hi!<br />

\end{document}<br />

1.5.3 Extending L AT E X with packages<br />

Packages are a very important feature of L AT E X. These are extensions <strong>to</strong><br />

the basic L AT E X comm<strong>and</strong>s that are written <strong>to</strong> files with names that end<br />

in.sty <strong>and</strong> are loaded with the comm<strong>and</strong> \usepackage in the preamble.<br />

Packages can be classified by their origin:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!