A short introduction to L TEX A Martin Helsø

advertisement
A short introduction to LATEX
Martin Helsø
28th November 2015
This template assumes that the user has downloaded TEX Live; otherwise the
user might lack several of the packages. Read here about how TEX Live can be
loaded as a module on the Department of Mathematics’ computers.
1
Mathematics
This section gives various examples of typesetting mathematics. There is no
coherence between the subjects. It is recommended to switch between reading
the compiled document and the source code.
Exercise 1. Find the solutions of the quadratic equation x2 − 4x + 3 = 0.
Solution. The roots of the polynomial ax2 + bx + c are described by the quadratic
formula
√
−b ± b2 − 4ac
x=
.
2a
Insertion yields
√
4 ± 42 − 4 · 1 · 3
x=
= 2 ± 1,
2·1
thus the solutions are x1 = 1 and x2 = 3.
Example 1.1. The quadratic form of a symmetric 3 × 3 matrix A is a square
over C if and only if rank A = 1. The quadratic form is particularly nice if


1 a b
A := a a2 ab .
b ab b2
Then the quadratic form is

 
1 a b
x
xT Ax = x y z a a2 ab y 
b ab b2
z


x + ay + bz
= x y z ax + a2 y + abz 
bx + aby + b2 z
= x(x + ay + bz) + y(ax + a2 y + abz) + z(bx + aby + b2 z)
= x2 + 2axy + a2 y 2 + 2bxz + 2abyz + b2 z 2
= (x + az + by)2 .
1
Exercise 2. Let f : R → R be given by
(
ln(x)
f (x) :=
6x + 3
x ≥ 1,
x < 1.
Determine whether f is continuous.
Solution. The function f is discontinuous because the one-sided limit
lim f (x) = lim− 6x + 3 = 9
x→1−
x→1
differs from f (1) = 0.
Exercise 3. Find the area bounded by the graph of sin x and the lines x = 0
and x = π.
Solution. We calculate the definite integral
Z π
sin x dx = [− cos x]π0 = 1 + 1 = 2.
0
Hence the area is 2.
Theorem 1.2. This is the first theorem in this document.
Proof. Trivial.
1.1
Delimiters with Adjustable Height
Often one need to adjust the height of delimiters such as (. . . ) and {. . . } to
the height of their content. This can be done by inserting the commands \left
and \right in front of the left and right delimiter, respectively. In addition,
\middle can be used on some symbols to give the content the same height as
the delimiters.
However, we defined the commands \p, \set, \abs and \norm, and you
can define more as needed. By default, \p{...} will encapsulate its argument
in ordinary parentheses, but if the starred version \p*{...} is used, then the
argument with be encapsulated by parentheses of adjustable height.
Compare for instance1
{(x1 , . . . , xn ) ∈ Rn |
n
X
xi 2
( ) = 1},
i
i=1
and

)
n X
2
x

i
(x1 , . . . , xn ) ∈ Rn 
=1 .

i
i=1
(
2
Command
Description
Example
\ref
\eqref
\pageref
\cref
\vref
Number
Number in parentheses
Page number
Type and number
Type, location and number
1.2
(1.2)
2
Theorem 1.2
Theorem 1.2 on the previous page
Table 1: Cross reference commands.
2
Cross References
To refer to an equation, theorem, table, image or section, give the object a
key with \label{key}. Then you can refer to it with one of the commands in
Table 1, for example \ref{key}.
The command \eqref is intended for equations, but both \cref and \vref
will add parentheses if they refer to an equation.
The package autonum ensures that equations are unnumbered until they
have been referred to2 . In addition, the package removes the starred versions of
equations, so align* and equation* will result in compilation errors. However,
issues can arise if one does not have the latest version of the package  at the
moment, this is the case at the Department of Informatics  so the following
lines from the preamble has been commented out:
\usepackage{autonum}
\makeatletter
\autonum@generatePatchedReference{vref}
\makeatother
Remove the comments and test if you can still compile this document.
When it comes to cross references, it is important which order they are
imported in. In general, they should be the last packages to be imported, and
to get the correct interplay between the different cross reference packages, they
have to be imported in a specific order. Be careful of this when you expand this
template.
1 It
is more natural to use \mid, but it does not scale, hence \arrowvert in the second
version.
2 This does not apply to \pageref, as it only refers to the page and not the equation itself.
3
Download