% Last modified on 1-14-05. This version is an attempt to put links in the pdf file.
% modified 19 Feb 1997 to use new espsfig which requires figures to end with .ps
% also we fixed PSFig4.7 and PSFig4.8 to accomodate acrobat
% for ams choose usepackage [dvips] and remove .ps in \barefig}
% step 1: latex with \makeindex and comment out \printindex and \nofiles
% step 2   use amsbook.mac.idx to make index  and then put in \printindex and latex 
% step 3  put in \nofiles and use \amsbook.4-25-97.toc, making a copy of it and naming
% the copy \amsbook.mac.toc; retypeset amsbook.mac.tex
%New comment on 1-12-05:  When I did step 1 above, the file
%amsbook.mac.idx was created.  However, when I did step 2 above,
%the console gave me the following error:  `Input index file amsbook.mac not found.'
%What appears to have happened is that TexShop created the file amsbook.mac.idx,
%and then it looked for a file amsbook.mac.  Pretty stupid, huh?  Anyway, I removed the 
%suffix `.idx' from the filename amsbook.mac.idx, and then ran Makeindex (in TexShop).
%It ran with no problems.  It created a file called amsbook.ind.  But now, in order for this
%file to be included in the rest of step 2, the file must be renamed amsbook.mac.ind.
%Then I completed step 2, and it seemed to work fine.  
%Finally, step 3 above seems unnecessary to me, since one of  the commands in
%the file frontmatter is \maketableofcontents.
\documentclass{book}
%\nofiles
\newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}}
\def\@endpart{\vfil\newpage
              \if@tempswa
                \twocolumn
              \fi}
