summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/csassignments/csassignments.dtx
blob: 7c52fd94d77ef76a030d03429f5a99e710c355b0 (plain)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
% \iffalse meta-comment
%
% Copyright (C) 2022 by Alexander Bartolomey
% -------------------------------------------
% MIT License
%
% Copyright (c) 2022
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
% 
% The above copyright notice and this permission notice shall be included in all
% copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.
% \fi
% \iffalse
%<*driver>
\ProvidesFile{csassignments.dtx}
%</driver>
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{csassignments}[2022/07/28 v1.0.2 Assignments Class for CS]
%    \end{macrocode}
%
%<*driver>
\documentclass[a4paper]{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
  \DocInput{csassignments.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%
% \CheckSum{574}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0.0}{2022/06/01}{Publish class with documentation}
% \changes{v1.0.1}{2022/06/07}{Rename class to not collide with existing assignments class}
% \changes{v1.0.2}{2022/07/28}{Fix a bug where verb+\ClassWarning+ lacked the right number of arguments}
%
% \GetFileInfo{csassignments.cls}
%
% \title{The \texttt{csassignments} class}
% \date{}
% \author{Alexander Bartolomey}
% \maketitle
% \tableofcontents
%
% \StopEventually{} ^^A
%
% \section{Introduction}
% 
% This class file is designed for assignments of university courses, specifically
% in the field of computer science, but can easily be adapted to other fields. It
% provides macros for counting exercise points, adding a grading table, a helpful
% document title block including several non-standard information, and page
% headers with compressed author details. 
% 
% It supports German and English language by default, by requirement of the
% author's university.
% 
% Additional to the layout utilities, the class provides several commonly used
% macros for computer science topics, namely several mathematical operators,
% mathmode utilities and special environments for proofs and theorem. Those are a
% condensed version of macros defined in
% \url{https://github.com/zoomoid/AlphabetClasses}.
% 
% \section{Getting Started}
% 
% Use the class like any default document class 
%
% \begin{verbatim}
%   \documentclass[<option>]{csassignments}
% 
%   \course{}
%   \group{}
%   \due{}
% 
%   \member{}{}{}
%   % ...
% 
%   \begin{document}
%   \maketitle
%   \gradingtable
% 
%   \exercise[<Exercise Points>]{<Exercise Title>}
%   \subexercise{}
%   \end{document}
% \end{verbatim}
%
% Because it inherits from \texttt{article}, you can pass down any options that
% \texttt{article} understands.
%
% \section{Initial Code}
% First, we define the document class and set some initial lengths.
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass[a4paper,11pt]{article}
\makeatletter
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.6em}
%    \end{macrocode}
% 
% \section{Required Packages}
%
% Notably, the class introduces several dependencies. Here's a list of the
% packages required by \texttt{csassignments}:
%
% \begin{description}
%   \item[geometry] \texttt{CTAN:macros/latex/contrib/geometry}
%   \item[inputenc] \texttt{CTAN:macros/latex/base}
%   \item[babel] \texttt{CTAN:macros/latex/required/babel/base}
%   \item[titlesec] \texttt{CTAN:macros/latex/contrib/titlesec}
%   \item[enumitem] \texttt{CTAN:macros/latex/contrib/enumitem}
%   \item[tocloft] \texttt{CTAN:macros/latex/contrib/tocloft}
%   \item[float] \texttt{CTAN:macros/latex/contrib/float}
%   \item[ifthen] \texttt{CTAN:macros/latex/base}
%   \item[translations] \texttt{CTAN:macros/latex/contrib/translations}
%   \item[csquotes] \texttt{CTAN:macros/latex/contrib/csquotes}
%   \item[fancyhdr] \texttt{CTAN:macros/latex/contrib/fancyhdr}
%   \item[microtype] \texttt{CTAN:macros/latex/contrib/microtype}
%   \item[stmaryrd] \texttt{CTAN:fonts/stmaryrd}
%   \item[graphicx] \texttt{CTAN:macros/latex/required/graphics}
%   \item[pdfpages] \texttt{CTAN:macros/latex/contrib/pdfpages}
%   \item[hyperref] \texttt{CTAN:macros/latex/contrib/hyperref}
%   \item[tikz] \texttt{CTAN:graphics/pgf/base}
%   \item[microtype] \texttt{CTAN:macros/latex/contrib/microtype}
%   \item[amsmath] \texttt{CTAN:macros/latex/required/amsmath}
%   \item[amsthm] \texttt{CTAN:macros/latex/required/amscls}
%   \item[amssymb] \texttt{CTAN:macros/latex/required/amscls}
%   \item[mathtools] \texttt{CTAN:macros/latex/contrib/mathtools}
%   \item[totcount] \texttt{CTAN:macros/latex/contrib/totcount}
%   \item[changepage] \texttt{CTAN:macros/latex/contrib/changepage}
%   \item[etoolbox] \texttt{CTAN:macros/latex/contrib/etoolbox}
%   \item[environ] \texttt{CTAN:macros/latex/contrib/environ}
%   \item[multicol] \texttt{CTAN:macros/latex/required/tools}
%   \item[tgpagella] \texttt{CTAN:fonts/tex-gyre}
%   \item[suffix] \texttt{CTAN:macros/latex/contrib/bigfoot}
% \end{description}
%
%    \begin{macrocode}
\RequirePackage[left=2.5cm,right=2.5cm,top=2cm,bottom=2cm,
  includeheadfoot]{geometry}
\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\RequirePackage{graphicx}
\RequirePackage{tocloft}
\RequirePackage{float}
\RequirePackage{ifthen}
\RequirePackage{translations}
\RequirePackage{csquotes}
\RequirePackage{fancyhdr}
\RequirePackage{microtype}
\RequirePackage{stmaryrd}
\RequirePackage{pdfpages}
\RequirePackage[hidelinks, unicode]{hyperref}
\RequirePackage{tikz}
\RequirePackage{microtype}
\RequirePackage[fleqn]{amsmath}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{mathtools}
\RequirePackage{totcount}
\RequirePackage{changepage}
\RequirePackage{etoolbox}
\RequirePackage{environ}
\RequirePackage{multicol}
\RequirePackage{tgpagella}
\RequirePackage{suffix}
\usetikzlibrary{arrows,calc}
%    \end{macrocode}
%
% \section{Translations}
% \texttt{csassignments} comes with several predefined prefixes that are localized in both 
% English and German:
%    \begin{macrocode}
\DeclareLanguage{english}
\DeclareLanguage{german}
\select@language{english}
\ProvideTranslation{german}{prefixAuthor}{Eingereicht von}
\ProvideTranslation{english}{prefixAuthor}{Handed in by}
\ProvideTranslationFallback{prefixAuthor}{Handed in by}
\ProvideTranslation{german}{prefixDate}{am}
\ProvideTranslation{english}{prefixDate}{on}
\ProvideTranslationFallback{prefixDate}{on}
\ProvideTranslation{ngerman}{exercise}{Aufgabe}
\ProvideTranslation{english}{exercise}{Exercise}
\ProvideTranslationFallback{exercise}{Exercise}
\ProvideTranslation{ngerman}{exerciseAbbrev}{Aufg.}
\ProvideTranslation{english}{exerciseAbbrev}{Ex.}
\ProvideTranslationFallback{exerciseAbbrev}{Ex.}
\ProvideTranslation{ngerman}{subexercise}{Teilaufgabe}
\ProvideTranslation{english}{subexercise}{Subexercise}
\ProvideTranslationFallback{subexercise}{Subexercise}
\ProvideTranslation{ngerman}{points}{Punkte}
\ProvideTranslation{english}{points}{Points}
\ProvideTranslationFallback{points}{Points}
\ProvideTranslation{ngerman}{sheet}{Abgabe}
\ProvideTranslation{english}{sheet}{Exercise Sheet}
\ProvideTranslationFallback{sheet}{Exercise Sheet}
\ProvideTranslation{ngerman}{studentId}{Matr.Nr.}
\ProvideTranslation{english}{studentId}{Student ID}
\ProvideTranslationFallback{studentId}{Student ID}
%    \end{macrocode}
%
% \section{Grouping Exercises}
% To support the grading table, we need to initialize several counters for both counting up
% the awarded points of exercises but also for labels of exercises and subexercises.
%    \begin{macrocode}
\newtotcounter{exercisenumber}
\newtotcounter{subexercisenumber}
\newtotcounter{totalpoints}
\edef\exerciseLabelGradingTable{}
\edef\gradingTableExercisePoints{}
\edef\PTableA{}
\edef\PTableB{}
\edef\PTHead{}
\newcommand{\@addPT}[2]{
  \edef\gradingTableExerciseLabel{\GetTranslation{exerciseAbbrev} #1 &}
  \edef\gradingTableExercisePoints{\qquad / $#2$ &}
  \xappto\PTableA{\gradingTableExerciseLabel}
  \xappto\PTableB{\gradingTableExercisePoints}
  \xappto\PTHead{c | }
}
%    \end{macrocode}
% \begin{macro}{\gradingtable}
% You can toggle the displaying of the grading table by adding \cmd{\gradingtable} at some point
% in your document before the first exercise. It requires the compiler to run twice, in order
% expand the control sequence created on the first run, where exercise labels and points were
% appended in order to be combined in a subsequent run.
%    \begin{macrocode}
\newcommand{\gradingtable}{%
  \ifdef{\PTHeadSaved}{%
    {\Large\bfseries Grading Table}\\%
    \begin{table}[h!]
      \renewcommand\arraystretch{2}%
      \begin{tabular}{\expandonce{\PTHeadSaved} c}
        \PTableASaved {\Large$\Sigma$}\\ \hline
        \PTableBSaved \qquad / $\totalpointsSaved$
      \end{tabular}
      \renewcommand{\arraystretch}{1}%
    \end{table}
  }{\texttt{Compile again}\ClassWarning{csassignments}{Compile again to %
  properly display grading table}}
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\exercise}
% \begin{macro}{\exercise*}
% On top-level, assignments consist of one or more exercise. The
% \cmd{\exercise}\oarg{exercise points}\marg{exercise title} macro provides a
% numbered section title for your assignment. The mandatory argument should
% contain the exercise's title which is then included in the section title, or
% be left blank, in which case nothing is appended to the exercise title. The
% optional argument contains the points rewarded for the exercise in total.
%
% Exercise points are added up in the first run of pdflatex (or your TeX
% backend of choice) and written to the auxilliary file. On the second run,
% the grading table is added to the top of the document, by inclusion of the
% points stored in the first run. \textbf{This is the reason csassignments
% requires two or more runs when used with the grading table}.
%
% If you do not specify points, that is, leave the optional argument field
% empty, the awarded points for the exercise will be set to zero, but the
% exercise will not be included in the grading table.
%
% If you do not specify a title, no empty parentheses are printed.
%
% Using the starred version of the exercise command will allow you to
% explicitly exclude exercise from the grading table (similar to
% \cmd{section*}\marg{section title} not being included in the table of
% contents). Note that you can set points on explicitly excluded exercises.
% The exercise will not count towards the total number of points, but the
% points for the exercise will still be included in the right column of the
% exercise's title line. This might be particularly helpful for modelling
% bonus exercises.
%    \begin{macrocode}
\newcommand{\@pointsPerExercise}[1]{
  \ifstrempty{#1}{}{{\quad\large\bfseries/#1 \GetTranslation{points}}}
}
\newcommand{\@exerciseLabel}[1]{
  \quad\ifstrempty{#1}{}{\bfseries(#1)}
}
\newcommand\exercise[2][]{
  \penalty150
  \ifblank{#1}{\def\points{0}}{\def\points{#1}}
  \stepcounter{exercisenumber}
  \setcounter{subexercisenumber}{0}
  \par
  \vspace{1.5\baselineskip}
  {
    {\Large\bfseries\GetTranslation{exercise}\ \arabic{exercisenumber}}
    \@exerciseLabel{#2}
    \@exerciseRules
    \notblank{#1}{\@pointsPerExercise{#1}}{}
  }
  \par
  \notblank{#1}{
    \addtocounter{totalpoints}{\points}
    \@addPT{\arabic{exercisenumber}}{\points}
  }{}
}
\WithSuffix\newcommand\exercise*[2][]{
  \penalty150
  \ifblank{#1}{\def\points{0}}{\def\points{#1}}
  \stepcounter{exercisenumber}
  \setcounter{subexercisenumber}{0}
  \par
  \vspace{1.5\baselineskip}
  {
    {\Large\bfseries\GetTranslation{exercise}\ \arabic{exercisenumber}}
    \@exerciseLabel{#2}
    \@exerciseRules
    \notblank{#1}{\@pointsPerExercise{#1}}{}
  }
  \par
  \addtocounter{totalpoints}{\points}
}
\AtEndDocument{
  \makeatletter
  \immediate\write\@mainaux{\string\gdef\string\PTableASaved{\PTableA}}
  \immediate\write\@mainaux{\string\gdef\string\PTableBSaved{\PTableB}}
  \immediate\write\@mainaux{\string\gdef\string\PTHeadSaved{\PTHead}}
  \immediate\write\@mainaux{\string\gdef\string\totalpointsSaved%
    {\arabic{totalpoints}}}
  \makeatother
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\subexercise}
% Subexercises are the subsection to section equivalent for exercises. In fact,
% their counters behave the same way as subsection counters do.
% \cmd{\subexercise}\oarg{Subexercise title} will make a new subexercise under the
% current exercise. Note that point counting for subexercises is not supported.
% Rather, points are only awarded on the exercise level. Therefore, subexercises
% are rather semantical for the exercise's reading flow.
%    \begin{macrocode}
\newcommand{\subexercise}[1][]{
  \penalty150
  \stepcounter{subexercisenumber}
  \par
  \vspace{0.5\baselineskip}
  {
    {\bfseries\GetTranslation{subexercise}\ (\alph{subexercisenumber})}
    \quad\ifstrempty{#1}{}{(#1)}
    \@subexerciseRules
  }
  \par
}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\def\Vhrulefill{\leavevmode\leaders\hrule height 0.7ex depth
\dimexpr0.4pt-0.7ex\hfill\kern0pt}
%    \end{macrocode}
% \begin{macro}{\exerciseRules}
% \begin{macro}{\subexerciseRules}
% To add line-spanning horizontal rules between exercises and subexercises,
% respectively, for better visual separation, add \cmd{\exerciseRules} add some
% point in the document before the first exercise.
%    \begin{macrocode}
\newcommand{\exerciseRules}{
  \renewcommand{\@exerciseRules}{\hspace{1em}\Vhrulefill} }
  \newcommand{\subexerciseRules}{
  \renewcommand{\@subexerciseRules}{\hspace{0em}\Vhrulefill} }
\newcommand{\@exerciseRules}{}
\newcommand{\@subexerciseRules}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\noPoints}
% To remove points and grading entirely from the
% document, add \cmd{\noPoints} at some point in the document before the first
% exercise. This overwrites the grading table macro and defines the exercise
% command to not count points.
%    \begin{macrocode}
\newcommand{\nopoints}{
  \renewcommand{\@pointsPerExercise}{}
  \renewcommand{\gradingtable}{}
  \renewcommand{\exercise}{\@exerciseNoPoints}
}
\newcommand{\@exerciseNoPoints}[1]{ 
  \def\points{0}
  \stepcounter{exercisenumber}
  \setcounter{subexercisenumber}{0}
  \par
  \vspace{1.5\baselineskip}
  { {\Large\bfseries\GetTranslation{exercise}\ \arabic{exercisenumber}}
    \@exerciseLabel{#1} \@exerciseRules }
  \par
}
%    \end{macrocode}
% \end{macro}
% \section{Document Title}
% The \texttt{csassignments} class offers several customizations to the default title of article.
% Namely, we can omit the default fields \cmd{\title}, \cmd{\author}, and \cmd{\date}, and 
% replace them with something more fitting to an assignment:
%    \begin{macrocode}
\newcommand{\@course}{Assignment}
\newcommand{\@sheet}{}
\newcommand{\@group}{}
\newcommand{\@prefixId}{\GetTranslation{studentId} }
\newcommand{\@members}{}
\newcommand{\@member}[2][]%
  {\notblank{#1}{#2, \notblank{#1}{\@prefixId{#1}}{} \\}{#2}}
\newcommand{\@due}{}
\newcommand{\@prefixAuthor}{\GetTranslation{prefixAuthor}}
\newcommand{\@prefixDate}{\GetTranslation{prefixDate}}
%    \end{macrocode}
% \begin{macro}{\course}
% \begin{macro}{\sheet}
% \begin{macro}{\group}
% \begin{macro}{\due}
% \begin{macro}{\member}
% Course name with \cmd{\course}\marg{Course}, sheet number with \cmd{\sheet}\marg{sheet number},
% group name with \cmd{\group}\marg{group name}, due date with \cmd{\due}\marg{due date},
% and all members of the group with repeated \cmd{\member}\oarg{student id}\marg{name}.
%    \begin{macrocode}
\newcommand{\course}[1]{\expandafter\notblank\expandafter{#1}%
  {\def\@course{#1}}{}}
\newcommand{\sheet}[1]{\def\@sheet{\GetTranslation{sheet} #1}}
\newcommand{\group}[1]{\renewcommand{\@group}{#1}}
\newcommand{\due}[1]{\renewcommand{\@due}{#1}}
\newcommand{\member}[2][]{
  \expandafter\renewcommand\expandafter\@members\expandafter
    {\@members\@member[#1]{#2}}
  \expandafter\renewcommand\expandafter\pdfmembers\expandafter
    {\pdfmembers\pdfmember[#1]{#2}}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\PrefixId}
% \begin{macro}{\PrefixAuthor}
% \begin{macro}{\PrefixDate}
% Additionally, you can redefine the prefixes prepended to the individual parts of the title, for example,
% the default (english) prefix for the members line in the title block is ``Handed in by'', which you can
% replace by using \cmd{\PrefixDate}\marg{custom due date prefix}.
%    \begin{macrocode}
\newcommand{\PrefixId}[1]{\renewcommand{\@prefixId}{#1}}
\newcommand{\PrefixAuthor}[1]{\renewcommand{\@prefixAuthor}{#1}}
\newcommand{\PrefixDate}[1]{\renewcommand{\@prefixDate}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
\renewcommand{\and}{\\}
\renewcommand{\maketitle}{
  \thispagestyle{empty}
  {\bfseries\Huge\@course}
  \par
  \expandafter\notblank\expandafter\@sheet{{\LARGE\@sheet\\}}{}
  \par
  \expandafter\notblank\expandafter\@members{
    {\footnotesize\bfseries\@prefixAuthor}\\
    \hspace*{4pt}{\large{\vspace*{4pt}\begin{tabular}[t]{@{}l}
    \@members
    \end{tabular}}}\\
  }{}
  \expandafter\notblank\expandafter\@due{
    {\footnotesize\bfseries\@prefixDate}\\
    \vspace*{4pt}{\hspace*{4pt}{\large\@due}}\\
  }{}
  \vskip \baselineskip
  \pagestyle{fancy}
}
\renewcommand{\headrulewidth}{1pt}
\setlength\headheight{4\baselineskip}
\rhead{
  \begin{tabular}{r}
    \textbf{\@course} \\
    \@sheet \\
    {\small\@due}
  \end{tabular}
}
\lhead{
  \small{%
    \begin{tabular}{l}
      \@members
    \end{tabular}%
  }
  }
%    \end{macrocode}
% 
% Lastly, the class handles PDF metadata creation using \texttt{hyperref} from the provided
% macros, i.e., \cmd{\course}, \cmd{\group} etc.
%    \begin{macrocode}
\newcommand{\@pdfauthorprefix}{\expandafter\notblank\expandafter%
  {\@group}{Group \@group: }{}\relax}
\newcommand{\pdfmembers}{}
\newcommand{\pdfmember}[2][]{\expandafter\notblank\expandafter%
  {#1}{#2, {#1};}{#2}}
\AtBeginDocument{\hypersetup{
  pdftitle = {\texorpdfstring{Assignment \@sheet}{}},
  pdfauthor = {\texorpdfstring{\@pdfauthorprefix\pdfmembers}{}},
  pdfsubject = {\texorpdfstring{\@course}{}}
}}
%    \end{macrocode}
%
% \section{Math Helpers}
%
% \texttt{csassignments} includes several frequently used macros for mathmode, that were,
% and still are, helpful with assignment work during several computer science courses.
% Most of them were originally created in one of the \textsc{AlphabetClasses} packages,
% which featured a lot more definitions.
%
% This class only contains a condensed version of them:
%
% \begin{macro}{\N}
% \begin{macro}{\Z}
% \begin{macro}{\R}
% \begin{macro}{\Q}
% \begin{macro}{\C}
% \begin{macro}{\F}
% \begin{macro}{\primefield}
% These macros define common number spaces and fields as double font in mathmode. Notably,
% \cmd{\primefield} makes a double-printed P, as notation for an arbitrary prime field.
%    \begin{macrocode}
\newcommand{\N}{\ensuremath{\mathbf{N}}}
\newcommand{\Z}{\ensuremath{\mathbf{Z}}}
\newcommand{\R}{\ensuremath{\mathbf{R}}}
\newcommand{\Q}{\ensuremath{\mathbf{Q}}}
\newcommand{\C}{\ensuremath{\mathbf{C}}}
\newcommand{\F}{\ensuremath{\mathbb{F}}}
\newcommand{\primefield}{\ensuremath{\mathbb{P}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\modring}
% Denoting a ring of integers modulo \(n\) is easily done in short notation with \cmd{\modring},
% see \(\mathbb{Z}/\!n\:\), which even works in regular text due to custom trailing spacing.
%    \begin{macrocode}
\newcommand{\modring}[2]{#1/\!#2\:}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\derivative}
% The \cmd{\derivative}\marg{variable} prints a typical \(\frac{d}{dx}\) as a shorthand macro.
% Notably it is not even shorter than the explicit fracture, it is just a convenience macro created
% at a time when writing \LaTeX for assignments was supported by semantic macros (a thing \LaTeX
% clearly lacks).
%    \begin{macrocode}
\newcommand{\derivative}[1]{\ensuremath{\frac{d}{d#1}}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\matadd}
% \begin{macro}{\matmul}
% \begin{macro}{\matswap}
% These macros are helpful when visualizing matrix operations, namely addition of rows,
% scalar multiplication of a row, and swapping of rows. Arguments of the macros are identical
% to the group operation's parameter.
%    \begin{macrocode}
\newcommand{\matadd}[3]{\ensuremath{\xmapsto{\mathrm{add}_{#1,#2,#3}}}}
\newcommand{\matmul}[2]{\ensuremath{\xmapsto{\mathrm{mul}_{#1,#2}}}}
\newcommand{\matswap}[2]{\ensuremath{\xmapsto{\mathrm{sw}_{#1,#2}}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% 
% \begin{macro}{\forall}
% \begin{macro}{\exists}
% To make logic quantors look a bit better, we redefine the ``for all'' and ``exists'' quantors with 
% a bit more horizontal space left and right
%    \begin{macrocode}
\renewcommand{\forall}{\ensuremath{\hskip 2pt \oforall \hskip 2pt}}
\renewcommand{\exists}{\ensuremath{\hskip 2pt \oexists \hskip 2pt}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\floor}
% \begin{macro}{\ceil}
% \begin{macro}{\abs}
% These are some commonly used mathematical functions, that is, rounding up or down, 
% and the absolute function of a value.
%    \begin{macrocode}
\newcommand{\ceil}[1]{\ensuremath{\left\lceil #1 \right \rceil}}
\newcommand{\floor}[1]{\ensuremath{\left\lfloor #1 \right \rfloor}}
\newcommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\rfrac}
% For inline math, regular fractions tend to either stretch the line height, 
% resulting in optical heterogeneity of multiple lines, or setting the letters 
% in the fraction so small that they become unreadable. For small, inline fractions,
% \cmd{\rfrac}\marg{numerator}\marg{denominator} offers a less optically noisy option,
% by setting the numerator and denominator in a diagonal arrangement, rahter than purely 
% vertical. Here are some examples: \({}^{1}\!/_{n}\), \({}^{2n}\!/_{k}\), \({}^{100}\!/_{4}\).
%    \begin{macrocode}
\newcommand{\rfrac}[2]{{}^{#1}\!/_{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mod}
% The macro defines the usual modulus function with a bit of extra space to the left and right.
%    \begin{macrocode}
\renewcommand{\mod}{\ \mathrm{mod}\ }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rel}
% To make a new, arbitrary relation, that is, a symbol for with \texttt{amsmath} ensures horizontal
% space left and right using \cmd{\mathrel}
%    \begin{macrocode}
\newcommand{\rel}[1]{\ensuremath{\mathrel{#1}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\QED}
% Ending a proof the way tought at RWTH Aachen University, with a square flushed to the right of
% the line, can be done by simply adding \cmd{\QED}.
% Note however that it is semantically more elegant to use \texttt{amsthm} with either predefined
% \texttt{proof} environment, or any custom environment, as these usually also handle adding a label
% to the block, e.g., ``\textbf{Proof}.'' or ``\textbf{Lemma}''.
%    \begin{macrocode}
\newcommand{\QED}{\hfill\(\square\)}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\newtheoremstyle{it}{3pt}{3pt}{}{}{\itshape}{:}{.5em}{}
\theoremstyle{it}
%    \end{macrocode}
%    \begin{macrocode}
\makeatother
%    \end{macrocode}
%
% \Finale
%
\endinput