-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackages.tex
215 lines (195 loc) · 6.99 KB
/
packages.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
%% REMEMBER: The order of package imports is sometimes important
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Language and font encodings
%%
\usepackage[english]{babel}
% NB https://tex.stackexchange.com/a/49613
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Page size and margins etc.
%%
\usepackage[a4paper,top=2cm,bottom=4cm,inner=4cm,outer=2.5cm,twoside]{geometry}
\usepackage{layout}
\usepackage{lineno}
\usepackage{setspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Mathematics and lists
%%
\usepackage{amsmath}
\usepackage{bm}
\usepackage{enumitem}
% Compact lists; https://stackoverflow.com/a/4974583
\setlist{noitemsep,topsep=0pt,parsep=0pt,partopsep=0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Graphics
\usepackage{graphicx}
% Tikz setup
% https://www.sharelatex.com/blog/2013/08/29/tikz-series-pt3.html
% https://tex.stackexchange.com/a/342227
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered, draw=black, fill=red!30]
\tikzstyle{io} = [trapezium, trapezium left angle=80, trapezium right angle=100, trapezium stretches=true, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Hyperlinks
% Re: print version, see https://tex.stackexchange.com/a/95009
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
% \usepackage[colorlinks=true, allcolors=blue, hidelinks=true]{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% For TO-DO notes in margins
%%
\usepackage[colorinlistoftodos]{todonotes}
% put todo notes on the inner (larger) margin:
\reversemarginpar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% More mathematics and other things...
%%
\usepackage{amssymb}
\usepackage{siunitx}
% gensymb provides \degree
\usepackage{textcomp, gensymb}
% For sidewaystable and sidewaysfigure
\usepackage{rotating}
\usepackage[toc,acronym,nonumberlist]{glossaries}
\usepackage[toc,page]{appendix}
% Make figure captions smaller
\usepackage[textfont={small},labelfont={small,bf}]{caption}
% Makes list of figures, tables appear in table of contents
\usepackage[nottoc]{tocbibind}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% DEPRECATED
% %% Bibliography using natbib
% %% https://www.overleaf.com/learn/latex/Bibliography_management_with_natbib
% %% http://merkel.texture.rocks/Latex/natbib.php
% %% https://tex.stackexchange.com/a/39457
% %% agsm provides Harvard style
% \usepackage{doi} % clickable doi's, must be loaded before natbib
% \usepackage{natbib}
% \bibliographystyle{abbrvnat}
% % \bibliographystyle{agsm}
% % \bibliographystyle{humannat}
% % \bibliographystyle{alpha}
% % \bibliographystyle{apalike}
% % \setcitestyle{authoryear}
% % \setcitestyle{authoryear,open={((},close={))}}
% % Must use \bibliography{references} in main.tex
%% http://merkel.texture.rocks/Latex/natbib.php
%% https://tex.stackexchange.com/a/39457
%% agsm provides Harvard style
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Bibliography using biblatex
%% https://www.overleaf.com/learn/latex/Bibliography_management_in_LaTeX
%% https://www.overleaf.com/learn/latex/Articles/Getting_started_with_BibLaTeX
%% https://tex.stackexchange.com/a/5105
%% MANUAL: http://mirrors.ibiblio.org/CTAN/macros/latex/exptl/biblatex/doc/biblatex.pdf
\usepackage{csquotes}
\usepackage[
% Provide compatibility with natbib's \citet and \citep commands
natbib=true,
backend=biber,
bibstyle=authoryear,
citestyle=authoryear-comp,
% sorting=nyt,
% Don't replace repeated author name with dash
% see manual page 72 (authoryear)
dashed=false,
% Don't print the url fields (will be a problem for referencing websites)
url=false,
% Only print forename initials
% https://tex.stackexchange.com/a/128823
% NB: doesn't affect sorting (beware of mix of names and initials)
giveninits=true,
% Don't print initials in citations
% https://tex.stackexchange.com/a/134544
uniquename=false,
uniquelist=false,
% Show at most 6 names, followed by et al.
% https://tex.stackexchange.com/a/76251
minbibnames=6,
maxbibnames=6,
% Show at most 2 names in citations
% https://tex.stackexchange.com/a/368042
maxcitenames=2,
% Sort list by (first author) name, year, title
% https://tex.stackexchange.com/a/203270
% Why doesn't maxsortnames do this?
% maxalphanames=1,
% labelalpha=true,
% sorting=anyt,
% Sort set members
% sortsets=true,
% must be set after maxbibnames, maxcitenames
% minsortnames=1,
% maxsortnames=1, % DOESN'T APPEAR TO BE WORKING?
% sortfirstinits=True,
% Sort citations in the same way as the bibliography (default?)
% sortcites=true,
]{biblatex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PROVIDE YOUR REFERENCES LOCATION HERE
%%
\addbibresource{references.bib}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% More complicated biblatex stuff
%
% 1)
% Sort bibliography (and citations) by first author name only
% https://tex.stackexchange.com/a/434947
% NB: bibtex file (from Mendeley) must not contain mix of first names and initials like:
% Last, First; Last, F.
% (that will interfere with the sorting)
% 2)
% Undo Mendeley's auto-escaping of special characters in url/doi fields
% https://tex.stackexchange.com/a/309995
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=author, match=\regexp{(.*?)\s+and\s+}]
\step[fieldset=sortname, fieldvalue={$1}]
}
% % Undo Mendeley's auto-escaping of special characters in url/doi fields
% % https://tex.stackexchange.com/a/309995
\map{ % Replaces '{\_}', '{_}' or '\_' with just '_'
\step[fieldsource=doi,
match=\regexp{\{\\\_\}|\{\_\}|\\\_},
replace=\regexp{\_}]
}
\map{ % Replaces '{'$\sim$'}', '$\sim$' or '{~}' with just '~'
\step[fieldsource=doi,
match=\regexp{\{\$\\sim\$\}|\{\~\}|\$\\sim\$},
replace=\regexp{\~}]
}
}
}
%
% Print url if no doi
% https://tex.stackexchange.com/a/424775
\renewbibmacro*{doi+eprint+url}{%
\printfield{doi}%
\newunit\newblock%
\iftoggle{bbx:eprint}{%
\usebibmacro{eprint}%
}{}%
\newunit\newblock%
\iffieldundef{doi}{%
\usebibmacro{url+urldate}}%
{}%
}
%
% Get rid of ISSNs
% https://tex.stackexchange.com/a/40107
\AtEveryBibitem{\clearfield{issn}}
%
% fix period before brackets in citation
% https://tex.stackexchange.com/a/312565
\DeclareDelimFormat[cbx@textcite]{nameyeardelim}{\addspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%