http://www.comp.leeds.ac.

uk/andyr
Learning Latex
before it´s too late!
Andrew Roberts
andy¡0comp.]eeds.ac.uk
http://www.comp.leeds.ac.uk/andyr
Overview
1 History of Latex
1 What does it do?
1 How does it work?
1 Benefits of using Latex
1 And problems
1 Getting set up
1 Hello World!
http://www.comp.leeds.ac.uk/andyr
History of Latex (1)
1 ~ 19// Donald Knuth began writing
Tex.
2 Designed to be a powerful and flexible
typesetting utility.
2 Output equal to professional printers.
(Especially good for maths)
2 Focussed on physical presentation -
needed to learn lots of intricate
commands.
http://www.comp.leeds.ac.uk/andyr
History of Latex (2)
1 Beginning of 80s, Leslie Lamport
created Latex.
2 Adds layer of abstraction over
standard Tex.
2 Allows author to focus on content
rather than presentation.
2 Added many useful tools for
automating tedious tasks (indices,
bibliographies, cross-references etc.)
http://www.comp.leeds.ac.uk/andyr
What does Latex do?
1 Takes input from a source file (text)
1 Processes the contents and decides
how best to typeset the document
1 Outputs device-independent (Dv!)
file.
1 NøI ¡nIera¿I¡ve I¡Ke wørø prø¿ess¡ng.
http://www.comp.leeds.ac.uk/andyr
How does Latex work? (1)
1 Essentially, everything is put into a box and
glued together.
1 Accuracy is very high - s¿aIeø øø¡nI is 100
th
of the wavelength of natural light!
1 Waits until it sees everything you want to
put into the document, and Inen determines
the most aesthetic presentation (or, least
bad is more accurate).
http://www.comp.leeds.ac.uk/andyr
How does Latex work? (2)
1 Source text is marked-up with logical
structure.
1 Document classes tell Latex how to
format these elements.
1 This is the spirit of Latex!
http://www.comp.leeds.ac.uk/andyr
Latex Architecture
12345
Tex output (.dvi)
User input (.tex)
Document classes (.cls)
Packages (.sty)
Postscript (.ps) Acrobat (.pdf) Screen Printer
Working files
(.aux) (.idx)
(.toc) (.lof)
Bibliography (.bbl)
http://www.comp.leeds.ac.uk/andyr
123456
1 Think HTML!
1 Presentation markup
2 Give explicit instruction on how to
display data.
1 Logical markup
2 To provide semantics and structure.
http://www.comp.leeds.ac.uk/andyr
Narkup Advantages
1 Separation of content and form
1 Facilitates consistent presentation
1 Can easily change document styles
2 Remember! Typography is a creative
skill - leave it to the experts!
1 Allows easier conversion between
markup formats, e.g, Latex ² HTNL.
http://www.comp.leeds.ac.uk/andyr
Narkup Disadvantages
1 Need to learn markup before being
able to produce basic documents.
1 Narkup can be easily misused, e.g.,
using tables as a tool for layouts (a
big issue in web pages).
1 Narking up more complex data, such
as tables 123 take more time than a
visual approach as employed by WP.
http://www.comp.leeds.ac.uk/andyr
Output - DvI
1 Device Independent files (.dvi).
1 Designed so that output could be
printed/viewed on any device:
2 > 1000dpi commercial printers
2 Dot matrix printers
2 Screen viewers (high resolution to
text-only terminals)
1 Can be converted easily to PS or PDF.
http://www.comp.leeds.ac.uk/andyr
Benefits of Latex
1 Separation of style and content (it's a
good thing, honest!)
1 Portability - x-platform; small files.
1 Flexibility - can do anything!
1 Control - do it how you want it done.
1 Output - Superior to WP.
1 Scalability - Big documents
1 Stability - never crash and corrupt
1 Cost - free!
http://www.comp.leeds.ac.uk/andyr
The basics - Commands
1 Command format:
\commandname|option|{argument}
1 Arguments are manditory
1 Options are optional!
1 E.g.,
\1nc]udeg¡aph1cs|W1d1h=2.Scm]|ch1ck.eps}
http://www.comp.leeds.ac.uk/andyr
The basics - Source file
Preamble
Front matter
Body
Back matter
\documenfc]ass|a¡f1c]e}
\usepackage|babe]}
\beg1n|documenf}
\f1f]e|An Lxamp]e}
\makef1f]e
...
12345346
...
\beg1n|b1b]1og¡aphy}
...
\end|b1b]1og¡aphy}
\end|documenf}
http://www.comp.leeds.ac.uk/andyr
Hello World!
1 Not just for programming languages!
x he]]o.1ex - Ou¡ f1¡s1 La1ex examp]e!
\documen1c]ass|a¡11c]e}
\beg1n|documen1}
he]]o Wo¡]d!
\end|documen1}
http://www.comp.leeds.ac.uk/andyr
Hello World! (2)
1 Comments begin with ¾ - ignored by
Latex.
1 Document classes defines the format
of the document (standards included:
article, book, report, letter and slides.
1 Document environment encapsulates
the contents. Text in-between is
printed by Latex.
http://www.comp.leeds.ac.uk/andyr
Special Characters
\1ex1ba¡
!
\1ex1]ess
<
\1ex1g¡ea1e¡
>
\1ex1asc1111]de
~
\1ex1asc1c1¡cum
´
\
_
\}
}
\|
{
\$
$
\&
8
\#
4
\x
¾
\1ex1backs]ash
\
http://www.comp.leeds.ac.uk/andyr
Nore lingo
1 Environments:
\beg1n{env-name}
...
\end{env-name}
2 Commonly for specifying different
special paragraph styles, e.g,.
abstract, quote. Also for more general
formatting, e.g, center.
http://www.comp.leeds.ac.uk/andyr
Nore lingo (2)
1 Packages:
\usepackage|package-opfs]{package-name}
(Always in the declared in the preamble)
2 Extends the core Latex functionality
(or simplifies complex tasks).
2 Provide new commands and/or
environments.
2 Nany already come bundled with
Latex - hundreds more available from
CTAN (WWW.cfan.o¡g)
http://www.comp.leeds.ac.uk/andyr
Nore info.
1 First stop:
hffp://WWW.comp.]eeds.ac.uk/andy¡
1 Beware when using search engines!

Sign up to vote on this title
UsefulNot useful