Docsity

LaTeX Wikibook Contents, Notas de estudo de Engenharia Informática

Toggle sidebar
bg1
PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information.
PDF generated at: Mon, 26 Sep 2011 17:12:46 UTC
LaTeX Wikibook
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe LaTeX Wikibook Contents e outras Notas de estudo em PDF para Engenharia Informática, somente na Docsity!

PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information. PDF generated at: Mon, 26 Sep 2011 17:12:46 UTC

LaTeX Wikibook

Contents

Introduction (^1)

Introduction

What is TeX?

TeX (X or chi is pronounced as in Scottish loch ) is a low-level markup and programming language created by Donald Knuth to typeset documents attractively and consistently. Its name originates from the Greek word "τεχνολογία" ( technologìa ), which translates as "technology" in English; its first syllable is "τεχ", similar to TeX in the Latin alphabet. According to a different approach the name originates from the Greek word "τέχνη" ( techni ), which translates as art in English. In the second case the first syllable is "τεχ" again. Knuth started writing the TeX typesetting engine in 1977 to explore the potential of the digital printing equipment that was beginning to infiltrate the publishing industry at that time, especially in the hope that he could reverse the trend of deteriorating typographical quality that he saw affecting his own books and articles. TeX is a programming language, in the sense that it supports the if-else construct, you can make calculations with it (that are performed while compiling the document), etc., but you would find it very hard to do anything else but typesetting with it. The fine control TeX offers makes it very powerful, but also difficult and time-consuming to use. TeX is renowned for being extremely stable, for running on many different kinds of computers, and for being virtually bug free. Nowadays practically nobody uses plain TeX to produce documents in the TeX language. Instead, different TeX distributions such as LaTeX are used to save time, automate certain tasks and reduce user introduced errors.

What is LaTeX?

LaTeX (pronounced either "Lah-tech" or "Lay-tech") is a macro package based on TeX created by Leslie Lamport. Its purpose is to simplify TeX typesetting, especially for documents containing mathematical formulae. Many later authors have contributed extensions, called packages or styles , to LaTeX. Some of these are bundled with most TeX/LaTeX software distributions; more can be found in the Comprehensive TeX Archive Network (CTAN [1]).

Since LaTeX comprises a group of TeX commands, LaTeX document processing is essentially programming. You create a text file in LaTeX markup. The LaTeX macro reads this to produce the final document. This approach has some disadvantages in comparison with a WYSIWYG (What You See Is What You Get) program such as Openoffice.org Writer or Microsoft Word. In LaTeX:

  • You don't (usually) see the final version of the document when editing it.
  • You generally need to know the necessary commands for LaTeX markup.
  • It can sometimes be difficult to obtain a certain look for the document. On the other hand, there are certain advantages to the LaTeX approach:
  • Document sources can be read with any text editor and understood, unlike the complex binary and XML formats used with WYSIWYG programs.
  • You can concentrate purely on the structure and contents of the document, not get caught up with superficial layout issues.
  • You don't need to manually adjust fonts, text sizes, line heights nor text flow for readability, as LaTeX takes care of them automatically.
  • In LaTeX the document stucture is visible to the user, and can be easily copied to another document. In WYSIWYG applications it is often not obvious how a certain formatting was produced, and it might be impossible to copy it directly for use in another document.

Introduction (^2)

  • The layout, fonts, tables and so on are consistent throughout the document.
  • Mathematical formulae can be easily typeset.
  • Indexes, footnotes, citations and references are generated easily.
  • You are forced to structure your documents correctly. The LaTeX-like approach can be called WYSIWYM, i.e. What You See Is What You Mean: you can't see what the final version will look like while typing. Instead you see the logical structure of the document. LaTeX takes care of the formatting for you. The LaTeX document is a plain text file containing the content of the document, with additional markup. When the source file is processed by the macro package, it can produce documents in several formats. LaTeX natively supports DVI and PDF, but by using other software you can easily create PostScript, PNG, JPG, etc.

Other TeX distributions

When searching for information on LaTeX, you might also stumble upon XeTeX, ConTeXt, LuaTeX or other names with a -TeX suffix. Some of them are TeX distributions, others are TeX engines. They differ from LaTeX in many ways, for example XeTeX is a TeX engine which uses Unicode and supports widely popular .ttf and .otf fonts, and ConTeXt is a TeX distribution with a very consistent and easy syntax and support for pdfTeX, XeTeX and LuaTeX engines. Before using code snippets or packages found on the web, you should always check they are written in LaTeX.

