-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdocsetup.tex
151 lines (121 loc) · 5.37 KB
/
docsetup.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
\documentclass[10pt, b5paper, twoside]{book}
\usepackage[inner=1.8cm, outer=2.5cm, bottom=3.0cm]{geometry} % Spacing on each page - since two page style there are more space on outer border than inner boarder
\usepackage[parfill]{parskip} % To begin paragraphs with an empty line rather than an indent
\usepackage{float}%To allow [H] after figures/tables ++ to force placement
\usepackage{lmodern}
\usepackage[utf8]{inputenc} %Allow norwegian letters
\usepackage[T1]{fontenc} % norsk tegnsett (æøå)
\usepackage[english]{babel}
%\usepackage{hyperref}
\usepackage[pdftex]{hyperref}
\usepackage{amsmath} %Math
\usepackage{amsthm} %Math?
\usepackage{textcomp}%Get math symbols like circled R
\usepackage{emptypage} %Removes pagenumber on empty pages
\usepackage{setspace} %To use doublespacing / singlespacing ++
\usepackage[nonumberlist,toc]{glossaries}%Adding glossary, and adding it to contents. "nonumberlist" removes page reference in glossary
\usepackage[toc, page]{appendix} %Adding appendix
%Bibliography definitons
\usepackage{natbib}
\usepackage{apalike}
\usepackage{url} %Get url in referencelist
\usepackage[table,xcdraw]{xcolor} %Adding color to tabels
%AA------------------------------- Figure layout --------------------------------
\usepackage{graphicx} % To include images
\graphicspath{ {figures/} } %To add list of figures
\usepackage[font=footnotesize, labelfont=bf]{caption} %Setting size of figure text, and making figure numbering bold
\captionsetup{width=0.9\linewidth} %Setting global width of figure text (can also be set specifically for one figure)
\usepackage{caption}
\usepackage{subcaption} %To add caption for each independend side-by-side figure
%AA ---------------------------- CODE LAYOUT ------------------------------
% Inserting code and making it look readable (adding numbering, colours and formatting)
\usepackage{listings} %insert code style
\usepackage{color}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{pythonstyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{blue},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false, %Makes underscore look correct
showstringspaces=false,
showtabs=false,
tabsize=2
}
%creating new language with everything defined in python, but adding more keywords
\lstdefinelanguage{Python-tf}{
language = {Python},
morekeywords = {with, as},
}
%Making space between background box and content
\usepackage{fancyvrb}
\usepackage{framed}
\lstset{
style=pythonstyle,
framexleftmargin=1pt,
framextopmargin=8pt,
framexbottommargin=6pt,
frame=tb, framerule=0pt,
%Setting arrow after forced line break in code
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}
}
%Get backround color on inline listing (code)
\usepackage{xpatch}
\usepackage{realboxes}
\makeatletter
\xpretocmd\lstinline{\Colorbox{backcolour}\bgroup\appto\lst@DeInit{\egroup}}{}{}
\makeatother
%AA----------------------------- Header and footer layout--------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % Clear all header and footer fields
%L = left, R = right, C=center, O = odd page, E = even page
\fancyhead[LE]{\leftmark} %\leftmark sets number and name of chapter
\fancyfoot[LE,RO]{\thepage} %\thepage gives page number
% redefinition of the plain style: Otherwise first page of new chapter gets original plain style
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrulewidth}{0pt} %Remove header line on new
\fancyfoot[LE,RO]{\thepage} %\ "thepage" gives page number
}
%AA-------------------- TOC layout ----------------------------------------------------
\usepackage{titletoc}
\titlecontents{chapter}[1.5pc]
{\filright}
{\contentslabel{1.5pc}}{\hspace*{-1.5pc}}
{\titlerule*[0.7pc]{.}\contentspage}
\titlecontents{section}[3.5pc]
{\addvspace{-0.4pc}\filright\footnotesize} %space between lines
{\contentslabel{2pc}}{\hspace*{-2pc}}
{\titlerule*[0.7pc]{.}\contentspage} %space between dots
\titlecontents{subsection}[4.5pc]
{\addvspace{-0.4pc}\filright\footnotesize} %space between lines
{\contentslabel{2pc}}{\hspace*{-2pc}}
{\titlerule*[0.7pc]{.}\contentspage} %space between dots
%Set levels in contents:
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{2}
%AA-------------------- Chapter header layout ------------------------------------
\usepackage{titlesec}
%\titleformat{\chapter}[hang]
\usepackage{titlesec, blindtext, color}
\definecolor{gray75}{gray}{0.75}
\newcommand{\hsp}{\hspace{20pt}}
%Setting layot to line between number and name, setting the color to gray and adding space
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries}
%{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter. }{0.7em}{}%[{\titlerule[0.2pt]}] %underline
\makeatletter %Decide layout for chapter header
\renewcommand{\@chapapp}{}% Remove "Chapter" before chap number
\newenvironment{chapquote}[2][2em]
%------------------------------------------------------------------