forked from 132nd-vWing/132-DOC-108
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path108th.cls
453 lines (354 loc) · 13.2 KB
/
108th.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
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
%-------------------------------------------------------------------------------
% Main Info
%-------------------------------------------------------------------------------
\ProvidesClass{108th}[2022/01/30 v1.0 108th Document Class]
\NeedsTeXFormat{LaTeX2e}
% Inherit options of article
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}
}
\ProcessOptions
\LoadClass{article}
%-------------------------------------------------------------------------------
% 3rd party libs
%-------------------------------------------------------------------------------
% Required for font / color management
\RequirePackage[quiet]{fontspec}
\RequirePackage[table]{xcolor}
% Letter spacing
\defaultfontfeatures{LetterSpace=-1.3, Scale=0.80}
\linespread{1.01}
% margins etc
\RequirePackage{geometry}
% nicely referenced sections
\RequirePackage{nameref}
% Drawing
\RequirePackage{tikz}
\usetikzlibrary{fadings} % Anchoring / east west etc.
\RequirePackage[export]{adjustbox}
% titleps from titlesec for nice heading styles with links
\RequirePackage[pagestyles]{titlesec}
\RequirePackage{titletoc}
\RequirePackage[title]{appendix}
\RequirePackage[hidelinks]{hyperref}
% Nice fancy headers / Footers (and page numbers)
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
% EnumItem titles
\RequirePackage[shortlabels]{enumitem}
% Wrapping Figures
\RequirePackage{wrapfig}
% aligning images
\RequirePackage{graphbox}
% Nicer tables, and for specialrule, and coloring said specialrule, and makecell for pretty contents top aligned
\RequirePackage{tabularx}
\RequirePackage{booktabs}
\RequirePackage{colortbl}
\RequirePackage{makecell}
% For FP math (used in \sidebyside)
\RequirePackage[nomessages]{fp}
% For nice fractions
\RequirePackage{xfrac}
% adjustwidth
\RequirePackage{changepage}
% Needed for matchign appendicies
\RequirePackage{etoolbox}
%-------------------------------------------------------------------------------
% Fonts
%-------------------------------------------------------------------------------
\newfontfamily\fontbody{Open Sans}
\newfontfamily\fontsection{Open Sans Light}
%-------------------------------------------------------------------------------
% COLORS
%-------------------------------------------------------------------------------
\definecolor{body}{rgb}{0, 0, 0}
\definecolor{rule}{rgb}{0.5,0.5,0.5}
\definecolor{footerpage}{rgb}{.329,.553,.831}
%-------------------------------------------------------------------------------
% TITLE PAGE HELPERS
%-------------------------------------------------------------------------------
\newcommand{\version}[1]{\makeatletter\def\@version{#1}\makeatother}
\newcommand{\subtitle}[1]{\makeatletter\def\@subtitle{#1}\makeatother}
\newcommand{\summary}[1]{\makeatletter\def\@summary{#1}\makeatother}
\newcommand{\objectives}[1]{\makeatletter\def\@objectives{#1}\makeatother}
\newcommand{\trainee}[1]{\makeatletter\def\@trainee{#1}\makeatother}
\newcommand{\instructor}[1]{\makeatletter\def\@instructor{#1}\makeatother}
\newcommand{\evaluation}[1]{\makeatletter\def\@evaluation{#1}\makeatother}
\newcommand{\appliesto}[1]{\makeatletter\def\@appliesto{#1}\makeatother}
\newcommand{\type}[1]{\makeatletter\def\@type{#1}\makeatother}
\newcommand{\published}[1]{\makeatletter\def\@published{#1}\makeatother}
\newcommand{\owner}[1]{\makeatletter\def\@owner{#1}\makeatother}
\newcommand{\acknowledgements}[1]{\makeatletter\def\@acknowledgements{#1}\makeatother}
\newcommand{\changes}[1]{\makeatletter\def\@changes{#1}\makeatother}
%-------------------------------------------------------------------------------
% References
%-------------------------------------------------------------------------------
% Reference to include chapter and title
\newcommand*{\fullref}[1]{%
\hyperref[{#1}]{\underline{\autoref*{#1}: \nameref*{#1}}}} % One single link
\def\sectionautorefname{Section}
\def\subsectionautorefname{Section}
\def\subsubsectionautorefname{Section}
%-------------------------------------------------------------------------------
% Commands
%-------------------------------------------------------------------------------
% We have a lot of 132nd / 108th and since we can't have numbers in commands
% we use nd / th instead (th is originally for thorn but we won't be needing
% that
\newcommand{\nd}{{\fontsize{9pt}{1em}\fontbody nd }}
\renewcommand{\th}{{\fontsize{9pt}{1em}\fontbody th }}
% approx
\renewcommand{\textapprox}{\raisebox{0.9ex}{\texttildelow}}
% Rule Colors
\let\old@rule\@rule
\def\@rule[#1]#2#3{\textcolor{rule}{\old@rule[#1]{#2}{#3}}}
% Underline Links
\let\oldhref\href
\renewcommand\href[2]{\underline{\oldhref{#1}{#2}}}
% Nice little boxed section
% Make parboxes have a nice parskip
\let\oldparbox\parbox
\let\parskip\parskip
\renewcommand\parbox[3][c]{\oldparbox[#1]{#2}{\setlength{\parskip}{1em}#3}}
\newcommand{\boxed}[2][]{%
\noindent\fbox{%
\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{
\if\relax\detokenize{#1}\relax {} \else \leavevmode\color{#1} \fi
#2
}%
}
}
% Circled numbers etc.
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=1pt] (char) {#1};}}
%-------------------------------------------------------------------------------
% Section Heading Formatting
%
% \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
%-------------------------------------------------------------------------------
% Start a new page for each section
\newcommand{\sectionbreak}{\clearpage}
% more subsections
\setcounter{secnumdepth}{4}
% General format of <number>. Title
\titlelabel{\thetitle.\hskip0.25em\relax}
% SECTION
\titlespacing{\section}{0pt}{0em}{-.5em}
\titleformat*{\section}
{\fontsize{16pt}{1em}\color{black!50}\fontsection}
% SUBSECTION
\titlespacing{\subsection}{0pt}{0em}{-.5em}
\titleformat{\subsection}
{\fontsize{11.5pt}{1em}\color{black!50}\fontsection\itshape}
{\thetitle\hskip0.25em\relax}
{10pt}{}{}
\titleformat{name=\subsection,numberless}
{\addtocounter{subsection}{1}\fontsize{11.5pt}{1em}\color{black!50}\fontsection\itshape}
{\thetitle\hskip0.25em\relax}
{0pt}{}{}
% SUBSUB SECTION is identical to subsection
\titlespacing{\subsubsection}{0em}{0em}{-0.5em}
\titleformat{\subsubsection}
{\fontsize{11.5pt}{1em}\color{black!50}\fontsection\itshape}
{\thetitle\hskip0.25em\relax}
{0pt}{}{}
\titleformat{name=\subsubsection,numberless}
{\addtocounter{subsubsection}{1}\fontsize{11.5pt}{1em}\color{black!50}\fontsection\itshape}
{\thetitle\hskip0.25em\relax}
{0pt}{}{}
%-------------------------------------------------------------------------------
% TOC Formatting
%-------------------------------------------------------------------------------
\renewcommand\contentsname{Table of Contents\vspace{0.5em}}
\titlecontents{section}[1.7em] % left margin
{\vspace{-.75\parskip}} % above code
{\contentslabel[\thecontentslabel.]{1.7em}} % numbered format
{} % unnumbered
{\hfill\contentspage} % filler-page-format
\titlecontents{subsection}[3.2em] % left margin
{\vspace{-.75\parskip}} % above code
{\contentslabel[\thecontentslabel~]{2.5em}} % numbered format
{} % unnumbered
{\hfill\contentspage} % filler-page-format
\titlecontents{subsubsection}[4.9em] % left margin
{\vspace{-.75\parskip}} % above code
{\contentslabel[\thecontentslabel~]{3.5em}} % numbered format
{} % unnumbered
{\hfill\contentspage} % filler-page-format
%-------------------------------------------------------------------------------
% TOC APPENDIX FORMATTING
%-------------------------------------------------------------------------------
% TOC spacing
\renewcommand{\appendixtocname}{List of appendices\vspace{0.5em}}
\patchcmd{\appendices}{\quad}{: }{}{}
\let\oldappendix\appendices
\renewcommand{\appendices}{%
\clearpage
\renewcommand{\thesection}{\Roman{section}}
% From now, everything goes to the app - file and not to the toc
\let\tf@toc\tf@app
\addtocontents{app}{\protect\setcounter{tocdepth}{1}}
\immediate\write\@auxout{%
\string\let\string\tf@toc\string\tf@app^^J
}
\oldappendix
}%
\newcommand{\listofappendices}{%
\begingroup
\renewcommand{\contentsname}{\appendixtocname}
\let\@oldstarttoc\@starttoc
\def\@starttoc##1{\@oldstarttoc{app}}
\tableofcontents% Reusing the code for \tableofcontents with different
%\contentsname and different file handle app
\endgroup
}
%-------------------------------------------------------------------------------
% FOOTER
%-------------------------------------------------------------------------------
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[R]{%
%\vskip-14pt%
\fontsize{11.5pt}{1em}\fontbody{\color{footerpage}Page} \thepage~|
\pageref{LastPage}
}
%-------------------------------------------------------------------------------
% Title Page
%-------------------------------------------------------------------------------
\renewcommand\maketitle{%
\begin{titlepage}
{
\centering
\fontsize{40pt}{0em}\fontbody
\noindent\rule{\linewidth}{0.75pt}\\[.25em]
\makeatletter\@title\makeatother\\[.25em]
\fontsize{16pt}{0em}\fontbody
\noindent\rule{\linewidth}{0.75pt}\\[0.5em]
\fontsize{16pt}{1.3em}\fontbody
\makeatletter\@subtitle\makeatother\\[15pt]
\includegraphics[width=2in]{132nd_Logo_new_trans}\\
\vfill
\fontsize{11.5pt}{1em}\fontbody
\href{www.132virtualwing.org}{www.132virtualwing.org}\\
This work is licensed under a
\href{https://creativecommons.org/licenses/by-sa/3.0/}{Creative
Commons Attribution-ShareAlike 3.0 Unported License}.
}
\end{titlepage}
}
\def\changes{}
\newcommand\change[2]{
\expandafter\def\expandafter\changes\expandafter{%
\changes
#1: & #2 \\
}
}
\newcommand\metatable{
\newpage
{
\makeatletter
\setlength{\parsep}{1em}
\fontsize{28pt}{0em}\fontbody
\@title
\fontsize{11.5pt}{0.7em}\fontbody
\rowcolors{2}{white}{gray!10}
\begin{tabularx}{\textwidth}{ r!{\color{black!50}\vrule width 1pt}X }
{\color{black!50}APPLIES TO:} & \textbf{\@appliesto} \\
\arrayrulecolor{black!50}\specialrule{0.1em}{0em}{0em}
{\color{black!50}TYPE:} & \textbf{\@type} \\
{\color{black!50}VERSION:} & \@version \\
{\color{black!50}PUBLISHED:} & \@published \\
{\color{black!50}DOCUMENT RESPONSIBLE:} & \@owner \\
{\color{black!50}ACKNOWLEDGEMENTS:} & \@acknowledgements \\
{\color{black!50}SUMMARY OF CHANGES:} & {
\setlength\parskip{0em}
\setlength{\tabcolsep}{0.25em}
\fontsize{11.5pt}{1.2em}\fontbody
\def\arraystretch{1.3}
\vspace*{-1.2em} % This is important to space it correctly...weirdly
\begin{tabularx}{\linewidth}{rX}
\changes
\end{tabularx}
}
\end{tabularx}
\makeatother
}
}
\newcommand\sidebyside[3]{
\FPeval{\secondpage}{round(1-#1-0.05,3)}
\begin{minipage}[t]{#1\textwidth}
#2
\end{minipage}\hfill
\begin{minipage}[t]{\secondpage\textwidth}
#3
\end{minipage}
}
%-------------------------------------------------------------------------------
% LISTS / ENUMERATIONS
%-------------------------------------------------------------------------------
\SetLabelAlign{LeftAlignWithIndent}{\makebox[0em][l]{#1}}
\newenvironment{orderedlist}[1][]
{%
\begin{enumerate}[%
leftmargin=*,
labelsep=1.25em,
align=LeftAlignWithIndent,
label={\fontsize{11.5pt}{1.25em}\color{black!50}\fontbody{\ifx\\#1\\
\theenumi. \else #1.\theenumi \fi}}
]
% These spacings make for easier to read multiline lists
\setlength\itemsep{-0.2em}
\fontsize{11.5pt}{1.2em}\fontbody
}
{\end{enumerate}}
\newenvironment{sectionenumerate}
{\begin{orderedlist}[\thesection]}
{\end{orderedlist}}
\newenvironment{subsectionenumerate}
{\begin{orderedlist}[\thesubsection]}
{\end{orderedlist}}
\newenvironment{subsubsectionenumerate}
{\begin{orderedlist}[\thesubsubsection]}
{\end{orderedlist}}
\let\tempone\itemize
\let\temptwo\enditemize
\renewenvironment{itemize}{%
%\setlength\parskip{.25em}
\tempone[noitemsep,topsep=0pt,partopsep=0pt]
%\setlength{\itemsep}{1pt}
%\setlength{\parsep}{0pt}
}{\temptwo}
% Set 2nd indent to stars
\setlist[itemize,2]{label={$\circ$}}
%-------------------------------------------------------------------------------
% FORMAT
%-------------------------------------------------------------------------------
\newcommand\narrow[1]{
\begin{indentblock}
#1
\end{indentblock}
}
\newenvironment{indentblock}{%
\begin{adjustwidth}{.5in}{.5in}
}{%
\end{adjustwidth}
}
%-------------------------------------------------------------------------------
% GENERAL INIT
%-------------------------------------------------------------------------------
\geometry{top=1in,left=0.75in,right=0.75in,bottom=1in}
%\setlength{\headsep}{0mm}
\setlength{\parindent}{0mm}
\setlength{\parskip}{1em}
\setmainfont{Open Sans}
\fontsize{11.5pt}{1em}\fontbody
\pagestyle{fancy}
% We don't want hyphenation, so allow more whitespace
\hyphenpenalty=10000
\tolerance=9999
% Store the above for minipage
\newcommand{\@minipagerestore}{%
\setlength{\parindent}{0mm}
\setlength{\parskip}{1em}
\hyphenpenalty=10000
}