% NTU News Lab Cover style
% Extended from UC CS REPORT COVER STYLE
% Provides a command, \makecover, that produces a UC CS technical report 
% cover (complete with campanile logo), and then resets the page number.

% Copyright (C) 1993, 1994 by Paul N. Hilfinger.  All rights reserved.
% Permission to copy this file and use after suitable modification is granted, 
% provided that this notice be retained on the copy and that no change is
% made to the format of the text of the report number without the author's 
% permission.  

% To use:
%
%    1. Include ntu_techrpt_cover as a style parameter in the \documentstyle
%       command.
%    2. Use the declarations \author, \title, \reportmonth, 
%       \reportyear, and \reportnumber to supply the necessary 
%information for the cover.  These declarations
% typically go in the prelude.  For example,
%
%   \author{P. N. Hilfinger}
%   \title{LaTeX: Threat or Menace?}
%   \reportmonth{April}
%   \reportyear{1993}
%   \reportnumber{42}
%       
%       You may also leave off \reportyear and \reportmonth, and put the 
%entire report designation in \reportnumber. This use is deprecated, 
%but retained for backwards compatibility.  For example,
%   \author{P. N. Hilfinger}
%   \title{LaTeX: Threat or Menace?}
%   \date{April 1993}
%   \reportnumber{93-42}
%    3. If you wish to use the ugly official format (with the form
%UCB//CSD-94-nn rather than UCB/CSD-94-nn), include also the 
%       declaration
%   \useuglyformat
%       with \title, \reportmonth, etc.
%    4. Put a \makecover command immediately after \begin{document}
%
% This file requires the auxiliary Postscript file coverart.eps.

% TO INSTALL: 
% 1. Put coverart.ps in some appropriate directory.
% 2. Change the following declaration to give the right path name (see 1)
%    for coverart.eps.  This must be a full path name (starting with
%    /).
\RequirePackage{graphicx}
\RequirePackage{eso-pic}
%% \RequirePackage{pdfpages}
\newcommand\BackgroundPicObselete{%
\put(-0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[width=0.80\paperwidth,height=\paperheight,%
keepaspectratio]{figures/coverart}%
%% \includegraphics[width=0.90\paperwidth,height=\paperheight,%
%% keepaspectratio,bb=0 0 560 763]{figures/coverart}%
%% \includepdf[scale=0.90,pagecommand={},pages={-}]{figures/coverart.pdf}%
\vfill
}}}

