-
Notifications
You must be signed in to change notification settings - Fork 5
/
style.tex
216 lines (175 loc) · 7.82 KB
/
style.tex
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cleese Assignment
% Structure Specification File
% Version 1.0 (27/5/2018)
%
% This template originates from:
% http://www.LaTeXTemplates.com
%
% Author:
% Vel (vel@LaTeXTemplates.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\usepackage{lastpage} % Required to determine the last page number for the footer
\usepackage{graphicx} % Required to insert images
\setlength\parindent{0pt} % Removes all indentation from paragraphs
\usepackage[most]{tcolorbox} % Required for boxes that split across pages
\usepackage{booktabs} % Required for better horizontal rules in tables
\usepackage{listings} % Required for insertion of code
\usepackage{etoolbox} % Required for if statements
\usepackage{geometry} % Required for adjusting page dimensions and margins
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{fancyhdr} % Required for customising headers and footers
\usepackage{xspace}
\usepackage{booktabs}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}
\newcommand{\ie}{i.e.\@\xspace}
\newcommand{\eg}{e.g.\@\xspace}
\newcommand{\notemark}[1]{\textcolor{blue}{N.B.\ \emph{#1}}}
\newcommand{\noteself}[1]{\textcolor{red}{Thought: \emph{#1}}}
\newcommand{\note}[1]{\emph{\textbf{N.B.}\@\xspace#1}}
\newcommand{\hint}[1]{\emph{Hint: #1}}
\newcommand{\half}{$\frac{1}{2}$ }
\newbool{clearnext} %Running Counter to see if clearing the page or not in the next subquestion.
\newbool{clearon} %Parameter for specifying whether we will be clearing or not.
\newbool{authoron} %Parameter to specify whether to show author or not
%----------------------------------------------------------------------------------------
% Standard Template
%----------------------------------------------------------------------------------------
\geometry{
paper=a4paper, % Change to letterpaper for US letter
top=3cm, % Top margin
bottom=3cm, % Bottom margin
left=2.5cm, % Left margin
right=2.5cm, % Right margin
headheight=14pt, % Header height
footskip=1.4cm, % Space from the bottom margin to the baseline of the footer
headsep=1.2cm, % Space from the top margin to the baseline of the header
%showframe, % Uncomment to show how the type block is set on the page
}
\pagestyle{fancy} % Enable custom headers and footers
%----------------------------------------------------------------------------------------
% My Changes
%----------------------------------------------------------------------------------------
\lhead{\small\assignmentClass}
\chead{}
\ifbool{authoron}{\rhead{\small{\assignmentAuthorName}}}{\rhead{}}
\lfoot{} % Left footer
\cfoot{} % Centre footer
\rfoot{\small Page\ \thepage\ of\ \pageref{LastPage}} % Right footer
\renewcommand\headrulewidth{0.5pt} % Thickness of the header rule
%----------------------------------------------------------------------------------------
% MODIFY SECTION STYLES
%----------------------------------------------------------------------------------------
\usepackage{titlesec} % Required for modifying sections
%------------------------------------------------
% Section
\titleformat
{\section} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\Large\bfseries} % Format of the whole section
{\assignmentQuestionName~\thesection} % Format of the section label
{6pt} % Space between the title and label
{} % Code before the label
\titlespacing{\section}{0pt}{0.5\baselineskip}{0.5\baselineskip} % Spacing around section titles, the order is: left, before and after
%------------------------------------------------
% Subsection
\titleformat
{\subsection} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{} % Format of the whole section
{[\arabic{section}.\arabic{subsection}]} % Format of the section label (\alph{subsection})
{4pt} % Space between the title and label
{} % Code before the label
\titlespacing{\subsection}{0pt}{0.5\baselineskip}{0.5\baselineskip} % Spacing around section titles, the order is: left, before and after
\renewcommand\thesubsection{(\alph{subsection})}
%----------------------------------------------------------------------------------------
% CUSTOM QUESTION COMMANDS/ENVIRONMENTS
%----------------------------------------------------------------------------------------
% Environment to be used for each question in the assignment
\newenvironment{question}[1]{
\ifbool{clearon}{\clearpage}{}
\global\setbool{clearnext}{false}
\vspace{0.5\baselineskip} % Whitespace before the question
\section{: #1}
\lfoot{\small\itshape\assignmentQuestionName~\thesection~continued on next page\ldots} % Set the left footer to state the question continues on the next page, this is reset to nothing if it doesn't (below)
}{
\lfoot{} % Reset the left footer to nothing if the current question does not continue on the next page
}
%------------------------------------------------
% Environment for inter-subquestion texts (no arguments)
\newenvironment{interquestiontext}{
\ifbool{clearon}{\ifbool{clearnext}{\clearpage}{}}{}
\global\setbool{clearnext}{false}
}{
}
%------------------------------------------------
%------------------------------------------------
% Environment for subquestions, takes 1 argument - the name of the section
\newenvironment{subquestion}[1]{
\ifbool{clearon}{\ifbool{clearnext}{\clearpage}{}}{}
\global\setbool{clearnext}{true}
\subsection{#1}
}{
}
%------------------------------------------------
% Command to print a question sentence
\newcommand{\questiontext}[1]{
\textbf{#1}
\vspace{0.5\baselineskip} % Whitespace afterwards
\global\setbool{clearnext}{false}
}
%------------------------------------------------
% Command to print a Marking Scheme box.
\newcommand{\marking}[1]{
\begin{tcolorbox}[colback=green!5!white,enhanced]
\textbf{Marking Scheme:}#1
\end{tcolorbox}
}
%------------------------------------------------
% Command to print a box that breaks across pages with the space for a student to answer
\newcommand{\model}[1]{
\begin{tcolorbox}[enhanced]
\textbf{Model Answer}:#1
\end{tcolorbox}
}
\newcommand{\answerbox}[2]{
\begin{tcolorbox}[enhanced, height=#1]
#2
\end{tcolorbox}
}
%------------------------------------------------
% Command to print an assignment section title to split an assignment into major parts
\newcommand{\assignmentSection}[1]{
{
\centering % Centre the section title
\vspace{2\baselineskip} % Whitespace before the entire section title
\rule{0.8\textwidth}{0.5pt} % Horizontal rule
\vspace{0.75\baselineskip} % Whitespace before the section title
{\LARGE \MakeUppercase{#1}} % Section title, forced to be uppercase
\rule{0.8\textwidth}{0.5pt} % Horizontal rule
\vspace{\baselineskip} % Whitespace after the entire section title
}
}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\title{
\thispagestyle{empty} % Suppress headers and footers
\vspace{0.01\textheight} % Whitespace before the title
\textbf{\assignmentClass:\\ \assignmentTitle}\\[4pt]
\ifbool{authoron}{\assignmentAuthorName}{
\ifdef{\assignmentDueDate}{{\small Due\ on\ \assignmentDueDate}\\}{}
{\large \textit{\assignmentWarning}}
\vspace{0.01\textheight}} % Whitespace before the author name
}
\ifbool{authoron}{\author{Student: \textbf{\assignmentAuthorName}}}{}
\date{} % Don't use the default title page date field