Quite Short LaTeX Introduction
Quite Short LaTeX Introduction
A
T
E
X Introduction
Weijie Chen
Department of Economics
University of Helsinki
6 July, 2011
Contents
1 Buckle Your Seatbelt 2
2 Start! 6
3 Put It Nicely 8
3.1 Cross reference . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Footnote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3 Emphasize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.5 Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.6 Loading a picture . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.7 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 Queen of Science 11
4.1 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2 Super- and Subscript . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5 Beamer 14
6 Miscellaneous 16
6.1 Your Command . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2 Change Style . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
List of Figures
1 T
E
XnicCenter interface . . . . . . . . . . . . . . . . . . . . . . 3
2 LyX interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 T
E
Xmaker interface . . . . . . . . . . . . . . . . . . . . . . . . 4
1
4 Lake Louise in Canada . . . . . . . . . . . . . . . . . . . . . . 10
5 Reserved picture . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 Beamer Title Page . . . . . . . . . . . . . . . . . . . . . . . . 15
Abstract
This article is used for helping you quickly master some essential
L
A
T
E
X skills, especially used for writing your class exercise, nal paper
or graduation thesis. L
A
T
E
X can be very confusing for beginners, since
it is not WYSIWYG
1
at all. In the very beginning when you learn
L
A
T
E
X, you desperately watch bunches of L
A
T
E
X source codes on the
computer screen which distracts you away from your initial intention,
consuming most of your energy on handling with codes rather than
your thought. I undertand, I had been through this before. Thus I
write this article to extract all essential stu which might help you
learn as quickly as possible, and of most importance, at lowest pain.
Hence excuse my informal languages in this article, I have no intention
to make this article read like an academic paper which merely brings
you more pain.
1 Buckle Your Seatbelt
For those people who want to pursue an academic career, L
A
T
E
X is absolute
necessity. Dont anticipate that you could submit a Ph.D. dissertation writ-
ten by MS word. In a word, unprofessional. When you were in classroom,
watching teacher clicking folders in his/her USB, didnt you notice that most
of your teachers do not use Powerpoint to show you his/her course slides?
He/she usually opens a pdf le, then it becomes course slides, and it looks
rather neat and nice-looking. I can assure you, these slides were made by
L
A
T
E
X. You must have following experience when dealing with MS word,
although it is considerably straighforward, it seems always inconsistent in
everything, such as fonts change, line space diers, picture unproportionally
scales, messes of footnotes, chaos of bibliography. . . Well, I might have ex-
agerated a little bit, you might also turn fastidious with MS Oce after you
get to know L
A
T
E
X quite well. You even get a basic sense of how L
A
T
E
X out-
put look like from reading my article, since my article is compile by L
A
T
E
X,
I guess you will notice lots of dierences from MS Word.
L
A
T
E
X is not a word processor programme, it is a typesetting system.
From my perspective, it can be regarded as script programming
2
. But this
system is embedded into some window interface programme into which you
can type your articles. I recommend some programmes here, once you get
familiar with one, you can try others, but dont start with several together.
1
What you see is what you get. Microsoft Word and Powerpoint belongs to this
catagory.
2
If you do not know this terminolgy from computer programming, dont bother.
2
interface.png
Figure 1: T
E
XnicCenter interface
1. T
E
XnicCenter
This is my favourite, most of time I use this IDE
3
to typeset my article.
2. LyX
LyXisdesignedtohavewordprocessorinterface, whichmakesitrathereasytogethandson, verysuitableforabsolutebeginners.Butitsoutputlayoutsettingisdifferentfromstandardthesiswritingsetting, andifyoudon
tknowhowtoreset, itmightbeaproblem.Lotsofuniversitiesprividedontheircomputers.T
E
Xmaker
AratherpopularIDEamongL
A
T
E
Xusers.Simpleandneatinterface, won
tmakeyoufeellost.
They are all free to download from their website, just go to their website
and browse the instruction, it wont take more than 10 minutes. Before
installation of these programme, you should install MiKT
E
X rst, which is
the core of everything else, packages gather in it.
Now take a look at this,
3. \sum_{i=1}^k=\boldsymbol{X}_tu_t
This is how we compile mathematics in L
A
T
E
X, rather scary? Dont
worry, you will get used to it. The output of this line will be
k
i=1
= X
t
u
t
Here is more, you will get the basic sense how we work in L
A
T
E
X environment,
3
Integrated development environment, again, dont bother.
3
\begin{equation*}
\begin{bmatrix}
x_{11} & x_{12} & \cdots & x_{1k}\\
x_{21} & x_{22} & \cdots & x_{2k}\\
\vdots & \vdots & \ddots & \vdots\\
x_{n1} & x_{n2} & \cdots & x_{n3}
\end{bmatrix}
\begin{equation*}
I know you get a headache, but here is the output, quite nice, right?
x
11
x
12
x
1k
x
21
x
22
x
2k
.
.
.
.
.
.
.
.
.
.
.
.
x
n1
x
n2
x
n3
t=1
u
t
. (ice cream)
I tag it as ice cream.
There is one situation when you have several equations, impossible to
put them in a single line, you align them by setting a reference point.
\begin{align*}
a-c+b-d&=x+y+z\\
&=e+f+g+h+i\\
&=j+k+l+m+n+o+p
\end{align*}
Notice that you put a & in front of the reference point, equations beneath
will follow at that point. Result is
a c + b d = x + y + z
= e + f + g + h + i
= j + k + l + m + n + o + p
4.2 Super- and Subscript
Easy, ^2 and _2 are super- and subscript respectively. Try these, x^7,
x^{abcde}, X^{abc}_{123}, X^{b^a}_{c_d}. Output are below,
x
7
x
abcde
X
abc
123
X
b
a
c
d
.
Besides, integration, summation and product operators, all can need super-
and subscript.
11
\begin{equation*}
\int_a^b{\frac{x^2}{\pi}} \,\mathrm{d}x
\qquad \prod_{t=1}^n\beta^tE(u_t)
\end{equation*}
Check your result,
b
a
x
2
dx
n
t=1
t
E(u
t
)
4.3 Matrix
Now I want you to look back 1. Try to gure out how it works, read slowly.
I present another kind of matrix notation here,
\begin{equation*}
\begin{pmatrix}
x_{11} & x_{12} & \cdots & x_{1k}\\
x_{21} & x_{22} & \cdots & x_{2k}\\
\vdots & \vdots & \ddots & \vdots\\
x_{n1} & x_{n2} & \cdots & x_{n3}
\end{pmatrix}
\begin{equation*}
Did you notice the dierence of our command, here I use
\begin{pmatrix}...\end{pmatrix}. It looks like,
x
11
x
12
x
1k
x
21
x
22
x
2k
.
.
.
.
.
.
.
.
.
.
.
.
x
n1
x
n2
x
n3
If you want to write a matrix multiplication, you just write several matrices
in a same equation environment.
\begin{equation*}
\begin{bmatrix}
x_{11} & x_{12} & \cdots & x_{1k}\\
x_{21} & x_{22} & \cdots & x_{2k}\\
\vdots & \vdots & \ddots & \vdots\\
x_{n1} & x_{n2} & \cdots & x_{n3}
\end{bmatrix}
\begin{bmatrix}
\beta_1\\
12
\beta_2\\
\vdots\\
\beta_3
\end{bmatrix}
=
\boldsymbol{X}\boldsymbol{\beta}
\end{equation*}
It is actually not that complicated as it seems, just put two matrices
together,
x
11
x
12
x
1k
x
21
x
22
x
2k
.
.
.
.
.
.
.
.
.
.
.
.
x
n1
x
n2
x
n3
2
.
.
.
= X
5 Beamer
One of the most important documentclass is beamer, it is used to creat
you fancy slides, when you are on a presentation of your thesis to your
superviser and other defense opponents. The time of Powerpoint is gone. I
barely see any professors using Powerpoint, since it kind of degenerate the
rigourous level of your presentation. If you need to crush some slides to
give a course presentation tomorrow morning, you use Powerpoint to make
fast slides, no one will blame you. But be careful, when you present your
stu among academia, appearance matters as well as contents. Here is one
beamer sample,
\documentclass{beamer}
\mode<presentation>
\usepackage{amssymb,amsthm,amsmath,}
\usepackage{graphicx,verbatim,textcomp}
\usepackage{amsfonts,mathrsfs,syntonly}
\usepackage{color,hyperref}
\usetheme{Frankfurt}
%\usecolortheme{lily}
\title{How to Cook Instant Noodles}
%\subtitle{}
\author{Weijie Chen}
\institute{\scriptsize Department of Economics\\
\vspace{.10cm}Universiteit van Amsterdam}
13
Yliopisto-Programme/My LaTeX working
les/Examples/latex-presentation/presentation.pdf
Outline General overview of the project Last 6 months Next 6 months
How to Cook and Eat Instant Noodles
Weijie Chen
Universiteit van Amsterdam
11 July, 2010
Weijie Chen How to Cook and Eat Instant Noodles
Figure 6: Beamer Title Page
14
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\section*{Outline}
\begin{frame}
\tableofcontents
\end{frame}
\section{What is Instant Noodle}
\subsection{Ingredients}
Instant noole is made of \cdots
\end{document}
\usetheme{Frankfurt} is a theme package named Frankfurt, almost
all theme package names are named after a city or town, for more detailed
information you should check The Beamer class User Guide[2]. However, as
you can see, it is no signicant dierence than compiling articles or books,
you just need to use \begin{frame}...\end{frame} to make a slide, ane
ll in it with your own content, such mathematics, pictures, etc. However if
you need far more function than this plain sample, you need to study The
Beamer class User Guide[2], it is a rather long manual.
6 Miscellaneous
Rest of things I put here, it might be more interesting to explore L
A
T
E
X by
yourself.
6.1 Your Command
Working on L
A
T
E
X can be very time consuming especially you have huge
bunches of math symbol to deal with. If you repeatedly use some com-
mands, and they are combination of several, you might consider to use a
new command to replace them, not really replace, just a self-made con-
densed version. Say you have to type in
X
1
thousands of times in your
le, it is rather boring. Now we set a new command for it. Put this
\newcommand{\bx}{\boldsymbol{\hat{X}}_{\!{1}}} at your preamble.
Then try this
\begin{equation*}
15
\bx
\end{equation*}
See? Quite convenient.
6.2 Change Style
Take look at this rst,
n
i=1
x
i
n
i=1
y
i
n
i=1
y
i
n
i=1
x
i
y
i
As you have already notice that summation operation does not display as its
usual form, because they are in a matrix. If summation, product, integral
operation will be displayed like this if you put them into matrix or fraction.
You might want to use \displaystyle{} to turn it back. Just put the
summation into its curly braces,
i=1
x
i
n
i=1
y
i
n
i=1
y
i
n
i=1
x
i
y
i
you have seem the modied output, it looks not so intensive as the rst one,
so I suggest you be careful when use some command to override L
A
T
E
Xs
preset command.
The End.
References
[1] Oetiker T.(2010): The Not So Short Introduction to L
A
T
E
X2
, version
4.31
[2] Wright J. and Miletic V. (2010): The Beamer Class User Guide
16