-
Notifications
You must be signed in to change notification settings - Fork 0
/
customassignment.cls
197 lines (174 loc) · 7.45 KB
/
customassignment.cls
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
% Copyright 2024–present Lars Schütz
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Lars Schütz.
%
% This work consists of the file customassignment.cls.
\ProvidesClass{customassignment}[2024/09/05 v1.26 customassignment]
\newif\if@showsolutions\@showsolutionsfalse
\DeclareOption{showsolutions}{\@showsolutionstrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ProcessOptions\relax
\LoadClass[%
article,
11pt,
a4paper,
]{memoir}
%-------------------------------------------------------------------------------
% Packages
%-------------------------------------------------------------------------------
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amstext}
\RequirePackage{amsthm}
\RequirePackage{babel}
\RequirePackage{ccicons}
\RequirePackage{enumitem}
\RequirePackage{graphicx}
\RequirePackage{hyperref}
\RequirePackage{metalogo}
\RequirePackage{nicematrix}
\RequirePackage{pgfplots}
\RequirePackage{subcaption}
\RequirePackage{tcolorbox}
\RequirePackage{tikz}
\PassOptionsToPackage{math-style=ISO,bold-style=ISO}{unicode-math}
\RequirePackage[default]{fontsetup}
%-------------------------------------------------------------------------------
% Helpers
%-------------------------------------------------------------------------------
\NewDocumentCommand\resetstyle{}{\rmfamily\upshape\mdseries}
\NewDocumentCommand\hide{m}{\if@showsolutions#1\fi}
%-------------------------------------------------------------------------------
% Custom commands
%-------------------------------------------------------------------------------
\NewDocumentCommand\logo{}{Logo}
\NewDocumentCommand\course{}{Course}
\NewDocumentCommand\term{}{Term}
\NewDocumentCommand\docent{}{Docent}
\NewDocumentCommand\tas{}{Teaching assistant~1\\teaching assistant~2\\\ldots\\teaching assistant~$n$}
\NewDocumentCommand\sheetname{}{Assignment sheet}
\NewDocumentCommand\sheetnumber{}{1}
\NewDocumentCommand\assignmentname{}{Assignment}
\NewDocumentCommand\license{}{License}
\NewDocumentCommand\colophon{}{Colophon}
%-------------------------------------------------------------------------------
% Overall layout
%-------------------------------------------------------------------------------
\linespread{1.05}
\isopage[11]%
\setlrmargins{*}{*}{1}
\checkandfixthelayout
%-------------------------------------------------------------------------------
% Paragraphs
%-------------------------------------------------------------------------------
\setlength{\parindent}{0em}
\setlength{\parskip}{6pt}
%-------------------------------------------------------------------------------
% Pages
%-------------------------------------------------------------------------------
\NewDocumentCommand\licensestyle{}{\resetstyle\tiny}
\NewDocumentCommand\pagenumberstyle{}{\resetstyle\small}
\NewDocumentCommand\colophonstyle{}{\resetstyle\tiny}
\makeoddhead{plain}{}{\licensestyle\license}{}
\makeevenhead{plain}{}{\licensestyle\license}{}
\makeoddfoot{plain}{\colophonstyle\colophon}{}{\pagenumberstyle\thepage}
\makeevenfoot{plain}{\colophonstyle\colophon}{}{\pagenumberstyle\thepage}
%-------------------------------------------------------------------------------
% Title
%-------------------------------------------------------------------------------
\NewDocumentCommand\logostyle{}{}
\NewDocumentCommand\coursestyle{}{}
\NewDocumentCommand\termstyle{}{}
\NewDocumentCommand\titlestyle{}{}
\NewDocumentCommand\docentstyle{}{}
\NewDocumentCommand\tasstyle{}{}
\NewDocumentCommand\beforetitleskip{}{\bigskip\medskip}
\NewDocumentCommand\assignmenttitle{}{\sheetname~\sheetnumber}
\NewDocumentCommand\maketitlealpha{}{%
\RenewDocumentCommand\logostyle{}{\resetstyle\footnotesize}
\RenewDocumentCommand\coursestyle{}{\resetstyle\footnotesize}
\RenewDocumentCommand\termstyle{}{\resetstyle\footnotesize}
\RenewDocumentCommand\titlestyle{}{\resetstyle\LARGE\bfseries}
\RenewDocumentCommand\docentstyle{}{\resetstyle\footnotesize}
\RenewDocumentCommand\tasstyle{}{\resetstyle\footnotesize}
\begin{center}
{\logostyle\logo\\}
{\coursestyle\course\\}
{\termstyle\term\par}
{\docentstyle\docent\\}
{\tasstyle\tas\par}
{\titlestyle\beforetitleskip\assignmenttitle}
\end{center}
}
\RenewDocumentCommand\maketitle{}{\maketitlealpha}
%-------------------------------------------------------------------------------
% Sections
%-------------------------------------------------------------------------------
\maxsecnumdepth{subsection}
\renewcommand\thesection{\arabic{section}}
\setsecheadstyle{\large\bfseries\raggedright}
\setsubsecheadstyle{\normalsize\bfseries\raggedright}
\setsecnumformat{\assignmentname~\csname the#1\endcsname\quad}
%-------------------------------------------------------------------------------
% Captions
%-------------------------------------------------------------------------------
\NewDocumentCommand\floatcaptionstyle{}{\resetstyle\small}
\captionnamefont{\floatcaptionstyle}
\captiontitlefont{\floatcaptionstyle}
%-------------------------------------------------------------------------------
% Lists
%-------------------------------------------------------------------------------
\setlist{nosep}
\newlist{subtasks}{enumerate}{1}
\setlist[subtasks]{label=(\alph*),ref=\emph{\alph*},leftmargin=*}
%-------------------------------------------------------------------------------
% Solutions
%-------------------------------------------------------------------------------
\NewDocumentCommand\solutionname{}{Solution}
\NewDocumentEnvironment{solution}{+b}{%
\hide{%
\begin{tcolorbox}[
title=\solutionname,
colback=technikblau!3!basisweiss,
colframe=technikblau,
sharp corners
]
#1
\end{tcolorbox}
}
}{}
%-------------------------------------------------------------------------------
% Cross referencing
%-------------------------------------------------------------------------------
\NewDocumentCommand\abbrassignmentlabel{}{ass}
\NewDocumentCommand\abbrfigurelabel{}{fig}
\NewDocumentCommand\abbrtablelabel{}{tab}
\NewDocumentCommand\abbrequationlabel{}{eq}
\NewDocumentCommand\labass{m}{\label{\abbrassignmentlabel:#1}}
\NewDocumentCommand\labfig{m}{\label{\abbrfigurelabel:#1}}
\NewDocumentCommand\labtab{m}{\label{\abbrtablelabel:#1}}
\NewDocumentCommand\labeq{m}{\label{\abbrequationlabel:#1}}
\NewDocumentCommand\refass{m}{\assignmentname~\ref{\abbrassignmentlabel:#1}}
\NewDocumentCommand\reffig{m}{\figurename~\ref{\abbrfigurelabel:#1}}
\NewDocumentCommand\reftab{m}{\tablename~\ref{\abbrtablelabel:#1}}
\NewDocumentCommand\refeq{m}{(\ref{\abbrequationlabel:#1})}
%-------------------------------------------------------------------------------
% Translations
%-------------------------------------------------------------------------------
% It is important not to insert a space in the following statement,
% because otherwise it could end up in the header or footer when using
% \leftmark or \rightmark.
\addto\captionsngerman{%
\RenewDocumentCommand\assignmentname{}{Aufgabe}%
\RenewDocumentCommand\solutionname{}{Lösung}%
}