forked from tinino/knitr-thesis-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaper.Rnw
155 lines (136 loc) · 4.96 KB
/
Paper.Rnw
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
\documentclass[a4paper,11pt,bibliography=totoc,numbers=noenddot]{scrartcl}
\usepackage{alltt}
\usepackage[ngerman]{babel}
\usepackage{amsmath,amssymb}
\usepackage{enumerate}
\usepackage{blindtext}
\usepackage{listings}
%\usepackage{xcolor} % knitr automatically adds this
\usepackage{graphicx}
\usepackage{float}
\usepackage{rotating} % allows for rotation of tables
\usepackage{dcolumn} % aligns numbers regarding decimal point in tables
\usepackage{pdfpages}
\usepackage[onehalfspacing]{setspace}
\usepackage[left=3cm,right=2.5cm,top=2.5cm,bottom=2.5cm
%,includeheadfoot
]{geometry}
\usepackage{varioref} % use \vref{} instead of \ref
\usepackage{pgf,tikz}
\usepackage[pdfborder={0 0 0}]{hyperref}
%\usepackage{apacite}
\usepackage{appendix}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[hybrid]{markdown}
\usepackage{url}
\usepackage[backend=biber,style=apa]{biblatex}
\DeclareLanguageMapping{german}{german-apa}
\usepackage[autostyle]{csquotes}
%%%%%%%%%%%%%%% Define some commands: %%%%%%%%%%%%%%%%
\newcommand{\R}{\textrm{R}} % for correct writing of R, write \R
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% Check and edit this: %%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\theAuthor}{Your Name}
\newcommand{\theDate}{\today}
\newcommand{\theAddress}{Your Address}
\newcommand{\theZip}{ZIP Code}
\newcommand{\theCity}{Your City}
\newcommand{\theMatriculation}{09-xyz-xyz}
\newcommand{\theTitle}{Some Title}
\newcommand{\theSubtitle}{Some Subtitle}
\newcommand{\theSupervisor}{Prof.\,PhD~Jon Doe}
\newcommand{\theType}{Master's Thesis}
\newcommand{\theSemester}{Fall 2016}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\labelformat{section}{section~#1}
\labelformat{subsection}{subsection~#1}
\labelformat{equation}{(#1)}
\labelformat{table}{table~#1}
\labelformat{figure}{figure~#1}
% penalty for line break over pages
\clubpenalty = 10000
\widowpenalty = 10000
% Distance Toc-Title and first entry
\usepackage{tocloft}
%\setlength\cftaftertoctitleskip{30pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% Front page:
\include{FrontBack/Frontpage}
% Abstract:
\include{FrontBack/Abstract}
\pagenumbering{Roman} % Change pagenumbering to capital roman numbers
% Preface:
\include{FrontBack/Preface}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Lists %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TOC
\newpage
\tableofcontents
\newpage
% List of Tables
%\phantomsection
%\addcontentsline{toc}{section}{List of Tables}
%\addtocontents{toc}{\protect\vspace{-5pt}}
\listoftables
\newpage
% List of Figrues
%\phantomsection
%\addtocontents{toc}{\protect\vspace{-5pt}}
%\addcontentsline{toc}{section}{List of Figures}
\listoffigures
%\lstlistoflistings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load relevant things into R's memory, such as functions, data and packages %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<<prepare,results='hide',message=FALSE,warning=FALSE,echo=FALSE>>=
source(file = "Code/functions.R")
# makes it possible to install packages from github:
if (!require("devtools")){
install.packages("devtools")
library(devtools)
}
# installs my package from github to make life easier:
if (!require("tinotools")){
devtools::install_github("tinino/tinotools")
}
LoadOrInstall(packages.required = c("devtools", "stargazer")) # loads all packages required
@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Content %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Introduction:
<<Introduction,child='Sections/Introduction.Rnw'>>=
@
% Data:
<<Data,child='Sections/Data.Rnw'>>=
@
% Conclusion:
<<Conclusion,child='Sections/Conclusion.Rnw'>>=
@
% References
\newpage
\setlength{\bibitemsep}{.45\baselineskip}
\bibliographystyle{apacite}
\interlinepenalty=10000 %prevent splited bibitems
\bibliography{References}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Appendix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\labelformat{section}{appendix~#1} % following sections are called appendix when refered to
\begin{appendices}
\include{Appendices/DataDeclaration}
\newpage
\section{\R-Code}
\label{app:code}
\lstinputlisting[nolol=true,basicstyle=\scriptsize\tt,breaklines=true]{Code/functions.R}
\end{appendices}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Academic Honesty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{FrontBack/Honesty}
\end{document}