Public
Snippet $10 authored by Charlie Wang

CS 245 Cover Sheet Package

Edited
cs245coversheet.sty
\ProvidesPackage{cs245coversheet}

% USAGE
% % blah blah
% \usepackage{cs245coversheet}
%
% \termandyear{Spring 2015}
% \assignmentno{1}
% \daydue{Tuesday}
% \datedue{May 12}
% \timedue{3:00pm}
% \locationdue{the dropbox near MC~4065}
% \numprobs{2}
% \firstname{Aaaa}
% \lastname{asddgs}
% \studentid{~}
%
% \begin{document}
% \makecoversheet
%
% % blah blah
%
% \end{document}

\usepackage{fullpage}
\usepackage{tabularx}

\newcommand*{\numprobs}{2}

%\termandyear
\def\termandyear#1{\gdef\@termandyear{#1}}
\def\@termandyear{\@latex@warning@no@line{No \noexpand\termandyear given}}

%\assignmentno
\def\assignmentno#1{\gdef\@assignmentno{#1}}
\def\@assignmentno{\@latex@warning@no@line{No \noexpand\assignmentno given}}

%\daydue
\def\daydue#1{\gdef\@daydue{#1}}
\def\@daydue{\@latex@warning@no@line{No \noexpand\daydue given}}

%\datedue
\def\datedue#1{\gdef\@datedue{#1}}
\def\@datedue{\@latex@warning@no@line{No \noexpand\datedue given}}

%\timedue
\def\timedue#1{\gdef\@timedue{#1}}
\def\@timedue{\@latex@warning@no@line{No \noexpand\timedue given}}

%\locationdue
\def\locationdue#1{\gdef\@locationdue{#1}}
\def\@locationdue{\@latex@warning@no@line{No \noexpand\locationdue given}}

%\numprobs
\def\numprobs#1{\gdef\@numprobs{#1}}
\def\@numprobs{\@latex@warning@no@line{No \noexpand\numprobs given}}

%\firstname
\def\firstname#1{\gdef\@firstname{#1}}
\def\@firstname{\@latex@warning@no@line{No \noexpand\firstname given}}

%\lastname
\def\lastname#1{\gdef\@lastname{#1}}
\def\@lastname{\@latex@warning@no@line{No \noexpand\lastname given}}

%\studentid
\def\studentid#1{\gdef\@studentid{#1}}
\def\@studentid{\@latex@warning@no@line{No \noexpand\studentid given}}


% DON'T change this macro!  Re-define the macros defined above, instead.
\newcommand{\makecoversheet}{
\pagestyle{empty}

\begin{center}
\large\upshape\bfseries
CS 245: \@termandyear\hfill
Assignment \@assignmentno\hfill
CS 245: \@termandyear

\bgroup
\bigskip\bigskip
\normalsize\normalfont
\renewcommand{\arraystretch}{1.4}
\begin{tabularx}{\linewidth}{|X|X|X|}
\hline
Surname: \@lastname & Personal name: \@firstname & \rlap{ID \#: \@studentid}\hfill
\\\hline
\multicolumn{3}{|l|}{Circle time/room for return of your paper, or ``Do not return in tutorial''}\\
\multicolumn{1}{|c}{8:30, 4063 (TUT102)} &
\multicolumn{1}{c}{9:30, 4063 (TUT101)} &
\multicolumn{1}{c|}{11:30, 4042 (TUT104)}
\\
\multicolumn{3}{|c|}{%
\hspace*{\fill}\makebox[0pt][c]{12:30, 4042 (TUT103)}\hspace*{\fill}
\hspace*{\fill}\makebox[0pt][c]{4:30, 4042 (TUT105)}\hspace*{\fill}
\hspace*{\fill}\makebox[0pt][c]{Do not return in tutorial}\hspace*{\fill}}\\\hline
\end{tabularx}

\bigskip
Due \ifx\@daydue\relax\else\@daydue, \fi
\@datedue\ifx\@timedue\relax\else, by \@timedue\fi
\ifx\@locationdue\relax\else, to \@locationdue\fi.

{\bfseries Attach this sheet as a cover sheet on your submission.}
\egroup

\end{center}


% The ``suppressfloats'' should force the float (with the marking
% boxes) onto the next page.  Note that this will only happen if there
% IS a second page.
%
% If this doesn't work for whatever reason,
% (a) remove the line "\suppressfloats[t]", and
% (b) put enough text before the figure to fill the first page, which
% puts the figure on the second page.  (Make sure it's the second!)
% Or hey let's try pagebreak with t!
\pagebreak

\begin{figure}[t!]
\ifx\@numprobs\empty\relax\def\@numprobs{4}\fi
\newcounter{pctr}\setcounter{pctr}{0}
\def\fboxsep{-\fboxrule}
\def\marksbox##1{\framebox[1.5cm][c]{\raisebox{-0.5\height}{\rule{0pt}{1cm}}{##1}}\framebox[1.5cm][c]{\raisebox{-0.5\height}{\rule{0pt}{1cm}}\vphantom{X}}}
%\def\stepandprint##1{\stepcounter{##1}\arabic{##1}}
\normalsize\normalfont
\hspace*{\fill}\smash{\raisebox{\depth}{%
{Marks: }%
\loop{{\framebox[1cm][c]{\raisebox{-0.5\height}{\rule{0pt}{1cm}}\stepcounter{pctr}\arabic{pctr}}\hspace{-\fboxrule}\framebox[1.5cm][c]{\raisebox{-0.5\height}{\rule{0pt}{1cm}}\vphantom{X}}}\\}%
\ifnum\value{pctr}<\@numprobs\relax\repeat%
\marksbox{Total}
}}%
\end{figure}

}