Prerequisites

At a minimum, you'll need a TeX distribution, a good text editor and a DVI or PDF viewer. But, if this is the first time you are trying out LaTeX, you don't even need to install anything. Just create an user account at:

  • ScribTeX.com [2] and continue this tutorial in the next chapter. ScribTeX is a web based online editor for LaTeX documents with collaboration capabilities allowing you to experiment with LaTeX syntax without having to bother with installing and configuring a distribution and an editor. When you later feel that you would benefit from having a standalone LaTeX installation, you can return to this chapter and follow the instructions below.

Installing a distribution

If you want to use LaTeX locally on your computer, you generally need to install a TeX distribution. TeX distributions are packaged collections of packages and programs that enable you to typeset without having to manually fetch files and configure things. The recommended distributions for each of the major operating systems are:

  • TeX Live [3]^ is a major TeX distribution for Unix/Linux, Mac OS and Windows.
  • MiKTeX [4]^ is a Windows-specific distribution.
  • MacTeX [5]^ is a Mac OS-specific distribution based on TeX Live.

Introduction (^4)

TeXmaker TeXmaker [14]^ is a cross-platform editor very similar to Kile in features and user interface. In addition it has its own PDF viewer.

TeXnicCenter TeXnicCenter [15]^ is a popular free and open source LaTeX editor for Windows. It also has a similar user interface to TeXmaker and Kile.

BaKoMa TeX BaKoMa TeX [16]^ is a editor for Windows with WYSIWYG-like features. It takes care of compiling the LaTeX source and updating it constantly to view changes to document almost in real time.

TeXShop TeXShop [17]^ is a TeXworks-like editor for Mac OS.

gedit-latex-plugin Gedit with gedit-latex-plugin [18]^ is also worth trying out for users of GNOME. GEdit is a cross-platform application for Windows, Mac, and Linux

Gummi Gummi [19]^ is a LaTeX editor for Linux, which compiles the output of pdflatex in realtime and shows it on the right half of the screen.

Emacs Emacs [20]^ is a general purpose text processing system. When used in combination with Auctex and Reftex (extensions that may be installed into the Emacs program), Emacs provides a complete LaTeX editing environment complete with table of contents view, document preview and many other features. Emacs is a very mature editing system with a unique set of keyboard commands.

LaTeXila LaTeXila [21]^ is another text editor for Linux (Gnome).

Viewers

Finally, you will need a viewer for the files LaTeX outputs. Normally LaTeX saves the final document as a .dvi (Device independent file format), but you will rarely want it to. DVI files do not contain embedded fonts and many document viewers are unable to open them. Usually you will use a LaTeX compiler like pdflatex to produce a PDF file directly, or a tool like dvi2pdf to convert the DVI file to PDF format. Then you can view the result with your preferred PDF viewer (Adobe Reader, Okular, Evince, Sumatra, Foxit). Practically all LaTeX distributions have a DVI viewer for viewing the default output of latex, and also tools such as dvi2pdf for converting the result automatically to PDF and PS formats.

Introduction (^5)

Applications within a distribution

Here are the main programs you expect to find in any LaTeX distribution:

  • latex compiler reads a LaTeX .tex file and creates a .dvi
  • pdflatex compiler reads a LaTeX .tex file and creates a .pdf
  • dvi2ps converts the .dvi file to .ps (postscript).
  • dvi2pdf converts the .dvi file to .pdf (dvi2pdfm is an improved version). Also tex and pdftex compilers are included, but you should be careful with using them, because they support only plain TeX. Note that since LaTeX is just a collection of macros for TeX if you compile a plain TeX document with a LaTeX compiler (such as pdflatex) it will work while the opposite is not true: if you try to compile a LaTeX source with a TeX compiler you will get many errors. When LaTeX was created, the only format it could create was DVI; later PDF support was added by pdflatex. PDF files can be created with both pdflatex and dvipdfm. The output of pdflatex takes direct advantage of modern features of PDF such as hyperlinks and embedded fonts, which are not part of DVI. Passing through DVI imposes limitations of its older format. On the other hand, some packages, such as PSTricks, exploit the process of conversion to DVI, and therefore will not work with pdflatex. Some of those packages embed information in the DVI that doesn't appear when the DVI is viewed, but reemerges when the DVI is converted to another, newer format. You would write your document slightly differently depending on the compiler you are using (latex or pdflatex). But as we will see later it is possible to add a sort of abstraction layer to hide the details of which compiler you're using, while the compiler can handle the translation itself. The following diagram shows the relationships between the LaTeX source code and the formats you can create from it:

