<<

. 4
( 7)



>>

so that we can use $\vect{x}{n}$ to produce (x1 , x2 , . . . , xn ) and $\vect{a}{p}$ to pro-
duce (a1 , a2 , . . . , ap ).

MORE
VIII.3. ON MATHEMATICS

There are some many other features of typesetting math in LTEX, but these have better
A

implementations in the package amsmath which has some additional features as well. So,
for the rest of the chapter the discussion will be with reference to this package and some
allied ones. Thus all discussion below is under the assumption that the package amsmath
has been loaded with the command \usepackage{amsmath}.

Single equations
VIII.3.1.

In addition to the LTEX commands for displaying math as discussed earlier, the ams-
A

math also provides the \begin{equation*} ... \end{equation*} construct. Thus with
this package loaded, the output

The equation representing a straight line in the Cartesian plane is of the form

ax + by + c = 0

where a, b, c are constants.

can also be produced by
83
MORE
VIII.3. ON MATHEMATICS


The equation representing a straight line in the Cartesian plane is
of the form
\begin{equation*}
ax+by+c=0
\end{equation*}
where $a$, $b$, $c$ are constants.

Why the * after equation? Suppose we try it without the * as
The equation representing a straight line in the Cartesian plane is
of the form
\begin{equation}
ax+by+c=0
\end{equation}
where $a$, $b$, $c$ are constants.

we get

The equation representing a straight line in the Cartesian plane is of the form

ax + by + c = 0
(VIII.1)

where a, b, c are constants.

This provides the equation with a number. We will discuss equation numbering in some
more detail later on. For the time being, we just note that for any environment name
with a star we discuss here, the unstarred version provides the output with numbers.
Ordinary text can be inserted inside an equation using the \text command. Thus
we can get

Thus for all real numbers x we have

x ¤ |x| and x ≥ |x|

and so
x ¤ |x| for all x in R.

from
Thus for all real numbers $x$ we have
\begin{equation*}
x\le|x|\quad\text{and}\quad x\ge|x|
\end{equation*}
and so
\begin{equation*}
x\le|x|\quad\text{for all $x$ in $R$}.
\end{equation*}

Note the use of dollar signs in the second \text above to produce mathematical
symbols within \text.
Sometimes a single equation maybe too long to ¬t into one line (or sometimes even
two lines). Look at the one below:


(a + b + c + d + e)2 = a2 + b2 + c2 + d2 + e2
+ 2ab + 2ac + 2ad + 2ae + 2bc + 2bd + 2be + 2cd + 2ce + 2de
84 TYPESETTING MATHEMATICS
VIII.


This is produced by the environment multline* (note the spelling carefully”it is not
mult i line), as shown below.
\begin{multline*}
(a+b+c+d+e)ˆ2=aˆ2+bˆ2+cˆ2+dˆ2+eˆ2\\
+2ab+2ac+2ad+2ae+2bc+2bd+2be+2cd+2ce+2de
\end{multline*}
can be used for equations requiring more than two lines, but without tweaking,
multline
the results are not very satisfactory. For example, the input
\begin{multline*}
(a+b+c+d+e+f)ˆ2=aˆ2+bˆ2+cˆ2+dˆ2+eˆ2+fˆ2\\
+2ab+2ac+2ad+2ae+2af\\
+2bc+2bd+2be+2bf\\
+2cd+2ce+2cf\\
+2de+2df\\
+2ef
\end{multline*}
produces


(a + b + c + d + e + f )2 = a2 + b2 + c2 + d2 + e2 + f 2
+ 2ab + 2ac + 2ad + 2ae + 2a f
+ 2bc + 2bd + 2be + 2b f
+ 2cd + 2ce + 2c f
+ 2de + 2d f
+ 2e f

By default, the multline environment places the ¬rst line ¬‚ush left, the last line ¬‚ush right
(except for some indentation) and the lines in between, centered within the display.
A better way to typeset the above multiline (not multline) equation is as follows.


(a + b + c + d + e + f )2 = a2 + b2 + c2 + d2 + e2 + f 2
+ 2ab + 2ac + 2ad + 2ae + 2a f
+ 2bc + 2bd + 2be + 2b f
+ 2cd + 2ce + 2c f
+ 2de + 2d f
+ 2e f

This is done using the split environment as shown below.
\begin{equation*}
\begin{split}
(a+b+c+d+e+f)ˆ2 & = aˆ2+bˆ2+cˆ2+dˆ2+eˆ2+fˆ2\\
&\quad +2ab+2ac+2ad+2ae+2af\\
&\quad +2bc+2bd+2be+2bf\\
&\quad +2cd+2ce+2cf\\
&\quad +2de+2df\\
&\quad +2ef
\end{split}
\end{equation*}
85
MORE
VIII.3. ON MATHEMATICS




Some comments seems to be in order. First note that the split environment cannot
be used independently, but only inside some equation structure such as equation (and
others we will soon see). Unlike multline, the split environment provides for alignment
among the “split” lines (using the & character, as in tabular). Thus in the above example,
all the + signs are aligned and these in turn are aligned with a point a \quad to the right
of the = sign. It is also useful when the equation contains multiple equalities as in


