Sie sind auf Seite 1von 8

How to learn LaTeX in 7 minutes?

Ernst Witand Simon N. Wood Department of Statistics, University of Glasgow Glasgow G12 8QW, U.K. December 28, 2010

Abstract
A This paper will teach you how to use L TEXin some minutes. In fact, all you have to know is how to load this le, called learn-latex.tex A into WinEdt and know that you should press the L TEXbutton to create the nice looking le, the Bib button to include the bibliographic references in the nice looking le (that you have to repeat this process two times before the le learns the appropriate names) and the DVI button to show you the nice looking le. The DVIPDF button generates a PDF le, which you can share with your collaborators or with journals. A Everything else you have to learn about L TEXyou should simply steal from this document. Make sure that you also save the two additional les in your directory: the rst le is extendibility.bib, the bibliography le, and the second le is alleles-nonselves-rss.ps, the postscript le that contains a gure.

Introduction

A L TEXis a rather flexi le mathematical typesetting package. Various fonts and sizes of font are available. For example typewriter, italic, emphasised, san serif, bold as well as the default roman. Combinations of some are A possible emphasised san serif, for example. L TEXis very good at dealing with equations, only uses plain text, so its easy to email and doesnt produce mysterious reformatings of your document every time you use a dierent version.

ernst@stats.gla.ac.uk simon@stats.gla.ac.uk

1.1

document classes

The way your document will look and be structured depends on the documentclass command at the top of the le. Useful classes are: letter, article, for reports and journal articles and book for theses and books.

1.2

sections

Articles are usually structured into sections, and books into chapters and chapter sections. Sections can be cross referenced, if you \label them. For example the Introduction is section 1 in this document. Sub-sections are possible 1.2.1 sub-sub-sections are also possible

Sometimes you also want a section without a number . . .

Like this
which used the subsection* command.

1.3

Spaces, gaps, pagebreaks, etc.

Sometimes you want to over-ride the default formatting in various ways. Here are a few common examples. A If you leave a blank line between two lines of text L TEXassumes that you want a new paragraph and indents accordingly. Sometimes you dont want this indentation and the \noindent command is useful. Perhaps you want more space between lines. \bigskip will do this for you in a manner that takes account of the font size in use. But sometimes you want more control - a 0.6cm vertical space, for example . . . or even a horizontal space. Sometimes you may want to break a line in a dierent place to the default in which case use \\ to insert a line break. Sometimes you just want the wretched page to end right now

A \pagebreak does this, although sometimes this means that L TEXstretches out everything above the page break out in an ugly way, in which case \vfil\eject is better.

Equations

A The real beauty of L TEXis equations. For inline equations like, (x1 , x2 ) = 2x1 +2x2 , simply insert the instructions dening the equation between single $ signs. If you want a display equation without a number put the instructions between $$s like this: cos + sin 0 0 ... cos sin 0 ... cos 0 sin . . . . . . .. . . . . . . . X = 0 cos + sin 0 ... 0 cos sin . . . . . . .. . . . . . . .

If you want an equation to have a number then you need to use begin{equation} and \end{equation} for example = Mx dx (1)

Numbered equations like equation (1) can be referenced using \ref. Note that bold Greek letters, like are only available if you have \usepackage{bm} near the top of your document. Multi-line equations (without numbering) are produced like this: (af1 + bf2 ) (x) := af1 (x) + bf2 (x) = = or with numbering like this: (n, T ) = B(n, T ) (n, T ) = { | = X, R
nT

axt 1 + bxt 2 xt (a1 + b2 ).

(2) } { | ii 0, ij = ji R, i = j}

Often you may want something like this: f (xi ) = ( + 1)x 0 < xi < 1 i 0 otherwise

