This repository was archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackages.sty
237 lines (202 loc) · 8.73 KB
/
packages.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
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
% Author - Jon Arnt Kårstad, NTNU IV-IMT
%%% OWN STUFF %%%
% % Setup 1.5 spacing (as required by some NTNU theses)
\usepackage{setspace}
\onehalfspacing
% See below for more own-stuff which requires other packages installed in-between
% Remove "Chapter X" from chapter pages (if book template)
% \usepackage{titlesec}
% % Default:
% % \titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
% \titleformat{\chapter}[display]{\normalfont\huge\bfseries}{}{0pt}{\Huge}
% For appendices titled "Appendix A", "Appendix B", etc.
\usepackage[title]{appendix}
% Enable "breakable" verbatim environment, for search terms
% From https://tex.stackexchange.com/questions/309042/how-can-i-redefine-verbatim-to-wrap-lines-add-break-before-or-after-spaces
\usepackage{verbatim}
\makeatletter
\newenvironment{verbatimBreakable}
{\def\@xobeysp{\ }\verbatim\rightskip=0pt plus 6em\relax}
{\endverbatim}
\makeatother
% Nicer tables
\usepackage{booktabs}
% Longer tables
\usepackage{longtable}
% Enable left-adjusted (not box-adjusted) columns
% From https://latex.org/forum/viewtopic.php?t=32450
\usepackage{ragged2e}
\usepackage{array}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
% Enable table notes
% From https://tex.stackexchange.com/a/209851
\usepackage{threeparttablex}
% Enable multi-row cells
\usepackage{multirow}
% Enable horizontal pages
\usepackage{pdflscape}
% Use this for printing:
% \usepackage{lscape}
% Enable text color (for notes to Nhien)
\usepackage{xcolor}
% Enable plotting stuff
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
%%% END OWN STUFF %%%
%%% TEMPLATE STUFF %%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{packages}[2021/04/20 Packages]
\usepackage[utf8]{inputenc} % Character encoding
% ------ Contents -------
% Appendices
% Bibliography & References
% Code input
% Flow charts
% Front matter
% General
% Image
% Language
% Main matter
% Mathematics
% Page setup
% -----------------------
% --- Appendices ---
% \usepackage{appendix}
% \newcommand{\addappendix}{ % Self-created command to insert appendix with predefined settings
% \newpage
% \appendix
% \section*{Appendix} % Name of appendix
% \addcontentsline{toc}{section}{Appendix} % Add appendix name to table of contents
% \renewcommand{\thesubsection}{\Alph{subsection}} % Change numbering of section to upper-case letters.
% }
% --- Bibliography & References---
\usepackage[backend = biber, % Recommended backend for sorting bibliography
style = apa, % Close to the 'Harvard' referencing style
% urldate = short, % Long: 24th Mar. 1997 | Short: 24/03/1997
% maxcitenames = 2, % Number of authors in cite before replaced with 'Author#1 et al.'
% defernumbers=true,
% dashed=false,
% date=year
]{biblatex}
\usepackage{caption} % Enables controlling the look and feel of captions, see package documentation
\usepackage{subcaption} % Recommended when making sub-figures
\usepackage[nottoc]{tocbibind} % Includes Bibliography, Index, list of Listing etc. to table of contents
\newcommand{\source}[1]{\vspace{-4pt} \caption*{\hfill \footnotesize{Source: {#1}} } } % Easily insert sources in images
% --- Code ---
\usepackage{minted} % Includes several programming languages and styles, visit --https://www.ntnu.no/wiki/display/imtsoftware/Code+in+LaTeX-- for more information and examples
% --- Flow Charts ---
% Keep in mind that you may customize these flow chart settings to fit your own preferences.
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,chains}
\tikzstyle{decision} = [diamond, draw, fill=blue!20,
text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
minimum height=2em]
% --- Front matter ---
% Front matter is located before the table of contents, e.g. preface (Norsk: forord) and often has separate settings
% Comment out when using "Book" documentclass
\newcommand{\frontmatter}{
\pagenumbering{roman} % Setting page numbering to lower-case roman
}
% --- General ---
\usepackage{import} % Enable importing of sections
\usepackage[english=american]{csquotes} % Provides international handling of quote marks. Especially useful for bibliography management using BibLaTeX
\usepackage{hyperref} % Hyper-references, possible to change color
\hypersetup{ % Color of hyper-references
colorlinks,
citecolor = black,
filecolor = black,
linkcolor = black,
urlcolor = black
}
\usepackage{comment} % Comment blocks of text using \begin{comment} ... \end{comment}
\usepackage{pdfpages} % Enables import of pdf-pages using e.g. \includepdf[pages=-]{./my_pdf.pdf}
% --- Image ---
\usepackage{graphicx} % Handle images
\usepackage{wrapfig} % Wrap text around images
\usepackage{float} % Force image location using "H"
\usepackage{url} % Insert urls
\urlstyle{sf} % Set url-style as "sans-serif". Other options are e.g. "same" or "rm"
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Ruler
% --- Language ---
\usepackage{siunitx} % Enable SI units
\usepackage[british]{babel} % Defining UK English as language. This will among other things ensure that dates are displayed as 24/03/1997 rather than 03/24/1997 in the bibliography.
\addto\extrasbritish{ % Change naming of different functions, e.g. figure references.
\renewcommand*\contentsname{Table of Contents} % Rename table of contents
\renewcommand{\listfigurename}{List of Figures} % Rename list of figures
\renewcommand{\listtablename}{List of Tables} % Rename list of tables
\def\equationautorefname{Equation} % Autoref-name for equations
\def\figureautorefname{Figure} % Autoref-name for figures
\def\tableautorefname{Table} % Autoref-name for tables
\def\sectionautorefname{Section} % Autoref-name for sections
\def\subsectionautorefname{\sectionautorefname} % Autoref-name for subsections
\def\subsubsectionautorefname{\sectionautorefname} % Autoref-name for subsubsections
}
% --- Main matter ---
% This is the main part of the paper.
% Comment out when using "Book" document class
\newcommand{\mainmatter}{
\newpage
\pagenumbering{arabic} % Setting page numbering to normal integers
}
% --- Mathematics ---
\usepackage{bm} % Bold text in math mode
\usepackage{amsmath} % Math formulas and improved typographical quality of their output
\usepackage{amssymb} % Extended symbol collection
\usepackage{amsthm} % Helps define theorem-like structures
\usepackage{textcomp} % Used in the package "gensymb" (below), which will give warnings if "textcomp" is not imported in advance
\usepackage{gensymb} % Adds extra generic symbols for math and text mode, e.g. \degree
% --- Page setup ---
\usepackage[a4paper, total={150mm, 245mm,footskip = 14mm}]{geometry}
\setlength{\parindent}{0em}
\setlength{\parskip}{0.8em}
% Customized header and footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.1ex}
\renewcommand{\footrulewidth}{0.1ex}
\fancyfoot[C]{\thepage}
%%% END TEMPLATE STUFF %%%
%%% MORE OWN STUFF %%%
% Add references
\addbibresource{References/review.bib} % Add results from review
\addbibresource{References/introduction.bib}
\addbibresource{References/background.bib}
\addbibresource{References/method.bib}
\addbibresource{References/results.bib}
\addbibresource{References/definitions.bib}
\addbibresource{References/discussion.bib}
\addbibresource{References/further work.bib}
\addbibresource{References/other.bib} % Add other references
% Add keyword "litrev" automatically to all files in References/review.bib
% Gotten from https://tex.stackexchange.com/a/35779
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{References/review.bib}
\step[fieldset=KEYWORDS, fieldvalue={,litrev}, append]
}
}
}
% % Write bibliography as Last, First name
\DeclareNameAlias{author}{family-given}
\DeclareNameAlias{editor}{family-given}
\DeclareNameAlias{translator}{family-given}
% % Separate authors with ";" instead of ","
% \DeclareDelimFormat[bib]{multinamedelim}{\addsemicolon\space}
% Override quote symbols to get "quotes with 'second level quotes' correctly"
\DeclareQuoteStyle{british}
{\textquotedblleft}
{\textquotedblright}
{\textquoteleft}
{\textquoteright}
% Use todonotes as a way to "send" comments to Nhien
% REMOVE ENTIRE BLOCK BEFORE SUBMITTING!!!
% \setlength {\marginparwidth }{2cm}
\usepackage[textsize=scriptsize, disable]{todonotes}
%%% END OWN STUFF %%%