%
% modifications made to stanford thesis for Syracuse University thesis
% ed guy  9/25/89 &&
% customized to suit my requirements: Manish Parashar 5/94
% Saleh Elmohamed 7/99

\makeatletter
\oddsidemargin 0.5in \evensidemargin 0.5in
\marginparwidth 35pt \marginparsep 10pt
\topmargin 1pt \headsep .5in
\textheight 7.8in \textwidth 6in
%%\brokenpenalty=10000
\brokenpenalty=10000
\clubpenalty=1000
\widowpenalty=1000
\displaywidowpenalty=1000
\looseness = 2

\renewcommand{\baselinestretch}{1.3}

\def\cl@chapter{\@elt{section}\@elt{footnote}\@elt{figure}\@elt{equation}
\@elt{table}}
%%\def\thefigure{\@arabic\c@figure}
%%\def\thefigure{\@elt{chapter}\c@figure}
%%\def\thetable{\@arabic\c@table}
%%\def\theequation{\arabic{equation}}

\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
      \@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
       \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
       \@tfor \@tempa :=#2\do
                        {\if\@tempa h\advance\@tempcnta \@ne\fi
                         \if\@tempa t\advance\@tempcnta \tw@\fi
                         \if\@tempa b\advance\@tempcnta 4\relax\fi
                         \if\@tempa p\advance\@tempcnta 8\relax\fi
         }\global\count\@currbox\@tempcnta}\@fltovf\fi
    \global\setbox\@currbox\vbox\bgroup 
    \def\baselinestretch{1}\@normalsize
    \boxmaxdepth\z@
    \hsize\columnwidth \@parboxrestore}
