-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomework.cls
156 lines (111 loc) · 3.72 KB
/
homework.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{homework}[2014/12/16 Class file for homework assignments]
\LoadClassWithOptions{article}
% ----- Options ---------------------------------------------------------------
%\newcommand\@opnewpage{0}
%\DeclareOption{newpage}{\renewcommand\@opnewpage{1}}
%\newcommand\@oplargemargins{0}
%\DeclareOption{largemargins}{\renewcommand\@oplargemargins{1}}
%\ProcessOptions
% ----- Packages --------------------------------------------------------------
% Better fonts with accents
\RequirePackage[T1]{fontenc}
% Required for starred commands
\RequirePackage{suffix}
\RequirePackage{parskip}
% Math symbols
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amsthm}
\RequirePackage{amssymb}
\RequirePackage{centernot}
% Nice lists
\RequirePackage{enumerate}
\RequirePackage{enumitem}
% Nice images, figures, and listings
\RequirePackage{graphicx}
\RequirePackage{grffile}
\RequirePackage[all]{xy}
\RequirePackage{wrapfig}
\RequirePackage{fancyvrb}
\RequirePackage{listings}
% Conditionals
\RequirePackage{ifthen}
% Header & Page Setup
\RequirePackage{fancyhdr}
%\ifthenelse{\equal{\@oplargemargins}{1}}{}{\RequirePackage{fullpage}}
\RequirePackage{fullpage}
\RequirePackage[a4paper,
hmargin=1.5cm,
vmargin=1cm,
includeheadfoot]{geometry}
\setlength{\headheight}{12pt}
\addtolength{\headsep}{0.7cm}
\addtolength{\textheight}{-0.6cm}
% Links
\RequirePackage{hyperref}
% ----- Questions -------------------------------------------------------------
\newcounter{questionCounter}
\newcounter{partCounter}[questionCounter]
%
\WithSuffix\providecommand\assignment*{}
\WithSuffix\renewcommand\assignment*[1]{%
% Wrap in minipage so that we don't get a line break anywhere in between
\begin{minipage}{\linewidth}%
\setcounter{partCounter}{0}%
\vspace{.2in}%
\noindent{\bf \large Assignment #1}%
\vspace{0.3em} \hrule \vspace{.1in}%
\end{minipage}
}
% ----- Question Parts --------------------------------------------------------
\newenvironment{alphaparts}[0]{%
\begin{enumerate}[label=\textbf{(\alph{partCounter})}]%
}{\end{enumerate}}
\newenvironment{arabicparts}[0]{%
\begin{enumerate}[label=\textbf{\arabic{questionCounter}.\arabic{partCounter}})]%
}{\end{enumerate}}
\newcommand{\questionpart}[0]{\stepcounter{partCounter}\item}
% ----- Answer Box ------------------------------------------------------------
\newcommand{\answerbox}[1]{%
\begin{framed}
\vspace{#1}
\end{framed}}
% ----- Page Setup ------------------------------------------------------------
% Use block style paragraphs
\setlength{\parindent}{0pt}
%\setlength{\parskip}{5pt plus 1pt}
%\setlength{\parskip}{3pt plus 1pt}
\def\indented#1{\list{}{}\item[]}
\let\indented=\endlist
% ----- Title & Header --------------------------------------------------------
% \pagestyle{empty}
\pagestyle{fancy}
\newcommand{\mysetupheader}{
% Setup header
% \setlength{\headheight}{15.2pt}
% \setlength{\headsep}{0.2in}
\lhead{\hwclassshort{} -- \hwshorttitle{}}%
\rhead{\hwauthor{}}%
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
%\if\@opanon%
\renewcommand{\maketitle}[0]{%
\mysetupheader
% Setup hrule in header
\renewcommand{\headrulewidth}{0pt}
\headrule{}
% Don't put header on first page
\thispagestyle{plain}
\begin{center}
{\LARGE \hwtitle{}}
{\Large \hwclass{}}
Student: \hwauthor{} \hwauthorextra{}
\end{center}
\renewcommand{\headrulewidth}{0.4pt}
}
% ----- For usage with pandoc converted documents -----------------------------
\providecommand{\tightlist}{%
\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}}
% -----------------------------------------------------------------------------