How to learn LaTeX in 7 minutes?

10 downloads 0 Views 190KB Size Report
Mar 5, 2004 - This paper will “teach” you how to use LATEXin some minutes. In ... article, for reports and journal articles and book for theses and books.
How to learn LaTeX in 7 minutes? Ernst Wit∗and Simon N. Wood† Department of Statistics, University of Glasgow Glasgow G12 8QW, U.K. March 5, 2004

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

1

Introduction

b

LATEXis 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 possible emphasised san serif, for example. LATEXis very good at dealing with equations, only uses plain text, so it’s easy to email and doesn’t produce mysterious reformatings of your document every time you use a different version. ∗ †

[email protected] [email protected]

1

1.1

document classes

The way your document will look and be structured depends on the documentclass command at the top of the file. 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. If you leave a blank line between two lines of text LATEXassumes that you want a new paragraph and indents accordingly. Sometimes you don’t 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 different place to the default in which case use \\ to insert a line break. Sometimes you just want the wretched page to end right now

2

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

2

Equations

The real beauty of LATEXis equations. For inline equations like, µ(x1 , x2 ) = 2x1 +2x2 , simply insert the instructions defining 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 Z θ = 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: (afθ1 + bfθ2 ) (x) := afθ1 (x) + bfθ2 (x) =

axt θ1 + bxt θ2

=

xt (aθ1 + bθ2 ).

or with numbering like this: Θ(n, T ) = B(n, T ) × Σ(n, T ) = {µ | µ = Xβ, β ∈ R

(2) nT

} × {Σ² | σii ≥ 0, σij = σji ∈ R, i 6= j}

Often you may want something like this: ½ (β + 1)xβi 0 < xi < 1 f (xi ) = 0 otherwise the large { is achieved using the bracketing commands \left and \right along with the null bracket symbol ‘.’. 3

3

Documentation

At this point you may be feeling the need for a less random source of information. If you are going to use LATEXto write your thesis then get hold of: Kopka, H. and P.W. Daly A guide to LATEX Addison Wesley. It’s comprehensive and excellent. Within WinEdt try Help>LaTeX2e from the menues.

4

Figures

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

0.10

95% CI for θ

0.02

0.06

RSS

0.14

Non−selves (off−diagonal)

0

π 4

π 2

3π 4

π

θ

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

5

Tables

Here are some examples of tables.

4

0.10 0.06

95% CI for θ

0.02

RSS

0.14

Non−selves (off−diagonal)

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

0

π 4

π 2 θ

3π 4

π

.

0.10

95% CI for θ

0.02

0.06

RSS

0.14

Non−selves (off−diagonal)

π 4

0

π 2

3π 4

π

θ

Figure 1: Residual sums of squares of the differential effect model DEθ with an approximate 95% confidence interval for θ.

subrepresentation Diagonal 1D 1⊥ D

= =

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

1O sym+ sym alt+ alt

= = = = =

{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}

dim 1 n−1

Off-diagonal

Name diagonal 1 RΩ off-diagonal Symmetric 1 sym+ sym Alternating alt+ alt Differential Effects DEθ DE

Model formula

1 n−1 n(n−3) 2

n−1 (n−1)(n−2) 2

Conditions

µii = µ µii = µ + αi

µij = µ µij = αi + αj µij = γij

γij = γji

µij = αi − αj µij = γij

γij = −γji

µij = αi cos θ + αj sin θ µij = αi cos θ + αj sin θ

5

θ ∈ [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

Total

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

5

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

6

Lists

Devotees of the bullet point: • 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. Numbered lists can be useful 1. because I say so. 2. because they break op the visual flatness of a page. 3. because they can be nested which is useful for (a) examination questions. (b) algorithms. (c) er.

7

Including computer code/output

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

6

• Little snippets can be included with the \verb command. The first 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