<< . .

. 17
( : 23)



. . >>


Now we are ready to roll our own “theorem styles”. This is done via the \newtheoremstyle
command, which allows us to control almost all aspects of typesetting theorem like state-
ments. this command has nine parameters and the general syntax is
\newtheoremstyle%
{name}%
{abovespace}%
{belowspace}%
{bodyfont}%
{indent}%
{headfont}%
{headpunct}%
{headspace}%
{custom-head-spec}%


The ¬rst parameter name is the name of the new style. Note that it is not the name of the
environment which is to be used later. Thus in the example above remark is the name of a
new style for typesetting theorem like statements and note is the name of the environment
subsequently de¬ned to have this style (and Note is the name of the statement itself).
The next two parameters determine the vertical space between the theorem and the
surrounding text”the abovespace is the space from the preceding text and the belows-
pace the space from the following text. You can specify either a rigid length (such as
12pt) or a rubber length (such as \baselineskip) as a value for either of these. Leaving
either of these empty sets them to the “usual values” (Technically the \topsep).
The fourth parameter bodyfont speci¬es the font to be used for the body of the
theorem-like statement. This is to be given as a declaration such as \scshape or \bfseries
and not as a command such as \textsc or \textbf. If this is left empty, then the main
text font of the document is used.
The next four parameters refer to the theoremhead”the part of the theorem like
statement consisting of the name, number and the optional note. The ¬fth parameter
indent speci¬es the indentation of theoremhead from the left margin. If this is empty,
then there is no indentation of the theoremhead from the left margin. The next parameter
speci¬es the font to be used for the theoremhead. The comments about the parameter
bodyfont, made in the previous paragraph holds for this also. The parameter headpunct
THEOREMS”THE AMSTHM PACKAGE 113
DESIGNER
IX.2.


(the seventh in our list) is for specifying the punctuation after the theoremhead. If you
do not want any, you can leave this empty. The last parameter in this category (the last
but one in the entire list), namely headspace, determines the (horizontal) space to be left
between the theoremhead and the theorembody. If you want only a normal interword
space here put a single blank space as { } in this place. (Note that it is not the same as
leaving this empty as in {}.) Another option here is to put the command \newline here.
Then instead of a space, you get a linebreak in the output; that is, the theoremhead will
be printed in a line by itself and the theorembody starts from the next line.
The last parameter custom-head-spec is for customizing theoremheads. Since it needs
some explanation (and since we are de¬nitely in need of some breathing space), let us now
look at a few examples using the eight parameters we™ve already discussed.
It is almost obvious now how the last theorem in Section 1 (see Page 111) was
designed. It was generated by
\newtheoremstyle{mystyle}{}{}{\slshape}{}{\scshape}{.}{ }{}
\theoremstyle{mystyle}
\newtheorem{mythm}{Theorem}[section]
\begin{mythm}
The sum of the angles of a triangle is $180ˆ\circ$.
\end{mythm}
As another example, consider the following
\newtheoremstyle{mynewstyle}{12pt}{12pt}{\itshape}%
{}{\sffamily}{:}{\newline}{}
\theoremstyle{mynewstyle}
\newtheorem{mynewthm}{Theorem}[section]
\begin{mynewthm}[Euclid]
The sum of the angles of a triangle is $180ˆ\circ$.
\end{mynewthm}
This produces

Theorem IX.2.1 (Euclid):
The sum of the angles of a triangle is 180—¦ .

Do you need anything more? Perhaps yes. Note that theoremhead includes the op-
tional note to the theorem also, so that the font of the number and name of the theorem-
like statement and that of the optional note are always the same. What if you need
something like

Cauchy™s Theorem (Third Version). If G is a simply connected open subset of C, then for every
closed recti¬able curve γ in G, we have

f = 0.
γ



