0% found this document useful (0 votes)
48 views5 pages

Exercises Kit LaTeX Mit

The document provides LaTeX exercises on various math topics, including equations, symbols, matrices, summations, and combinations. It includes 20 examples of expressions to typeset along with explanations of useful packages and environments.

Uploaded by

Gustavo Paiva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views5 pages

Exercises Kit LaTeX Mit

The document provides LaTeX exercises on various math topics, including equations, symbols, matrices, summations, and combinations. It includes 20 examples of expressions to typeset along with explanations of useful packages and environments.

Uploaded by

Gustavo Paiva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LATEX Exercises

Jason Gross
TEXed on September 6, 2010

If you have trouble figuring out how to typeset one of the following, try to figure it out using
the Internet before asking me how to typeset it. Knowing how to find the information you want on
the Internet is an important skill. If you’re stuck or frustrated, feel free to ask for help.
Note that http://detexify.kirelabs.org/classify.html is useful.

1 Easy
Please type me! The quick brown fox jumps over the lazy dog. (1)

eiπ + 1 = 0 (2)

eiθ = cos θ + i sin θ (3)

8πG
Gµν + Λgµν = Tµν (4)
c4

−b ± b2 − 4ac
x= (5)
2a
~ = ~r × p~
L (6)


3
2 (7)

n  
n
X n r n−r
(x + y) = x y (8)
r=0
r
r
a21 + · · · + a2n a1 + · · · + an √ n
≥ ≥ n a1 · · · an ≥ 1 1 (9)
n n a1 + ··· + an

|hx, yi|2 ≤ hx, xi · hy, yi (10)

A1: ϕ −→ (ψ → ϕ)
A2: (ϕ → (ψ → θ)) −→ ((ϕ → ψ) → (ϕ → θ))
A3: (¬ϕ → ¬ψ) −→ (ψ → ϕ) (11)

1
2 Medium
(
1 if x ∈ A
1A = (12)
0 if x ∈
/A

n↑ ··· ↑n = n → n → n (13)
| {z }
n
3
In the following, note the spacing between the = and the 1 1, 2 2, and 3
3.
1
1↑1= 1=1
2 ↑↑ 2 = 2 2 = 4
.3
..
3 33
33
3
3 ↑↑↑ 3 = 3 = 3 ↑↑ 3 ↑↑ 3 = |33 {z } (14)
333 threes

d f (x + ∆x) − f (x)
f (x) = lim (15)
dx ∆x→0 ∆x

H2 O(`) + H2 O(`) H3 O+ (aq) + OH− (aq) (16)


ˆ ∞
e−t tn dt
def
Γ(n + 1) = (17)
0

gcd(n, m mod n); x≡y (mod b); x≡y mod c; x≡y (d) (18)

In the following, note the bold symbols.


ρ
∇·E=
ε0
∇·B=0
∂B
∇×E=−
∂t
∂E
∇ × B = µ0 J + µ0 ε0 (19)
∂t

For the following exercise, you will need to \usepackage{esint} to get the symbol .

Q(V )
E · dA =
ε0
‹ ∂V
B · dA = 0
˛
∂V
∂ΦB,S
E · dl = −
∂t
˛ ∂S
∂ΦE,S
B · dl = µ0 IS + µ0 ε0 (20)
∂S ∂t

2
You might find the environments bmatrix and pmatrix useful for the following exercises.
   
cos θ sin θ cos θ sin θ
ρθ = = (21)
− sin θ cos θ − sin θ cos θ
 
1 0 ··· 0 1 0 ··· 0
 0 ∗ ··· ∗  0 ∗ ··· ∗
..  = .. .. . . (22)
 
 .. .. . . .
 . . . .  . . . ..
0 ∗ ··· ∗ 0 ∗ ··· ∗

Note the locations of the bounds on the summation in the following exercise.
v
u N
uX
v
u N
u
u pi (xi − x̄)2
u1 X t i=1
σ=t pi (xi − x̄)2 = (23)
N i=1 N

Y  1

ϕ(n) = n · 1− (24)
p|n
p
p prime

If you \usepackage{mathtools}, you can make it look like


Y 1

ϕ(n) = n · 1− (25)
p
p|n
p prime

5+ 14 5+ 4 5+ 14
4
12 C2 2 C2 12 C2 C5+
2
5+
2 C2 (26)
In the following, note the size of the /, and the spacing on the sides of the |.
na o.
Q∼= a, b ∈ Z and b 6= 0 ∼
b
a c
∼ ⇐⇒ ad − bc = 0 (27)
b d

Notice both the horizontal and vertical spacing in the following exercise.

1 ↑ 1 = 11 = 1
3
2 ↑↑ 2 = 2 2 = 4 33
..
.

3 33
3 ↑↑↑ 3 = 3 3 = 3 ↑↑ 3 ↑↑ 3 = |33 {z } (28)
333 threes

3
3 Hard
The command \newcommand{\name}[n][default]{definition} defines a new command, where n is
the number of parameters and default is the default value for the first parameter. Parameters in
braces ({ }) are required, and parameters in square brackets ([ ]) are optional. The parameters
can be referred to via #1, #2, . . . , #9. Using \newcommand{\mathset}[2][default value for the
first argument]{command definition}, define a command \mathset that acts as follows. Notice, in
particular, the sizes of the middle bar, the sizes of the braces, and the spacing between the middle
bar and the things on each side.
\mathset{1} gives {1}
\mathset[x]{0\leq x\leq 1} gives {x
( | 0 ≤ x ≤ 1} )
X X
\mathset[(x)_i]{ xi ∈ A} gives (x)i xi ∈ A
i i
∞ ∞
( )
X X
\mathset[ n−s ]{n \in A} gives n−s n ∈ A
i=1 i=1
\mathset{} ∅
gives n o
1
\mathset[ 1+ 1 ]{x\in A} gives 1+1 1 x ∈ A
x  x 
1
\mathset[ 1+ 1 ]{x\in A} gives 1+ 1 1 x ∈ A
1+ 1
x  1+ x1 
 
