% Adapted from gt3m book macros.
%
\def\Empty{}
%
% FLoat placement parameters:
%
\def\bottomfraction{.7}
\def\textfraction{0}
\def\floatpagefraction{.7}
%
% Definitions that use @ : 
\catcode`\@=11
% Redefine section heading to get smaller letters (this
% is copied from the original in rep12.sty)

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
-.2ex}{2.3ex plus .2ex}{\large\bf}}

% Here is \eqalign from plain TEX, resurrected here because latex
% refuses to make it easy to put equation numbers BETWEEN two 
% equations...
\def\eqalign#1{\,\vcenter{\openup\jot\m@th
  \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
	\crcr#1\crcr}}\,}

% Modified description environment with paragraph indentation
% (lifted from report.sty)
\def\mydesc{\list{}{\labelwidth\z@ \itemindent-\leftmargin
\listparindent 1.5em
\let\makelabel\descriptionlabel}}
\let\endmydesc\endlist

% Matrix with smaller entries, modified from \matrix in plain.tex.
\def\Smatrix#1{\,\vcenter{\normalbaselines\baselineskip=2pt\m@th
    \ialign{\hfil$\scriptstyle ##$\hfil&&\hfil$\scriptstyle ##$\hfil\crcr
      \crcr
      #1\crcr\crcr}}\,}

% Our own caption style --

\def\fnum@figure{{\small Figure \thefigure}}
\def\fakefigure{\def\@captype{figure}}

\long\def\@makecaption#1#2{
    \vskip 10pt 
    \def\FCap{#2} \def\NoCap{\ignorespaces}
    \ifx \FCap\NoCap
       \setbox\@tempboxa\hbox{#1}  % This is to avoid the damn colon.
      \else
       \setbox\@tempboxa\hbox{#1: \small \it #2}
    \fi
    \ifdim \wd\@tempboxa >\hsize   % IF longer than one line:
        \unhbox\@tempboxa\par      %   THEN set as ordinary paragraph.
      \else                        %   ELSE  center.
        \hbox to\hsize{\hfil\box\@tempboxa\hfil}  
    \fi}

% Our page heading style:
\pagestyle{headings}
%\oddsidemargin 1in
%\evensidemargin 1in
%\textwidth 5in
%\def\@evenhead{\rm \thepage\hfil \leftmark}%        Left heading.
\def\@oddhead{\hbox{}\rightmark \hfil \rm\thepage}% Right heading.
%\def\chaptermark#1{\markboth {\sc {\ifnum \c@secnumdepth >\m@ne
%      \@chapapp\ \thechapter. \ \fi #1}}{}}%
\def\sectionmark#1{\markright {\sc{\ifnum \c@secnumdepth >\z@
      \S\thesection.\hskip 1em\relax \fi #1}}}
%\def\thebibliography#1{\chapter*{References\@mkboth
%{\sc References}{\sc References}}\list
% {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
%    \advance\leftmargin\labelsep
%    \usecounter{enumi}}
%    \def\newblock{\hskip .11em plus .33em minus -.07em}
%    \sloppy
%    \sfcode`\.=1000\relax}

