You are on page 1of 17

Latex - a Typesetting System

Typesetting

V ERY VERY S HORT G UIDE TO L ATEX


Dr P. V. Johnson
School of Mathematics

2012

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

T HE BASIC I DEA
A word processor allows the user to design the document
on screen whilst the text they type appears inside it
In LATEX, when writing, you will not see the final document...
LATEXwill design the document for you.
You can help with the design by using LATEX commands.
You will see this idea everywhere:
Computer coding
html
xml
postscript
svg

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

T HE BASIC I DEA

Write your document


in an ACSII file
file.tex

Compile the file


using LaTeX
COMPILE
latex file.tex

If not satisfactory
change settings

Dr P. V. Johnson

Latex

Document ready
for printing or viewing
file.dvi

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

T HE GOOD POINTS
Professionally crafted layouts are available, which make a
document really look as if printed.
The typesetting of mathematical formulae is supported in a
convenient way.
Users only need to learn a few easy-to-understand
commands that specify the logical structure of a document.
They almost never need to tinker with the actual layout of
the document.
Even complex structures such as footnotes, references,
table of contents, and bibliographies can be generated
easily.

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

T HE GOOD POINTS

Free add-on packages exist for many typographical tasks


not directly supported by basic LATEX. For example,
packages are available to include Postscript graphics or to
typeset bibliographies conforming to exact standards.
LATEXencourages authors to write well-structured texts,
because this is how LATEXworks - by specifying structure.
TEX, the formatting engine of LATEX 2 , is highly portable
and free. Therefore the system runs on almost any
hardware platform available.

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

T HE BAD POINTS

LATEXdoes not work well for people who have sold their
souls. . .
Although some parameters can be adjusted within a
predefined document layout, the design of a whole new
layout is difficult and takes a lot of time
It is very hard to write unstructured and disorganized
documents.
Your hamster might, despite some encouraging first steps,
never be able to fully grasp the concept of Logical Markup.

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

G ETTING STARTED

The easiest way to create latex documents is to use an IDE


There are many of these programs available for all
platforms
Follow the guide for
WinEdt on windows
Kile on linux

depending on which platform you prefer.

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

A SIMPLE LATEX DOCUMENT

Every file must start with the command


\documentclass{...}
Like every good book it must have a start. . .
\begin{document}
and an end
\end{document}

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Advantages...
Disadvantages...
The Basics

H ELLO W ORLD !
So the Hello World! tex file looks like
\documentclass{article}
\begin{document}
Hello World!!
\end{document}
On unix machines, if this file is called helloworld.tex
we can compile it with the command
latex helloworld.tex

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

S PACES , LINE BREAKS AND PARAGRAPHS


Several consecutive white spaces, and single carriage
returns are treated as a single space
We must use a special command to make a newline \\
An empty line starts a new paragraph
A line break \\
Another line break \\
A
large space
counts as a single
whilst an empty line.
Makes a new paragraph.

Dr P. V. Johnson

A line break
Another line break
A large space counts as
a single whilst an empty
line.
Makes a new
paragraph.
Latex

Latex - a Typesetting System


Typesetting

Text
Maths

T ITLES , C HAPTERS AND S ECTIONS

A good document will be divided into appropriate sections


In LATEXwe use the following commands
\section{}
\subsection{}
\paragraph{}
\subparagraph{}

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

T ITLES , C HAPTERS AND S ECTIONS

A good document will be divided into appropriate sections


In LATEXwe use the following commands
\section{}
\subsection{}
\paragraph{}
\subparagraph{}
LATEXwill also create a table of contents with the following
command: \tableofcontents

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

C ROSS -R EFERENCING
One of the most powerful tools of LATEXis the cross
referencing
Write the label commmand after the equation, section,
figure or table we want to reference
Commands are:
\label{key}, \ref{key}, \pageref{key}

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

C ROSS -R EFERENCING
One of the most powerful tools of LATEXis the cross
referencing
Write the label commmand after the equation, section,
figure or table we want to reference
Commands are:
\label{key}, \ref{key}, \pageref{key}
Use descriptive names for the key, for example
\begin{equation}
a^2 + b^2 = c^2
\label{eqn:pythags-rule}
\end{equation}

Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

E QUATIONS
Use the amsmath is the standard package to typeset
maths in LATEX
Put the following at the top of your document:
\usepackage{amsmath}
We can put mathematical expression within text:
Paul was running
at $5ms^{-1}$.

Paul was running at 5ms1 .

Or in its own paragraph


Pauls running speed Pauls running speed was
was $$v=5ms^{-1}$$.
v = 5ms1 .
Dr P. V. Johnson

Latex

Latex - a Typesetting System


Typesetting

Text
Maths

B UILDING B LOCKS OF M ATHS


Inside the math environment we can easily build complex
equations using the commands \frac, \sum, \int, etc.
and superscript and subscript commands ^ and _. For
example
$$\frac{\sum_i i^2}
{N}$$

i2

or
$$ \int_0^\infty
e^{x^2} dx $$

Dr P. V. Johnson

Z
0

Latex

ex dx

Latex - a Typesetting System


Typesetting

Text
Maths

S UMMARY

This should be just enough to get you started


Read through the not so short guide
Try the examples and check against the solutions
Try to follow the tutorial on writing a School of Maths
thesis
and using bibtex for referencing

Dr P. V. Johnson

Latex

You might also like