The boxed red text represents the file formats, the blue text on the arrows represents the commands you have to use, the small dark green text under the boxes represents the image formats that are supported. Any time you pass

Absolute Beginners (^7)

Absolute Beginners

This tutorial is aimed at getting familiar with the bare bones of LaTeX. Before starting, ensure you have LaTeX installed on your computer (see Installation for instructions of what you will need). We begin by creating the source LaTeX file, and then take you through how to feed this file through the LaTeX system to produce quality output, such as postscript or PDF.

The LaTeX source

LaTeX uses a markup language in order to describe document structure and presentation. LaTeX converts your source text, combined with the markup, into a high quality document. For the purpose of analogy, web pages work in a similar way: the HTML is used to describe the document, but it is your browser that presents it in its full glory - with different colours, fonts, sizes, etc. The input for LaTeX is a plain ASCII text file. You can create it with any text editor. It contains the text of the document, as well as the commands that tell LaTeX how to typeset the text. For the truly impatient, a minimal example looks something like the following (the commands will be explained later):

\documentclass {article} \begin {document} Hello world! \end {document}

Spaces

"Whitespace" characters, such as blank or tab, are treated uniformly as "space" by LaTeX. Several consecutive whitespace characters are treated as one "space". Whitespace at the start of a line is generally ignored, and a single line break is treated as “whitespace.” An empty line between two lines of text defines the end of a paragraph. Several empty lines are treated the same as one empty line. The text below is an example. On the left hand side is the text from the input file, and on the right hand side is the formatted output.

It does not matter whether you enter one or several spaces after a word. An empty line starts a new paragraph.

It does not matter whether you enter one or several spaces after a word. An empty line starts a new paragraph.

Special Characters

The following symbols are reserved characters that either have a special meaning under LaTeX or are unavailable in all the fonts. If you enter them directly in your text, they will normally not print, but rather make LaTeX do things you did not intend.

$ % ^ & _ { } ~ \

As you will see, these characters can be used in your documents all the same by adding a prefix backslash:

# $ % \textasciicircum {} & _ { } ~ {} \textbackslash {}

The other symbols and many more can be printed with special commands in mathematical formulae or as accents. The backslash character \ can not be entered by adding another backslash in front of it ( \ ); this sequence is used for line breaking. For introducing a backslash in math mode, you can use \backslash instead. The command ~ produces a tilde which is placed over the next letter. For example ~ n gives ñ. To produce just the character ~, use ~ { } which places a ~ over an empty box.

Absolute Beginners (^8)

Similarly, the command ^ produces a hat over the next character, for example ^ {o } produces ô. If you need in text to display the ^ symbol you have to use \textasciicircum. If you want to insert text that might contain several particular symbols (such as URIs), you can consider using the \verb command, that will be discussed later in the section on formatting.

LaTeX Commands

LaTeX commands are case sensitive, and take one of the following two formats:

  • They start with a backslash \ and then have a name consisting of letters only. Command names are terminated by a space, a number or any other "non-letter".
  • They consist of a backslash \ and exactly one non-letter. Some commands need an argument, which has to be given between curly braces { } after the command name. Some commands support optional parameters, which are added after the command name in square brackets [ ]. The general syntax is:

\commandname [option1,option2,...]{argument1}{argument2}...

LaTeX environments

Environments in LaTeX have a role that is quite similar to commands, but they usually have effect on a wider part of the document. Their syntax is:

\begin {environmentname} text to be influenced \end {environmentname}

Between the \begin and the \end you can put other commands and nested environments. In general, environments can accept arguments as well, but this feature is not commonly used and so it will be discussed in more advanced parts of the document. Anything in LaTeX can be expressed in terms of commands and environments.

Comments

When LaTeX encounters a % character while processing an input file, it ignores the rest of the current line, the line break, and all whitespace at the beginning of the next line. This can be used to write notes into the input file, which will not show up in the printed version.

This is an % stupid % Better: instructive <---- example: Supercal % ifragilist % icexpialidocious

This is an example: Supercalifragilisticexpialidocious

Note that the % character can be used to split long input lines that do not allow whitespace or line breaks, as with Supercali...cious above. The core LaTeX language does not have a predefined syntax for commenting out regions spanning multiple lines. Refer to multi-line comments for simple workarounds.

Absolute Beginners (^10)

Our first document