\catcode`\@=12
%
% Macro to define a new chapter without printing the big chapter heading 
\def\fakechapter#1{
	\refstepcounter{chapter}
	\chaptermark{#1}}

\def\oplabel#1{
  \def\OpArg{#1} \ifx \OpArg\Empty {} \else
  	\label{#1}
  \fi}
% Here we define the numbering conventions for theorems, etc.
% They are all numbered together, consecutively in each section.
%
\newtheorem{theoremSt}{Theorem}[section]
\newtheorem{corollarySt}[theoremSt]{Corollary}
\newtheorem{propositionSt}[theoremSt]{Proposition}
\newtheorem{lemmaSt}[theoremSt]{Lemma}
\newtheorem{defineSt}[theoremSt]{Definition}
\newtheorem{exampleSt}[theoremSt]{Example}
\newtheorem{exerciseSt}[theoremSt]{Exercise}
%
\def\NextItem{\refstepcounter{theoremSt} \item[\thetheoremSt]}
% This macro allows us to define a bunch of similar theorem-environments
% with automatic labelling and extra features.
%
\def\MakeStEnv#1{
  \newenvironment{#1}[2]{
  \begin{#1St} \oplabel{##1}%
  \global\def\CrntSt{\thetheoremSt}%
  \def\Labl{##1}\ifx\Labl\Empty{} \else {\rm (\Labl)\,}\fi%
  {\rm ##2}%
}{ 
  \end{#1St} }
}
\MakeStEnv{theorem}
\MakeStEnv{corollary}
\MakeStEnv{proposition}
\MakeStEnv{lemma}
\MakeStEnv{define}
\MakeStEnv{example}

\newenvironment{exercise}[1]{
  \small
  \begin{quote}	% To get indentation
    \begin{exerciseSt} \oplabel{#1}
    \rm
}{
    \end{exerciseSt}
  \end{quote}
  \medbreak\noindent
}
	
\def\lref#1{\ref{#1} (#1)}% Prints label as well as number
%
%
\def\defineterm#1{{\it #1}}
%
% Make a blank figure of given size with label in center.
%	\blankfig{label}{# of inches}{caption}
%
\newlength{\saveu}
\def\blankspace#1#2{
  \setlength{\saveu}{#2in}
  \divide\saveu by 2
  \vskip\saveu
  \centerline {\small \mbox{}#1}
  \vskip\saveu
}

\long\def\placefig#1#2#3#4{
  \begin{figure}[#4]
    \blankspace{#1}{#2}
    \caption[#1]{#3}
    \oplabel{#1}
  \end{figure}}
\long\def\blankfig#1#2#3{
  \placefig{#1}{#2}{#3}{htbp}}
\long\def\herefig#1#2#3{
  \par\noindent\vbox{
  \blankspace{#1}{#2}
  \fakefigure\caption[#1]{#3}
  \oplabel{#1}
  \vspace{\intextsep}
  }}
\long\def\botfig#1#2#3{
  \placefig{#1}{#2}{#3}{b}}

% figure macros that insert actual postscript files:

\long\def\ifig#1#2#3#4#5{
  \begin{figure}[#5]
   {\vss\special{psfile=#4}}
    \blankspace{#1}{#2}
    \caption[#1]{#3}
    \oplabel{#1}
  \end{figure}}
\long\def\realfig#1#2#3#4{
  \ifig{#1}{#2}{#3}{#4}{htb}}

%\def\blankfig#1#2#3{
%  \begin{figure}[hbp]
%  \blankspace{#1}{#2}
%  \caption{\it #3}
%  \label{#1}
%  \end{figure}
%}
\newcommand{\EndBlFig}{}		% Does nothing
%
\def\Subheading#1{\refstepcounter{theoremSt}
  \medskip\noindent{\bf \thetheoremSt\quad #1} 
  \par\medskip}
\def\numbergen#1{\refstepcounter{theoremSt} 
	\thetheoremSt \oplabel{#1}}
%
% This environment shouldn't be nested. 
%
\newenvironment{proof}[1]{
  \def\PfArg{#1}
  \ifx\PfArg\Empty
  	\edef\PfArg{\CrntSt}  \fi
 \startproof{\PfArg}%
}{ 
  \finishproof{\PfArg}
}
%
\newcommand{\startproof}[1]{
  \medbreak\mbox{}
  {\it Proof of #1:}%
}
\newcommand{\finishproof}[1]{ 
  \def\FPArg{#1}
  \ifx\FPArg\Empty
  	\def\FPArg{\CrntSt}  \fi
  \smallbreak\noindent\makebox[\textwidth]{\hfill\fbox{\FPArg}}
  \medbreak\noindent
}
%
\newcommand{\TE}{\BlankTableend}
\newcommand{\TS}{\BlankTable}
\newcommand{\BlankTableend}{}
\newcommand{\BlankTable}{\par  TABLE GOES HERE \par}
\newcommand{\UL}{\it}
\newcommand{\numreg}[3]{}		%Does nothing
%
%  math macros:
%
\def\extendor{\raisebox{0ex}[0in][0in]{\rule{0.5pt}{4ex}}}

\newcommand{\degree}{^\circ}
\newcommand{\degrees}{^\circ}
\newcommand{\complexes}{{\bf C}}
\newcommand{\dihedral}{{\bf D}_}
\newcommand{\gozto}{\mapsto}
\newcommand{\hyperbolic}{{\bf H}}
\newcommand{\hy}{{\bf H}}
\newcommand{\id}{{\rm id}}
\newcommand{\integers}{{\bf Z}}
\newcommand{\supperp}{^\perp}
\newcommand{\reals}{{\bf R}}
\def\zeemod #1{{\bf Z}_{#1}}
\newcommand{\euclidean}{{\bf E}}
\newcommand{\Euclidean}{{\bf E}}
\def\omicron{\circ}

\def\C{\complexes}
\def\Z{\integers}
\def\R{\reals}
\def\E{\Euclidean}
\def\H{\hyperbolic}
\def\Cstar{{\bf C_\ast}}
\def\Rstar{{\bf R_\ast}}
\def\SD{{\mathcal D}}
\def\empset{\phi}

\def\RP#1{{\bf RP}^{#1}}
\def\PSL#1{{\rm PSL}_{#1}}
\def\PSLtil#1{\til{\rm PSL}_{#1}}
\def\PGL#1{{\rm PGL}_{#1}}
\def\SL#1{{\rm SL}_{#1}}
\def\GL#1{{\rm GL}_{#1}}
\def\CP#1{{\bf CP}^{#1}}
\def\SU#1{{\rm SU}(#1)}
\def\PSU#1{{\rm PSU}(#1)}
\def\SO#1{{\rm SO}(#1)}
\def\O#1{{\rm O}(#1)}
\def\qi{{\bf i}}
\def\qj{{\bf j}}
\def\qk{{\bf k}}
\def\diff{\hbox{\it Diff\/}}

\def\Longmapsto{\longmapsto}    % Eventually this should be improved 
\def\bigrightarrow#1{\hbox to #1{\rightarrowfill}}
\def\bigleftarrow#1{\hbox to #1{\leftarrowfill}}
\def\iff{\Leftrightarrow}
\def\Iff{\Longleftrightarrow}
\def\implies{\Rightarrow}
\def\homeo{\cong}
\def\boundary{\partial}
\def\union{\cup}
\def\intersect{\cap}
\def\semidir{\mathrel{\hbox{\vrule depth-.03ex height1.1ex\kern-0.15em$\times$}}}
\def\isom{\hbox{isom}}
\def\nbd{{\mathcal N}}
\def\del{\nabla}
\def\til{\widetilde}
\def\length{{\rm length}}
\def\tr{{\rm tr}}
\def\empty{\phi}
\def\BSmatrix#1{
	\bigl[\Smatrix{#1}\bigr]
}
\def\Bmatrix#1{
	\left[\matrix{#1}\right]
}
% The small matrix that actually works:
\def\littlemat#1#2#3#4{
	{\bigl[ {#1 \atop #3} {#2 \atop #4} \bigr]}}
\def\littlevec#1#2{
	{\bigl[ {#1 \atop #2} \bigr]}}
