0% found this document useful (0 votes)
110 views

3 - Mathematics in TeX

1. This document discusses typesetting mathematics in LaTeX. It covers inserting mathematical symbols, superscripts and subscripts, fractions, brackets, and common functions. 2. Entering mathematics inline or on its own line in LaTeX only requires dollar signs. Numbered equations are set within the equation environment. 3. Greek letters, arrows, general symbols, and accents each have specific LaTeX codes. Examples are provided of common codes to insert mathematical symbols.

Uploaded by

Will Matcham
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)
110 views

3 - Mathematics in TeX

1. This document discusses typesetting mathematics in LaTeX. It covers inserting mathematical symbols, superscripts and subscripts, fractions, brackets, and common functions. 2. Entering mathematics inline or on its own line in LaTeX only requires dollar signs. Numbered equations are set within the equation environment. 3. Greek letters, arrows, general symbols, and accents each have specific LaTeX codes. Examples are provided of common codes to insert mathematical symbols.

Uploaded by

Will Matcham
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/ 7

Tutorial 3: Typesetting Mathematics in LATEX

William Matcham

September 2013
Chapter 1

Mathematics in LaTeX

Covered in this Tutorial

Inputting mathematics

Symbols

Superscripts and subscripts

Fractions

Brackets

Large operators

Vectors and matrices

Theorems, definitions and proofs

1.1 Introduction
In the third tutorial of the series, we explore how to insert mathematics into LaTeX
documents. Apart from the degree of control and aesthetic impact, the main advantage of
using LaTeX is the ease at which mathematics can be typeset. Although the introduction
of the equation mode on Microsoft Word 2007 facilitated the typesetting of mathematics
for Microsoft users, LaTeX still preferred for two reasons: first, mathematics looks better
on LaTeX, and second, certain techniques are much easier to produce on LaTeX than
Microsoft Word.

Entering mathematics inline on LaTeX is very straightforward. Simply place your desired
mathematical text inside dollar signs:

Rectangle B has side lengths x + 3 and x + 5 1 Rectangle B has side lengths $x+3$ and $x+5$

1
Oftentimes, it looks messy to have detailed mathematical expressions inside of prose. In
such cases, one can force mathematics onto a new line. To do this, place mathematical
text inside four dollar signs - two at the start of the mathematical content and two at the
end:

The area of rectangle B is:


1 The area of rectangle B is: $$ (x+3)(x+5) = x^{2} + 8x
2
(x + 3)(x + 5) = x + 8x + 15

When referring to mathematics in academic work, it is common to number equations.


To achieve this in LaTeX, one is required to use the equation environment. LaTeX will
handle the numbering automatically, but this can be adjusted manually to meet the exact
requirements of the author. Note in the example below that any mathematics inside the
equation environment need not be enclosed in dollar signs.

Thus we are required to solve the following


differential equation: 1 Thus we are required to solve the following differentia

dy/dx = 2x (1.1)

Finally, before we focus on specific mathematical symbols and operations, we introduce


the equation array. When one requires more than one equation, the equation array
environment is normally most appropriate. Similar to creating a table, to start a new line,
use a double backslash. to customise the point of alignment, simply wrap the symbol that
you wish to align by with ampersands. Consider the following example:

