An Interactive Introduction to LATEX
Part 1: The Basics
Dr John D. Lees-Miller
February 26, 2015
Why LATEX?
It makes beautiful documents
Especially mathematics
It was created by scientists, for scientists
A large and active community
It is powerful — you can extend it
Packages for papers, presentations, spreadsheets, . . .
How does it work?
You write your document in plain text with commands that
describe its structure and meaning.
The latex program processes your text and commands to
produce a beautifully formatted document.
The rain in Spain falls \emph{mainly} on the plain.
l
a
t
e
x
The rain in Spain falls mainly on the plain.
More examples of commands and their output. . .
Tea
Milk
Biscuits
\begin{itemize}
\item Tea
\item Milk
\item Biscuits
\end{itemize}
\begin{figure}
\includegraphics{chick}
\end{figure}
\begin{equation}
\alpha + \beta + 1
\end{equation}
Image from http://www.andy-roberts.net/writing/latex/importing_images
α + β + 1
(1)
Attitude adjustment
Use commands to describe ‘what it is’, not ‘how it looks’.
Focus on your content.
Let LATEX do its job.
Getting started
A minimal LATEX document:
\documentclass{article}
\begin{document}
Hello World! % your content goes here...
\end{document}
Commands start with a backslash \ .
Every document starts with a \documentclass command.
The argument in curly braces {
tells LATEX what kind of
}
document we are creating: an article.
A percent sign %
rest of the line.
starts a comment — LATEX will ignore the
Getting started with Overleaf
Overleaf is a website for writing documents in LATEX.
It ‘compiles’ your LATEX automatically to show you the results.
Click here to open the example document in Overleaf
For best results, please use Google Chrome or a recent FireFox.
As we go through the following slides, try out the examples by
typing them into the example document on Overleaf.
No really, you should try them out as we go!
Typesetting Text
Type your text between \begin{document} and \end{document}.
For the most part, you can just type your text normally.
Words are separated by one or more
spaces.
Paragraphs are separated by one
or more blank lines.
Words are separated by one
or more spaces.
Paragraphs are separated by
one or more blank lines.
Space in the source file is collapsed in the output.
rain
The
falls mainly on the plain.
in Spain
The rain in Spain falls
mainly on the plain.