\usepackage{theorem}
\theorembodyfont{\rmfamily}
%\usepackage[dvips]{epsfig}	% specify `dvips' driver
% The following line was commented out on 3/14/01
\usepackage[pdftex]{epsfig}	% specify `pdftex' driver
\usepackage{makeidx}
%We temporarily took out the makeidx format in the above brackets
%Diddling parameters to make acrobat version.  Comment out for paper version.
\setlength{\textheight}{8.1in}
\setlength{\textwidth}{5in}
\setlength{\topmargin}{.25in}
\setlength{\oddsidemargin}{.75in} % 1.25 for book Change to .75 for web version
\setlength{\evensidemargin}{.75in} % .25 for book Change to .75 for web version
%
% Low-level figure positioning.  Change as appropriate to your system.
%
\newcommand{\barefig}[2]{\makebox{\includegraphics*[width=#2] {#1.pdf}}} % for textures #1.ps
%\newcommand{\barefig}[2]{\epsfxsize=#2 \epsffile{PSfigblank}}
%
% Higher-level figure commands.
%
\newcommand{\NA}{{\rm NA}}
\usepackage{latexsym}
\newif\ifdiscrete
%\discretetrue
\discretefalse
\newcommand{\choice}[2]{\ifdiscrete{#1}\else{#2}\fi}

%\putfig{3.5truein}{PSfig1.3}{Peter's winnings in 40 plays of heads or tails.}{fig 1.3}
\newcommand{\putfig}[4]
{\begin{figure}
\centerline{\barefig{#2}{#1}}
\caption{#3}
\label{#4}
\end{figure}}

\newcommand{\putfigdouble}[6]
{\begin{figure}
\centerline{\barefig{#2}{#1}}
\centerline{\barefig{#4}{#3}}
\caption{#5}
\label{#6}
\end{figure}}

\newcommand{\nocaption}[4]
{\begin{figure}
\centerline{\barefig{#2}{#1}}
%\caption{#3}
\label{#4}
\end{figure}}
%
\newenvironment{example}
{\noindent\begin{examp}}
{\hfill $\Box$ \end{examp}}

\newenvironment{definition}
{\noindent\begin{defn}}
{\hfill $\Box$ \end{defn}}

\newenvironment{theorem}
{\noindent\begin{thm}}
{\hfill $\Box$ \end{thm}}

\newenvironment{corollary}
{\noindent\begin{cor}}
{\hfill $\Box$ \end{cor}}

\newenvironment{lemma}
{\noindent\begin{lem}}
{\hfill $\Box$ \end{lem}}

\newenvironment{proposition}
{\noindent\begin{prop}}
{\hfill $\Box$ \end{prop}}
%
\newtheorem{examp}{Example}[chapter]
\newtheorem{defn}{Definition}[chapter]
\newtheorem{thm}{Theorem}[chapter]
\newtheorem{cor}{Corollary}[chapter]
\newtheorem{prop}{Proposition}[chapter]
\newtheorem{lem}{Lemma}[chapter]
\newcommand{\exercises}{\subsection*{Exercises}}
\newcommand{\proof}{\vskip .2in\noindent{\bf Proof.\ }}
%\newcommand{\emx}[1]{{\emx{#1}\/}}
%\newcommand{\mat}[1]{{\mbox{\bf#1}\/}}
\newcommand{\emx}[1]{{\em{#1}\/}}
\newcommand{\mat}[1]{{\mbox{\bf#1}\/}}


\newenvironment{scope}{}{}
\newenvironment{shrink}{\begin{scope} \small}{\end{scope}}
\newenvironment{progout}{\begin{shrink}}{\end{shrink}}


\newcount\exerciseno
%\def\chapterno{4}
\def\i{\advance\exerciseno by 1\bigskip
\item[\bf{\the\exerciseno}]}
\def\istar{\advance\exerciseno by 1\bigskip
\item[\bf{*\the\exerciseno}]}

%\newenvironment{LJSItem}[1]
%   {\exerciseno=0
%     \renewcommand{\theenumi}{\alph{enumi}}
%	    \renewcommand{\labelenumi}{\bf{\theenumi.}}
%      \begin{list}{}%
%          {\renewcommand{\makelabel}[1]{\hfil\bf{##1}\hspace{.5em}}%
%            \settowidth{\labelwidth}{\bf{#1}}%
%            \addtolength{\labelwidth}{.5em}%
%            \setlength{\leftmargin}{\labelwidth}
%             \addtolength{\leftmargin}{\labelsep}%
%             }%
%    }%
%{\end{list}}

\newenvironment{LJSItem}{%

%\def\chapterno{4}
\newcommand{\exref}[1]{\ref{##1}}
\def\i{\renewcommand{\labelenumi}{\bf\theenumi}\item}

\def\istar{\renewcommand{\labelenumi}{\bf*\theenumi}\item}

\begin{enumerate}}
{\end{enumerate}}
\def\partzero{ourtitle,dedication,frontmatter}
\def\partone{ch1,ch2,ch3,ch4,ch5,ch6}
\def\parttwo{ch7,ch8,ch9,ch10,ch11,ch12,append}
\def\all{\partzero,\partone,\parttwo}
\typein[\secstoprocess]{enter the sections to process: }
\includeonly{\secstoprocess}

\title{Introduction to Probability}
\author{Charles M. Grinstead \\ Swarthmore College
\and
J. Laurie Snell \\ Dartmouth College}
\date{10 September 1996}

\makeindex
\usepackage[dvips, bookmarks,colorlinks=true,pdfpagemode=,   pdfstartview=FitH,  pdfpagelayout=SinglePage,pdftitle=,  pdfauthor=,pdfkeywords=,pdfsubject=,]{hyperref}
\begin{document}
\addtolength{\normalbaselineskip}{1pt}
\normalbaselines
\include{ourtitle}
\include{dedication}
\include{frontmatter}
%\include{intro}
\include{ch1}
\choice{}{\include{ch2}}
\include{ch3}
\clearemptydoublepage
\include{ch4}
\include{ch5}
\include{ch6}
\include{ch7}
\include{ch8}
\include{ch9}
\choice{}{\include{ch10}}
\include{ch11} 
\choice{}{\include{ch12}}
%\printindex
%\pagestyle{myheadings}
%\markboth{\chaptername\ \thechapter. }{\thesection}

\end{document}
