Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.

Commit aeb0ce2

Browse files
committed
feat(iwork): refactor
1 parent 2665dbc commit aeb0ce2

File tree

1 file changed

+22
-110
lines changed

1 file changed

+22
-110
lines changed

iwork.cls

Lines changed: 22 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,29 @@
11
\NeedsTeXFormat{LaTeX2e}
2-
\ProvidesClass{iwork}[2022/03/12 Coursework Class]
2+
\ProvidesClass{iwork}[2022/10/20 Coursework Class]
33

4-
% load in the main exam class with appropriate options
5-
\LoadClass[a4paper]{exam}
4+
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{iarticle}}
5+
\ProcessOptions\relax
66

7-
\RequirePackage{amsmath}
8-
\RequirePackage{amssymb}
9-
\RequirePackage{amsthm}
10-
\RequirePackage{enumitem}
11-
\RequirePackage{etoolbox}
12-
\RequirePackage{float}
13-
\RequirePackage{hyperref}
14-
\RequirePackage{physics}
15-
\RequirePackage{siunitx}
16-
\RequirePackage{subcaption}
17-
\RequirePackage{tcolorbox}
18-
\RequirePackage{xcolor}
19-
\RequirePackage{xparse}
7+
\LoadClass{iarticle}
208

21-
\RequirePackage{cleveref}
9+
\fancyhead[L]{\small \thecourse}
10+
\fancyhead[C]{}
11+
\fancyhead[R]{\small \@date}
12+
\fancyfoot[L]{\small \thedepartment \\ \theemail}
13+
\fancyfoot[C]{}
14+
\fancyfoot[R]{Page \thepage{} of \,\pageref{LastPage}}
15+
\renewcommand{\headrulewidth}{0.4pt}
16+
\renewcommand{\footrulewidth}{0.4pt}
2217

23-
\AtBeginDocument{\RenewCommandCopy\qty\SI}
24-
25-
% space out the lines by 25% more than the default (basically 1.5 line spacing)
26-
\linespread{1.25}
27-
28-
% General thinking is that 12pt font, with 1.25 spread, black on white text,
29-
% gives a good readable document for most people. For those that benefit
30-
% from larger fonts many will be best zooming / expanding the document on
31-
% screen or simply printing enlarged on A3 as that will best preserve the
32-
% formatting rather than enlarging the font whilst still fitting into an A4
33-
% sized space. For those that benefit from a different background colour
34-
% this is likely easiest achieved if the document is on white and then
35-
% software or a film is used to change the white to cream, blue etc
36-
37-
% increase the printed page area width
38-
\extrawidth{0.5cm}
39-
40-
% increase header space on title page only
41-
\extraheadheight[2.0cm]{0cm}
42-
43-
% setup page headers/footers for first and subsequent pages
44-
\pagestyle{headandfoot}
45-
\lhead{}
46-
\chead[
47-
\bfseries \Large \@course \leavevmode \\
48-
\large Sheet \@sheetNumber \ Solutions \quad --- \quad \@semester \leavevmode \\
49-
\@title \leavevmode \\
50-
\ifstrempty{\@class}{}{\@class \quad} \ifstrempty{\@id}{}{\@id \quad} \@author
51-
]{}
52-
\rhead[]{\bfseries \@course: Sheet \@sheetNumber \ Solutions --- \@semester}
53-
\lfoot{\footnotesize \@department \leavevmode \\ \href{mailto:\@email}{\@email}}
54-
\cfoot{}
55-
\rfoot{Page \thepage{} of \numpages}
56-
\footrule
57-
58-
% define newcommands for user set page header details
59-
\title{}
60-
\author{Qin Li}
61-
\newcommand{\class}[1]{\def\@class{#1}}
62-
\newcommand{\id}[1]{\def\@id{#1}}
63-
\newcommand{\semester}[1]{\def\@semester{#1}}
64-
\newcommand{\course}[1]{\def\@course{#1}}
65-
\newcommand{\sheetNumber}[1]{\def\@sheetNumber{#1}}
66-
\class{未央-水木 02}
67-
\id{2020012872}
68-
\semester{Autumn Term 2022 -- 2023}
69-
\course{Course Name}
70-
\sheetNumber{0}
71-
72-
% define a command for user to set some contact info in the footer
73-
\newcommand{\department}[1]{\def\@department{#1}}
74-
\newcommand{\email}[1]{\def\@email{#1}}
75-
\department{Weiyang College, Tsinghua University}
76-
77-
78-
\hypersetup{
79-
colorlinks = true,
18+
\fancypagestyle{titlepage}{
19+
\pagestyle{fancy}
20+
\fancyhead[C]{}
8021
}
8122

82-
\tcbuselibrary{breakable, skins}
83-
\newcounter{probCounter}
23+
\newcounter{prob}
8424
\newtcolorbox[
8525
auto counter,
86-
use counter = probCounter,
26+
use counter = prob,
8727
]{prob}[1][]{
8828
title = {Problem \thetcbcounter. #1},
8929
colframe = blue!75!white,
@@ -94,44 +34,16 @@
9434
}
9535

9636
\theoremstyle{remark}
97-
\newtheorem*{ans}{{\color{blue} Answer}}
98-
\newtheorem*{sol}{{\color{blue} Solution}}
99-
\renewcommand{\proofname}{{\color{blue} Proof}}
100-
101-
\newcommand{\probNumber}[1][]{
102-
\ifstrempty{#1}{
103-
}{
104-
\setcounter{probCounter}{#1}
105-
\addtocounter{probCounter}{-1}
106-
}
107-
}
37+
\newtheorem*{sol}{\textcolor{blue}{Solution}}
38+
\renewcommand{\proofname}{\textcolor{blue}{Proof}}
10839

109-
\newlist{subprobs}{enumerate}{2}
110-
\newcommand{\subprobLabel}{\arabic*.}
111-
\setlist[subprobs]{label*=\subprobLabel}
112-
\newcommand{\subprob}[1][]{
113-
\ifstrempty{#1}{
114-
}{
115-
\setcounter{subprobsi}{#1}
116-
\addtocounter{subprobsi}{-1}
117-
}
118-
\item
119-
}
120-
\newenvironment{subsubprobs}{\begin{subprobs}}{\end{subprobs}}
121-
\newcommand{\subsubprob}[1][]{
122-
\ifstrempty{#1}{
123-
}{
124-
\setcounter{subprobsii}{#1}
125-
\addtocounter{subprobsii}{-1}
126-
}
127-
\item
128-
}
129-
130-
\newcommand{\image}[2][]{
40+
\DeclareDocumentCommand{\image}{O{} m}{
13141
\begin{figure}[H]
13242
\centering
13343
\includegraphics[height=0.3\linewidth]{assets/#2}
13444
\caption{#1}
13545
\label{fig:#2}
13646
\end{figure}
13747
}
48+
49+
\course{}

0 commit comments

Comments
 (0)