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