357 359




Linux Unleashed, Third Edition:TeX and LaTeX





-->















Previous
Table of Contents
Next




Defining a LaTeX Document
Every LaTeX document begins with the \documentclass command. The parameter passed to this command specifies what kind of document you want to write. The basic document classes are described in Table 19.2.
Table 19.2. Document classes.



Document Class
Description



article
Used for short reports, reference cards, presentations, scientific journals, and so on.

book
Used for complete books.

report
Used for reports having several chapters, theses, and so on.



To create a very basic LaTeX document, simply place some words between the two commands \begin{document} and \end{document}. The text that precedes the \begin{document} command is called the preamble, and the text that comes after is known as the body. So, you can create a very simple document such as the following:


\documentclass{article}
\begin{document}
What a small document this is.
\end{document}


To process this document (which you will edit in a file called gloves.tex), use the following command:


% latex gloves


This produces a dvi file and a log file in the same manner used by TeX. The dvi file can either be converted to PostScript, or viewed directly using xdvi.
You can specify options with the type of document in the \documentclass command using the following format:


\documentclass[option]{document class}


These options relate to the physical structure of the document. Some of the more common ones are listed in Table 19.3.

Table 19.3. \documentclass options.



Option
Description



10pt, 11pt, 12pt
The default font for the document, which is 10ptif not otherwise stated.

fleqn
Displays formulas as left-justified instead of centered.

leqno
Numbers formulas on the left side.

letterpaper, a4 paper
The paper size, which is letterpaper by default.

openright, openany
Starts the first page of a chapter on the right side, or on the next available page.

titlepage, notitlepage
Does or does not start a new page after the title.

twocolumn
Splits each page into two columns (useful for newsletters).

twoside, oneside
Generates double- or single-sided output.



Some of the differences between document classes are encapsulated by the defaults that they use for the options mentioned. For instance, articles and reports are single-sided by default, whereas books are not. Articles do not use the options for title pages and starting right-sided chapters because they do not understand what a chapter is. Thus, the document classes in LaTeX are smart enough to do the kind of layout that you expect for the type of document you need.
Packages
LaTeX also has the \usepackage command, which enables you to extend the capabilities of LaTeX even further by using an external package of features. The format is as follows:


\usepackage{package name}


package name can be any of several available packages. For instance, the doc package is used for the documentation of LaTeX programs, and the makeidx package provides support for the production of indexes.
You can also control what page styles LaTeX applies to your document by using the \pagestyle command. Table 19.4 describes the basic page styles available.
Table 19.4. Page styles.



Style
Description



empty
Sets the header and footers to be empty.

headings
Prints the current chapter heading and page number on each page with an empty footer.

plain
Prints the page number centered in the footer (the default page style).



You can also vary page styles in your document using the \thispagestyle command. This applies the supplied page style to the current page only.
Using Special Characters
LaTeX supports the use of international characters, such as umlauts (..) and circumflexes (^). These characters are generated using a command variant on the letter itself. For example, the text


What a na\”\i ve fj\o rd you are!


produces the following:

What a naïve fjörd you are!
International spacing can also be applied using the \frenchspacing command. This command tells LaTeX not to insert the usual extra space after a period.



Previous
Table of Contents
Next














Wyszukiwarka

Podobne podstrony:
359 11 (2)
357 364
359 07
353 359
359 03
359 363 6v4nwcjnb4dbnstjd3npiah3dmipkvb5oncshxa
359 04
359 ind (2)
359 16

więcej podobnych podstron