\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{illcmolthesis}[2005/05/13 ILLC Master of Logic Thesis 
Style, M. Vervoort, B. Loewe]

% For more information, cf. 
%   https://msclogic.illc.uva.nl/current-students/graduation/titlepage/

\RequirePackage{epsfig}

\newcommand{\degree}[1]{%
  \gdef\@degree{#1}
}
\newcommand{\@degree}[1]{%
  MSc in Logic
}
\newcommand{\birthdate}[1]{%
  \gdef\@birthdate{\ #1}
  \gdef\@birthpreamble{(born}
  \gdef\@birthpostamble{)}
}
\newcommand{\@birthpreamble}{}
\newcommand{\@birthpostamble}{}
\newcommand{\@birthdate}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\birthdate given (but field is optional, so if omission was deliberate you may safely ignore this warning)}%
}
\newcommand{\@birthplacepreamble}{}
\newcommand{\birthplace}[1]{%
  \gdef\@birthplace{\ #1}
  \gdef\@birthpreamble{(born}
  \gdef\@birthplacepreamble{\ in}
  \gdef\@birthpostamble{)}
}
\newcommand{\@birthplace}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\birthplace given (but field is optional, so if omission was deliberate you may safely ignore this warning)}%
}
\newcommand{\defensedate}[1]{%
  \gdef\@defensedate{#1}
}
\newcommand{\@defensedate}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\defensedate given}%
}
\newcount\@supervisorcnt
\@supervisorcnt=1
\newcommand{\supervisor}[1]{%
  \advance\@supervisorcnt 1%
  \ifnum\@supervisorcnt=1%
  {\gdef\@supervisorA{#1}\gdef\@supervisorAA{\textbf{#1}}}
  \else\ifnum\@supervisorcnt=2%
  {\gdef\@supervisorB{#1}\gdef\@supervisorBB{ and \textbf{#1}}}
  \fi\fi
}
\newcommand{\@supervisorA}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\supervisor given}%
}
\newcommand{\@supervisorAA}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\supervisor given}%
}
\newcommand{\@supervisorB}{}
\newcommand{\@supervisorBB}{}



\newcount\@committeemembercnt
\@committeemembercnt=1
\newcommand{\committeemember}[1]{%
  \advance\@committeemembercnt 1%
  \ifnum\@committeemembercnt=1%
  \gdef\@committeememberA{#1}
  \else\ifnum\@committeemembercnt=2%
  \gdef\@committeememberB{#1}
  \else\ifnum\@committeemembercnt=3%
  \gdef\@committeememberC{#1}
  \else\ifnum\@committeemembercnt=4%
  \gdef\@committeememberD{#1}
  \else\ifnum\@committeemembercnt=5%
  \gdef\@committeememberE{#1}
  \else\ifnum\@committeemembercnt=6%
  \gdef\@committeememberF{#1}
  \else\ifnum\@committeemembercnt=7%
  \gdef\@committeememberG{#1}
  \else\ifnum\@committeemembercnt=8%
  \gdef\@committeememberH{#1}
  \fi\fi\fi\fi\fi\fi\fi\fi
}



\newcommand{\@committeememberA}{%
  \PackageWarningNoLine{illcmolthesis.sty}{No \noexpand\committeemember given}%
}
\newcommand{\@committeememberB}{}
\newcommand{\@committeememberC}{}
\newcommand{\@committeememberD}{}
\newcommand{\@committeememberE}{}
\newcommand{\@committeememberF}{}
\newcommand{\@committeememberG}{}
\newcommand{\@committeememberH}{}
\renewcommand{\maketitle}{%
  \begin{titlepage}%
    % Make sure title-page is centered even with option 'twopage'
    % Note: these lenghts should auto-revert after the titlepage is complete
    \setlength{\oddsidemargin}{0.5\paperwidth}
    \addtolength{\oddsidemargin}{-0.5\textwidth}
    \addtolength{\oddsidemargin}{-1in}
    \setlength{\evensidemargin}{\oddsidemargin}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let\footnote\thanks
    \null\vfil
    \begin{center}%
      {\Large \@title \par}%
      \vskip2cm%
      {\large \textbf{MSc Thesis} \textsl{(Afstudeerscriptie)}}%
      \vskip3mm%
      written by%
      \vskip3mm%
      \textbf{\@author}\\
      \@birthpreamble\@birthdate\@birthplacepreamble\@birthplace\@birthpostamble%
      \vskip3mm%
      under the supervision of 
      {\@supervisorAA}{\@supervisorBB},
      and submitted to the Examinations Board
      in partial fulfillment of the requirements for the degree of%
      \vskip5mm%
      {\large\textbf{\@degree}}%
      \vskip5mm%
      at the \textit{Universiteit van Amsterdam}.%
      \vskip2cm%
      \begin{tabular}{ll}%
        \textbf{Date of the public defense:} & \textbf{Members of the Thesis Committee:}\\%
        \textsl{\@defensedate}                  & \@committeememberA\\%
                                       & \@committeememberB\\%
                                       & \@committeememberC\\%
                                       & \@committeememberD\\%
                                       & \@committeememberE\\%
                                       & \@committeememberF\\%
                                       & \@committeememberG\\%
                                       & \@committeememberH%
      \end{tabular}%
      \vfill%
      \resizebox{10cm}{!}{\includegraphics{illclogo}}%
    \end{center}\par%
    \@thanks%
    \vfil\null%
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\birthdate\relax
  \global\let\birthplace\relax
  \global\let\supervisor\relax
  \global\let\committeemember\relax
  \global\let\@thanks\@empty
  \global\let\@title\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@birthdate\@empty
  \global\let\@birthplace\@empty
  \global\let\@supervisor\@empty
  \global\let\@committeemember\@empty
  \global\let\maketitle\relax
  \global\let\and\relax
}
% added to allow working with amsbook
\renewcommand{\author}[1]{%
  \gdef\@author{#1}%
}