\long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize
    \interlinepenalty \interfootnotelinepenalty 
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
   \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
    {\rule{\z@}{\footnotesep}\ignorespaces
      #1\strut}}}


\def\dept#1{\gdef\@dept{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
\def\@title{}\def\@author{}\def\@dept{Computer Science and Engineering}

% etg 8/14/89 
\def\@previousdegrees{\ }  
\def\previousdegrees#1{\gdef\@previousdegrees{#1}}
\def\@typeofthesis{Dissertation} 
\def\typeofthesis#1{\gdef\@typeofthesis{#1}}
\def\thetypeofthesis{\@typeofthesis}
\def\@degreelevel{Doctor of Philosophy} 
\def\degreelevel#1{\gdef\@degreelevel{#1}}
\def\@advisor{\ }
\def\advisor#1{\gdef\@advisor{#1}}

\def\@typeofabstract{Abstract of Dissertation}
\def\typeofabstract#1{\gdef\@typeofabstract{#1}}
\def\thetypeofabstract{\@typeofabstract}
\def\@abstractfile{abstract}
\def\abstractfile#1{\gdef\@abstractfile{#1}}

%
% \facts are useful during for sourcing statements.
%        it produces numbered margin notes starting with "Fact"
%        the default reference is G.A. for generally accepted
%        \fact[ref] will replace G.A. with ref
% \conjecture works the same way,  its default reference is "Mine"
%        margin notes start with "conj"
% \linesourcefalse (the default) causes these notes to be ignored
% \linesourcetrue  turns them on.
%
%
% \joke{a funny thing happened to me on the way to the campus}
%        is a way for the writer to humor himself and his early 
%        readers.  
% \jokestrue (the default) causes these jokes to be included
%\jokesfalse          %turns them off.
%
\newif\ifjokes       \jokestrue                %Include Jokes and Wise remarks
\newif\iflinesource  \linesourcefalse          %Classify each line's source 
\def\joke#1{\ifjokes #1 \fi}
\newcounter{marginnotectr}
\def\fact{\@ifnextchar[{\@fact{Fact}}{\@fact{Fact}[G.A.]}}
\def\conjecture{\@ifnextchar[{\@fact{Conj}}{\@fact{Conj}[Mine]}}
\def\@fact#1[#2]{
    \iflinesource
        \ifnum\value{marginnotectr}=0    %is it the first one?
            %increased margin size doesn't work !!!
            \addtolength{\textwidth}{-.5in}
            \message{increased right margin size}
        \fi
        \stepcounter{marginnotectr}
        \marginpar{\tiny \arabic{marginnotectr} #1 #2}
        $^{\arabic{marginnotectr}:}$ 
%    \else       
    \fi
}


\def\@submitdate{\ifcase\the\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\the\year}
\ifnum\month=12
    \@tempcnta=\year \advance\@tempcnta by 1
    \edef\@copyrightyear{\number\the\@tempcnta}
\else
    \def\@copyrightyear{\number\the\year}
\fi
\newif\ifcopyright \newif\iffigurespage \newif\iftablespage 
\copyrighttrue \figurespagetrue \tablespagetrue 

\def\abtitlep{%
        \thispagestyle{empty}%
        \null%\vskip1in%
        \begin{center}
                {\large \sc \expandafter \@title}
        \end{center}
        \medskip
        \begin{center}
                \rm by\\
                {\sc \@author}
        \end{center}
        \medskip
        \begin{center}
            \expandafter{\sc \@typeofabstract}  \\
                \@submitdate\\
        \end{center}
        \newpage
        \thispagestyle{empty}%
        \pagestyle{empty}%
        \chapter*{\vspace{-1.0in}\centering{Abstract}}
        \thispagestyle{empty}%
        \input{\@abstractfile}
        \newpage}

\def\coverp{%
\newpage
        \thispagestyle{empty}%
        \setcounter{page}{1}
        \null%\vskip1in%
        \begin{center}
                {\Large \sc \expandafter \@title}
        \end{center}
        \bigskip
        \begin{center}
                \rm by\\
                {\sc \@author}\\
                \@previousdegrees\\
        \end{center}
        \medskip
        \begin{center}
            \expandafter{\sc \@typeofthesis}  \\ \ \\
                \@submitdate\\
        \end{center}
        %\vfill
        \newpage}

\def\titlep{%
        \thispagestyle{empty}%
        \null%\vskip1in%
        \begin{center}
                {\Large\uppercase\expandafter{\@title}}
        \end{center}

        \vfill
        \begin{center}
                \rm By\\
                \@author\\
                \@previousdegrees\\
        \end{center}
        \vfill
        \begin{center}
              \uppercase\expandafter{\@typeofthesis}  \\ \ \\ \sc 
               submitted in partial fulfillment of the requirements for the 
               degree of \@degreelevel\ in  \lowercase\expandafter{\@dept}\ 
               in the Graduate School of Syracuse University \\
                \@submitdate\\
        \end{center}
        \vskip1.0in
        \begin{flushright}
               \begin{minipage}{0.5\textwidth}
               \sc 
               Approved\ \hrulefill \\
                \hspace*{\fill}\ \ \ {\@advisor} \hspace*{\fill} \\
               %\makebox[0.5\textwidth][r]{\@advisor}\\

               Date\ \hrulefill \\
               \end{minipage}
        \end{flushright}
        \vskip.5in
        \ifjokes \footnote{ Caution: /jokestrue version}\fi
        \newpage}

\def\copyrightpage{%
        \thispagestyle{empty}
        \null\vfill
        \begin{center}
                \Large\copyright\ Copyright \@copyrightyear\\
                \@author\\
        \end{center}
        \vfill\newpage}

\def\prefacetop{
        \pagestyle{empty}
        \abtitlep}

\def\beforepreface{
        \coverp
        \pagenumbering{roman}
        \pagestyle{plain}
        \titlep
        \ifcopyright\copyrightpage\fi
        \chapter*{\vspace{-1.0in}\centering{Abstract}}
        \input{\@abstractfile}
        \newpage}
     

\def\prefacesection#1{%
        \chapter*{\vspace{-1.0in} #1}
        \addcontentsline{toc}{chapter}{#1}}

\def\afterpreface{\newpage
        \tableofcontents
        \newpage
        \iftablespage
                {\addvspace{10pt}
                \let\saveaddvspace=\addvspace
                \def\addvspace##1{}
                \addcontentsline{toc}{chapter}{List of Tables}
                \listoftables
                \let\addvspace=\saveaddvspace}
                \newpage
        \fi
        \iffigurespage
                {\addvspace{10pt}
                \let\saveaddvspace=\addvspace
                \def\addvspace##1{}
                \addcontentsline{toc}{chapter}{List of Figures}
                \listoffigures
                \let\addvspace=\saveaddvspace}
                \newpage
        \fi}
\def\thesisbody{
        \pagenumbering{arabic}
        \pagestyle{headings}}

\def\biopage{
        \pagestyle{plain}
        \chapter*{\vspace{-1.75in}\centering Vita}
        \addcontentsline{toc}{chapter}{Vita}}
\def\bioitem#1#2{ 
          \begin{minipage}[t]{0.30\textwidth}
           \begin{flushleft}
            {\sc #1}
           \end{flushleft}
          \end{minipage}
          \begin{minipage}[t]{0.7\textwidth}
           \begin{flushleft}
            #2
           \end{flushleft}
          \end{minipage}
          %\ \\ \ \\
}
\def\mbioitem#1#2{ 
           {\sc #1}
             \vspace{-0.3cm}
             \begin{flushright}
             \begin{minipage}[t]{0.95\textwidth}
              \begin{flushleft}
                #2
              \end{flushleft}
             \end{minipage}
             \end{flushright}
          \ \\ %\ \\
}

% Start with pagestyle{headings} in case front matter isn't processed
\pagestyle{headings}
\makeatother