(a + b)2 = (a + b)(a + b)
= a2 + ab + ba + b2
= a2 + 2ab + b2

which is produced by
\begin{equation*}
\begin{split}
(a+b)ˆ2 & = (a+b)(a+b)\\
& = aˆ2+ab+ba+bˆ2\\
& = aˆ2+2ab+bˆ2
\end{split}
\end{equation*}


Groups of equations
VIII.3.2.

A group of displayed equations can be typeset in a single go using the gather environ-
ment. For example,


(a, b) + (c, d) = (a + c, b + d)
(a, b)(c, d) = (ac ’ bd, ad + bc)

can be produced by
\begin{gather*}
(a,b)+(c,d)=(a+c,b+d)\\
(a,b)(c,d)=(ac-bd,ad+bc)
\end{gather*}
Now when several equations are to be considered one unit, the logically correct way
of typesetting them is with some alignment (and it is perhaps easier on the eye too). For
example,

Thus x, y and z satisfy the equations

x+y’z=1
x’y+z=1

This is obtained by using the align* environment as shown below
Thus $x$, $y$ and $z$ satisfy the equations
\begin{align*}
x+y-z & = 1\\
x-y+z & = 1
\end{align*}
86 TYPESETTING MATHEMATICS
VIII.




We can add a short piece of text between the equations, without disturbing the alignment,
using the \intertext command. For example, the output

Thus x, y and z satisfy the equations

x+y’z=1
x’y+z=1

and by hypothesis

x+y+z=1

is produced by
Thus $x$, $y$ and $z$ satisfy the equations
\begin{align*}
x+y-z & = 1\\
x-y+z & = 1\\
\intertext{and by hypothesis}
x+y+z & =1
\end{align*}

We can also set multiple ˜columns™ of aligned equations side by side as in

Compare the following sets of equations

cos2 x + sin2 x = 1 cosh2 x ’ sinh2 x = 1
cos2 x ’ sin2 x = cos 2x cosh2 x + sinh2 x = cosh 2x

All that it needs are extra &™s to separate the columns as can be sen from the input
Compare the following sets of equations
\begin{align*}
\cosˆ2x+\sinˆ2x & = 1 & \coshˆ2x-\sinhˆ2x & = 1\\
\cosˆ2x-\sinˆ2x & = \cos 2x & \coshˆ2x+\sinhˆ2x & = \cosh 2x
\end{align*}

We can also adjust the horizontal space between the equation columns. For example,
Compare the sets of equations
\begin{align*}
\cosˆ2x+\sinˆ2x & = 1 &\qquad \coshˆ2x-\sinhˆ2x & = 1\\
\cosˆ2x-\sinˆ2x & = \cos 2x &\qquad \coshˆ2x+\sinhˆ2x & = \cosh 2x
\end{align*}

gives

Compare the sets of equations

cos2 x + sin2 x = 1 cosh2 x ’ sinh2 x = 1
cos2 x ’ sin2 x = cos 2x cosh2 x + sinh2 x = cosh 2x


Perhaps a nicer way of typesetting the above is
87
MORE
VIII.3. ON MATHEMATICS



Compare the following sets of equations

cos2 x + sin2 x = 1 cosh2 x ’ sinh2 x = 1
and
cos2 x ’ sin2 x = cos 2x cosh2 x + sinh2 x = cosh 2x

This cannot be produced by the equation structures discussed so far, because any of these
environments takes up the entire width of the text for its display, so that we cannot put
anything else on the same line. So amsmath provides variants gathered, aligned and
alignedat which take up only the actual width of the contents for their display. Thus the
above example is produced by the input
Compare the following sets of equations
\begin{equation*}
\begin{aligned}
\cosˆ2x+sinˆ2x & = 1\\
\cosˆ2x-\sinˆ2x & = \cos 2x
\end{aligned}
\qquad\text{and}\qquad
\begin{aligned}
\coshˆ2x-\sinhˆ2x & = 1\\
\coshˆ2x+\sinhˆ2x & = \cosh 2x
\end{aligned}
\end{equation*}


Another often recurring structure in mathematics is a display like this
±
if x ≥ 0
x
|x| = 


’x if x ¤ 0



There is a special environment cases in amsmath to take care of these. The above exam-
ple is in fact produced by
\begin{equation*}
|x| =
\begin{cases}
x & \text{if $x\ge 0$}\\
-x & \text{if $x\le 0$}
\end{cases}
\end{equation*}


Numbered equations
VIII.3.3.

We have mentioned that each of the the ˜starred™ equation environments has a corre-
sponding unstarred version, which also produces numbers for their displays. Thus our
very ¬rst example of displayed equations with equation instead of equation* as in
The equation representing a straight line in the Cartesian plane is
of the form
\begin{equation}
ax+by+c=0
\end{equation}
where $a$, $b$, $c$ are constants.
88 TYPESETTING MATHEMATICS
VIII.




produces

The equation representing a straight line in the Cartesian plane is of the form

ax + by + c = 0
(VIII.2)

where a, b, c are constants.


Why VIII.2 for the equation number? Well, this is Equation number 2 of Chap-
ter VIII, isn™t it? If you want the section number also in the equation number, just give
the command
\numberwithin{equation}{section}

We can also override the number LTEX produces with one of our own design with the
A

