This Will Look At: Latex Supplement
This Will Look At: Latex Supplement
3. Common styles
4. Fonts
5. Maths typesetting
6. Tables
7. Figures
The heading must start with a \documentclass, and include a title and author.
The title and author are not printed yet.
You then include the body of the document bracketed by
Processing
Two commands are useful when processing Latex documents
1. >latex filename
This runs latex on a file called filename.tex and puts
the output in a file called filename.dvi.
2. >pdflatex filename
This runs latex on a file called filename.tex and puts
the output in a PDF file called filename.pdf.
Dvi files can be viewed using xdvi under Linux, or Yap under
Windows. These packages also allow you to print the files.
Pdf files can be viewed and printed using Adobe Acrobat.
enumerate
An example
\begin{enumerate}
\item The first paragraph.
\item The successor paragraph.
\item And here is the ultimate one.
\end{enumerate}
This producees:
Quotations
Program fragments
Instead
Which produces
It is often necessary to cite program source in a document.
When this is done we want to avoid it being typeset in paragraphs like this:
Fonts
1. Font Families.
3. Faces.
4. Size.
Font families By default Latex uses fonts produced by MetaFont, the companion font design package. The standard
fonts are the Computer Modern family of MetaFont faces.
These include Roman, Typewriter, SansSerif, Italic, and Slanted
faces.
You can override this and use Postscript fonts by putting the
line \usepackage{pslatex} into your document prelude
before \begin{document}.
Then it will use more familiar fonts like Times, Helvetica etc.
You should also modify your documentclass line to:
\documentclass[times]{article}
\documentclass[times,11pt]{article}
or
\documentclass[times,12pt]{article}
All of the headings etc are increased in size proportionately
to the increase in size for normal paragraph text.
\rm, \tt, \em which stand for boldface, sanserifface, roman, teletypeface, and emphasised face. The following shows
the effects.
Warning
You should as far as possible try to avoid using these commands, or use them very sparingly. It is reasonable to use
them in the following ways:
Use teletype face when citing program variables or reserved words in document texts.
Math
One of the strengths of Latex is its mathematical typesetting. It is particularly good at giving well balanced and well
spaced maths formulae. Maths formulae can be of 3 types,
inline, display or equation. Inline formulae are simply bracketed with dollar signs.
1 1
x [a, b] = [ , ]
2 2
and
1 1
y [a, b] = [ , ]
2 2
\begin{equation}
\label{Landauer1}
e= \ln (2)kt b
\end{equation}
e = ln(2)ktb
(1)
You can then refer to the equation using the label thus:
Matrices
We can express this as a matrix calculation TP = Q with
1
T = 12
2
1
(2)
\begin{array}{cc}
\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}}\\
\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}
\end{array}
The {cc} that comes after {array} tells Latex that we have
2 columns and that the formulae are to be centered in the
columns. Each row of the matrix is then separated by \\
and each element on a row is separated by &.
Coin
2
0
0
7
Casava
0
6
2
0
Kola
0
6
5
0
\begin{tabular}{|l|ccc|}\hline
Agent &Coin& Casava&Kola \\\hline
State &2&0&0\\
Alande&0&6&6\\
Tunde&0&2&5\\
Femi&7&0&0\\\hline
\end{tabular}
The {|l|ccc|} indicates we have 4 columns, the first left
aligned the others centered. Vertical lines can be placed
between columns.
Horizontal lines are generated by \hline.
Figures
These can be inserted using encapsulated postscript files (
ending in .eps ). The packages Xfig and tgif provide Linux
drafting environments for producing .eps diagrams.
It is also possible to convert photos to .eps using the Gimp.
\begin{figure}
\includegraphics[scale=0.75]{manhattan.eps}
\caption{How to get from the corner
of Greene and Broome
to the corner of West Houston and
Broadway in the Manhattan street layout.}
\label{fig:manhattan}
\end{figure}
West Houston St
Prince St
Broadway
Mercer St
Greene St
Spring St
Broome St