-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmhomework.cls
73 lines (61 loc) · 1.6 KB
/
gmhomework.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
%GMHomework.cls is a LaTeX document class for formatting homework.
%2016-02-01 Grant Moyer <[email protected]>
\ProvidesClass{gmhomework}[2016/02/01 version 0.1 GMHomework]
\NeedsTeXFormat{LaTeX2e}
%Pass options to article class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax
%Use article class
\LoadClass{article}
%Set margins
\RequirePackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
%define course
\def\@course{}
\newcommand{\course}[1]{\def\@course{#1}}
%define assignment
\def\@assignment{}
\newcommand{\assignment}[1]{\def\@assignment{#1}}
%define date
\def\@date{\today}
%Set headers and footers
\RequirePackage{fancyhdr}
\RequirePackage{datetime2}
\fancypagestyle{gmhomework}{
\fancyhf{} %clear fields
\fancyhead[LE,LO]{\@author}
\fancyhead[CE,CO]{ % hyphen only if both course and assignment present
\if\relax\@course\relax
\if\relax\@assignment\relax
\else
\@assignment
\fi
\else
\if\relax\@assignment\relax
\@course
\else
\@course\ ---\ \@assignment
\fi
\fi
}
\fancyhead[RE,RO]{\@date}
\fancyfoot[CE,CO]{\thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
}
\pagestyle{gmhomework}
%Set up problem commands
\RequirePackage{enumitem}
\newenvironment{problem}[1]{
\noindent
\textbf{\Large Problem #1}\vspace{\topsep}\nobreak\@afterheading\
\begin{description}[leftmargin=*,labelindent=\parindent]
}{
\end{description}
\vspace{5ex}
}
\renewcommand{\part}[1]{
\item[#1]
}
\newcommand{\solution}{
\item[Solution] \hfill \\*
}