%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% document class and packages section
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\haha{{\emph{Handbook}}\xspace}
\def\hamo{{\emph{Handbook of Moduli}}\xspace}
\def\google{{\rm\texttt{google}}\xspace}

\newif\ifprint%IM
\printfalse%IM off for contributors
\documentclass[twoside,10pt]{HandbookOfModuli}%IM

\usepackage{amsmath,amsthm}
\usepackage{amssymb}
\usepackage{latexsym}%IM
\usepackage[utf8]{inputenc}%IM
\usepackage{textcomp}%IM
\usepackage{color}%IM
\usepackage[pdftex]{graphicx}%IM
%\usepackage[dvips]{epsfig}%comment out IM
\usepackage{titlesec}
\usepackage{xspace}

% start section added by IM
\ifprint
	\input{giovanni} % off for contributors
	\usepackage[final]{microtype}%IM off for contributors
\fi
\usepackage{bm}
\renewcommand{\mathbf}[1]{\bm{#1}} % override \mathbf for use with Giovanni

\ifprint
	\definecolor{linkred}{rgb}{0,0,0} % black
	\definecolor{linkblue}{rgb}{0,0,0} % black
\else
	\definecolor{linkred}{rgb}{0.7,0.2,0.2}
	\definecolor{linkblue}{rgb}{0,0.2,0.6}
\fi

\numberwithin{equation}{section} % standardize numbering

\usepackage[
	hypertexnames=false,% IM 2/10 prevent spurious duplicate dests
	hyperindex,
	pagebackref,
	pdftex,
	pdftitle={Handbook of Moduli},
	pdfdisplaydoctitle,
	pdfpagemode=UseNone,
	breaklinks=true,
	extension=pdf,
	bookmarks=false,
	plainpages=false,
	colorlinks,
	linkcolor=linkblue,
	citecolor=linkred,
	urlcolor=linkred,
	pdfmenubar=true,
	pdftoolbar=true,
	pdfpagelabels,
	pdfpagelayout=TwoPage,
	pdfview=Fit,
	pdfstartview=Fit
]{hyperref}%IM

\linespread{1.12}%IM
% end section added by IM

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% code pulled from Latex-document.sty: China Higher Education Press headers
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  set IP desired page layout
\paperheight 10in
\paperwidth 7.17in
\textwidth 12.5cm
\textheight 19.5cm
\setlength{\oddsidemargin 3mm}
\setlength{\evensidemargin 3mm}
\headsep 6mm
\footskip 11mm
\catcode`@=11 \baselineskip 4.5mm
\parindent 8mm
\topmargin -0.25in
\leftmargin -0.0625in
\setlength{\arraycolsep}{0.5mm}
\def\ps@handbook{\def\@oddhead{\hfill \leftmark \hfill\thepage }
\def\@evenhead{\thepage \hfill \rightmark \hfill}
\def\@oddfoot{}
\def\@evenfoot{}}
%\def\ps@first{\def\@evenhead{ICCM 2007 $\cdot$ Vol. I $\cdot$ 120--164\hfill}}
\def\@evenhead{}
\def\@oddfoot{}%\hfill \copyright\ China Higher Education Press}
\def\@evenfoot{\hfill\copyright\ China Higher Education Press}
\def\list#1#2{\ifnum \@listdepth >5\relax \@toodeep \else \global
\advance \@listdepth\@ne \fi \rightmargin \z@ \listparindent\z@
\itemindent\z@ \csname @list\romannumeral\the\@listdepth\endcsname
\def\@itemlabel{#1}\let\makelabel\@mklab \@nmbrlistfalse #2\relax
\@trivlist \parskip -\parsep \parindent\listparindent \advance
\linewidth -\rightmargin \advance\linewidth -\leftmargin \advance
\@totalleftmargin \leftmargin \parshape \@ne \@totalleftmargin
\linewidth \ignorespaces}
% IM 1/10 following 3 lines fix a toc incompatibility between titlesec and amsarticle.cls
\renewcommand*\l@section{\@tocline{1}{0pt}{0em}{1em}{}}%IM 1/10 fix toc incompatibility
\renewcommand*\l@subsection{\@tocline{2}{0pt}{1.5em}{2em}{}} %IM 1/10 fix toc incompartibility 
\renewcommand\contentsnamefont{\bfseries\large} %IM 1/10 fix toc incompartibility 
\catcode`@=12
\pagestyle{handbook}
% IM 3/2 following 3 lines supressed: class file sets these up as we wish
%\renewcommand\thesection{\arabic{section}}%IM 3/2 use def in .cls file
%\renewcommand\thesubsection{\arabic{subsection}}%IM 3/2 use def in .cls file
%\renewcommand\thesubsubsection{\arabic{subsubsection}}%IM 3/2 use def in .cls file
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\def\setzero{\setcounter{equation}{0}}
\pagenumbering{arabic}
\def\thebibliography#1{\section*{References}
\list{[\arabic{enumi}]}{\settowidth \labelwidth{[#1]} \leftmargin
\labelwidth \advance \leftmargin \labelsep \usecounter{enumi}}
\def\newblock{\hskip .11em plus .33em minus .07em} \sloppy
\clubpenalty 4000 \widowpenalty 4000 \sfcode`\.=1000 \relax}
%\usepackage[footnotesize]{caption}%È¥µôÍ¼×¢ºó²ýºÅ%%%[hang,footnotesize]±íÊ¾Í¼×¢ÔÚÍ¼ºÅºó×Ô¿Ø¶ÔÆë
%\renewcommand{\captionlabeldelim}{\quad}%È¥µôÍ¼×¢ºó²ýºÅs

% design of headers and numbering of equations
\titleformat{\section}{\normalfont\large\bfseries}{\thesection.}{0.5em}{}[\kern0.em]%IM 3/3 null kern marks mark optional vertical spacing after
\titleformat{\subsection}{\normalfont\bfseries}{\thesubsection.}{0.3em}{}[\kern0.em]%IM 3/3 null kern marks mark optional vertical spacing after
\titleformat{\subsubsection}[runin]{\normalfont\bfseries}{\thesubsubsection.}{0.5em}{}[\kern0.5em]%IM 9/29 set as run in head
\newcommand{\prf}{\noindent {\bf Proof. }}

% IM 3/3 next 4 lines are changes in March 2010 revision 
\setcounter{secnumdepth}{3}%IM 3/3 number to subsubsections but not below
\setcounter{tocdepth}{2}%IM 3/3 sections and subsections in contents
\def\fofsubsubsection#1{\refstepcounter{equation}\subsubsection*{\theequation.\kern0.25em #1}}%IM 3/3 flush "subsubsection" using section.equation numbering
\def\foisubsubsection#1{\refstepcounter{equation}\subsubsection*{\kern\parindent\theequation.\kern0.25em #1}}%IM 3/3 indented "subsubsection" using section.equation numbering   
