UCexam.cls
2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%%
%% 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}