UCexam.cls 2.43 KB
%%
%% UCexam.cls 2019/01/17 Raul Barbosa <rbarbosa@dei.uc.pt>
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{UCexam}[2019/01/17 University of Coimbra Exams class]

%% based on LaTeX class article
\LoadClass[11pt]{article}

%% required packages
\RequirePackage[papersize={210mm,297mm},top={5mm},bottom={15mm},left={15mm},right={15mm},headheight={13mm},headsep={12mm},footskip={3mm},includehead,includefoot]{geometry}
\RequirePackage{graphicx}
\RequirePackage{lastpage}
\RequirePackage{fancyhdr}

%% header text and notice
\def\headertopleft#1{\gdef\@headertopleft{#1}}
\def\headertopright#1{\gdef\@headertopright{#1}}
\def\headerbottomleft#1{\gdef\@headerbottomleft{#1}}
\def\headerbottomright#1{\gdef\@headerbottomright{#1}}
\def\notice#1{\gdef\@notice{#1}}

%% place the logo and the first page header
\renewcommand{\maketitle}{%
~\vspace{-20mm}%
\begin{center}%
\includegraphics[width=.14\textwidth,trim={0 0 164.7mm 0},clip]{UClogo.pdf}

\vspace{1mm}%
\@title
\end{center}
\vspace{.5\baselineskip}%
\@headertopleft \hfill \@headertopright

\vspace{-.5\baselineskip}%
\rule{\textwidth}{0.33pt}
  
\vspace{.6\baselineskip}%
\@headerbottomleft \hfill \@headerbottomright

\vspace{-.5\baselineskip}%
\rule{\textwidth}{0.33pt}

\vspace{\baselineskip}%
\textit{\@notice}

\vspace{2\baselineskip}
}

%% minimal spacing between paragraphs and items
\setlength{\itemsep}{0mm}
\setlength{\parskip}{0mm}
\setlength{\parindent}{0mm}
\setlength{\topsep}{0mm}

%% fancy headers for all pages except the first one
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0.33pt}
\lhead{\@date}
\rhead{\thepage\ / \pageref{LastPage}}
\newcommand{\pageheadleft}[1]{\lhead{#1}}
\newcommand{\pageheadright}[1]{\rhead{#1}}
\thispagestyle{empty}
\pagestyle{fancy}

%% questions, subquestions, answer boxes, and multiple choice
\newcounter{questioncounter}
\newcounter{subquestioncounter}

\newcommand{\question}[1]{%
\vspace{.75\baselineskip}%
\setcounter{subquestioncounter}{0}%
\addtocounter{questioncounter}{1}\arabic{questioncounter}.\ #1%
}

\newcommand{\subquestion}[1]{%
\vspace{.75\baselineskip}%
\addtocounter{subquestioncounter}{1}\arabic{questioncounter}.\alph{subquestioncounter}) #1%
}

\newcommand{\essay}[2][]{

\vspace{.75\baselineskip}%
\fbox{%
\begin{minipage}{.987\textwidth}%
#1~\vspace{#2}%
\end{minipage}%
}%
\vspace{.75\baselineskip}%
}

\renewcommand{\theenumi}{\Alph{enumi}}
\newcommand{\choices}[1]{\begin{enumerate}\setlength\itemsep{0mm}#1\end{enumerate}}
\newcommand{\choice}{\item}