the large { is achieved using the bracketing commands \left and \right along with the null bracket symbol .. 3

Documentation

At this point you may be feeling the need for a less random source of inA formation. If you are going to use L TEXto write your thesis then get hold of:
A Kopka, H. and P.W. Daly A guide to L TEX Addison Wesley.

Its comprehensive and excellent. Within WinEdt try Help>LaTeX2e from the menues.

Figures

You will need to include gures. It is best to include postscript gures, i.e. .ps or .eps les. There are many ways to do this, but using \package{epsf} is quite straightforward. For example
Nonselves (offdiagonal)

RSS

0.10

0.14

0.02

0.06

95% CI for

3 4

. . . is a gure included just where I wanted it, but many times we also want gure to be nicely placed with captions etc. as in gure 1
Nonselves (offdiagonal)

Notice how easy it is to control the size of postscript gures . . .

0.14

0.02

0.06

95% CI for

3 4

Tables

Here are some examples of tables.

RSS

0.10

Nonselves (offdiagonal)

RSS

0.10

0.14

0.02

0.06

95% CI for

3 4

Figure 1: Residual sums of squares of the dierential eect model DE with an approximate 95% condence interval for .

subrepresentation Diagonal 1D 1 D 1O sym+ sym alt+ alt = = = = = = =


{f | fij =0, fii =c} Pn {f | fij =0, i=1 fii =0}

dim
1 n1 1 n1
n(n3) 2

O-diagonal
{f | fii =0, fij =c} P {f | fij =i +j , i =0} P P {f | fij =fji , i fij = j fij =0} P {f | fij =i j , i =0} P P {f | fij =fji , i fij = j fij =0}

n1
(n1)(n2) 2

Name diagonal 1 R o-diagonal Symmetric 1 sym+ sym Alternating alt+ alt Dierential Eects DE DE

Model formula ii = ii = + i

Conditions

ij = ij = i + j ij = ij ij = i j ij = ij ij = i cos + j sin ij = i cos + j sin

ij = ji

ij = ji [0, )

Table 1: Orbits of Sn in 3 (with n > 3) and in 4 (with n > 4) Orbits in 3 Orbit type multiplicity {(i, i, i)} 1 {(i, i, j)} 3 {(i, j, k)} 1 Orbits in 4 Orbit type multiplicity {(i, i, i, i)} 1 {(i, i, i, j)} 4 {(i, i, j, j)} 3 {(i, i, j, k)} 6 {(i, j, k, l)} 1 Total 15

Total

Nicely placed tables with captions, numbers and labels like table 1, can be produced with \begin{table} and \end{table}.

Lists
Should use the \begin{itemize} command to start a bulleted list. Should use the \item command to add items to the list. Should use the \end{itemize} command to end a bulleted list.

Devotees of the bullet point:

Numbered lists can be useful 1. because I say so. 2. because they break op the visual atness of a page. 3. because they can be nested which is useful for (a) examination questions. (b) algorithms. (c) er.

Including computer code/output

Computer code represents a special problem, because it often uses characters A that have a special meaning in L TEXand is often carefully laid out in a way that the author does not want messed around by automatic text processing.

Little snippets can be included with the \verb command. The rst character after \verb is taken as a marker for the beginning of the characters to be reproduced verbatim, the second occurance of this character is taken as the end of the verbatim text. For example \verb+q1<-1:4+ will yield q1<-1:4. Bigger sections of code require the use of \begin{verbatim} and \end{verbatim} like this:
gam<-function (formula, family = gaussian(), data = list(), weights = NULL, subset = NULL, na.action, control = gam.control(), scale = 0, knots = NULL, sp = NULL, min.sp = NULL, H = NULL, gamma = 1, ...) { gp <- gam.parser(formula) mf <- match.call(expand.dots = FALSE) ff <- paste(gp$v.names[1], gp$pftext) n <- length(gp$v.names) if (n > 1) { ff1 <- paste(gp$v.names[2:n], collapse = "+") ff <- paste(ff, "+", ff1) } . . . }

Bibliography and references

Quite nice bibliography creating facilities are available using the BibTex program. Basically you create a separate le containing all your references, cite them in the document using standard commands and then place a command at the end of you document to create the reference list only references that you actually cited will appear on this list. Here are some example citations: [?], [?, ?], [?, ?].

Table of contents

A table of contents can be inserted anywhere with the command \tableofcontents

Contents
1 Introduction 1.1 document classes . . . . . . . . . . . . . . . . . . . . . . . . . 1 2

1.2 1.3

sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 sub-sub-sections are also possible . . . . . . . . . . . . Spaces, gaps, pagebreaks, etc. . . . . . . . . . . . . . . . . . .

2 2 2 3 4 4 4 6 6 7 7

2 Equations 3 Documentation 4 Figures 5 Tables 6 Lists 7 Including computer code/output 8 Bibliography and references 9 Table of contents

References

Das könnte Ihnen auch gefallen