3 \NeedsTeXFormat{LaTeX2e}
4 \ProvidesClass{exsheet2}
6 \DeclareOption{10pt}{\PassOptionsToClass{\CurrentOption}{article}}
7 \DeclareOption{12pt}{\PassOptionsToClass{\CurrentOption}{article}}
8 \DeclareOption{twoside}{\PassOptionsToClass{\CurrentOption}{article}}
10 \DeclareOption{german}{\def \exsheetgerman{}}
11 \DeclareOption{ngerman}{\def \exsheetgerman{}}
12 \DeclareOption{austrian}{\def \exsheetgerman{}}
13 \DeclareOption{naustrian}{\def \exsheetgerman{}}
14 \DeclareOption{showanswers}{\def \exsheetshowanswers{}}
15 \DeclareOption{exam}{\def \exsheetexam{}}
16 \DeclareOption{nostudentinfo}{\def \exsheetnostudentinfo{}}
17 \DeclareOption{nogradeinfo}{\def \exsheetnogradeinfo{}}
20 \PassOptionsToClass{a4paper}{article}
26 \@ifundefined{exsheetgerman}{
27 \usepackage[american]{babel}
28 \newcommand{\theexercise}{Exercise}
29 \newcommand{\thepoint}{Point}
30 \newcommand{\thepoints}{Points}
31 \newcommand{\thename}{Name}
32 \newcommand{\thestudnumber}{Number}
33 \newcommand{\theanswer}{Answer}
34 \newcommand{\theduration}{Duration}
35 \newcommand{\thegrade}{Grade}
36 \newcommand{\theof}{of}
38 \usepackage[ngerman]{babel}
39 \newcommand{\theexercise}{Aufgabe}
40 \newcommand{\thepoint}{Punkt}
41 \newcommand{\thepoints}{Punkte}
42 \newcommand{\thename}{Name}
43 \newcommand{\thestudnumber}{Personenkennzeichen}
44 \newcommand{\theanswer}{Antwort}
45 \newcommand{\theduration}{Prüfungsdauer}
46 \newcommand{\thegrade}{Note}
47 \newcommand{\theof}{von}
50 \usepackage[useregional]{datetime2}
52 \RequirePackage{xifthen,geometry,fancyhdr,enumitem,comment,amssymb}
54 \newcounter{exsheet2@pointsum}
55 \def\droptotalpoints{unknown}
56 \AtBeginDocument{\AtEndDocument{%
57 \immediate\write\@mainaux{%
58 \string\gdef\string\droptotalpoints{\number\value{exsheet2@pointsum}}%
62 \newcounter{exsheet2@excounter}
63 \setcounter{exsheet2@excounter}{1}
64 \newenvironment{exercise}[1][]{%
66 \textbf{\theexercise~\arabic{exsheet2@excounter}}
67 \ifthenelse{\isempty{#1}}{}{%
68 \addtocounter{exsheet2@pointsum}{#1}
72 \hfill[#1 \thepoints]%
76 {\addtocounter{exsheet2@excounter}{1}}
78 \@ifundefined{exsheetshowanswers}{
79 \excludecomment{answer}
81 \newenvironment{answer}{\vspace*{0.5em}\textit{\theanswer:} \hspace*{0.5em} }{}
84 \newenvironment{choices}{%
85 \begin{itemize}[label=$\square$, labelsep=2ex]
90 \newcommand{\course}[1]{\def\@course{#1}}
93 \newcommand{\curriculum}[1]{\def\@curriculum{#1}}
96 \newcommand{\semester}[1]{\def\@semester{#1}}
99 \renewcommand{\author}[1]{\def\@auth{#1}\def\@author{#1}}
102 \newcommand{\institute}[1]{\def\@institute{#1}}
105 \newcommand{\school}[1]{\def\@school{#1}}
108 \newcommand{\duration}[1]{\def\@duration{#1}}
111 \newcommand{\instructions}[1]{\def\@instructions{#1}}
114 \DTMsavenow{exsheet2@today}
115 \renewcommand{\date}[1]{\olddate{#1}\DTMsavedate{exsheet2@today}{#1}}
118 \geometry{a4paper,textwidth=16cm,textheight=23cm}
122 \reinitrand[first=10000,last=99999,counter=examnonce,quiet]
125 \fancypagestyle{exsheet}
133 {\DTMsetdatestyle{iso}\DTMusedate{exsheet2@today}}
139 \@ifundefined{exsheetexam}{}{%
141 \tiny nonce: \arabic{examnonce}
146 \setlength{\headheight}{2.5em}
147 \renewcommand{\headrulewidth}{1pt}
149 \setlength{\parindent}{0em}
152 \newcommand{\makestudentinfo}{%
154 \thename: \underline{\hspace{5cm}}
156 \thestudnumber: \underline{\hspace{4cm}}
160 \newcommand{\makegradeinfo}{%
162 \thegrade: \underline{\hspace{5cm}}
164 \thepoints: \underline{\hspace{2cm}} \theof\ \droptotalpoints
169 \let\oldmaketitle\maketitle
172 \@ifundefined{exsheetexam}{
173 \PassOptionsToClass{notitlepage}{article}
174 \renewcommand{\@maketitle}{%
182 \renewcommand{\@maketitle}{%
195 \ifthenelse{\equal{\@semester}{}}{}{ (\@semester)}
207 {\DTMusedate{exsheet2@today}} \\
214 \ifthenelse{\equal{\@duration}{}}{}{%
216 \theduration: \@duration
225 \ifthenelse{\isundefined{\exsheetnostudentinfo}}{%
229 \ifthenelse{\isundefined{\exsheetnogradeinfo}}{%
237 \renewcommand{\maketitle}{%
239 \thispagestyle{exsheet}