\mathset[ 1+ 1 1 ]{x\in A} gives 1 + 1
1 x∈A
1+ 1 1  1+ 1 1 
1+ 1+
x  x 

 

\mathset[ 1+ 1 1 ]{x\in A} gives 1+ 1 1 x∈A
1
1+
1+ 1 1
 1+ 1+ 1 1
 

1+ 1+ 1
x  x 

 

 
1 1
\mathset[ 1+ 1 ]{x\in A} gives 1+ 1 x∈A
1+ 1 1
 1+ 1+ 1+ 1 1
1
 
1+
 
1+ 1 1

1+ 1+ 1
x  x 

 


 

 
1 1
\mathset[ 1+ 1 ]{x\in A} gives 1+ 1 x∈A
1+ 1  1+ 1 
1+ 1  1+ 1 
1+ 1 
 1+ 1 

1+ 1  1+ 1 
1+ 1 1+ 1
x x

4
4 Insane
Write a command \outputcode which outputs the code of the document being typeset.
The following exercise idea is taken from the TEXbook. Define a command \primes{n} which
typesets the first n primes. For example, \primes{30} should give 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, and 113.

5 Diabolical
The Ackermann function is defined as

n + 1
 if m = 0
A(m, n) = A(m − 1, 1) if m > 0 and n = 0

A(m − 1, A(m, n − 1)) if m > 0 and n > 0

Define a command, \ackermann{m}{n}, which computes the Ackermann function and displays the
intermediate values. For an extra challenge, ensure that it only displays each sub-value only once
(per command call; a second call to \ackermann{m}{n} should typeset the same thing as the first
one).
For example, \ackermann{2}{2} should display

A(2, 2) = A(1, A(2, 1))


= A(1, A(1, A(2, 0)))
= A(1, A(1, A(1, 1)))
= A(1, A(1, A(0, A(1, 0))))
= A(1, A(1, A(0, A(0, 1))))
= A(1, A(1, A(0, 2)))
= A(1, A(1, 3))
= A(1, A(0, A(1, 2)))
= A(1, A(0, A(0, A(1, 1))))
= A(1, A(0, A(0, 3)))
= A(1, A(0, 4))
= A(1, 5)
= A(0, A(1, 4))
= A(0, A(0, A(1, 3)))
= A(0, A(0, 5))
= A(0, 6)
=7

You might also like