-
Notifications
You must be signed in to change notification settings - Fork 4
/
SUSTechHomework.cls
102 lines (86 loc) · 2.48 KB
/
SUSTechHomework.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
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8
% !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{SUSTechHomework}[2019/03/09 SUSTech Homework LaTeX class]
\LoadClass[a4paper]{article}
\RequirePackage{newpxtext,newpxmath}
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{amsmath}
\RequirePackage{listings}
\RequirePackage{xeCJK}
\RequirePackage[T1]{fontenc}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\RequirePackage{booktabs}
\RequirePackage{parskip}
\RequirePackage[hidelinks]{hyperref}
% \RequirePackage{courier}
\RequirePackage{inconsolata}
% \DeclareOption{titlepage}{}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\def\sid#1{\gdef\@sid{#1}}
\def\@sid{\@latex@error{No \noexpand\sid given}\@ehc}
\def\coursename#1{\gdef\@coursename{#1}}
\def\@coursename{\@latex@error{No \noexpand\coursename given}\@ehc}
\def\coursecode#1{\gdef\@coursecode{#1}}
\def\@coursecode{\@latex@error{No \noexpand\coursecode given}\@ehc}
\def\univ#1{\gdef\@univ{#1}}
\def\@univ{\@latex@error{No \noexpand\univ given}\@ehc}
\univ{SUSTech}
\geometry{
left=.85in,
right=.85in,
top=1in,
bottom=.8in,
bindingoffset=.15in
}
\setlength{\parindent}{0pt}
\renewcommand{\baselinestretch}{1.1}
\newcommand{\mktitle}{
\noindent\makebox[\linewidth]{
\begin{minipage}[b]{.7\linewidth}
{\Large\textsf{\@coursecode~$\cdot$~\@coursename}}\\\\
{\Huge\textbf\@title}
\end{minipage}\hfill
\begin{minipage}[b]{.3\linewidth}
\large\begin{flushright}
\@author~/~\@sid\\
\vspace{.5em}
\@date
\end{flushright}
\end{minipage}
}
\noindent\rule{\linewidth}{1.5pt}
\if@twocolumn\vspace{.5em}\fi
\thispagestyle{empty}
}
\if@twocolumn
\renewcommand{\maketitle}{\twocolumn[\mktitle]}
\else
\renewcommand{\maketitle}{\mktitle}
\fi
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.3pt}
\if@twoside
\fancyhead[EL,OR]{\thepage~/~\pageref{LastPage}}
\fancyhead[EC]{\textsc{\@coursename}}
\fancyhead[ER]{\@title}
\fancyhead[OL]{\@univ~$\circ$~\@coursecode}
\fancyhead[OC]{\textsc{\@author $\cdot$ \@sid}}
\else
\lhead{\textsc{\@author $\cdot$ \@sid}}
\chead{\textsc{\@coursename~$\circ$~\@title}}
\rhead{\thepage~/~\pageref{LastPage}}
\fi
\lstset{
numbers=left,
basicstyle=\ttfamily,
frame=shadowbox,
columns=flexible,
xleftmargin=1.5em,
xrightmargin=1em
}