<< . . . 11( : 23) . . >>
1974
Launch of Voyager missions to outer spce
1977
IBM personal computer launched
1983
Hailey™s comet intercepted
1986
Cloning of “Dolly” the sheep
1997
Decoding of 90% of human genome completed
2000
Source : The Cambrige Fact¬nder

Part of the code to produce this is given below.
\renewcommand{\arraystretch}{1.2}
\begin{longtable}{|c|l|}
\multicolumn{2}{c}%
{\textbf{Science and Technology in the Twentieth Century}}\$5pt] \hline \multicolumn{1}{|c|}{\sffamily Year} &\multicolumn{1}{|c|}{\sffamily Event}\\ \hline \endfirsthead \multicolumn{2}{c}% {\textbf{Science and Technology in the Twentieth Century} (\textit{continued})}\\[5pt] \hline \multicolumn{1}{|c|}{\sffamily Year} &\multicolumn{1}{|c|}{\sffamily Event}\\ \hline \endhead \hline \multicolumn{2}{r}{\small\itshape continued on the next page}\\ \endfoot \hline \multicolumn{2}{r}{\small Source\,:\,\itshape The Cambrige Factfinder} \endlastfoot 1900 & Max Planck proposes quantum theory\\ .............................................. 2000 & Decoding of 90\% of human genome completed\\ \hline \end{longtable} And that™s not all! VII.2.6. There are many more packages which help to produce tables of various requirements. Be sure to check out the pakages tabularx, delarray, dcolumn and hhline. 76 TUTORIAL VIII TYPESETTING MATHEMATICS Donal Knuth created TEX primarily to typeset Mathematics beautifully. LTEX includes all A the capabilities of TEX in Mathematics typesetting, sometimes with easier user interfaces. Then there are packages like amsmath which enhance and re¬ne these interfaces. THE VIII.1. BASICS A mathematical expression occurring in running text (called in-text math) is produced by enclosing it between dollar signs. Thus to produce The equation representing a straight line in the Cartesian plane is of the form ax + by + c = 0, where a, b, c are constants. we type The equation representing a straight line in the Cartesian plane is of the form ax+by+c=0, where a, b, c are constants. Some comments are in order. First note that the text within dollars is typeset in italic (actually math italic). Again, even though we did not leave any spaces within ax+by+c=0, TEX leaves spaces on either side of the addition signs and the equality sign. On the other hand, even if we type ax + by + c = 0, the output would be the same: ax + by + c = 0. The moral? TEX has its own spacing rules in math mode. To see another instance of this, change the last part of the code above to read ... where a, b, c are constants. Saves some typing, does not it? But look at 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. Do you see the difference? There are no spaces after the commas, though we had such spaces in the output. So TEX swallows spaces in math mode (you can not save dollars that way!). Incidentally, dollar signs are TEX way of distinguishing Mathematical text. LTEX A has other ways also of doing it, using $$...$$ or \begin{math} ... \end{math}. Thus either of the inputs shown below also produces the same output as above. The equation representing a straight line in the Cartesian plane is of the form $$ax+by+c=0$$, where $$a$$, $$b$$, $$c$$ are constants. The equation representing a straight line in the Cartesian plane is of the form \begin{math}ax+by+c=0\end{math}, where \begin{math} a \end{math}, \begin{math} b \end{math}, \begin{math} c \end{math} are constants. 77 78 TYPESETTING MATHEMATICS VIII. Now suppose we want to display the equation in the above output as in The equation representing a straight line in the Cartesian plane is of the form ax + by + c = 0 where a, b, c are constants. This can be done by changing the input as follows: The equation representing a straight line in the Cartesian plane is of the form  ax+by+c=0  where a, b, c are constants. Again  ...  is the TEX way of producing displayed math. LTEX has the constructs A \[ ...$ or \begin{displaymath} ... \end{displaymath} also to do this.

Superscripts and subscripts
VIII.1.1.

Look at the text below

In the seventeenth century, Fermat conjectured that if n > 2, then there are no integers x, y, z
for which
xn + yn = zn .
This was proved in 1994 by Andrew Wiles.

This is produced by the input
In the seventeenth century, Fermat conjectured that if $n>2$, then
there are no integers $x$, $y$, $z$ for which
$$xˆn+yˆn=zˆn.$$
This was proved in 1994 by Andrew Wiles.

This shows that superscripts (mathematicians call them exponents) are produced by the
ˆ symbol. If the superscript is more than one character long, we must be careful to group
these characters properly. Thus to produce

It is easily seen that (xm )n = xmn .

we must type
It is easily seen that $(xˆm)ˆn=xˆ{mn}$.

Instead of $xˆ{mn}$, if we type $xˆmn$ we end up with xm n instead of the intended xmn
in the output.
We can have superscripts of superscripts (and mathematicians do need them). For
example,
n
Numbers of the form 22 + 1, where n is a natural number, are called Fermat numbers.

is produced by
79
THE
VIII.1. BASICS

Numbers of the form $2ˆ{2ˆn}+1$, where $n$ is a natural number, are
called Fermat numbers.

Note the grouping of superscripts. (What happens if you type $2ˆ2ˆn+1$ or ${2ˆ2}ˆn$?)
Now let us see how subscripts (mathematicians call them subscripts) are produced.
To get

The sequence (xn ) de¬ned by

x1 = 1, x2 = 1, xn = xn’1 + xn’2 (n > 2)

is called the Fibonacci sequence.

we must type
The sequence $(x_n)$ defined by
$$x_1=1,\quad x_2=1,\quad x_n=x_{n-1}+x_{n-2}\;\;(n>2)$$
is called the Fibonacci sequence.

Thus subscripts are produced by the _ character. Note how we insert spaces by the \quad
command. (The command \; in math mode produces what is known as a “thickspace”.)
Subscripts of subscripts can be produced as in the case of superscripts (with appropriate
grouping).
We can also have superscripts and subscripts together. Thus

If the sequence (xn ) converges to a, then the sequence (x2 ) converges to a2
n

is produced by
If the sequence $(x_n)$ converges to $a$, then the sequence
$(x_nˆ2)$ converges to $aˆ2$

Again, we must be careful about the grouping (or the lack of it) when typesetting
superscripts and subscripts together. The following inputs and the corresponding outputs
make the point.
$$x_mˆn\qquad xˆn_m\qquad {x_m}ˆn\qquad {xˆn}_m$$

xn xn xm n xn m
m m

(This has to do with the way TEX works, producing “boxes” to ¬t the output characters.
The box for xn is like xn while the box for xm n is xm n .
m m

Roots
VIII.1.2.

Square roots are produced by the \sqrt argument. Thus $\sqrt{2}$ produces 2. This
command has an optional argument to produce other roots. Thus

√ 5
4
Which is greater 5 or 4?

is produced by
80 TYPESETTING MATHEMATICS
VIII.

Which is greater $\sqrt[4]{5}$ or $\sqrt[5]{4}$?

The horizontal line above the root (called vinculum by mathematicians of yore) elon-

gates to accommodate the enclosed text. For example, $\sqrt{x+y}$ produces x + y.
Also, you can produce nested roots as in

The sequence

√ √ √ √
2 2, 2, 2+ 2, 2+ 2+ 2+ 2, ...
22 23 24
2’ 2’ 2’

converge to π.

by typing
The sequence
$$2\sqrt{2}\,,\quad 2ˆ2\sqrt{2-\sqrt{2}}\,,\quad 2ˆ3 \sqrt{2-\sqrt{2+\sqrt{2}}}\,,\quad 2ˆ4\sqrt{2- \sqrt{2+\sqrt{2+\sqrt{2+\sqrt{2}}}}}\,,\;\ldots$$
converge to $\pi$.

The \ldots command above produces . . ., the three dots indicating inde¬nite contin-
uation, called ellipsis (more about them later). The command \, produces a “thinspace”
(as opposed to a thickspace produced by \; , seen earlier). Why all this thin and thick
spaces in the above input? Remove them and see the difference. (A tastefully applied
thinspace is what makes a mathematical expression typeset in TEX really beautiful.)
The symbol π in the output produced by $\pi$ maybe familiar from high school
mathematics. It is a Greek letter named “pi”. Mathematicians often use letters of the
Greek alphabet ((which even otherwise is Greek to many) and a multitude of other sym-
bols in their work. A list of available symbols in LTEX is given at the end of this chapter.
A

Mathematical symbols
VIII.1.3.

In the list at the end of this chapter, note that certain symbols are marked to be not avail-
able in native LTEX, but only in certain packages. We will discuss some such packages
A

later. Another thing about the list is that they are categorized into classes such as “Bi-
nary Relations”, “Operators”, “Functions” and so on. This is not merely a matter of
convenience.
We have noted that TEX leaves some additional spaces around “binary operators”
such as + and ’. The same is true for any symbol classi¬ed as a binary operator. For
example, consider the following

For real numbers x and y, de¬ne an operation —¦ by

x —¦ y = x + y ’ xy

This operation is associative.

From the list of symbols, we see that —¦ is produced by \circ and this is classi¬ed as a
binary operator, so that we can produce this by
For real numbers $x$ and $y$, define an operation $\circ$ by
$$81 CUSTOM VIII.2. COMMANDS x\circ y = x+y-xy$$
This operation is associative.

Note the spaces surrounding the —¦ symbol in the output. On the other hand suppose you
want

For real numbers x and y, de¬ne an operation by

y = x2 + y2
x

The list of symbols show that the symbol is produced by \Box but that it is avail-
able only in the package latexsym or amssymb. So if we load one of these using the
\usepackage command and then type
For real numbers $x$ and $y$, define an operation $\Box$ by
$$x\Box y = xˆ2+yˆ2$$

you will only get

For real numbers x and y, de¬ne an operation by

x y = x2 + y2

Notice the difference? There are no spaces around ; this is because, this symbol is
not by default de¬ned as a binary operator. (Note that it is classi¬ed under “Miscel-
laneous”.) But we can ask TEX to consider this symbol as a binary operator by the
command \mathbin before \Box as in
For real numbers $x$ and $y$, define an operation $\Box$ by
$$x\mathbin\Box y=xˆ2+yˆ2$$

and this will produce the output shown ¬rst.
This holds for “Relations” also. TEX leaves some space around “Relation” symbols
and we can instruct TEX to consider any symbol as a relation by the command \mathrel.
Thus we can produce

De¬ne the relation ρ on the set of real numbers by x ρ y iff x ’ y is a rational number.

by typing
Define the relation $\rho$ on the set of real numbers by
$x\mathrel\rho y$ iff $x-y$ is a rational number.

(See what happens if you remove the \mathrel command.)

CUSTOM
VIII.2. COMMANDS

We have seen that LTEX produces mathematics (and many other things as well) by means
A

of “commands”. The interesting thing is that we can build our own commands using
the ones available. For example, suppose that t the expression (x1 , x2 , . . . , xn ) occurs
frequently in a document. If we now write
82 TYPESETTING MATHEMATICS
VIII.

\newcommand{\vect}{(x_1,x_2,\dots,x_n)}

Then we can type $\vect$ anywhere after wards to produce (x1 , x2 , . . . , xn ) as in
We often write $x$ to denote the vector $\vect$.

to get

We often write x to denote the vector (x1 , x2 , . . . , xn ).

(By the way, the best place to keep such “newcommands” is the preamble, so that you
can use them anywhere in the document. Also, it will be easier to change the commands,
if the need arises).
OK, we can now produce (x1 , x2 , . . . , xn ) with $\vect$, but how about (y1 , y2 , . . . , yn )
or (z1 , z2 , . . . , zn )? Do we have to de¬ne newcommands for each of these? Not at all. We
can also de¬ne commands with variable arguments also. Thus if we change our de¬nition
of \vect to
\newcommand{\vect}[1]{(#1_1,#1_2,\dots,#1_n)}

Then we can use $\vect{x}$ to produce (x1 , x2 , . . . , xn ) and $\vect{a}$ to produce
(a1 , a2 , . . . , an ) and so on.
The form of this de¬nition calls for some comments. The [1] in the \newcommand
above indicates that the command is to have one (variable) argument. What about the
#1? Before producing the output, each occurrence of #1 will be replaced by the (single)
argument we supply to \vect in the input. For example, the input $\vect{a}$ will be
changed to $(a_1,a_2,\dots,a_n)$ at some stage of the compilation.
We can also de¬ne commands with more than one argument (the maximum number
is 9). Thus for example, if the document contains not only (x1 , x2 , . . . , xn ), (y1 , y2 , . . . , yn )
and so on, but (x1 , x2 , . . . , xm ), (y1 , y2 , . . . , yp ) also, then we can change our de¬nition of
\vect to
\newcommand{\vect}[2]{(#1_1,#1_2,\dotsc,#1_#2)}

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,
 << . . . 11( : 23) . . >>