forked from florian-rabe/Teaching
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyhomeworks.sty
82 lines (71 loc) · 2.56 KB
/
myhomeworks.sty
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
%% package arguments
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=hw,prefix=hw@} % needed to override default values obtained from file name
\DeclareStringOption{course}
\DeclareStringOption{number}
\DeclareStringOption{date}
\DeclareStringOption{duedate}
\DeclareStringOption[before the lecture]{duetime}
\DeclareBoolOption{unpublished}
\DeclareBoolOption{solutions}
\ProcessKeyvalOptions*
%% standard packages
\RequirePackage{amsmath,amssymb}
\RequirePackage[hyphens]{url}
\RequirePackage{paralist}
\RequirePackage{comment}
\RequirePackage{listings}
\lstset{basicstyle=\ttfamily}
% counters
\newcounter{assignmentno}
\setcounter{assignmentno}{\hw@number}
\newcounter{problemno}
\setcounter{problemno}{1}
\newcommand{\assignment}{\arabic{assignmentno}}
%% formatting
\setlength{\parindent}{0pt}
\setlength{\parskip}{2pt}
\usepackage[top=2cm,bottom=2cm,left=2cm,right=2cm]{geometry}
\pagestyle{empty}
%% main commands
\ifhw@solutions
\newenvironment{solution}{\pagebreak[2]\vspace{.5cm}\hrule{\bf Solution:}}{\hrule\vspace{.5cm}}
\else
\excludecomment{solution}
\fi
%% \header
\newcommand{\header}{
\hw@course \hfill Homework \assignment\\
Jacobs University Bremen \hfill given: \hw@date\\
Dr. Florian Rabe \hfill %due: \hw@due
\begin{center}
{\Large Homework \assignment\hspace{0.3cm}\\}
\vspace{.5cm}
You have to submit your solutions as announced in the lecture.\\
\textbf{Unless mentioned otherwise, all problems are due \hw@duedate, \hw@duetime.}\\
There will be no deadline extensions unless mentioned otherwise in the lecture.
\end{center}
\vspace{.5cm}
\hrule
\vspace{.5cm}
\ifhw@unpublished
\begin{center}
\textbf{This homework is not published yet. I may still change it before publishing it.}
\end{center}
\vspace{.5cm}
\hrule
\vspace{.5cm}
\fi
}
\newenvironment{problem}[2]{
\pagebreak[2]
~\\
{\large \textbf{Problem \arabic{assignmentno}.\arabic{problemno}} \hspace{0.2cm}\textit{#1}} \hfill Points: #2\refstepcounter{problemno}\vspace{2pt}\\}
{\bigskip}
%% {\bf Problem F.\arabic{problem}:} \textit{#1} \hfill (#2 point\ifthenelse{#2=1}{}{s})\refstepcounter{problem}}\\
\newcommand{\bonus}[2]{
\pagebreak[2]
~\\
{\large \textbf{Bonus Problem \arabic{assignmentno}.\arabic{problemno}} \hspace{0.2cm}\textit{#1}} \hfill (#2 bonus point\ifthenelse{#2=1}{}{s})\refstepcounter{problemno}\vspace{2pt}\\}
%% {\bf Problem F.\arabic{problem}:} \textit{#1} \hfill (#2 point\ifthenelse{#2=1}{}{s})\refstepcounter{problem}}\\
\newenvironment{hint}{\vspace{.5cm}\hrule \textbf{Hint:}}{\hrule\medskip}