% cdmtcs.sty
% defines \coverpage command, for CDMTCS techreport coverpage
% you must have defined \title etc before calling this!
%
% Jeremy Gibbons (jeremy@cs.auckland.ac.nz), Feb 1996
% Michael J. Dinneen (mjd@cs.auckland.ac.nz) -- maintainer

\usepackage{graphicx}

\def\cdmtcs@file{cdmtcs-bw-notext}

\def\@cdmtcs@logo{\includegraphics[width=1.5in]{\cdmtcs@file}}
\def\cdmtcs@logo{\hbox{\vbox{\hbox{\@cdmtcs@logo}\vskip0pt}}}
  % extra \vbox and \hbox to ensure all height, no depth


\def\cdmtcstitle#1{\def\@cdmtcstitle{#1}}
\cdmtcstitle{}
\def\cdmtcstrnumber#1{\def\@cdmtcstrnumber{#1}}
\cdmtcstrnumber{}
\def\cdmtcsdate#1{\def\@cdmtcsdate{#1}}
\cdmtcsdate{}

% author and affiliation are trickier: we allow multiple author and affil
\newcounter{cdmtcs@author} \setcounter{cdmtcs@author}{0}
\def\cdmtcsauthor#1{%
  \stepcounter{cdmtcs@author}%
  \edef\@cdmtcs@au@ctr{\roman{cdmtcs@author}}%
  \expandafter\def\csname @cdmtcsauthor@\@cdmtcs@au@ctr\endcsname{#1}%
}
\def\@cdmtcsauthor@i{}

% specify the affiliation for the most recent author
\def\cdmtcsaffiliation#1{%
  \edef\@cdmtcs@au@ctr{\roman{cdmtcs@author}}%
  \expandafter\def\csname @cdmtcsaffiliation@\@cdmtcs@au@ctr\endcsname{#1\\}%
}
\def\@cdmtcsaffiliation@i{}

\def\@trc@titlesize{\@setsize\Large{30pt}\xxvpt\@xxvpt}
\def\@trc@authorsize{\@setsize\large{24pt}\xxpt\@xxpt}
\def\@trc@blurbsize{\@setsize\normalsize{15pt}\xiipt\@xiipt}

\def\coverpage{%
  \shipout\vbox{\vskip-\voffset\vskip-1in\hbox{\hskip-\hoffset\hskip-1in\vbox to 297mm{\hsize210mm
    \vskip 1cm
    \hbox{\hskip 1cm
      \hbox{\hbox{%
        $\vcenter{\vbox to 277mm{
          \vskip17mm % to match gap at bottom of column
          \cdmtcs@logo \vfil
          \cdmtcs@logo \vfil
          \cdmtcs@logo \vfil
          \cdmtcs@logo \vfil
          \cdmtcs@logo \vfil
          \cdmtcs@logo \vfil
          \cdmtcs@logo
          \vskip17mm % large gap, so don't fall off bottom of US letter paper
        }}$}}
      \hskip 0.5in
      \hbox{\hbox{\begin{minipage}[c]{5in}
        \vbox to 277mm{\vskip17mm
        \begin{flushleft}
          \vfil
          {\@trc@titlesize\bf CDMTCS \\ Research\\ Report\\ Series \\}
          \vfil
          {\@trc@titlesize\bf 
           \ifx\@empty\@cdmtcstitle \@title \else \@cdmtcstitle \fi \\}
           % use CDMTCS title if given, else ordinary title
          \vskip 0.5in
          {\@trc@authorsize 
           \ifnum\c@cdmtcs@author>0 % at least one \cdmtcsauthor specified
             \@tempcnta=0
             \@whilenum \@tempcnta<\value{cdmtcs@author} \do
               {\advance \@tempcnta by 1
                \ifnum \@tempcnta>1 \vskip 1ex \fi % gap between authors
                \edef\@cdmtcs@au@ctr{\romannumeral\@tempcnta}%
                {\bf \csname @cdmtcsauthor@\@cdmtcs@au@ctr\endcsname}\\
                \csname @cdmtcsaffiliation@\@cdmtcs@au@ctr\endcsname
               }
           \else % no \cdmtcsauthor specified
             {\bf \@author} \\
             \@cdmtcsaffiliation@
           \fi}
          \vskip 1in
          {\@trc@blurbsize CDMTCS-\@cdmtcstrnumber\\
           \ifx\@empty\@cdmtcsdate \@date \else \@cdmtcsdate \fi \\
           \vfil
           Centre for Discrete Mathematics and\\
           Theoretical Computer Science\\}
        \end{flushleft}
        \vskip17mm}
      \end{minipage}}}
      \hskip 1cm}
    \vfil
    \vskip 1cm
  }}}
}

\def\colourcoverpage{
  \def\cdmtcs@file{cdmtcs-colour-notext}
  \coverpage
}