1 \begin{eqnarray}
2 (x+3)(x+5) + (x+3)(
(x + 3)(x + 5) + (x + 3)(x + 4) = x2 + 8x + 15 + x2 + 7x + 12 (1.2)
3 &=& 2x^{2} + 15x +
= 2x2 + 15x + 27 (1.3) 4 &=& (2x + 9)(x + 3)

= (2x + 9)(x + 3) (1.4) 5 \end{eqnarray}

Note that equation numbers follow from the previous example. To remove numbers, use
the eqnarray* environment instead.

1.2 Mathematical Symbols


A great deal of typesetting mathematics involves inserting mathematical symbols. Each
symbol has a codename, and entering the symbol into your document is as simple as
typing this codename inside dollar signs. For example, to type the greek letter alpha, use
code to obtain . There are many superb documents that list the mathematical symbols
and their LaTeX code. 1 Naturally with such superb lists available, one is not required to
1
These tutorials especially recommend The Comprehensive LATEXSymbol List, Pakin (2009)

2
learn by wrote the codewords of every mathematical symbol. It is an investment of time
to learn the basic symbols to memory. We advise the reader to learn the symbols that
they will use regularly by wrote, but to avoid learning the code for symbols that they will
use rarely. We provide a reference list of the most commonly used LaTeX mathematical
symbols:

1.2.1 Greek Letters

, , , , , , , , , , , , , 1 $\alpha,\beta,\gamma,\delta,\epsilon,\varepsilon,\zeta,\eta,\the
, , $, , , %, , , , , , , , , 2 $\nu,\pi, \varpi,\xi,\rho,\varrho, \sigma, \varsigma, \tau,\upsi

, , , , , , , , , , 1 $\Gamma,\Delta,\Theta,\Lambda,\Xi,\Pi,\Sigma,\Phi,\Psi,\Omega,\U

Note above that the capital alpha is not defined, and one must use the roman A symbol
instead. This is the case for the capital forms of: alpha, beta, epsilon, zeta, eta, iota,
kappa, mu, nu, omicron, rho, tau, and chi.

1.2.2 Arrows
, , , , , , , , 7-, (, ),

, , , =, =, , 7, ,, * 1 $\gets,\to,\leftarrow,\Leftarrow,\rightarrow, \Rightarr
, +, , , , , l, m, %, &, ., -

1.2.3 General Symbols

, , 6=, , , , , , , , , , , , , 1 $\leq,\geq,\neq,\approx,\times,\div,\otimes,\oplus, \pm


, , , , , ,
/ , , |, , , , , ,

1.2.4 Accents

x, x, x, x, x, x, x, x, x, x, ~x, 3[
+ x, abc
f 1 $\hat{x},\check{x},\dot{x}, \breve{x},\acute{x},\ddot{x

1.2.5 Common Sets and Operators

N, Z, Q, R, C, L, H 1 $\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R},\mathbb{C}

1.3 Superscripts, Subscripts and Surds


Superscripts and subscripts are very easy in LaTeX. To see an example, to produce x2 ,
one simply types $ x 2 $. However, it is in most cases necessary to wrap the superscript
in braces. The example below shows why. When 10 is not placed in braces, TeX assumes
that the author wishes to type x1 followed by 0. Thus for any expression longer than one
character, braces must always be used.

3
x1 0, x10 1 $x^10, x^{10}$

Subscripts are exactly the same: x2 is given from the code $ x 2 $. The same applies as
above
regarding subscripts longer than one character. Finally, the square
root of variable
x, x is encoded $ \sqrt { x } $. One produces the nth root of x, n x with the code
$ \sqrt [n] { x } $ .

1.4 fractions
Although fractions can be obtained through using the forward slash, the exact way to
typeset a fraction is to use the \frac { } { } command. The numerator of the fraction
is placed in the first braces and the denominator in the second. Fractions can be easily
nested, as the example below shows:

1 1 1
1+ x1
= 2
2=1+ x
x=1 1 $\frac{1}{1 + \frac{1}{x}} = \frac{1}{2} \Leftrightarro

Fractions can of course be placed inline. When one uses the \frac command, LaTeX
automatically makes the fraction the same size as the text. This is problematic when
complex fractions are placed inline, since they become difficult to read. In such cases,
display fraction \dfrac is recommended. This case is illustrated below:

x2 x2
The fraction is difficult to read, whereas is easier. The fraction $\frac{x^{2}}{1
1+
x2 2 1


1 + x

1.5 Brackets
For simple cases, standard parentheses from the keyboard will suffice as brackets. For

example, $ (x+4) 3 $ is sufficient for (x + 4)3 . However, clearly ( )2 does not look
 3

right, and we would prefer . In such cases, we use the \left( and \right) code.

The examples below show their use.

  x1   
3 1

2
, , xN| x
5 , hx, yi 1 $\left( \frac{\Upsilon^{3}}{\gamma^{2}} \right) ^{\frac
3

When using the \left(, it must always be paired with a \right). In the cases where one
only requires a right bracket for example, the left side must contain \left. The example
below illustrates a case where this is necessary:

y $\left. \dfrac{\partial y}{\partial x} \right|_{x=3} = 10$
= 10 1
x x=3

4
1.6 Common Functions
Some common functions are entered on LaTeX without any special code. A clear example
is how ex is simply coded $ e x $. However, however, most functions look better when
preceded by a backslash. It looks better if $ \tan ( x ) $ is used rather than $ tan (
x ) $. Other examples are shown below:

tan(x), tan(x), log(x), log(x), sin(x), sin(x), cos(x), 1 $tan(x), \tan(x), log(x), \log(x), sin(x), \si
sinh(x), sec(x), cosh(x) 2 $ \sinh(x), \sec(x), \cosh(x)$

1.7 Large Operators


With our experience now, large operators are very easy. The following examples below
show sufficient details to explain their use.

n Z n
X 1 Y
j2 x
\ [ 1 $$\sum_{i=1}^{\infty} \dfrac{1}{i^{2}} \quad \
e f (x)e Ai Bi
i=1
i2 j=1 0 i=1 i=1

1.8 Matrices and Vectors


Matrices and vectors in LaTeX can prove challenging and if you are finding difficulty in
constructing large matrices, there exist matrix wizards to help. Both are created using
the array environment. This environment is very similar to the tabular environment. One
specifies the number of columns and their alignment first. Columns are separated with
ampersands, and lines are broke with double backslashes. The array environment creates
the array of numbers and brackets must be specified by the author. The examples below
should be sufficient to demonstrate the required techniques.
1 $$ \left(
2 \begin{array}{ccc}

3 1 & 2 & 3 \\

44 & 5 & 6

5 \end{array} \right)

6=

    7 \left(
1 2 3 a 
8 \begin{array}{c}
= x y z
4 5 6 b 9 a \\

10 b \end{array}

11 \right)\left(

12 \begin{array}{ccc}

13 x & y & z

14 \end{array} \right)

15 $$

5
1 $$ D = \left[ \begin{array}{cccc}
1 0 . . . 0 2 \lambda_{1} & 0 & \dots & 0 \\
0 2 . . . 0 3 0 & \lambda_{2} & \dots & 0 \\
D=

.. .. . . . 4 \vdots & \vdots & \ddots & \vdots \\
. ..

. .
5 0 & 0 & \dots & \lambda_{n}
0 0 . . . n
6 \end{array} \right]$$

The latter example shows how to implement different kinds of dots inside your array.

1.9 Theorems, Definitions and Proofs


Finally in this tutorial, we explain how one can correctly include theorems in work. First,
be sure to include the amsthm package in the preamble. Then, in the preamble, we need
to define the theorem environment. This is done by including the code

\newtheorem{X}{Y}[Z]

Here, X will be the name that LaTeX will use to name the theorem, Y will be the outputted
text for the theorem, and Z the depth for which we choose to number the theorems by
(part / chapter / section / subsection). Two common examples are:

\newtheorem{Theorem}{Theorem}[chapter]
\newtheorem{Definition}{Definition}[chapter]

For proofs, we simply use the proof environment shown below.


1 \begin{Definition}
2 A number $n$ is \textit{even

3 \end{Definition}
Definition 1.1. A number n is even if n = 2k for some integer k 4 \begin{Theorem}

5 32 is an even number
Theorem 1.1. 32 is an even number 6 \end{Theorem}

7 \begin{proof}
Proof. 32 = 2 16
8 $32

= 2 \times 16$
9 \end{proof}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy