A
T
E
X Introduction
Weijie Chen
Department of Economics
University of Helsinki
6 July, 2011
Contents
1 Buckle Your Seatbelt 3
2 Start! 7
3 Put It Nicely 9
3.1 Cross reference . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Footnote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Emphasize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.5 Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.6 Loading a picture . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.7 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Queen of Science 12
4.1 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Super- and Subscript . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Beamer 16
6 Miscellaneous 18
6.1 Your Command . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2 Change Style . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3 Some marks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4 Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.5 Umlaut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
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,
4
interface.png
Figure 2: LyX interface
interface.png
Figure 3: T
E
Xmaker interface
5
\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.
13
\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\\
14
\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
But here is one more situation it might end up like this, if you use code
above to compile this matrix, some number with a negative sign,
1 8 3 2 4
0 1 2 9 2
0 0 3 1 5
0 0 0 5 4
0 0 0 0 6
1 8 3 -2 4
0 -1 -2 9 2
0 0 3 1 5
0 0 0 5 -4
0 0 0 0 6
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\\
16
noodle.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
\vspace{.10cm}Universiteit van Amsterdam}
\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}
17
\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*}
\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
18
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.
6.3 Some marks
Did you ever use yet? LaTeX usually does not display like, and it has
dierent input than it looks like, if you want to put quotation mark such as
Know thyself.
Note that the rst mark, is , is the button on the left of number 1 on
an American keyboard layout.
6.4 Spacing
From an aesthetic view, mathematics should present in a gentle way, not any
surpassingly spacing, not any exceedingly constringing. Put mathematics in
a readable, or attractive manner is an art! The appearance of an article is
should be decorated just like a room, put things in the right place, it shines.
Let me show you two examples,
b
a
sin
2
du
f(x, y, z)dxdydz
do you feel any uncomfortable when wathcing them? Spacing! The codes
are follows,
\begin{equation*}
\int_a^b\sin{\frac{\pi}{2}}\mathrm{d}u
\qquad \int\int\int{f(x)}\mathrm{d}x{d}y{d}z
\end{equation*}
When you are dealing with micro-distance between symbols within an
expression, you use \! to shrink, and \, to expand space. Now it becomes,
b
a
sin
2
du
f(x, y, z) dxdy dz.
Here is the codes,
19
\begin{equation*}
\int_a^b\sin{\frac{\pi}{2}}\,\mathrm{d}u
\qquad \int\!\!\int\!\!\int{f(x,y,z)}
\,\mathrm{d}x\,\mathrm{d}y\,\mathrm{d}z.
\end{equation*}
6.5 Umlaut
You probably would write your thesis in a languge other than English, maybe
German, Swedish, Finnish. You might need to use letters such as a, o, u.
In German, they are called umlaute. Here is a small table,
a o u a c o
\"a \"o \"u \aa \^c \c o
Table 1: Most frequent acute symbols
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
20