\tag command as in
The equation representing a straight line in the Cartesian plane is
of the form
\begin{equation}
ax+by+c=0\tag{L}
\end{equation}
where $a$, $b$, $c$ are constants.

which gives

The equation representing a straight line in the Cartesian plane is of the form

ax + by + c = 0
(L)

where a, b, c are constants.

There is also a \tag* command which typesets the equation label without parentheses.
What about numbering alignment structures? Except for split and aligned, all
other alignment structures have unstarred forms which attach numbers to each aligned
equation. For example,
\begin{align}
x+y-z & = 1\\
x-y+z & = 1
\end{align}

gives


x+y’z=1
(VIII.3)
x’y+z=1
(VIII.4)

Here is also, you can give a label of your own to any of the equations with the \tag
command. Be careful to give the \tag before the end of line character \\ though. (See
what happens if you give a \tag command after a \\.) You can also suppress the label for
any equation with the \notag command. These are illustrated in the sample input below:
Thus $x$, $y$ and $z$ satisfy the equations
\begin{align*}
89
MATHEMATICS
VIII.4. MISCELLANY


x+y-z & = 1\ntag\\
x-y+z & = 1\notag\\
\intertext{and by hypothesis}
x+y+z & =1\tag{H}
\end{align*}


which gives the following output

Thus x, y and z satisfy the equations

x+y’z=1
x’y+z=1

and by hypothesis

x+y+z=1
(H)


What about split and aligned? As we have seen, these can be used only within
some other equation structure. The numbering or the lack of it is determined by this
parent structure. Thus

\begin{equation}
\begin{split}
(a+b)ˆ2 & = (a+b)(a+b)\\
& = aˆ2+ab+ba+bˆ2\\
& = aˆ2+2ab+bˆ2
\end{split}
\end{equation}


gives


(a + b)2 = (a + b)(a + b)
= a2 + ab + ba + b2
(VIII.5)
= a2 + 2ab + b2




MATHEMATICS
VIII.4. MISCELLANY

There are more things Mathematics than just equations. Let us look at how LTEX and in
A

particular, the amsmath package deals with them.


Matrices
VIII.4.1.

Matrices are by de¬nition numbers or mathematical expressions arranged in rows and
columns. The amsmath has several environments for producing such arrays. For example
90 TYPESETTING MATHEMATICS
VIII.



The system of equations

x+y’z=1
x’y+z=1
x+y+z=1

can be written in matrix terms as
’1· ¬x· ¬1·
¬1 1
« «  « 
1 · ¬ y· = ¬1· .
¬ ·¬ · ¬ ·
’1
¬1
¬ ·¬ · ¬ ·
¬ ·¬ · ¬ ·
¬ ·¬ · ¬ ·
1z
1 1 1
    

’1·
¬1 1
« 
¬ ·
Here, the matrix ¬1 1 · is invertible.
’1
¬ ·
¬ ·
¬ ·
1 1 1
 


is produced by
The system of equations
\begin{align*}
x+y-z & = 1\\
x-y+z & = 1\\
x+y+z & = 1
\end{align*}
can be written in matrix terms as
\begin{equation*}
\begin{pmatrix}
1 & 1 & -1\\
1 & -1 & 1\\
1& 1& 1
\end{pmatrix}
\begin{pmatrix}
x\\
y\\
z
\end{pmatrix}
=
\begin{pmatrix}
1\\
1\\
1
\end{pmatrix}.
\end{equation*}
Here, the matrix
$\begin{pmatrix}
1& 1 & -1\\
1 & -1 & 1\\
1& 1& 1
\end{pmatrix}$
is invertible.

Note that the environment pmatrix can be used within in-text mathematics or in
displayed math. Why the p? There is indeed an environment matrix (without a p) but it
91
MATHEMATICS
VIII.4. MISCELLANY


produces an array without the enclosing parentheses (try it). If you want the array to be
enclosed within square brackets, use bmatrix instead of pmatrix. Thus

a b
Some mathematicians write matrices within parentheses as in while others prefer square
c d
a b
brackets as in
c d

is produced by
Some mathematicians write matrices within parentheses as in
$
\begin{pmatrix}
a & b\\
c&d
\end{pmatrix}
$
while others prefer square brackets as in
$
\begin{bmatrix}
a & b\\
c&d
\end{bmatrix}
$

There is also a vmatrix environment, which is usually used for determinants as in

a b
The determinant is de¬ned by
c d

a b
= ad ’ bc
c d

which is obtained from the input
The determinant
$
\begin{vmatrix}
a & b\\
c&d
\end{vmatrix}
$
is defined by
\begin{equation*}
\begin{vmatrix}
a & b\\
c&d
\end{vmatrix}
=ad -bc
\end{equation*}

There is a variant Vmatrix which encloses the array in double lines. Finally, we have a
Bmatrix environment which produces an array enclosed within braces { }.
92 TYPESETTING MATHEMATICS
VIII.


A row of dots in a matrix can be produced by the command \hdotsfour. it should
be used with an argument specifying the number of columns to be spanned. For example,
to get

A general m — n matrix is of the form

