forked from simurgh9/hw
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhomework.cls
58 lines (51 loc) · 1.83 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
%% homework.cls Copyright (C) 2020 Ahmad Tashfeen
%% This program comes with ABSOLUTELY NO WARRANTY.
%% This is free software, and you are welcome to
%% redistribute it under certain conditions; read
%% file COPYING for more details.
% Put in /usr/local/texlive/texmf-local/tex/latex/local
% And then re-index, see: tex.stackexchange.com/q/1137/215221
% Latex documentation: https://en.wikibooks.org/wiki/LaTeX
% 'em' is the horizontal space unit and 'ex' is the vertical
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{homework}[2023/01/01 Homework]
\def\hw@ptsize{12pt} % https://tex.stackexchange.com/a/634138/215221
\DeclareOption{10pt}{\def\hw@ptsize{10pt}}
\DeclareOption{11pt}{\def\hw@ptsize{11pt}}
\DeclareOption{12pt}{\def\hw@ptsize{12pt}}
\def\hw@side{oneside}
\DeclareOption{oneside}{\def\hw@side{oneside}}
\DeclareOption{twoside}{\def\hw@side{twoside}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{amsart}}
\ProcessOptions\relax
\LoadClass[\hw@ptsize, \hw@side]{amsart}
\RequirePackage[margin=0.5in]{geometry}
\RequirePackage{lmodern, enumitem, needspace} % needspace for dynamic line breaking
\RequirePackage{hyperref} % for pdf bookmarks, other information and org-mode
\RequirePackage{ifthen}
\RequirePackage{hwsymb, hwlst, hwcmd} % tashfeen's
\hypersetup {
pdfstartview=FitH,
colorlinks=true
}
\AtBeginDocument{
\hypersetup {
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\@class}
}
}
\gdef\@author{\empty}
\gdef\@class{\empty}
\newcommand{\class}[1]{\gdef\@class{#1}}
\renewcommand{\author}[1]{\gdef\@author{#1}}
\renewcommand{\maketitle} {%
\noindent\ifthenelse{\equal{\@author}{\empty}}{}{\@author\par}%
\noindent\ifthenelse{\equal{\@class}{\empty}}{}{\@class\par}%
\noindent\@date\par
\addvspace{\medskipamount}%
\begin{center}\unskip%
\textbf{\@title}%
\end{center}%
\addvspace{\medskipamount}%
}