-
Notifications
You must be signed in to change notification settings - Fork 1
/
structure-digital.sty
201 lines (166 loc) · 5.79 KB
/
structure-digital.sty
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
% Coding
\usepackage[utf8]{inputenc}
% British and Spanish
\usepackage[spanish,british]{babel}
% Fonts
% See: https://tex.stackexchange.com/questions/338049/how-do-fonts-work-in-latex
% See: https://tex.stackexchange.com/questions/202789/where-to-find-the-family-code-for-a-custom-font
% See: https://en.wikibooks.org/wiki/LaTeX/Fonts#Using_TTF_and_OTF_fonts
\renewcommand{\familydefault}{upl} % Default family (upl: Palatino)
% \renewcommand{\familydefault}{LinuxBiolinumT-LF} % Default Biolinum (Sans Serif) <--- works in Overleaf (try texlive 2020?)
% Graphics
\usepackage{graphicx}
% \graphicspath{{img/}} % Directory where graphics are stored
% Modification to natbib citations (adapted from ICLR style)
\RequirePackage{natbib}
\setcitestyle{authoryear,round,citesep={;},aysep={,},yysep={;}}
% Space between paragraphs
\usepackage{parskip}
\setlength{\parindent}{15pt}
% Tables
\usepackage{multirow}
\usepackage{makecell} % Break line within table cells
% Algorithms
\usepackage{algorithm2e}
% Subfigures
\usepackage{subcaption} % Subfigures
% URL in bibliography
\usepackage{url}
% Hyper-references
\usepackage{hyperref}
% Euro symbol
\usepackage[official]{eurosym}
% Fonts and mathematical elements
\usepackage{amsmath}
\usepackage{amssymb}
% \usepackage{pslatex} % Nicer maths
\usepackage{bbm} % Indicator function
\usepackage{textcomp} % degrees symbol
\usepackage{color}
\usepackage{xcolor} % Color text
\usepackage{xfrac}
\newcommand{\dataset}{{\cal D}}
\newcommand{\fracpartial}[2]{\frac{\partial #1}{\partial #2}}
\providecommand{\norm}[1]{\lVert#1\rVert}
\providecommand{\abs}[1]{\lvert#1\rvert}
% For better formatting of matrices
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
% argmin with subscript below argmin, not below min
\usepackage{amsmath}
\newcommand{\argmin}{\operatornamewithlimits{arg\ min}}
% Margins
% \usepackage[top=3cm,bottom=3.5cm,left=3.50cm,right=2.40cm]{geometry} % Print
\usepackage[top=3cm,bottom=3cm,left=3cm,right=3cm]{geometry} % PDF
% Titles font
\usepackage{sectsty}
% \allsectionsfont{\usefont{T1}{qag}{b}{n}\selectfont} % Sans Serif
% \allsectionsfont{\usefont{T1}{qpl}{b}{n}\selectfont}
% \allsectionsfont{\usefont{T1}{unc}{b}{n}\selectfont}
\allsectionsfont{\usefont{T1}{upl}{b}{n}\selectfont} % Palatino
% \allsectionsfont{\usefont{T1}{qtm}{b}{n}\selectfont}
% Code Fonts
\usepackage{listings}
% Lorem ipsum
\usepackage{blindtext}
% Blocks of comments
\usepackage{comment}
% Appendices
\usepackage{appendix}
% Append pdf
\usepackage{pdfpages}
% HEADERS
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhf{}
\fancyhead[C]{\small \leftmark}
\fancyfoot[C]{\small \thepage} % Page numbers on the center
\renewcommand{\chaptermark}[1]{\markboth{Chapter \thechapter. #1}{}} % Chapter format: N. Name
\renewcommand{\headrulewidth}{0pt}
% CHAPTERS
\usepackage{chapterbib} % Separate bibliography for each chapter
\usepackage{titlesec}
\titleformat{\chapter}[display] % New format for chapters
{\usefont{T1}{upl}{b}{n}} % Font of chapter name
% {\usefont{T1}{qtm}{b}{n}} % Font type
{\filcenter \huge \usefont{T1}{upl}{m}{it} Chapter \thechapter} % Font of "Chapter X"
% {\filcenter \huge \usefont{T1}{upl}{m}{sc} Chapter \thechapter} % Font of "Chapter X" (capital)
% {\filcenter \huge \usefont{T1}{qtm}{m}{n} Chapter \thechapter} % Chapter number size: \Large
{0mm} % Minimum gap between title and body
{\titlerule \vspace{5mm} \filcenter \Huge} % Right-aligned body
[\vspace{7mm}] % After the body, set a gap and a thick horizontal line
% Blank pages without titles and headers
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
% Bibliography double column and smaller font
%% See: https://tex.stackexchange.com/a/440376/212008
\usepackage{multicol}
\renewcommand{\bibpreamble}{\begin{multicols}{2}}
\renewcommand{\bibpostamble}{\end{multicols}}
\renewcommand*{\bibfont}{\footnotesize}
% Prevent clear double page
% See: https://tex.stackexchange.com/a/29573/212008
\let\cleardoublepage\clearpage
% Bibliography
% See: https://www.overleaf.com/learn/latex/Commands
\newcommand{\chapterbibliography}{%
\clearpage
\bibliographystyle{bibliography}
\bibliography{references}
\addcontentsline{toc}{section}{Bibliography}
}
% Block with margin
% See: https://tex.stackexchange.com/questions/588/how-can-i-change-the-margins-for-only-part-of-the-text
\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist
% Contributors of chapter
% See: https://tex.stackexchange.com/questions/34844/when-is-it-harmful-to-add-percent-character-at-end-of-lines-in-a-newcommand-or
% See: https://en.wikibooks.org/wiki/LaTeX/Macros#New_environments
% See: https://www.overleaf.com/learn/latex/Environments
% See: https://tex.stackexchange.com/questions/59136/chapter-title-and-abstract-in-the-same-page/137309
\makeatletter
\newenvironment{contributors}%
{\noindent\ignorespaces%
\begin{changemargin}{1cm}{1cm}%
\normalsize \textbf{Contributors}%
\par\footnotesize}%
%
{\end{changemargin}%
\par\noindent%
\ignorespacesafterend}
\makeatother
% Outreach
\makeatletter
\newenvironment{outreach}%
{\noindent\ignorespaces%
\begin{changemargin}{1cm}{1cm}%
\normalsize \textbf{Outreach}%
\par\footnotesize%
This chapter extends the following publications:
\begin{itemize}}%
%
{\end{itemize}%
\begin{center}%
\rule{\linewidth}{0.1mm} \\ % Horizontal Line
\vspace{0.5cm}
\end{center}%
\end{changemargin}%
\par\noindent%
\ignorespacesafterend}
\makeatother
% Images path
\newcommand{\chapterpath}{includes}
\newcommand{\imgpath}{\chapterpath/img}
% Change bullet of itemize
%\renewcommand{\item}{\item[]}
%\newcommand{\labelitemi}{$\blacksquare$}