¬ a11 a12 . . . a1n ·
« 
¬ 21 a22 . . . a2n ·
¬ ·
¬a ·
¬ ·
¬. . . . . . . . . . . . . . . . . . . .·
¬ ·
¬ ·
¬ ·
¬ ·
am1 am2 . . . amn
 


we type
A general $m\times n$ matrix is of the form
\begin{equation*}
\begin{pmatrix}
a_{11} & a_{12} & \dots & a_{1n}\\
a_{21} & a_{22} & \dots & a_{2n}\\
\hdotsfor{4}\\
a_{m1} & a_{m2} & \dots & a_{mn}
\end{pmatrix}
\end{equation*}

The command \hdotsfor has also an optional argument to specify the spacing of dots.
Thus in the above example, if we use \hdotsfor[2]{4}, then the space between the dots
is doubled as in

A general m — n matrix is of the form

¬ a11 a12 . . . a1n ·
« 
¬ 21 a22 . . . a2n ·
¬ ·
¬a ·
¬ ·
¬. . . . . . . . . . . . . . .·
¬ ·
¬ ·
¬ ·
¬ ·
am1 am2 . . . amn
 




Dots
VIII.4.2.

In the above example, we used the command \dots to produce a row of three dots. This
can be used in other contexts also. For example,
Consider a finite sequence $X_1,X_2,\dots$, its sum $X_1+X_2+\dots$
and product $X_1X_2\dots$.

gives

Consider a ¬nite sequence X1 , X2 , . . . , its sum X1 + X2 + . . . and product X1 X2 . . . .

Here the dots in all the three contexts are along the “baseline” of the text. Isn™t it better
to typeset this as

Consider a ¬nite sequence X1 , X2 , . . . , its sum X1 + X2 + · · · and product X1 X2 · · · .

with raised dots for addition and multiplication? The above text is typeset by the input
Consider a finite sequence $X_1,X_2,\dotsc$, its sum $X_1+X_2+\dotsb$
and product $X_1X_2\dotsm$.
93
MATHEMATICS
VIII.4. MISCELLANY




Here \dotsc stands for dots to be used with commas, \dotsb for dots with binary
operations (or relations) and \dotsm for multiplication dots. There is also a \dotsi for
dots with integrals as in


f
···
A1 A2 An




Delimiters
VIII.4.3.

How do we produce something like

ahg ahg
= 0, the matrix
Since is not invertible.
hbf hbf
gfc gfc



Here the ˜small™ in-text matrices are produced by the environment smallmatrix. This
environment does not provide the enclosing delimiters ( ) or ” ” which we must supply
as in
$
\left|\begin{smallmatrix}
a & h & g\\
h & b & f\\
g&f&c
\end{smallmatrix}\right|
=0
$,
the matrix
$
\left(\begin{smallmatrix}
a & h & g\\
h & b & f\\
g&f&c
\end{smallmatrix}\right)
$
is not invertible.

Why the \left|...\right| and \left{...\right? These commands \left and \right
enlarge the delimiter following them to the size of the enclosed material. To see their ef-
fect, try typesetting the above example without these commands. The list of symbols at
the end of the chapter gives a list of delimiters that are available off the shelf.
One interesting point about the \left and \right pair is that, though every \left
should be matched to a \right, the delimiters to which they apply need not match. In par-
ticular we can produce a single large delimiter produced by \left or \right by matching
it with a matching command followed by a period. For example,

ux = v y
Cauchy-Riemann Equations
u y = ’vx

is produced by
94 TYPESETTING MATHEMATICS
VIII.


\begin{equation*}
\left.
\begin{aligned}
u_x & = v_y\\
u_y & = -v_x
\end{aligned}
\right\}
\quad\text{Cauchy-Riemann Equations}
\end{equation*}

There are instances where the delimiters produced by \left and \right are too small
or too large. For example,
\begin{equation*}
(x+y)ˆ2-(x-y)ˆ2=\left((x+y)+(x-y)\right)\left((x+y)-(x-y)\right)=4xy
\end{equation*}

gives

(x + y)2 ’ (x ’ y)2 = (x + y) + (x ’ y) (x + y) ’ (x ’ y) = 4xy

where the parentheses are all of the same size. But it may be better to make the outer
ones a little larger to make the nesting visually apparent, as in

(x + y)2 ’ (x ’ y)2 = (x + y) + (x ’ y) (x + y) ’ (x ’ y) = 4xy


This is produced using the commands \bigl and \bigr before the outer parentheses as
shown below:
\begin{equation*}
(x+y)ˆ2-(x-y)ˆ2=\bigl((x+y)+(x-y)\bigr)\bigl((x+y)-(x-y)\bigr)=4xy
\end{equation*}

Apart from \bigl and \bigr there are \Bigl, \biggl and \Biggl commands (and
their r counterparts) which (in order) produce delimiters of increasing size. (Experiment
with them to get a feel for their sizes.)
As another example, look at

For n-tuples of complex numbers (x1 , x2 , . . . , xn ) and (y1 , y2 , . . . , yn ) of complex numbers
2 «
« « 
n n n
¬ · ¬ ·¬ ·
|xk yk |· ¤ ¬ |xk |· ¬ |yk |·
¬ · ¬ ·¬ ·
¬ · ·¬ ·
¬ ¬
¬ · ¬ ·¬ ·
    