Now we can create our first document. We will produce the absolute bare minimum that is needed in order to get some output; the well known Hello World! approach will be suitable here.

  • Open your favorite text-editor. vim, emacs, Notepad++, and other text editors will have syntax highlighting that will help to write your files.
  • Reproduce the following text in your editor. This is the LaTeX source.

% hello.tex - Our first LaTeX example! \documentclass {article} \begin {document} Hello World! \end {document}

  • Save your file as hello.tex.

What does it all mean?

% hello.tex - Our first LaTeX example!

The first line is a comment. This is because it begins with the percent symbol (%); when LaTeX sees this, it simply ignores the rest of the line. Comments are useful for people to annotate parts of the source file. For example, you could put information about the author and the date, or whatever you wish. \documentclass {article} This line is a command and tells LaTeX to use the^ article^ document class. A document class file defines the formatting, which in this case is a generic article format. The handy thing is that if you want to change the appearance of your document, substitute article for another class file that exists. \begin {document} This line is the beginning of the environment called^ document; it alerts LaTeX that content of the document is about to commence. Anything above this command is known generally to belong in the preamble. Hello World! This was the only actual line containing real content - the text that we wanted displayed on the page. \end {document} The^ document^ environment ends here. It tells LaTeX that the document source is complete, anything after this line will be ignored.

As we have said before, each of the LaTeX commands begins with a backslash (\ ). This is LaTeX's way of knowing that whenever it sees a backslash, to expect some commands. Comments are not classed as a command, since all they tell LaTeX is to ignore the line. Comments never affect the output of the document.

Generating the document

It is clearly not going to be the most exciting document you have ever seen, but we want to see it nonetheless. I am assuming that you are at a command prompt, already in the directory where hello.tex is stored.

  1. Type the command: latex hello (the .tex extension is not required, although you can include it if you wish)
  2. Various bits of info about LaTeX and its progress will be displayed. If all went well, the last two lines displayed in the console will be: Output written on hello.dvi (1 page, 232 bytes). Transcript written on hello.log.

This means that your source file has been processed and the resulting document is called hello.dvi , which takes up 1 page and 232 bytes of space. This way you created the DVI file, but with the same source file you can create a PDF document. The steps are exactly the same as before, but you have to replace the command latex with pdflatex:

  1. Type the command: pdflatex hello (as before, the .tex extension is not required)

Absolute Beginners (^11)

  1. Various bits of info about LaTeX and its progress will be displayed. If all went well, the last two lines displayed in the console will be: Output written on hello.pdf (1 page, 5548 bytes). Transcript written on hello.log.

you can notice that the PDF document is bigger than the DVI, even if it contains exactly the same information. The main differences between the DVI and PDF formats are:

  • DVI needs less disk space and it is faster to create. It does not include the fonts within the document, so if you want the document to be viewed properly on another computer, there must be all the necessary fonts installed. It does not support any interactivity such as hyperlinks or animated images. DVI viewers are not very common, so you can consider using it for previewing your document while typesetting.
  • PDF needs more disk space and it is slower to create, but it includes all the necessary fonts within the document, so you will not have any problem of portability. It supports internal and external hyperlinks. It also supports advanced typographic features: hanging punctuation, font expansion and margin kerning resulting in more flexibility available to the TeX engine and better looking output. Nowadays it is the de facto standard for sharing and publishing documents, so you can consider using it for the final version of your document. About now, you saw you can create both DVI and PDF document from the same source. This is true, but it gets a bit more complicated if you want to introduce images or links. This will be explained in detail in the next chapters, but for now assume you can compile in both DVI and PDF without any problem. Note, in this instance, due to the simplicity of the file, you only need to run the LaTeX command once. However, if you begin to create complex documents, including bibliographies and cross-references, etc, LaTeX needs to be executed multiple times to resolve the references. But this will be discussed in the future when it comes up.

Basics

Document Classes

The first information LaTeX needs to know when processing an input file is the type of document the author wants to create. This is specified with the \documentclass command. \documentclass [options]{class} Here class specifies the type of document to be created. The LaTeX distribution provides additional classes for other documents, including letters and slides. The options parameter customizes the behavior of the document class. The options have to be separated by commas. Example: an input file for a LaTeX document could start with the line \documentclass [11pt,twoside,a4paper]{article} which instructs LaTeX to typeset the document as an article with a base font size of 11 points, and to produce a layout suitable for double sided printing on A4 paper. Here are some document classes that can be used with LaTeX:

Basics (^13)

Packages

