Latex Outline05
Latex Outline05
SIAM,
Contents
1 The First Steps
2 Basic LATEX
2.1 The Absolute Minimum . . . .
2.2 Plain Text . . . . . . . . . . . .
2.3 Type Styles . . . . . . . . . . .
2.4 Environments . . . . . . . . . .
2.5 Vertical and Horizontal Spacing
.
.
.
.
.
4
4
4
5
6
7
3 More Basics
3.1 Titles for Documents . . . . . . . . . . . . . . . . . . . . . . .
7
7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3.2
3.3
3.4
Sectioning Commands . . . . . . . . . . . . . . . . . . . . . .
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . .
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . .
8
9
10
4 Typesetting Mathematics
10
4.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Equation Environments . . . . . . . . . . . . . . . . . . . . . 10
4.3 Fonts and Indices . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Introduction to tables
13
6 Including figures
13
\documentclass{article}
\begin{document}
Hello world. I claim that $\sqrt{\tan (\pi/5)} =
\cos 2$. I will provide a proof in a short
while once Ive learnt \LaTeX.
\end{document}
We know well enough that this is very likely to be rubbish. But LATEX
doesnt care. So we go ahead and turn this text into something printable.
Step 1. Type the command latex first.tex under UNIX. This will produce
a file with name first.dvi (and some other files we dont care about
at this point).
Step 2. You can view this file by typing xdvi first.dvi &. This allows you
to view the translated content of our file first.tex.
Step 3. If you are satisfied with the outcome, you can send the file to a
printer by typing dvips first.dvi which produces the postscript
file first.ps which can be printed via the UNIX command lpr
-P<printer name> first.ps. Alternatively if you just want to create
the postscript file, and not print it, type dvips first -o.
You should receive a piece of paper with something on it that looks like this:
p
Basic LATEX
2.1
Each LATEX file has to contain at least the following three lines. At the very
beginning:
\documentclass{******}
\begin{document}
and at the very end:
\end{document}
The six asterisks can be replaced by one of the following: article,
report, book. It tells LATEX what sort of author you are. If you wish to
write an article to be submitted to a journal, you should use article. If
youre writing a thesis or a final year project report, you should replace
the six asterisks with report etc. LATEX will try to interpret everything it
finds between the \begin{document} command and the \end{document}
command into something printable.
From now on, I will present various small chunks of LATEX that live
between these very basic commands.
2.2
Plain Text
At first, we deal with plain text. Remember, even in this simplest of all
situations, LATEX will modify the appearance of the text as you typed it into
your LATEX document. A few rules:
1. The number of spaces between words is immaterial. A newline generated by a Return (or Enter) key is thought of as a space.
2. A blank line signifies the end of a paragraph.
3. The following characters have a special meaning in LATEX:
\
&
When you want one of these characters to appear in the output, most
of them can be generated by preceding the character with a backslash.
4
2.3
Type Styles
One can control the shape, series, and family of the type. There are four
shapes: upright, italic, slanted, and small caps, and two series: medium,
boldface, and three families: roman, sans serif, and typewriter.
This text was produced using the following lines:
One can control the shape, series, and family of the type.
There are four shapes: \textup{upright}, \textit{italic},
\textsl{slanted}, and \textsc{small caps}, and
two series: \textmd{medium}, \textbf{boldface},
and three families: \textrm{roman}, \textsf{sans serif},
and \texttt{typewriter}.
Note that text whose type is to be changed is enclosed in curly braces after
the command. One can also combine features by staggered curly braces.
The declarations
\Huge \huge \LARGE \Large \large \normalize
\small \footnotesize \scriptsize \tiny
5
can be used to change the type size selectively. These declarations, and the
words to which they apply, are enclosed in curly braces to limit their scope.
A space separates the command from the text. For example
{\LARGE Large text} makes ideal {\Large text} for
shortsighted people.
which produces
Environments
2.5
The vertical spacing between lines can be altered using the \vspace command. For example, the command
\vspace{3.5cm}
will leave a vertical space of 3.5cm. Horizontal spacing works in a similar
way using the \hspace command. For example
Get out your rulers and measure these lengths.
\vspace{1.0cm}
Push right\hspace{1cm}one centimeter.
This results in:
Get out your rulers and measure these lengths.
Push right
3
3.1
one centimeter.
More Basics
Titles for Documents
3.2
Sectioning Commands
1 Introduction
This is an empty intro. We go ahead and jump to the conclusions.
2 Conclusions
As indicated in Section 1, we didnt get any results.
2.1 Acknowledgements
We thank the department for its hospitality during the preparation
of this pointless paper.
3.3
Bibliography
\begin{thebibliography}{99}
\bibitem{1a}
Bill Bryson, \LaTeX\ is fun, Penguin, London, 2001.
\bibitem{1b}
Claus Davidson, \LaTeX\ is no fun, Knopf, New York, 1564.
\end{thebibliography}
3.4
Troubleshooting
When you run the latex command under UNIX, you might receive error
messages and warnings. These are often not very helpful. Just try to get the
latex command to finish its job by either pressing Return as many times
as necessary or, in the worst case, by doing a ^C (control C). Then try the
following:
If a dvi file has been produced, then preview the document. This may
make the error apparent.
Comment out suspicious looking lines by putting a % at the beginning
of them.
Insert the \end{document} command before (or about) where the error might have occurred. Run latex on this abbreviated document
and see if it works. Use this strategy to pinpoint the error.
In cases of real desperation, have a look at a LATEX manual and consult
its error section.
4
4.1
Typesetting Mathematics
Examples
Mathematical symbols that appear within the text are enclosed between $
signs. For example, x = sin y is created by
For example, $x = \sin y$ is created by
LATEX provides special expressions for many functions and expressions such
as \sin. A list is provided at the end of this document.
4.2
Equation Environments
(1)
11
4.3
2 + x3x
x =
sin x
2
12
Introduction to tables
Function
sin x
exp x2
1
Range
[1, 1]
(0, 1]
[1]
Notes:
1. {lcr} says left-justify the first column, centre the second and rightjustify the third.
2. & separates the columns, \\ ends the lines.
3. \hline puts a horizontal line right across the table.
4. To get vertical lines right down the table, change {lcr} into {|l|c|r|}
try it and see.
5. To centre the whole table, enclose the tabular environment within
\begin{center}... \end{center}.
Including figures
You may want to include include eps (encapsulated PostScript) figures in your document.
In order to do this, you will need
\usepackage[dvips]{graphics}straight after the \documentclass line
(i.e. the second line in your file). This loads a package capable of dealing with figures for you. Suppose a file called figure.eps contains your eps
figure, then
13
\begin{figure}[htbp]
\begin{center}
\scalebox{0.6}{\includegraphics{figure.eps}}
\caption{A simple figure.}
\label{fig1}
\end{center}
\end{figure}
will include the figure, scale, caption and label it. The options [htbp] stand
for here, top of current page, bottom of current page and on a separate
page respectively. LATEX will try to do the first one first; if it cant, it will
try the second and so on.
With the above code, this is what you get:
An illustration!
The End
Thats about it; good luck!
14