k=1 k=1 k=1


which is produced by
For $n$-tuples of complex numbers $(x_1,x_2,\dotsc,x_n)$ and
$(y_1,y_2,\dotsc,y_n)$ of complex numbers
\begin{equation*}
\left(\sum_{k=1}ˆn|x_ky_k|\right)ˆ2\le
\left(\sum_{k=1}ˆ{n}|x_k|\right)\left(\sum_{k=1}ˆ{n}|y_k|\right)
\end{equation*}

Does not the output below look better?
95
MATHEMATICS
VIII.4. MISCELLANY



For n-tuples of complex numbers (x1 , x2 , . . . , xn ) and (y1 , y2 , . . . , yn ) of complex numbers
n n n
2
|xk yk | ¤ |xk | |yk |
k=1 k=1 k=1


This one is produced by
For $n$-tuples of complex numbers $(x_1,x_2,\dotsc,x_n)$ and
$(y_1,y_2,\dotsc,y_n)$ of complex numbers
\begin{equation*}
\biggl(\sum_{k=1}ˆn|x_ky_k|\biggr)ˆ2\le
\biggl(\sum_{k=1}ˆ{n}|x_k|\biggr)\biggl(\sum_{k=1}ˆ{n}|y_k|\biggr)
\end{equation*}

Here the trouble is that the delimiters produced by \left and \right are a bit too large.

Putting one over another
VIII.4.4.

Look at the following text

From the binomial theorem, it easily follows that if n is an even number, then

n1 n1 n 1
+ =0
1’ ’ ··· ’
2 n’1
n’1 2
12 22

We have fractions like 2n’1 and binomial coef¬cients like n here and the common feature
1
2
of both is that they have one mathematical expression over another.
Fractions are produced by the \frac command which takes two arguments, the nu-
merator followed by the denominator and the binomial coef¬cients are produced by the
\binom command which also takes two arguments, the ˜top™ expression followed by the
˜bottom™ one. Thus the the input for the above example is
From the binomial theorem, it easily follows that if $n$ is an even
number, then
\begin{equation*}
1-\binom{n}{1}\frac{1}{2}+\binom{n}{2}\frac{1}{2ˆ2}-\dotsb
-\binom{n}{n-1}\frac{1}{2ˆ{n-1}}=0
\end{equation*}

You can see from the ¬rst paragraph above that the size of the outputs of \frac
and \binom are smaller in text than in display. This default behavior has to be modi¬ed
sometimes for nicer looking output. For example, consider the following output

Since (xn ) converges to 0, there exists a positive integer p such that

1
|xn | < for all n ≥ p
2

Would not it be nicer to make the fraction smaller and typeset this as

Since (xn ) converges to 0, there exists a positive integer p such that

|xn | < 1
for all n ≥ p
2



The second output is produced by the input
96 TYPESETTING MATHEMATICS
VIII.


Since $(x_n)$ converges to $0$, there exists a positive integer $p$
such that
\begin{equation*}
|x_n|<\tfrac{1}{2}\quad\text{for all $n\ge p$}
\end{equation*}

Note the use of the command \tfrac to produce a smaller fraction. (The ¬rst output is
produced by the usual \frac command.)
There is also command \dfrac to produce a display style (larger size) fraction in text.
Thus the sentence after the ¬rst example in this (sub)section can be typeset as

1
We have fractions like and ...
2n’1

by the input
We have fractions like $\dfrac{1}{2ˆ{n-1}}$ and ...

As can be guessed, the original output was produced by \frac. Similarly, there
are commands \dbinom (to produce display style binomial coef¬cients) and \tbinom (to
produce text style binomial coef¬cients).
There is also a \genfrac command which can be used to produce custom fractions.
To use it, we will have to specify six things
1. The left delimiter to be used”note that { must be speci¬ed as \{
2. The right delimiter”again, } to be speci¬ed as \}
3. The thickness of the horizontal line between the top expression and the bottom ex-
pression. If it is not speci¬ed, then it defaults to the ˜normal™ thickness. If it is set as
0pt then there will be no such line at all in the output.
4. The size of the output”this is speci¬ed as an integer 0, 1, 2 or 3, greater values cor-
responding to smaller sizes. (Technically these values correspond to \displaystyle,
\textstyle, \scriptstyle and \scriptscriptstyle.)
5. The top expression
6. The bottom expression
Thus instead of \tfrac{1}{2} we can also use \genfrac{}{}{}{1}{1}{2} and instead
of \dbinom{n}{r}, we can also use \genfrac{(}{)}{0pt}{0}{1}{2} (but there is hardly
any reason for doing so). More seriously, suppose we want to produce ikj and ikj as in

ij ij
The Christoffel symbol of the second kind is related to the Christoffel symbol of the ¬rst
k k
kind by the equation
ij ij ij
= gk1 + gk2
2
1
k

This can be done by the input

ij ij
The Christoffel symbol of the second kind is related to the Christoffel symbol of the ¬rst
k k
kind by the equation
ij ij ij
= gk1 + gk2
2
1
k

If such expressions are frequent in the document, it would be better to de¬ne ˜newcom-
mands™ for them and use them instead of \genfrac every time as in the following input
(which produces the same output as above).
97
MATHEMATICS
VIII.4. MISCELLANY


