-
Notifications
You must be signed in to change notification settings - Fork 0
/
LegrandOrangeBook.cls
executable file
·745 lines (604 loc) · 33.8 KB
/
LegrandOrangeBook.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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The Legrand Orange Book
% LaTeX Class
% Version 3.1 (February 18, 2022)
%
% Authors:
% Vel ([email protected])
% Mathias Legrand ([email protected])
%
% This class originates from:
% https://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% CLASS CONFIGURATION
%----------------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{LegrandOrangeBook}[2022/01/26 The Legrand Orange Book Class v3.0]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} % Pass through any options to the base class
\ProcessOptions\relax % Process given options
\LoadClass{book} % Load the base class
%----------------------------------------------------------------------------------------
% REQUIRED PACKAGES AND CONFIGURATIONS
%----------------------------------------------------------------------------------------
\usepackage{graphicx} % Required for including pictures
\graphicspath{{Images/}} % Specifies the directory where pictures are stored
\usepackage{float} % Allows more precisely positioning floats e.g. \begin{figure}[H]
\usepackage[usenames, svgnames, table]{xcolor} % Required for defining and using custom colors
\usepackage{calc} % For simpler calculations - used for spacing the index letter headings correctly
\usepackage{changepage} % Required for temporarily indenting text blocks
\usepackage[toc]{appendix} % Required for the appendices chapters
\usepackage{etoolbox} % Required for conditional logic and easily changing commands
%----------------------------------------------------------------------------------------
% MARGINS
%----------------------------------------------------------------------------------------
\usepackage{geometry} % Required for adjusting page dimensions and margins
\geometry{
top=2.5cm, % Top margin
bottom=2.5cm, % Bottom margin
inner=3.5cm, % Inner margin (left on odd pages, right on even or left in oneside mode)
outer=2cm, % Outer margin (right on odd pages, left on even or right in oneside mode)
headsep=10pt, % Space from the top margin to the baseline of the header
headheight=28.564pt, % Header height
footskip=1.4cm, % Space from the bottom margin to the baseline of the footer
columnsep=1cm, % Horizontal space between columns when in two column mode
%showframe, % Uncomment to show how the type block is set on the page
}
%----------------------------------------------------------------------------------------
% FONTS
%----------------------------------------------------------------------------------------
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Symbol, Chancery and Computer Modern fonts
\usepackage{microtype} % Improve typography
%----------------------------------------------------------------------------------------
% HEADERS AND FOOTERS
%----------------------------------------------------------------------------------------
\usepackage{fancyhdr} % Required for customizing headers and footers
\pagestyle{fancy} % Enable the custom headers and footers
\renewcommand{\headrulewidth}{0.5pt} % Top horizontal rule thickness
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.~#1}{}} % Redefine the styling of the current chapter name in the header
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection~#1}{}} % Redefine the styling of the current section name in the header
\fancyhf{} % Clear default headers and footers
% \fancyhead[L, RO]{\sffamily\thepage} % Header for left even pages and right odd pages
% \fancyhead[LO]{\rightmark} % Header for left odd pages
% \fancyhead[RO]{\leftmark} % Header for right even pages
\fancyhead[LE,LO]{\rightmark}
\rfoot{\thepage}
% original
% \fancyhead[LE, RO]{\sffamily\thepage} % Header for left even pages and right odd pages
% \fancyhead[LO]{\rightmark} % Header for left odd pages
% \fancyhead[RE]{\leftmark} % Header for right even pages
\fancypagestyle{plain}{ % Style for when a plain pagestyle is specified
\fancyhead{} % Clear headers
\renewcommand{\headrulewidth}{0pt} % Remove header rule
}
\usepackage{emptypage} % This package removes headers and footers on empty pages between chapters
%----------------------------------------------------------------------------------------
% SECTION STYLING
%----------------------------------------------------------------------------------------
\setcounter{secnumdepth}{3} % Number sections down to subsubsections, a value of 2 will number to subsections only and 1 to sections only
\usepackage[
explicit, % Specify section names explicitly in \titleformat with #1
newparttoc, % Required for writing the part toc entry number in a standard way (overriding default LaTeX behavior) so the titletoc package can style it
]{titlesec} % Required for modifying sections
%-------------------------------------------
% Command to create and output the parts pages
\newcommand{\outputpartpage}[2]{
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=center, rectangle, fill=ocre!20, inner sep=0pt, minimum height=\paperheight, minimum width=\paperwidth] at (current page.center) {}; % Background color
\node[anchor=north west, inner sep=0pt, xshift=\Gm@lmargin, yshift=-\Gm@tmargin] at (current page.north west) {\fontsize{220pt}{220pt}\selectfont\sffamily\bfseries\textcolor{ocre!40}{#1}}; % Part number
\node[anchor=north east, inner sep=0pt, xshift=-\Gm@rmargin, yshift=-\Gm@tmargin] at (current page.north east) {\fontsize{30pt}{30pt}\selectfont\sffamily\bfseries\textcolor{white}{\strut #2}}; % Part title
\node[anchor=south east, inner sep=0pt, xshift=-\Gm@rmargin, yshift=\Gm@bmargin] at (current page.south east) { % Mini table of contents
\parbox[t][][t]{8.5cm}{ % Width of box holding the mini ToC
\printcontents[part]{l}{0}{\setcounter{tocdepth}{1}} % Display the mini table of contents showing chapters and sections, change tocdepth to 2 to also show subsections or 0 to only show chapters
}
};
\end{tikzpicture}
}
\titleformat
{\part} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\startcontents[part]\outputpartpage{\thepart}{#1}} % Format of the whole section
{} % Format of the section label
{0em} % Space between the title and label
{} % Code before the label
[] % Code after the label
%-------------------------------------------
% Command to store the current chapter image to use for all future chapters, can be changed any time in the document and can be empty
\newcommand{\thechapterimage}{}
\newcommand{\chapterimage}[1]{\renewcommand{\thechapterimage}{#1}}
% Command to store the current whitespace above the chapter title box for all future chapters, can be changed at any time in the document
\newcommand{\thechapterspaceabove}{}
\newcommand{\chapterspaceabove}[1]{\renewcommand{\thechapterspaceabove}{#1}}
% Command to store the current whitespace below the chapter title box for all future chapters, can be changed at any time in the document
\newcommand{\thechapterspacebelow}{}
\newcommand{\chapterspacebelow}[1]{\renewcommand{\thechapterspacebelow}{#1}}
% Command to output the chapter title with optional background image
\newcommand{\outputchaptertitle}[2]{
\begin{tikzpicture}[remember picture,overlay]
% If a chapter image has been specified
\expandafter\ifstrequal\expandafter{\thechapterimage}{}{}{
% Output the chapter image
\node[
anchor=north west, % Anchor point on the image
inner sep=0pt, % Inner padding
] at (current page.north west) {\includegraphics[width=\paperwidth]{\thechapterimage}};
}
% Box with the chapter title
\draw[anchor=west] (current page.north west) node [
anchor=north west, % Anchor point of the chapter box
xshift=\Gm@lmargin, % Horizontal distance from the left side of the page
yshift=-\thechapterspaceabove, % Vertical distance from the top of the page
line width=2pt, % Border line thickness
rounded corners=10pt, % Rounded corners amount
draw=ocre, % Border line color
fill=black!5, % Box background color
fill opacity=0.6, % Background transparency
text opacity=1, % Text transparency
inner ysep=12.5pt, % Inner vertical padding
inner xsep=20pt, % Inner horizontal padding
align=flush left, % Text alignment inside box
text width=1.2\linewidth, % Box width (wider than page to go off the right side)
font=\huge\sffamily\bfseries, % Font styling for chapter title
] {\parbox{0.85\linewidth}{\strut\raggedright\expandafter\ifstrequal\expandafter{#1}{}{}{#1. }#2\vspace{-3pt}}}; % Chapter title in a fixed width box for wrapping
\end{tikzpicture}
}
% Numbered chapters
\titleformat
{\chapter} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\outputchaptertitle{\thechapter}{#1}} % Format of the whole section
{} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
% Unnumbered chapters
\titleformat
{name=\chapter, numberless} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\outputchaptertitle{}{#1}} % Format of the whole section
{} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titlespacing*{\chapter}{0pt}{0pt}{\thechapterspacebelow} % Spacing around section titles, the order is: left, before and after
%-------------------------------------------
\titleformat
{\section} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily\Large} % Format of the whole section
{\textcolor{ocre}{\thesection}\hspace{1em}#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titleformat
{name=\section, numberless} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily\Large} % Format of the whole section
{#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titlespacing*{\section}{0pt}{12pt}{6pt} % Spacing around section titles, the order is: left, before and after
%-------------------------------------------
\titleformat
{\subsection} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily\large} % Format of the whole section
{\textcolor{ocre}{\thesubsection}\hspace{1em}#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titleformat
{name=\subsection, numberless} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily\large} % Format of the whole section
{#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titlespacing*{\subsection}{0pt}{12pt}{4pt} % Spacing around section titles, the order is: left, before and after
%-------------------------------------------
\titleformat
{\subsubsection} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily} % Format of the whole section
{{\thesubsubsection}\hspace{1em}#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titleformat
{name=\subsubsection, numberless} % Section type being modified
[block] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily} % Format of the whole section
{#1} % Format of the section label
{0cm} % Space between the title and label
{} % Code before the label
[] % Code after the label
\titlespacing*{\subsubsection}{0pt}{8pt}{4pt} % Spacing around section titles, the order is: left, before and after
%-------------------------------------------
\titleformat
{\paragraph} % Section type being modified
[runin] % Shape type, can be: hang, block, display, runin, leftmargin, rightmargin, drop, wrap, frame
{\bfseries\sffamily} % Format of the whole section
{} % Format of the section label
{0cm} % Space between the title and label
{#1} % Code before the label
[] % Code after the label
\titlespacing*{\paragraph}{0pt}{0pt}{6pt} % Spacing around section titles, the order is: left, before and after
%----------------------------------------------------------------------------------------
% TABLE OF CONTENTS
%----------------------------------------------------------------------------------------
\usepackage{titletoc} % Required for manipulating the table of contents
\setcounter{tocdepth}{2} % Display down to subsections in the table of contents
\contentsmargin{0cm} % Removes the default right margin
%------------------------------------------------
% Styling of numbered parts in the table of contents
\newcommand{\tocentrypartnumbered}[1]{%
\setlength\fboxsep{0pt}% Remove box padding
\contentslabel[%
% Part number box
\colorbox{ocre!20}{% Background color
\strut\parbox[c][.7cm]{1.1cm}{% Box size
\color{ocre!70}\Large\sffamily\bfseries\centering\thecontentslabel% Part number
}%
}%
\hspace{4pt}%
% Part title box
\colorbox{ocre!40}{% Background color
\strut\parbox[c][.7cm]{\linewidth-1.25cm}{% Box size
\centering\Large\sffamily #1% Part title
}%
}%
]{1.25cm}
}
% Styling of unnumbered parts in the table of contents
\newcommand{\tocentrypartunnumbered}[1]{%
\setlength\fboxsep{0pt}% Remove box padding
\contentslabel[%
% Part title box
\colorbox{ocre!40}{% Background color
\strut\parbox[c][.7cm]{\linewidth}{% Box size
\centering\Large\sffamily #1% Part title
}%
}%
]{1.25cm}
}
\titlecontents{part} % Section type being modified
[1.25cm] % Left indentation
{\addvspace{20pt}\Large\sffamily\bfseries\hypersetup{linkcolor=black}} % Before code
{\tocentrypartnumbered} % Formatting of numbered sections of this type
{\tocentrypartunnumbered} % Formatting of numberless sections of this type
{} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
\titlecontents{chapter} % Section type being modified
[1.25cm] % Left indentation
{\addvspace{12pt}\large\sffamily\bfseries\hypersetup{linkcolor=ocre}} % Before code
{\color{ocre}\contentslabel[\Large\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{\color{ocre!60}\normalsize\;\titlerule*[6pt]{.}\;\color{ocre}\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
\titlecontents{section} % Section type being modified
[1.25cm] % Left indentation
{\addvspace{3pt}\sffamily\bfseries} % Before code
{\contentslabel[\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~{\normalfont\titlerule*[6pt]{.}}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
\titlecontents{subsection} % Section type being modified
[1.25cm] % Left indentation
{\addvspace{1pt}\sffamily\small} % Before code
{\contentslabel[\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~\titlerule*[6pt]{.}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
\titlecontents{subsubsection} % Section type being modified
[1.75cm] % Left indentation
{\sffamily\small} % Before code
{\contentslabel[\thecontentslabel]{1.75cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~\titlerule*[6pt]{.}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
% List of figures entries
\titlecontents{figure} % Section type being modified
[0cm] % Left indentation
{\addvspace{2pt}\sffamily\small} % Before code
{\thecontentslabel\hspace*{1em}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~\titlerule*[6pt]{.}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
% List of tables entries
\titlecontents{table} % Section type being modified
[0cm] % Left indentation
{\addvspace{2pt}\sffamily\small} % Before code
{\thecontentslabel\hspace*{1em}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~\titlerule*[6pt]{.}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
[] % After code
%------------------------------------------------
\titlecontents{lchapter} % Chapter headings on part pages
[0cm] % Left indentation
{\addvspace{12pt}\large\sffamily\bfseries\hypersetup{linkcolor=ocre}} % Before code
{\color{ocre}\contentslabel[\Large\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{\color{ocre}} % Formatting of numberless sections of this type
{~\color{ocre!60}\normalsize\titlerule*[6pt]{.}~\color{ocre}\thecontentspage} % Formatting of the filler to the right of the heading and the page number
%------------------------------------------------
\titlecontents{lsection} % Section headings on part pages
[0cm] % Left indentation
{\sffamily\small} % Before code
{\contentslabel[\thecontentslabel]{1.25cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~{\normalfont\titlerule*[6pt]{.}}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
%------------------------------------------------
\titlecontents{lsubsection} % Subsection headings on part pages
[0cm] % Left indentation
{\sffamily\footnotesize} % Before code
{\contentslabel[\thecontentslabel]{1.25cm}\hspace{0.5cm}} % Formatting of numbered sections of this type
{} % Formatting of numberless sections of this type
{~{\normalfont\titlerule*[6pt]{.}}~\thecontentspage} % Formatting of the filler to the right of the heading and the page number
%----------------------------------------------------------------------------------------
% BIBLIOGRAPHY
%----------------------------------------------------------------------------------------
\usepackage[
backend=biber, % Use the biber engine for compiling the bibliography
bibstyle=numeric, % Main bibliography style
citestyle=numeric, % In-text citation style
sorting=nyt, % Sort references in the bibliography by name, then year, then title
sortcites=true, % If multiple citekeys are passed to a citation command, sort them in the citation
abbreviate=false, % Suppress abbreviations such as "Ed." for Editor
backref=true, % List the page where references were cited in the bibliography
defernumbers=true,
]{biblatex}
\defbibheading{bibempty}{} % Suppress default bibliography headings
%----------------------------------------------------------------------------------------
% INDEX
%----------------------------------------------------------------------------------------
\usepackage{makeidx} % Required to make an index
\makeindex % Tells LaTeX to create the files required for indexing
% Modify the command to output the index to output the correctly styled Index name to the page headers
\patchcmd{\theindex}
{\MakeUppercase\indexname} % Find
{\sffamily\normalsize\bfseries\indexname} % Replace
{}
{}
%----------------------------------------------------------------------------------------
% TABLES
%----------------------------------------------------------------------------------------
\usepackage{array} % Required for manipulating table elements
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} % Define a new right-aligned paragraph column type
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} % Define a new left-aligned (no justification) paragraph column type
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % Define a new centered paragraph column type
\usepackage{booktabs} % Required for high quality horizontal rules in tables
%----------------------------------------------------------------------------------------
% LISTS
%----------------------------------------------------------------------------------------
\usepackage{enumitem} % Required for list customization
% nolistsep, noitemsep, wide
\setlist{parsep=0.5cm, wide} % Customize spacing inside and outside lists
% \setlength{\leftmargin}{1cm}
\renewcommand{\labelenumi}{\arabic{enumi}.} % Customize the first level numbered list characters
\renewcommand{\labelenumii}{\alph{enumii}.} % Customize the second level numbered list characters
\renewcommand{\labelenumiii}{\roman{enumiii}.} % Customize the third level numbered list characters
%------------------------------------------------
\renewcommand{\labelitemi}{\raisebox{-2pt}{\Large \textbullet}} % Customize the first level bullet point character
\renewcommand{\labelitemii}{--} % Customize the second level bullet point character
\renewcommand{\labelitemiii}{$\circ$} % Customize the third level bullet point character
%----------------------------------------------------------------------------------------
% LINKS
%----------------------------------------------------------------------------------------
\usepackage{hyperref}
\hypersetup{
colorlinks=true, % Whether to color links (a thin box is output around links if this is false)
%hidelinks, % Hide the default boxes around links
urlcolor=ocre, % Color for \url and \href links
linkcolor=black, % Color for \ref/\nameref links
citecolor=ocre, % Color for reference citations like \cite{}
hyperindex=true, % Adds links from the page numbers in the index to the relevant page
linktoc=all, % Link from section names and page numbers in the table of contents
}
%----------------------------------------------------------------------------------------
% BOOKMARKS
%----------------------------------------------------------------------------------------
\usepackage{bookmark} % Required for customizing PDF bookmarks
\bookmarksetup{
open, % Open all bookmark drawers automatically
numbered, % Add section numbers to bookmarks
addtohook={%
\ifnum\bookmarkget{level}=-1 % Customize part bookmarks
\bookmarksetup{color=ocre, bold}% Bold and colored
\fi
\ifnum\bookmarkget{level}=0 % Customize chapter bookmarks
\bookmarksetup{bold}% Bold
\fi
}
}
%----------------------------------------------------------------------------------------
% TITLE PAGE
%----------------------------------------------------------------------------------------
\renewcommand{\titlepage}[2]{
\thispagestyle{empty} % Suppress headers and footers on the title page
\begin{tikzpicture}[remember picture, overlay]
\node [inner sep=0pt] at (current page.center) {#1}; % Background image
\node [anchor=center, inner sep=1.25cm, rectangle, fill=ocre!30!white, fill opacity=0.6, text opacity=1, minimum height=0.2\paperheight, minimum width=\paperwidth, text width=0.8\paperwidth] at (current page.center) {#2}; % Title highlight box with title(s) and author(s)
\end{tikzpicture}
\newpage
}
%----------------------------------------------------------------------------------------
% THEOREM STYLES
%----------------------------------------------------------------------------------------
\usepackage{amsmath, amsfonts, amssymb, amsthm} % For math equations, theorems, symbols, etc
\renewcommand{\qedsymbol}{$\blacksquare$} % Redefine the QED symbol to be a filled square vs. the default unfilled square
%------------------------------------------------
% Orange theorem number and optional black title with padding above and below
\newtheoremstyle{ocrenum} % Theorem style name
{6pt} % Space above
{6pt} % Space below
{\normalfont} % Body font
{} % Indent amount
{} % Theorem head font
{} % Punctuation after theorem head
{0.25em} % Space after theorem head
{\small\sffamily\bfseries\color{ocre}\thmname{#1}~\thmnumber{\@ifnotempty{#1}{}\@upn{#2}} % Theorem text (e.g. Theorem 2.1)
\thmnote{\the\thm@notefont\sffamily\bfseries\color{black}---~#3.\hspace{0.25em}}} % Optional theorem note
%------------------------------------------------
% Orange theorem number and optional black title with no padding above and below
\newtheoremstyle{ocrenumbox} % Theorem style name
{0pt} % Space above
{0pt} % Space below
{\normalfont} % Body font
{} % Indent amount
{} % Theorem head font
{} % Punctuation after theorem head
{0.25em} % Space after theorem head
{\small\sffamily\bfseries\color{ocre}\thmname{#1}~\thmnumber{\@ifnotempty{#1}{}\@upn{#2}} % Theorem text (e.g. Theorem 2.1)
\thmnote{\the\thm@notefont\sffamily\bfseries\color{black}---~#3.\hspace{0.25em}}} % Optional theorem note
%------------------------------------------------
% Black theorem number and optional black title no padding above and below
\newtheoremstyle{blacknumex} % Theorem style name
{6pt} % Space above
{6pt} % Space below
{\normalfont} % Body font
{} % Indent amount
{} % Theorem head font
{} % Punctuation after theorem head
{0.25em} % Space after theorem head
{\small\sffamily\bfseries{\raisebox{1.25pt}{\tiny\ensuremath{\blacksquare}}}~\thmname{#1}~\thmnumber{\@ifnotempty{#1}{}\@upn{#2}} % Theorem text (e.g. Theorem 2.1)
\thmnote{\the\thm@notefont\sffamily\bfseries---~#3.\hspace{0.25em}}} % Optional theorem note
%------------------------------------------------
% Black theorem number and optional black title padding above and below
\newtheoremstyle{blacknumbox} % Theorem style name
{0pt} % Space above
{0pt} % Space below
{\normalfont} % Body font
{} % Indent amount
{} % Theorem head font
{} % Punctuation after theorem head
{0.25em} % Space after theorem head
{\small\sffamily\bfseries\thmname{#1}~\thmnumber{\@ifnotempty{#1}{}\@upn{#2}} % Theorem text (e.g. Theorem 2.1)
\thmnote{\the\thm@notefont\sffamily\bfseries---~#3.\hspace{0.25em}}} % Optional theorem note
%------------------------------------------------
% Set the theorem style for each type of theorem-like environment by placing it under the theorem style you would like to use for it
% Orange theorem number and optional black title with padding above and below
\theoremstyle{ocrenum}
\newtheorem{proposition}{Proposition}[chapter] % Propositions, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
% Orange theorem number and optional black title with no padding above and below
\theoremstyle{ocrenumbox}
\newtheorem{theoremeT}{Theorem}[chapter] % Theorems, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
\newtheorem{problem}{Problem}[chapter] % Problems, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
\newtheorem{exerciseT}{Exercise}[chapter] % Exercises, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
% Black theorem number and optional black title no padding above and below
\theoremstyle{blacknumex}
\newtheorem{exampleT}{Example}[chapter] % Examples, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
\newtheorem{notation}{Notation}[chapter] % Notations, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
\newtheorem{vocabulary}{Vocabulary}[chapter] % Vocabularies, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
% Black theorem number and optional black title with padding above and below
\theoremstyle{blacknumbox}
\newtheorem{definitionT}{Definition}[chapter] % Definitions, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
\newtheorem{corollaryT}{Corollary}[chapter] % Corollaries, the first argument is the theorem name, the second the theorem title used before the number and the third optional argument is whether to number under chapters (e.g. 2.1) or sections (e.g. 2.1.1)
%----------------------------------------------------------------------------------------
% COLORED THEOREM BOXES
%----------------------------------------------------------------------------------------
\RequirePackage[framemethod=default]{mdframed} % Required for creating colored boxes used for theorems, definitions, exercises and corollaries
% Theorem box
\newmdenv[
skipabove=7pt, % Whitespace above box
skipbelow=7pt, % Whitespace below box
backgroundcolor=black!5, % Background color
linecolor=ocre, % Border color
innerleftmargin=5pt, % Inside left margin width
innerrightmargin=5pt, % Inside right margin width
innertopmargin=5pt, % Inside top margin height
innerbottommargin=5pt, % Inside bottom margin height
leftmargin=0cm, % Outside left margin width
rightmargin=0cm % Outside right margin width
]{tBox}
% Exercise box
\newmdenv[
skipabove=7pt, % Whitespace above box
skipbelow=7pt, % Whitespace below box
rightline=false, % Right line visible
leftline=true, % Left line visible
topline=false, % Top line visible
bottomline=false, % Bottom line visible
linecolor=ocre, % Line color
linewidth=4pt, % Line width
backgroundcolor=ocre!10, % Background color
innerleftmargin=5pt, % Inside left margin width
innerrightmargin=5pt, % Inside right margin width
innertopmargin=5pt, % Inside top margin height
innerbottommargin=5pt, % Inside bottom margin height
leftmargin=0cm, % Outside left margin width
rightmargin=0cm % Outside right margin width
]{eBox}
% Definition box
\newmdenv[
skipabove=7pt, % Whitespace above box
skipbelow=7pt, % Whitespace below box
rightline=false, % Right line visible
leftline=true, % Left line visible
topline=false, % Top line visible
bottomline=false, % Bottom line visible
linecolor=ocre, % Border color
linewidth=4pt, % Border width
innerleftmargin=5pt, % Inside left margin width
innerrightmargin=5pt, % Inside right margin width
innertopmargin=0pt, % Inside top margin height
innerbottommargin=0pt, % Inside bottom margin height
leftmargin=0cm, % Outside left margin width
rightmargin=0cm % Outside right margin width
]{dBox}
% Corollary box
\newmdenv[
skipabove=7pt, % Whitespace above box
skipbelow=7pt, % Whitespace below box
rightline=false, % Right line visible
leftline=true, % Left line visible
topline=false, % Top line visible
bottomline=false, % Bottom line visible
linecolor=gray, % Line color
linewidth=4pt, % Line width
backgroundcolor=black!5, % Background color
innerleftmargin=5pt, % Inside left margin width
innerrightmargin=5pt, % Inside right margin width
innertopmargin=5pt, % Inside top margin height
innerbottommargin=5pt, % Inside bottom margin height
leftmargin=0cm, % Outside left margin width
rightmargin=0cm % Outside right margin width
]{cBox}
% Creates an environment for each type of theorem and assigns it a theorem text style from the THEOREM STYLES block above and a colored box from above
\newenvironment{theorem}{\begin{tBox}\begin{theoremeT}}{\end{theoremeT}\end{tBox}}
\newenvironment{exercise}{\begin{eBox}\begin{exerciseT}}{\hfill{\color{ocre}\tiny\ensuremath{\blacksquare}}\end{exerciseT}\end{eBox}}
\newenvironment{definition}{\begin{dBox}\begin{definitionT}}{\end{definitionT}\end{dBox}}
\newenvironment{example}{\begin{exampleT}}{\hfill{\tiny\ensuremath{\blacksquare}}\end{exampleT}}
\newenvironment{corollary}{\begin{cBox}\begin{corollaryT}}{\end{corollaryT}\end{cBox}}
%----------------------------------------------------------------------------------------
% REMARK ENVIRONMENT
%----------------------------------------------------------------------------------------
\newenvironment{remark}{%
\par\small % Reduce font size for remarks
\vspace{4pt} % Vertical whitespace
\begin{adjustwidth}{35pt}{25pt} % Left and right padding
\hspace{-2.5pt}%
\begin{tikzpicture}[overlay]
\node[draw=ocre!60,line width=1pt,circle,fill=ocre!25,font=\sffamily\bfseries,inner sep=3pt,outer sep=0pt] at (-15pt,0pt){\textcolor{ocre}{R}}; % Orange R in a circle
\end{tikzpicture}
\advance\baselineskip -1pt% Reduce line spacing
}{%
\end{adjustwidth}
}
%----------------------------------------------------------------------------------------
% LOAD PACKAGES THAT CLASH WITH OTHER PACKAGES
%----------------------------------------------------------------------------------------
\usepackage{tikz} % Required for drawing custom shapes and positioning elements absolutely on the page