Professional Documents
Culture Documents
Latex Intro Slides
Latex Intro Slides
We’re all great at Matlab now, so it’s time for something new.
• LATEX is not a word processor, and isn’t used the same way.
• Work is done in text files, which LATEX processes entirely and
decides how best to typeset the document.
• The output is either a .dvi or .pdf file. A .dvi file can easily be
converted to .ps or .pdf files.
Getting started with LATEX
\documentclass{article}
\begin{document}
Hello, world!. $1 + 1 = 2$.
\end{document}
• Make sure that the build box either has LaTeX =⇒ DVI or
LaTeX =⇒ PDF.
• Build your document. Something should have just happened...
What exactly just happened?
\documentclass[12pt]{article}
\include{amsmath}
\include{amssymb}
\include{graphicx}
\begin{document}
\maketitle
Hello, world!. $1 + 1 = 2$.
\end{document}
The first few lines are useful command packages. We’ll talk about
those next lecture. For now, include them in every document.
Sections and Subsections
Let’s take our document from before, and adjust the body to
include this:
\begin{document}
\maketitle
\end{document}
Labels and Referencing
\section{Introduction}\label{S.intro}
This section is Section \ref{S.intro}. This reference will continue to
point to the right part of the document, even if I add a new section
before this.
\begin{equation}\label{E.addition}
1 + 1 = 2.
\end{equation}
You typically need to compile twice. Once for LATEX to learn the
labels, and once to connect the cross-references.
Typesetting Text
There are other options as well. Feel free to explore colours and
underlines, and anything else that seems like it should be possible.
Typesetting Text
There are other options as well. Feel free to explore colours and
underlines, and anything else that seems like it should be possible.
Font Size
Use the left quote (below the escape key) once to make ‘ and twice
to make “. Use the right quote (next to the semi-colon) to make ’
and ” in the same way. Never use the double quotation mark.
Lists
\begin{itemize}
\item One thing in a list.
\item Another thing in a list.
\end{itemize}
\begin{enumerate}
\item The first numbered thing I have to say.
\item The second numbered thing I have to say.
\item The third numbered thing I have to say.
\end{enumerate}
Typesetting text is nice, but writing equations is the real reason for
using LATEX. We will only scratch the surface here.
Equations come in two varieties: Inline formulas and displayed
formulas.
The equation environment can also be accessed using square braces, but
this won’t be labelled or have equation numbers.
\[1 + 1 = 2.\]
Writing Equations
Typesetting text is nice, but writing equations is the real reason for
using LATEX. We will only scratch the surface here.
1 + 1 = 2. (1)
The equation environment can also be accessed using square braces, but this won’t be
labelled or have equation numbers.
1 + 1 = 2.
Writing Equations
Multiplication: 1 · 1 × 1 = 1.
Greek letters: α + θ + Θ + λ + Λ.
Writing Equations
Brackets: \[\left(\left[\left{\frac{x+1}{2}\right}\right]\right).\]
Limits:
lim f (x) = 1.
x→0
\begin{align}
x + y + z &= 1,\\
\nonumber 2y - z &= 5 + 3x,\\
x - y - 2z &= 2.
\end{align}
x + y + z = 1, (2)
2y − z = 5 + 3x,
x − y − 2z = 2. (3)
\begin{equation*}
M = \begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i \\
\end{bmatrix}
\end{equation*}
a b c
M = d e f
g h i
You’ll get a chance to practice this, and some other things, in the
first practical session. You’ll be given some documents, and asked
to do your best to reproduce them. Have fun.