\newcommand{\chsfk}[2]{\genfrac{[}{]}{0pt}{}{#1}{#2}}
\newcommand{\chssk}[2]{\genfrac{\{}{\}}{0pt}{}{#1}{#2}}
The Christoffel symbol $\genfrac{\{}{\}}{0pt}{}{ij}{k}$ of the second
kind is related to the Christoffel symbol $\genfrac{[}{]}{0pt}{}{ij}{k}$
of the first kind by the equation
\begin{equation*}
\chssk{ij}{k}=gˆ{k1}\chsfk{ij}{1}+gˆ{k2}\chsfk{ij}{2}
\end{equation*}

While on the topic of fractions, we should also mention the \cfrac command used
to typeset continued fractions. For example, to get

12
4
=1+
π 32
2+
52
2+
2 + ···

simply type
\begin{equation*}
\frac{4}{\pi}=1+\cfrac{1ˆ2}{2+
\cfrac{3ˆ2}{2+
\cfrac{5ˆ2}{2+\dotsb}}}
\end{equation*}

Some mathematicians would like to write the above equation as

12 32 52
4
=1+ ···
π 2+2+2+

There is no ready-to-use command to produce this, but we can de¬ne one as follows
\newcommand{\cfplus}{\mathbin{\genfrac{}{}{0pt}{}{}{+}}}
\begin{equation*}
\frac{4}{\pi}
=1+\frac{1ˆ2}{2}\cfplus\frac{3ˆ2}{2}\cfplus\frac{5ˆ2}{2}\cfplus\dotsb
\end{equation*}


Af¬xing symbols”over or under
VIII.4.5.

The table at the end of this chapter gives various math mode accents such as $\hat{a}$
—¦
to produce a and $\dot{a}$ to produce a. But what if one needs a or a? The commands
ˆ ™
—¦
—¦
and \underset come to the rescue. Thus $\overset{\circ}{a}$ produces a and
\overset
$\underset{\circ}{a}$ produces a.
—¦
Basic EX provides the commands \overrightarrow and \overleftarrow also to put
LT
A

(extensible) arrows over symbols, as can be seen from the table. The amsmath package
also provides the commands \underrightarrow and \underleftarrow to put (extensible)
arrows below mathematical expressions.
Speaking of arrows, amsmath provides the commands \xrightarrow and \xleftarrow
which produces arrows which can accommodate long texts as superscripts or subscripts.
Thus we can produce
98 TYPESETTING MATHEMATICS
VIII.



Thus we see that
f g
0’ A’ B’ C’ 0
’ ’’’
is a short exact sequence

from the input
Thus we see that
\begin{equation*}
0\xrightarrow{} A\xrightarrow{f}
B\xrightarrow{g}
C\xrightarrow{} 0
\end{equation*}
is a short exact sequence

Note how the mandatory arguments of the ¬rst and last arrows are left empty to produce
arrows with no superscripts. These commands also allow an optional argument (to be
typed inside square brackets), which can be used to produce subscripts. For example
Thus we get
\begin{equation*}
0\xrightarrow{} A\xrightarrow[\text{monic}]{f}
B\xrightarrow[\text{epi}]{g}
C\xrightarrow{} 0
\end{equation*}

gives

Thus we get
f g
0 ’ A ’’’ B ’ C ’ 0
’ ’’ ’’’
monic epi



By the way, would not it be nicer to make the two middle arrows the same width? This
can be done by changing the command for the third arrow (the one from B) as shown
below
Thus we get
\begin{equation*}
0\xrightarrow{} A\xrightarrow[\text{monic}]{f}
B\xrightarrow[\hspace{7pt}\text{epi}\hspace{7pt}]{g}
C\xrightarrow{}0
\end{equation*}

This gives

Thus we get
f g
0 ’ A ’’’ B ’ ’ ’ C ’ 0
’ ’’ ’ ’’ ’
monic epi



where the lengths of the two arrows are almost the same. There are indeed ways to make
the lengths exactly the same, but we will talk about it in another chapter.
Mathematical symbols are also attached as limits to such large operators as sum
( ), product ( ) set union ( ), set intersection ( ) and so on. The limits are input
as subscripts or superscripts, but their positioning in the output is different in text and
display. For example, the input
99
MATHEMATICS
VIII.4. MISCELLANY


Euler not only proved that the series
$\sum_{n=1}ˆ\infty\frac{1}{nˆ2}$ converges, but also that
\begin{equation*}
\sum_{n=1}ˆ\infty\frac{1}{nˆ2}=\frac{\piˆ2}{6}
\end{equation*}

gives the output

∞ 1
Euler not only proved that the series converges, but also that
n=1 n2


π2
1
=
n2 6
n=1


Note that in display, the sum symbol is larger and the limits are put at the bottom and
top (instead of at the sides,which is usually the case for subscripts and superscripts). If
you want the same type of symbol (size, limits and all) in text also, simply change the line
$\sum_{n=1}ˆ\infty\frac{1}{nˆ2}$

to
$\displaystyle\sum_{n=1}ˆ\infty\frac{1}{nˆ2}$

and you will get


1
Euler not only proved that the series converges, but also that
n2
n=1


π2
1
=
n2 6
n=1


(Note that this also changes the size of the fraction. What would you do to keep it
small?) On the other hand, to make the displayed operator the same as in the text, add
the command \textstyle before the \sum within the equation.
What if you only want to change the position of the limits but not the size of the
operator in text? Then change the command $\sum_{n=1}ˆ\infty \frac{1}{nˆ2}$ to
$\sum_\limits{n=1}ˆ\infty\frac{1}{nˆ2}$ and this will produce the output given below.


1
Euler not only proved that the series converges, but also that
n2
n=1


π2
1
=
n2 6
n=1


On the other hand, if you want side-set limits in display type \nolimits after the \sum
within the equation as in
Euler not only proved that the series
$\sum_{n=1}ˆ\infty\frac{1}{nˆ2}$ converges, but also that
\begin{equation*}
\sum\nolimits_{n=1}ˆ\infty\frac{1}{nˆ2}=\frac{\piˆ2}{6}
\end{equation*}

which gives
100 TYPESETTING MATHEMATICS
VIII.



∞ 1
Euler not only proved that the series converges, but also that
n=1 n2


π2
1

=
n2 6
n=1



All these are true for other operators classi¬ed as “Variable-sized symbols”,except
integrals. Though the integral symbol in display is larger, the position of the limits in
both text and display is on the side as can be seen from the output below

x sin x π
dx =
Thus lim and so by de¬nition,
x 2
x’∞ 0


π
sin x
dx =
x 2
0


which is produced by
Thus
$\lim\limits_{x\to\infty}\int_0ˆx\frac{\sin x}{x}\,\mathrm{d}x
=\frac{\pi}{2}$
and so by definition,
\begin{equation*}
\int_0ˆ\infty\frac{\sin x}{x}\,\mathrm{d}x=\frac{\pi}{2}
\end{equation*}

If you want the limits to be above and below the integral sign, just add the command
\limits immediately after the \int command. Thus

Thus
$\lim\limits_{x\to\infty}\int_0ˆx\frac{\sin x}{x}\,\mathrm{d}x
=\frac{\pi}{2}$
and so by definition,
\begin{equation*}
\int\limits_0ˆ\infty\frac{\sin x}{x}\,\mathrm{d}x=\frac{\pi}{2}
\end{equation*}

gives

x sin x π
dx =
Thus lim and so by de¬nition,
x 2
x’∞ 0


π
sin x
dx =
x 2
0



Now how do we typeset something like

n
x ’ ti
pk (x) =
tk ’ ti
i=1
ik



where we have two lines of subscripts for ? There is a command \substack which will
do the trick. The above output is obtained from
101
NEW
VIII.5. OPERATORS


\begin{equation*}
p_k(x)=\prod_{\substack{i=1\\i\ne k}}ˆn
\left(\frac{x-t_i}{t_k-t_i}\right)
\end{equation*}

The amsmath package has also a \sideset command which can be used to put
symbols at any of the four corners of a large operator. Thus
ul ur
produces
$\sideset{_{ll}ˆ{ul}}{_{lr}ˆ{ur}}\bigcup$
ll lr

produces .
$\sideset{}{™}\sum$


NEW
VIII.5. OPERATORS

Mathematical text is usually typeset in italics, and TEX follows this tradition. But certain
functions in mathematics such as log, sin, lim and so on are traditionally typeset in
roman. This is implemented in TEX by the use of commands like $\log$, $\sin$, $\lim$
and so on. The symbols classi¬ed as “Log-like symbols” in the table at the end of this
chapter shows such functions which are prede¬ned in LTEX.
A

Having read thus far, it may be no surprise to learn that we can de¬ne our own
“operator names” which receive this special typographic treatment. This is done by
the \DeclareMathOperator command. Thus if the operator cl occurs frequently in the
document, you can make the declaration

\DeclareMathOperator{\cl}{cl}

in the preamble and then type $\cl(A)$ to produce cl(A), for example.
Note that an operator de¬ned like this accommodates subscripts and superscripts in
the usual way, that is, at its sides. Thus
We denote the closure of $A$ in the subspace $Y$ of $X$ by
$\cl_Y(A)$

produces

We denote the closure of A in the subspace Y of X by clY (A)

If we want to de¬ne a new operator with subscripts and superscripts placed in the “lim-
its” position below and above, then we should use the starred form of the \DeclareMathOperator
as shown below
\DeclareMathOperator*{\esup}{ess\,sup}


For $f\in Lˆ\infty(R)$, we define
\begin{equation*}
||f||_\infty=\esup_{x\in R}|f(x)|
\end{equation*}

(Note that the declaration must be done in the preamble.) This produces the output

For f ∈ L∞ (R), we de¬ne
|| f ||∞ = ess sup | f (x)|
x∈R


(Why the \, command in the de¬nition?)
102 TYPESETTING MATHEMATICS
VIII.


THE
VIII.6. MANY FACES OF MATHEMATICS

We have noted that most mathematics is typeset in italics typeface and some mathematical
operators are typeset in an upright fashion. There may be need for additional typefaces
as in typesetting vectors in boldface.
LTEX includes several styles to typeset mathematics as shown in the table below
A


EXAMPLE
COMMAND
TYPE STYLE
INPUT OUTPUT
italic
x+y=z
\mathit $x+y=z$
(default)
x+y=z
roman \mathrm $\mathrm{x+y=z}$
x+y=z
bold \mathbf $\mathbf{x+y=z}$
x+y=z
sans serif \mathsf $\mathsf{x+y=z}$
x+y=z
typewriter \mathtt $\mathtt{x+y=z}$
calligraphic
X+Y=Z
\mathcal $\mathcal{X+Y=Z}$
(upper case only)

In addition to these, several other math alphabets are available in various packages (some
of which are shown in the list of symbols at the end of this chapter).
Note that the command \mathbf produces only roman boldface and not math italic
boldface. Sometimes you may need boldface math italic, for example to typeset vectors.
For this, amsmath provides the \boldsymbol command. Thus we can get

In this case, we de¬ne
a+b=c

from the input
In this case, we define
\begin{equation*}
\boldsymbol{a}+\boldsymbol{b}=\boldsymbol{c}
\end{equation*}

If the document contains several occurrences of such symbols, it is better to make a
new de¬nition such as

\newcommand{\vect}[1]{\boldsymbol{#1}}


and then use $\vect{a}$ to produce a and $\vect{b}$ to produce b and so on. the
additional advantage of this approach is that if you change your mind later and want
vectors to be typeset with arrows above them as ’, then all you need is to change the

a
\boldsymol part of the de¬nition of \vect to \overrightarrow and the change will be
effected throughout the document.
Now if we change the input of the above example as
In this case, we define
\begin{equation*}
\boldsymbol{a+b=c}
\end{equation*}

then we get the output
103
AND
VIII.7. THAT IS NOT ALL!



In this case, we de¬ne
a+b=c

Note that now the symbols + and = are also in boldface. Thus \boldsymbol makes bold
every math symbol in its scope (provided the bold version of that symbol is available in
the current math font).
There is another reason for tweaking the math fonts. Recently, the International
Standards Organization (ISO) has established the recognized typesetting standards in
mathematics. Some of the points in it are,
Simple variables are represented by italic letters as a, x.
1.
Vectors are written in boldface italic as a, x.
2.
Matrices may appear in sans serif as in A, X.
3.
The special numbers e, i and the differential operator d are written in upright roman.
4.
Point 1 is the default in LTEX and we have seen how point 2 can be implemented.
A

to ful¬ll Point 4, it is enough if we de¬ne something like
\newcommand{\me}{\mathrm{e}}
\newcommand{\mi}{\mathrm{i}}
\newcommand{\diff}{\mathrm{d}}

and then use $\me$ for e and $\mi$ for i and $\diff x$ for dx.
Point 3 can be implemented using \mathsf but it is a bit dif¬cult (but not impossible)
if we need them to be in italic also. The solution is to create a new math alphabet, say,
\mathsfsl by the command

\DeclareMathAlphabet{\mathsfsl}{OT1}{cmss}{m}{sl}

(in the preamble) and use it to de¬ne a command \matr to typeset matrices in this font by

\newcommand{\matr}[1]{\ensuremath{\mathsfsl{#1}}}

so that $\maqtr A$ produces A.

AND
VIII.7. THAT IS NOT ALL!

We have only brie¬‚y discussed the basic techniques of typesetting mathematics using
LTEX and some of the features of the amsmath package which helps us in this task. For
A

more details on this package see the document amsldoc.dvi which should be available
with your TEX distribution. If you want to produce really beautiful mathematical doc-
uments, read the Master”“The TEX Book” by Donald Knuth, especially Chapter 18,
“Fine Points of Mathematics Typing”.

SYMBOLS
VIII.8.


Table VIII.1: Greek Letters

± θ „
o
\alpha \theta o \tau
β ‘ π …
\beta \vartheta \pi \upsilon
γ ι φ
\gamma \iota \varpi \phi
δ κ ρ •
\delta \kappa \rho \varphi
» χ
\epsilon \lambda \varrho \chi
µ µ σ ψ
\varepsilon \mu \sigma \psi
104 TYPESETTING MATHEMATICS
VIII.


ζ ν ‚ ω
\zeta \nu \varsigma \omega
· ξ
\eta \xi

“ Λ Σ Ψ
\Gamma \Lambda \Sigma \Psi
∆ Ξ Υ „¦
\Delta \Xi \Upsilon \Omega
˜ Π ¦
\Theta \Pi \Phi



Table VIII.2: Binary Operation Symbols

± © •
\pm \cap \diamond \oplus

\mp \cup \bigtriangleup \ominus
— —
\times \uplus \bigtriangledown \otimes
· \div \sqcap \triangleleft \oslash
— \ast \sqcup \triangleright \odot
\lhd—

\star \vee \bigcirc
\rhd—
—¦ § †
\circ \wedge \dagger
\unlhd—
• \ ‡
\bullet \setminus \ddagger
\unrhd—
· \cdot \wr \amalg
+ ’
+ -

Not prede¬ned in LTEX 2µ . Use one of the packages latexsym, amsfonts or amssymb.
A


Table VIII.3: Relation Symbols

|=

<<

. 4
( 7)



>>