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{}}
18 \PassOptionsToClass{a4paper}{article}
24 \@ifundefined{exsheetgerman}{
25 \usepackage[american]{babel}
26 \newcommand{\theexercise}{Exercise}
27 \newcommand{\thepoint}{Point}
28 \newcommand{\thepoints}{Points}
29 \newcommand{\thename}{Name}
30 \newcommand{\thestudnumber}{Number}
31 \newcommand{\theanswer}{Answer}
32 \newcommand{\theduration}{Duration}
33 \newcommand{\thegrade}{Grade}
34 \newcommand{\theof}{of}
36 \usepackage[ngerman]{babel}
37 \newcommand{\theexercise}{Aufgabe}
38 \newcommand{\thepoint}{Punkt}
39 \newcommand{\thepoints}{Punkte}
40 \newcommand{\thename}{Name}
41 \newcommand{\thestudnumber}{Personenkennzeichen}
42 \newcommand{\theanswer}{Antwort}
43 \newcommand{\theduration}{Prüfungsdauer}
44 \newcommand{\thegrade}{Note}
45 \newcommand{\theof}{von}
48 \usepackage[useregional]{datetime2}
50 \RequirePackage{xifthen,geometry,fancyhdr,enumitem,comment,amssymb}
52 \newcounter{exsheet2@pointsum}
53 \def\droptotalpoints{unknown}
54 \AtBeginDocument{\AtEndDocument{%
55 \immediate\write\@mainaux{%
56 \string\gdef\string\droptotalpoints{\number\value{exsheet2@pointsum}}%
60 \newcounter{exsheet2@excounter}
61 \setcounter{exsheet2@excounter}{1}
62 \newenvironment{exercise}[1][]{%
64 \textbf{\theexercise~\arabic{exsheet2@excounter}}
65 \ifthenelse{\isempty{#1}}{}{%
66 \addtocounter{exsheet2@pointsum}{#1}
70 \hfill[#1 \thepoints]%
74 {\addtocounter{exsheet2@excounter}{1}}
76 \@ifundefined{exsheetshowanswers}{
77 \excludecomment{answer}
79 \newenvironment{answer}{\vspace*{0.5em}\textit{\theanswer:} \hspace*{0.5em} }{}
82 \newenvironment{choices}{%
83 \begin{itemize}[label=$\square$, labelsep=2ex]
88 \newcommand{\course}[1]{\def\@course{#1}}
91 \newcommand{\curriculum}[1]{\def\@curriculum{#1}}
94 \newcommand{\semester}[1]{\def\@semester{#1}}
97 \renewcommand{\author}[1]{\def\@auth{#1}\def\@author{#1}}
100 \newcommand{\institute}[1]{\def\@institute{#1}}
103 \newcommand{\school}[1]{\def\@school{#1}}
106 \newcommand{\duration}[1]{\def\@duration{#1}}
108 \def\@instructions{\ }
109 \newcommand{\instructions}[1]{\def\@instructions{#1}}
112 \DTMsavenow{exsheet2@today}
113 \renewcommand{\date}[1]{\olddate{#1}\DTMsavedate{exsheet2@today}{#1}}
116 \geometry{a4paper,textwidth=16cm,textheight=23cm}
120 \reinitrand[first=10000,last=99999,counter=examnonce,quiet]
123 \fancypagestyle{exsheet}
131 {\DTMsetdatestyle{iso}\DTMusedate{exsheet2@today}}
137 \@ifundefined{exsheetexam}{}{%
139 \tiny nounce: \arabic{examnonce}
144 \setlength{\headheight}{2.5em}
145 \renewcommand{\headrulewidth}{1pt}
147 \setlength{\parindent}{0em}
150 \newcommand{\makestudentinfo}{%
152 \thename: \underline{\hspace{5cm}}
154 \thestudnumber: \underline{\hspace{4cm}}
158 \newcommand{\makegradeinfo}{%
160 \thegrade: \underline{\hspace{5cm}}
162 \thepoints: \underline{\hspace{2cm}} \theof\ \droptotalpoints
167 \let\oldmaketitle\maketitle
170 \@ifundefined{exsheetexam}{
171 \PassOptionsToClass{notitlepage}{article}
172 \renewcommand{\@maketitle}{%
180 \renewcommand{\@maketitle}{%
190 {\large \bf \@course\ (\@semester)}
201 {\DTMusedate{exsheet2@today}} \\
209 \theduration: \@duration
224 \renewcommand{\maketitle}{%
226 \thispagestyle{exsheet}