\newcommand\MyAtPageCenter[1]{\AtPageUpperLeft{%
\put(\LenToUnit{.5\paperwidth},\LenToUnit{-.5\paperheight}){#1}}%
}

\newcommand\BackgroundPic{%
  \AtPageCenter{% Picture is centred on page
    \makebox[600pt]{% Horizontally centred
      \raisebox{-1\height}{% Vertically centred
        \includegraphics[scale=1.0]{figures/coverart}}}}}% Actual image

\DeclareOption{letterpaper}{\def\@coverart{\AddToShipoutPictureBG*{\BackgroundPic}}%
  \typeout{-- This is defined for letterpaper cover.}}
\DeclareOption{a4paper}{\def\@coverart{\AddToShipoutPictureBG*{\BackgroundPic}}%
  \typeout{-- This is defined for a4paper cover.}}

%% \DeclareOption{letterpaper}{\def\@coverart{\special{psfile=figures/coverart.eps %
%% 			hoffset=-50 voffset=-700 hscale=100 vscale=100}}%
%% 	\typeout{-- This is defined for letterpaper.}}
%% \DeclareOption{a4paper}{\def\@coverart{\special{psfile=figures/coverart.eps %
%%  			hoffset=-55 voffset=-740 hscale=100 vscale=100}}%
%%  	\typeout{-- This is defined for a4paper.}}

% default to A4 paper, 10pt, twocolumn, one sided, final, journal
\ExecuteOptions{a4paper}
% overrride these defaults per user requests
\ProcessOptions

% For a4paper 
% \def\@coverart{\special{psfile=figures/coverart.eps hoffset=-55 voffset=-740 hscale=100 vscale=100}}
% For letter
%% \def\@coverart{\special{psfile=figures/coverart.eps hoffset=-50 voffset=-700 hscale=100 vscale=100}}
\def\reportnumber#1{\def\@reportnumber{#1}}
\def\reportmonth#1{\def\@reportmonth{#1}}
\def\reportyear#1{\def\@reportyear{#1}}
\def\email#1{\def\@email{#1}}
\def\@reportnumber{?}
\def\@reportmonth{}
\def\@reportyear{}
\def\@numberformatter{Report No.~NTU/NEWS-\@reportdesignator}
\def\useuglyformat{%
    \gdef\@numberformatter{Report No.~NTU//NEWS-\@reportdesignator}%
}

\def\makecover{
\ifx\@empty\@reportyear%
    \def\@reportdesignator{\@reportnumber}
\else%
    \date{\@reportmonth\ \@reportyear}%
    \@tempcnta\@reportyear%
    \divide\@tempcnta by 100%
    \multiply\@tempcnta by 100%
    \@tempcntb\@reportyear%
    \advance\@tempcntb-\@tempcnta%
    \edef\@reportdesignator{\the\@tempcntb-\@reportnumber}%
\fi
\shipout\vbox to 7true in{
\hsize=7.4375true in\parindent=0.5true in
{\@coverart
\vbox to 1.25true in{\vfil}

\hspace*{-1.0true in}
\noindent\begin{minipage}[t]{6.9375 true in}
\def\thanks##1{\relax}
\LARGE\bf
\begin{center}
\@title
\end{center}
\end{minipage}

\vbox to 0.625true in{\vfil}

% 6.9375
% \noindent\begin{minipage}[t]{6.9375 true in}
% \Large\it
% \begin{center}
% \hspace*{-0.8in}{\lineskip .75em\begin{tabular}[t]{|p{12cm}|}\@author\end{tabular}\par}%
% \end{center}
% \end{minipage}

\hspace*{-1.0true in}
\noindent\begin{minipage}[t][3.3 true in]{6.9375 true in}
\large
\begin{center}
\@author
\end{center}
\end{minipage}

\vfil

\begin{center}
  \hspace{-1.25true in}Copyright \copyright  \@reportyear, National Taiwan University.
\end{center}

\begin{center}
\hrule width 440pt depth 0.5pt height 1pt
\end{center}

\vspace{2cm}

\hspace*{2.5true in}
\begin{minipage}[t]{3.75in}
\parindent=0pt
{\bf \@numberformatter}

\vspace{1ex}
\noindent \@date

\vspace{14ex}
\small
Wireless Networking and Embedded Systems (NEWS) Group\\
Graduate Institute of Networking and Multimedia \\
Department of Computer Science and Information Engineering \\
National Taiwan University \\
Taipei, Taiwan 106 \\ \\ \\
\end{minipage}
\vspace{14ex}
}}
}

%% \def\makecoverRB{
%% \ifx\@empty\@reportyear%
%%     \def\@reportdesignator{\@reportnumber}
%% \else%
%%     \date{\@reportmonth\ \@reportyear}%
%%     \@tempcnta\@reportyear%
%%     \divide\@tempcnta by 100%
%%     \multiply\@tempcnta by 100%
%%     \@tempcntb\@reportyear%
%%     \advance\@tempcntb-\@tempcnta%
%%     \edef\@reportdesignator{\the\@tempcntb-\@reportnumber}%
%% \fi
%% \shipout\vbox to 7true in{
%% \hsize=7.4375true in\parindent=0.5true in
%% {\@coverartRB
%% \vbox to 1.25true in{\vfil}

%% \hspace*{-1.0true in}
%% \noindent\begin{minipage}[t]{6.9375 true in}
%% \def\thanks##1{\relax}
%% \LARGE\bf
%% \begin{center}
%% \@title
%% \end{center}
%% \end{minipage}

%% \vbox to 0.625true in{\vfil}

%% % 6.9375
%% % \noindent\begin{minipage}[t]{6.9375 true in}
%% % \Large\it
%% % \begin{center}
%% % \hspace*{-0.8in}{\lineskip .75em\begin{tabular}[t]{|p{12cm}|}\@author\end{tabular}\par}%
%% % \end{center}
%% % \end{minipage}

%% \hspace*{-1.0true in}
%% \noindent\begin{minipage}[t]{6.9375 true in}
%% \large
%% \begin{center}
%% \@author
%% \end{center}
%% \end{minipage}

%% \vfil

%% \begin{center}
%%   \hspace{-1.25true in}Copyright \copyright  \@reportyear, National Taiwan University.
%% \end{center}

%% \begin{center}
%% \hrule width 440pt depth 0.5pt height 1pt
%% \end{center}

%% \vspace{1cm}

%% \hspace*{2.5true in}
%% \begin{minipage}[t]{3.75in}
%% \parindent=0pt
%% {\bf \@numberformatter}

%% \vspace{1ex}
%% \noindent \@date

%% \vspace{14ex}
%% \small
%% Wireless Networking and Embedded Systems (NEWS) Lab \\
%% Graduate Institute of Networking and Multimedia \\
%% Department of Computer Science and Information Engineering \\
%% National Taiwan University \\
%% Taipei, Taiwan 106
%% \end{minipage}
%% }}
%% }