While writing your document, you will probably find that there are some areas where basic LaTeX cannot solve your problem. If you want to include graphics, colored text or source code from a file into your document, you need to enhance the capabilities of LaTeX. Such enhancements are called packages. Packages are activated with the \usepackage [options]{package} command, where package is the name of the package and options is a list of keywords that trigger special features in the package. Some packages come with the LaTeX base distribution. Others are provided separately. Modern TeX distributions come with a large number of packages pre-installed. If you are working on a Unix system, use the command texdoc for accessing package documentation. For more information, see the Packages section.

Files you might Encounter

When you work with LaTeX you will soon find yourself in a maze of files with various extensions and probably no clue. The following list explains the most common file types you might encounter when working with TeX:

Common file extensions in LaTeX

.aux A file that transports information from one compiler run to the next. Among other things, the .aux file is used to store information associated with cross-references. .bbl Bibliography file output by BiBTeX and used by LaTeX .bib Bibliography database file .blg BiBTeX log file. .bst BiBTeX style file. .cls Class files define what your document looks like. They are selected with the \documentclass command. .dtx Documented TeX. This is the main distribution format for LaTeX style files. If you process a .dtx file you get documented macro code of the LaTeX package contained in the .dtx file. .ins The installer for the files contained in the matching .dtx file. If you download a LaTeX package from the net, you will normally get a .dtx and a .ins file. Run LaTeX on the .ins file to unpack the .dtx file. .fd Font description file telling LaTeX about new fonts. .dvi Device Independent File. This is the main result of a LaTeX compile run with latex. You can look at its content with a DVI previewer program or you can send it to a printer with dvips or a similar application. .pdf Portable Document Format. This is the main result of a LaTeX compile run with pdflatex. You can look at its content or print it with any PDF viewer. .log Gives a detailed account of what happened during the last compiler run. .toc Stores all your section headers. It gets read in for the next compiler run and is used to produce the table of contents. .lof This is like .toc but for the list of figures. .lot And again the same for the list of tables. .idx If your document contains an index. LaTeX stores all the words that go into the index in this file. Process this file with makeindex. .ind The processed .idx file, ready for inclusion into your document on the next compile cycle. .ilg Logfile telling what makeindex did. .sty LaTeX Macro package. This is a file you can load into your LaTeX document using the \usepackage command. .tex LaTeX or TeX input file. It can be compiled with latex.

Basics (^14)

Big Projects

When working on big documents, you might want to split the input file into several parts. LaTeX has three commands to insert a file into another when building the document. The simplest is the \input command: \input {filename} \input inserts the contents of another file, named filename.tex ; note that the .tex extension is omitted. For all practical purposes, \input is no more than a simple, automated cut-and-paste of the source code in filename.tex. The other main inclusion command is \include: \include {filename} The \include command is different from \input in that it's the output that is added instead of the commands from the other files. Therefore a new page will be created at every \include command, which makes it appropriate to use it for large entities such as book chapters. Very large documents (that usually include many files) take a very long time to compile, and most users find it convenient to test their last changes by including only the files they have been working on. One option is to hunt down all \include commands in the inclusion hierarchy and to comment them out: %\include{filename1} \include {filename2} \include {filename3} %\include{filename4} In this case, the user wants to include only filename2.tex and filename3.tex. If the inclusion hierarchy is intricate, commenting can become error-prone: page numbering will change, and any cross references won't work. A better alternative is to retain the include calls and use the \includeonly command in the preamble : \includeonly {filename2,filename3} This way, only \include commands for the specified files will be executed, and inclusion will be handled in only one place. Note that there must be no spaces between the filenames and the commas. Remember that the input file should omit all the commands referring to the main document structure, which should be kept in the original document file. This includes lines containing usepackages, document class, and everything but the code strictly referring to the section that is to be included. In this way you'll avoid finding characters of your code in the output document, or worse, not finding anything after the included file, in case you forget to erase the \end {document} line of your included file.

Picking suitable filenames

Never, ever use directories (folders) or file names that contain spaces. Although your operating system probably supports them, some don't, and they will only cause grief and tears with TeX. Make filenames as short or as long as you wish, but strictly avoid spaces. Stick to lower-case letters without accents (a-z), the digits 0-9, the hyphen (-), and the full point or period (.), (similar to the conventions for a Web URL): it will let you refer to TeX files over the Web more easily and make your files more portable. Some operating systems do not distinguish between upper-case and lower-case letters, others do. Therefore it's best not to mix them.

Document Structure (^16)

Top Matter