It is in such cases, that the last parameter of \newtheoremstyle is needed. Using it we
can separately customize the name and number of the theorem-like statement and also
the optional note. The basic syntax for setting this parameter is
{commands#1commands#2commands#3}
where #1 corresponds to the name of the theorem-like statement, #2 corresponds to its
number and #3 corresponds to the optional note. We are here actually supplying the
replacement text for a command \thmhead which has three arguments. It is as if we are
de¬ning
114 TYPESETTING THEOREMS
IX.


\renewcommand{\thmhead}[3]{...#1...#2...#3}

but without actually typing the \renewcommand{\thmhead}[3]. For example the theorem
above (Cauchy™s Theorem) was produced by
\newtheoremstyle{nonum}{}{}{\itshape}{}{\bfseries}{.}{ }{#1 (\mdseries #3)}
\theoremstyle{nonum}
\newtheorem{Cauchy}{Cauchy™s Theorem}


\begin{Cauchy}[Third Version]
If $G$ is a simply connected open subset of $\mathbb{C}$, then for every closed
rectifiable curve $\gamma$ in $G$, we have
\begin{equation*}
\int_\gamma f=0.
\end{equation*}
\end{Cauchy}

Note that the absence of #2 in the custom-head-spec, suppresses the theorem number and
that the space after #1 and the command (\mdseries#3) sets the optional note in medium
size within parentheses and with a preceding space.
Now if you try to produce

Riemann Mapping Theorem. Every open simply connected proper subset of C is analytically
homeomorphic to the open unit disk in C.

by typing
\theoremstyle{nonum}
\newtheorem{Riemann}{Riemann Mapping THeorem}


\begin{Riemann}Every open simply connected proper subset of $\mathbb{C}$ is analytically
homeomorphic to the open unit disk in $\mathbb{C}$.
\end{Riemann}

you will get

Riemann Mapping Theorem (). Every open simply connected proper subset of C is analytically
homeomorphic to the open unit disk in C.

Do you see what is happened? In the \theoremstyle{diffnotenonum}, the parameter
controlling the note part of the theoremhead was de¬ned as (\mdseries #3) and in the
\newtheorem{Riemann}, there is no optional note, so that in the output, you get an empty
“note”, enclosed in parantheses (and also with a preceding space).
To get around these dif¬culties, you can use the commands \thmname, \thmnumber
and \thmnote within the {custom-head-spec} as
{\thmname{commands#1}%
\thmnumber{commands#2}%
\thmnote{commands#3}}


Each of these three commands will typeset its argument if and only if the correspond-
ing argument in the \thmhead is non empty. Thus the correct way to get the Riemann
Mapping theorem in Page 114 is to input
THEOREMS”THE AMSTHM PACKAGE 115
DESIGNER
IX.2.


\newtheoremstyle{newnonum}{}{}{\itshape}{}{\bfseries}{.}{ }%
{\thmname{#1}\thmnote{ (\mdseries #3)}}

\theoremstyle{newnonum}
\newtheorem{newRiemann}{Riemann Mapping Theorem}

\begin{newRiemann} Every open simply connected proper subset of $\mathbb{C}$ is
analytically homeomorphic to the open unit disk in $\mathbb{C}$.
\end{newRiemann}

Then you can also produce Cauchy™s Theorem in Page 113 by typing
\theoremstyle{newnonum}
\newtheorem{newCauchy}{Cauchy™s Theorem}

\begin{newCauchy}[Third Version]If $G$ is a simply connected open subset of
$\mathbb{C}$, then for every closed rectifiable curve $\gamma$ in $G$, we have
\begin{equation*}
\int_\gamma f=0
\end{equation*}
\end{newCauchy}

The output will be exactly the same as that seen in Page 113. Now suppose you
want to highlight certain theorems from other sources in your document, such as

Axiom 1 in [1]. Things that are equal to the same thing are equal to one another.

This can be done as follows:
\newtheoremstyle{citing}{}{}{\itshape}{}{\bfseries}{.}{ }{\thmnote{#3}}


\theoremstyle{citing}
\newtheorem{cit}{}


\begin{cit}[Axiom 1 in \cite{eu}]
Things that are equal to the same thing are equal to one another.
\end{cit}

Of course, your bibliography should include the citation with label eu.

There is more!
IX.2.3.

There are some more prede¬ned features in amsthm package. In all the different examples
we have seen so far, the theorem number comes after the theorem name. Some prefer to
have it the other way round as in

Theorem (Euclid). The sum of the angles in a triangle is 180—¦ .
IX.2.1


This effect is produced by the command \swapnumbers as shown below:
\swapnumbers
\theoremstyle{plain}
\newtheorem{numfirstthm}{Theorem}[section]


\begin{numfirstthm}[Euclid]
The sum of the angles in a triangle is $180ˆ\circ$
\end{numfirstthm}
116 TYPESETTING THEOREMS
IX.




Note that the \swapnumbers command is a sort of toggle-switch, so that once it is given,
all subsequent theorem-like statements will have their numbers ¬rst. If you want it the
other way for some other theorem, then give \swapnumbers again before its de¬nition.
A quick way to suppress theoremnumbers is to use the \newtheorem* command as in
\newtheorem*{numlessthm}{Theorem}[section]

\begin{numlessthm}[Euclid]
The sum of the angles in a triangle is $180ˆ\circ$.
\end{numlessthm}

to produce

Euclid. The sum of the angles in a triangle is 180—¦ .

Note that this could also be done by leaving out #2 in the custom-head-spec parameter
of \newtheoremstyle, as seen earlier.
We have been talking only about theorems so far, but Mathematicians do not live
by theorems alone; they need proofs. The amsthm package contains a prede¬ned proof
environment so that the proof of a theorem-like statement can be enclosed within \begin
{proof} ... \end{proof} commands as shown below:
\begin{thmsec}
The number of primes is infinite.
\end{thmsec}


\begin{proof}
Let $\{p_1,p_2,\dotsc p_k\}$ be a finite set of primes. Define $n=p_1p_2\dotsm
p_k+1$. Then either $n$ itself is a prime or has a prime factor. Now $n$ is
neither equal to nor is divisible by any of the primes $p_1,p_2,\dotsc p_k$ so
that in either case, we get a prime different from $p_1,p_2,\dotsc p_k$. Thus
no finite set of primes can include all the primes.
\end{proof}

to produce the following output

Theorem The number of primes is in¬nite.
IX.2.3.

Proof. Let {p1 , p2 , . . . pk } be a ¬nite set of primes. De¬ne n = p1 p2 · · · pk + 1. Then either n itself
is a prime or has a prime factor. Now n is neither equal to nor is divisible by any of the primes
p1 , p2 , . . . pk so that in either case, we get a prime different from p1 , p2 , . . . pk . Thus no ¬nite set
of primes can include all the primes.


There is an optional argument to the proof environment which can be used to change
the proofhead. For example,
\begin{proof}[\textsc{Proof\,(Euclid)}:]
\begin{proof}
Let $\{p_1,p_2,\dotsc p_k\}$ be a finite set of primes. Define $n=p_1p_2\dotsm
p_k+1$. Then either $n$ itself is a prime or has a prime factor. Now $n$ is
neither equal to nor is divisible by any of the primes $p_1,p_2,\dotsc p_k$ so
that in either case, we get a prime different from $p_1,p_2,\dotsc p_k$. Thus
no finite set of primes can include all the primes.
\end{proof}
THEOREMS”THE AMSTHM PACKAGE 117
DESIGNER
IX.2.




produces the following

PROOF (EUCLID): Let {p1 , p2 , . . . pk } be a ¬nite set of primes. De¬ne n = p1 p2 · · · pk + 1. Then
either n itself is a prime or has a prime factor. Now n is neither equal to nor is divisible by any
of the primes p1 , p2 , . . . pk so that in either case, we get a prime different from p1 , p2 . . . pk . Thus
no ¬nite set of primes can include all the primes.

Note that the end of a proof is automatically marked with a which is de¬ned in the
package by the command \qedsymbol. If you wish to change it, use \renewcommand to
rede¬ne the \qedsymbol. Thus if you like the original “Halmos symbol” to mark the
ends of your proofs, include
\newcommand{\halmos}{\rule{1mm}{2.5mm}}
\renewcommand{\qedsymbol}{\halmos}

in the preamble to your document.
Again, the placement of the \qedsymbol at the end of the last line of the proof is done
via the command \qed. The default placement may not be very pleasing in some cases as
in

Theorem IX.2.4. The square of the sum of two numbers is equal to the sum of their squares
and twice their product.

Proof. This follows easily from the equation

(x + y)2 = x2 + y2 + 2xy




It would be better if this is typeset as

Theorem IX.2.5. The square of the sum of two numbers is equal to the sum of their squares
and twice their product.

Proof. This follows easily from the equation

(x + y)2 = x2 + y2 + 2xy


which is achieved by the input shown below:
\begin{proof}
This follows easily from the equation
\begin{equation}
(x+y)ˆ2=xˆ2+yˆ2+2xy\tag*{\qed}
\end{equation}
\renewcommand{\qed}{}
\end{proof}

For this trick to work, you must have loaded the package amsmath without the leqno
option. Or, if you prefer

Proof. This follows easily from the equation

(x + y)2 = x2 + y2 + 2xy


Then you can use
118 TYPESETTING THEOREMS
IX.


\begin{proof}
This follows easily from the equation
\begin{equation*}
(x+y)ˆ2=xˆ2+yˆ2+2xy\qed
\end{equation*}
\renewcommand{\qed}{}
\end{proof}



HOUSEKEEPING
IX.3.

It is better to keep all \newtheoremstyle commands in the preamble than scattering them
all over the document. Better still, you can keep them together with other customization
in a personal .sty ¬le and load it using the \usepackage command in the preamble. Also,
within this .sty ¬le, you can divide your \newtheorem commands into groups and preface
each group with the appropriate \theoremstyle.

BIBLIOGRAPHY

[1] Euclid, The Elements, Greece 300 BC
TUTORIAL X


SEVERAL KINDS OF BOXES


The method of composing pages out of boxes lies at the very heart of TEX and many
LTEX constructs are available to take advantage of this method of composition.
A

A box is an object that is treated by TEX as a single character. A box cannot be split
and broken across lines or pages. Boxes can be moved up, down, left and right. LTEX A

has three types of boxes.

(left-right) The content of this box are typeset from left to right.
LR
(paragraphs) This kind of box can contain several lines, which will be typeset
Par
in paragraph mode just like normal text. Paragraphs are put one on top of the
other. Their widths are controlled by a user speci¬ed value.
A thin or thick line that is often used to separate various logical elements on
Rule
the output page, such as between table rows and columns and between running
titles and the main text.

LR
X.1. BOXES

The usage information of four types of LR boxes are given below. The ¬rst line considers
the text inside the curly braces as a box, with or without a frame drawn around it. For
instance, \fbox{some words} gives some words whereas \mbox will do the same thing,
but without the ruled frame around the text.

\mbox{text}
\makebox{width}{pos}{text}
\fbox{text}
\framebox{width}{pos}{text}

The commands in the third and fourth lines are a generalization of the other com-
mands. They allow the user to specify the width of the box and the positioning of text
inside.
some words \makebox{5cm}{some words} \par

some words \framebox{5cm}{r}{some words}

<< . .

. 17
( : 23)



. . >>