At the beginning of most documents there will be information about the document itself, such as the title and date, and also information about the authors, such as name, address, email etc. All of this type of information within LaTeX is collectively referred to as top matter. Although never explicitly specified (there is no \topmatter command) you are likely to encounter the term within LaTeX documentation. A simple example:

\documentclass [11pt,a4paper,oneside]{report} \begin {document} \title {How to Structure a LaTeX Document} \author {Andrew Roberts} \date {December 2004} \maketitle \end {document}

The \title , \author , and \date commands are self-explanatory. You put the title, author name, and date in curly braces after the relevant command. The title and author are usually compulsory (at least if you want LaTeX to write the title automatically); if you omit the \date command, LaTeX uses today's date by default. You always finish the top matter with the \maketitle command, which tells LaTeX that it's complete and it can typeset the title according to the information you have provided and the class (style) you are using. If you omit \maketitle, the titling will never be typeset (unless you write your own). Here is a more complicated example:

\title {How to Structure a \LaTeX {} Document} \author {Andrew Roberts \ School of Computing, \ University of Leeds, \ Leeds, \ United Kingdom, \ LS2 1HE \ \texttt {[email protected]

\date{\today} \maketitle }} as you can see, you can use commands as arguments of \title and the others. The double backslash ( \ ) is the LaTeX command for forced linebreak. LaTeX normally decides by itself where to break lines, and it's usually right, but sometimes you need to cut a line short, like here, and start a new one. If there are two authors separate them with the \and command:

\title {Our Fun Document} \author {Jane Doe \and John Doe} \date { \today } \maketitle

If you are provided with a class file from a publisher, or if you use the AMS article class (amsart), then you can use several different commands to enter author information. The email address is at the end, and the \texttt commands formats the email address using a mono-spaced font. The built-in command called \today will be replaced with the current date when processed by LaTeX. But you are free to put whatever you want as a date, in no set order. If braces are left empty, then the date is omitted. Using this approach, you can create only basic output whose layout is very hard to change. If you want to create your title freely, see the Title Creation section.

Document Structure (^17)

Abstract

As most research papers have an abstract, there are predefined commands for telling LaTeX which part of the content makes up the abstract. This should appear in its logical order, therefore, after the top matter, but before the main sections of the body. This command is available for the document classes article and report , but not book. \documentclass {article} \begin {document} \begin {abstract} Your abstract goes here... ... \end {abstract} ... \end {document} By default, LaTeX will use the word "Abstract" as a title for your abstract, if you want to change it into anything else, e.g. "Executive Summary", add the following line in the preamble: \renewcommand { \abstractname }{Executive Summary}

Sectioning Commands

The commands for inserting sections are fairly intuitive. Of course, certain commands are appropriate to different document classes. For example, a book has chapters but an article doesn't. Here is an edited version of some of the structure commands in use from simple.tex. \section {Introduction} This section's content... \section {Structure} This section's content... \subsection {Top Matter} This subsection's content... \subsubsection {Article Information} This subsubsection's content... Notice that you do not need to specify section numbers; LaTeX will sort that out for you. Also, for sections, you do not need to markup which content belongs to a given block, using \begin and \end commands, for example. LaTeX provides 7 levels of depth for defining sections:

Command Level Comment \part{ part } -1 not in letters \chapter{ chapter } 0 only books and reports \section{ section } 1 not in letters \subsection{ subsection } 2 not in letters \subsubsection{ subsubsection } 3 not in letters \paragraph{ paragraph } 4 not in letters \subparagraph{ subparagraph } 5 not in letters

All the titles of the sections are added automatically to the table of contents (if you decide to insert one). But if you make manual styling changes to your heading, for example a very long title, or some special line-breaks or unusual font-play, this would appear in the Table of Contents as well, which you almost certainly don't want. LaTeX allows you to give an optional extra version of the heading text which only gets used in the Table of Contents and any running heads, if they are in effect. This optional alternative heading goes in [square brackets] before the curly braces: \section [Effect on staff turnover]{An analysis of the effect of the revised recruitment policies on staff turnover at divisional headquarters}

Section numbering Numbering of the sections is performed automatically by LaTeX, so don't bother adding them explicitly, just insert the heading you want between the curly braces. Parts get roman numerals (Part I, Part II, etc.); chapters and sections get decimal numbering like this document, and appendices (which are just a special case of chapters, and share the same structure) are lettered (A, B, C, etc.). You can change the depth to which section numbering occurs, so you can turn it off selectively. By default it is set to 2. If you only want parts, chapters, and sections numbered, not