-
Notifications
You must be signed in to change notification settings - Fork 0
/
Abschlussarbeit.Rnw
245 lines (172 loc) · 8.89 KB
/
Abschlussarbeit.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
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
238
239
240
241
242
%%% ----------------------------------------------------------
%%% Vorlage Abschlussarbeit (LaTeX)
%%%
%%% V1 03/2017, Stefan Etschberger (HSA)
%%% V1.1 04/2021, rnw-hack für biblatex-run
%%% V2 05/2021, Titelblatt und Erweiterungen: Stefan Jansen (HSA)
%%% ----------------------------------------------------------
\documentclass[12pt,a4paper,%
twoside, % Fuer Veröffentlichung
titlepage,
DIV=13,
headinclude,
footinclude=false,%
cleardoublepage=empty,%
parskip=half,
]{scrreprt}
<<R_SETUP, echo=FALSE, message=FALSE>>=
library(pacman)
p_load(tidyverse,rio,kableExtra)
def.chunk.hook <- knitr::knit_hooks$get("chunk")
knitr::knit_hooks$set(chunk = function(x, options) {
x <- def.chunk.hook(x, options)
ifelse(options$size != "normalsize",
paste0("\n \\", options$size,"\n\n",
x, "\n\n \\normalsize"), x)
})
@
\usepackage{HSAAbschlussarbeit}
% Ohne diese Zeile: Mit klickbaren links
\hypersetup{draft}
\renewcommand{\AutorName} {Carl Friedrich Gauß}
\renewcommand{\AutorMatrikelnummer} {30041777}
\renewcommand{\AutorStrasse} {Leonhard-Euler-Str.~271}
\renewcommand{\AutorPLZOrt} {37001 Göttingen}
\renewcommand{\AutorEMail} {carl.friedrich.gauss@hs-augsburg.de}
\renewcommand{\AutorTelefon} {+49\,3141-5926}
\renewcommand{\AutorOrtUnterschrift} {Augsburg}
\renewcommand{\ArbeitThema} {Disquisitiones generales circa superficies curvas}
\renewcommand{\Studiengang} {Mathematik}
\renewcommand{\ArbeitTyp} {Bachelorarbeit}
%{Masterarbeit}
\renewcommand{\Abschluss} % {Bachelor of Arts}
% {Bachelor of Engeneering}
{Bachelor of Science (B.\,Sc.)}
% {Master of Arts}
% {Master of Engeneering}
% {Master of Science (M.\,Sc.)}
\renewcommand{\Fakultaet} {Fakultät für \\ Angewandte \\ Geistes- und \\ Naturwissenschaften}
% {Fakultät für \\ Architektur und \\ Bauwesen}
% {Fakultät für \\ Elektrotechnik}
% {Fakultät für \\ Gestaltung}
% {Fakultät für \\ Informatik}
% {Fakultät für \\ Maschinenbau und \\ Verfahrenstechnik} \booltrue{Diesel}
% {Fakultät für \\ Wirtschaft}
% \renewcommand{\FakultaetTelefon} {}
% \renewcommand{\FakultaetEMail} {}
\renewcommand{\DatumAbgabe} {\today}
\renewcommand{\DatumThemenvergabe} {\today}
\renewcommand{\DatumVerteidigung} {\today} \booltrue{Verteidigung}
\renewcommand{\NonDisclosure} {Ja}
% {Nein}
\renewcommand{\Erstpruefer} {Prof.~Dr.~Frank N. Stein}
\renewcommand{\Zweitpruefer} {Prof.~Dr.~Mario Huana} \booltrue{Zweitpruefer}
\renewcommand{\HochschuleName} {Hochschule für angewandte \\ Wissenschaften Augsburg}
\renewcommand{\HochschuleStrasse} {An der Hochschule 1}
\renewcommand{\HochschulePLZOrt} {D-86161 Augsburg}
\renewcommand{\HochschuleTelefon} {+49\,821\,5586-0}
\renewcommand{\HochschuleFax} {+49\,821\,5586-3222}
\renewcommand{\HochschuleURL} {www.hs-augsburg.de}
\renewcommand{\HochschuleEMail} {info@hs-augsburg.de}
% Literaturdatenbank (.bib-Datei) aus Citavi o.ä.
\bibliography{lib_Abschlussarbeit}
\graphicspath{{Bilder/}}
\usepackage{caption}
\DeclareCaptionLabelFormat{something}{#2.#1.}
\captionsetup[lstlisting]{labelformat=something}
\begin{document}
% Sprachauswahl. Alternativen: ngerman, english
% Kann auch innerhalb des Textes umgeschaltet werden
\selectlanguage{ngerman}
\pagenumbering{roman}
\setcounter{page}{1}
\HSAtitlepage
\tableofcontents
%%% --------------------------------------------------
%%% Ab hier: Inhalt
%%% --------------------------------------------------
\setcounter{page}{1}
\pagenumbering{arabic}
\chapter{Hier beginnt das erste Kapitel}
% -----------------------------------------------------
\section{Wie verweist man auf Quellen?}
Hier wird \citet{Neumann:1977} zitiert. Zitate sollten in den Text eingebunden werden, zum Beispiel eine Quelle aus einem Tagungsband, hier von \citet{Bauer} oder ein Artikel aus einer Fachzeitschrift (auf den dann in einer Klammer beispielsweise bei \cite{Fox:2002} verwiesen wird).
Noch ein Absatz mit einem Zitat aus einem Buch, nämlich von \citet{R:Chambers:1998}. Webseiten, zum Beispiel das Dokument von \citet{xmlComparingSchemata} sollten nur äußerst sparsam referenziert werden.
Hier wird ein Buch zitiert, nämlich das von \citet{darwin}. Die Arbeit von \citet{meulman} ist in einer wissenschaftlichen Fachzeitschrift veröffentlicht worden. Ein Beispiel für einen Aufsatz in einem Tagungsband liefert \citet{banzhaf96effect}. In Ausnahmefällen zu zitieren ist eine unveröffentlichte Abschlussarbeit, zum Beispiel eine Diplom-, Bachelor-, oder Masterthesis, wie die von \citet{holzheuer}. Ganz selten ist man gezwungen Manuale oder Referenzen zu referenzieren, die nur im Internet zugänglich sind und zudem keinen ausgewiesenen Autor haben wie zum Beispiel die Anleitung vom \citet{hornik} oder der Aufsatz von \citet{xmlComparingSchemata}.
% -----------------------------------------------------
\section{Einbinden von Grafiken}
Es folgt die Abbildung~\ref{fig:Gauss} auf Seite \pageref{fig:Gauss}, die dynamisch (gleitend) eingebunden wird. Das ist typischerweise eine gute Idee und man sollte Grafiken, wenn es nicht unbedingt anders gemacht werden soll von LaTeX automatisch positionieren lassen.
\blindtext
\begin{figure}
\centering
\includegraphics[ angle=0, width=.3\textwidth]{karl_friedrich_gauss}
\caption{\index{Grafik}\index{jpg}Ein jpeg-Bild, hier mit Gauß darauf\label{fig:Gauss}}\par
\end{figure}
\blindtext \blindtext
\blindtext
% -----------------------------------------------------
\section{Einträge im Stichwortverzeichnis}
Einträge im Stichwortverzeichnis können über den \lstI{index}-Befehl generiert werden. Zum Beispiel soll der Begriff \emph{Bachelorarbeit}\index{Bachelorarbeit} hier referenziert werden. Außerdem sollen noch die Begriffe Apfel\index{Apfel}, Birne\index{Birne} und Zebra\index{Zebra} ins Verzeichnis. Damit unter dem Buchstaben mehr als ein Eintrag steht, nehmen wir noch \emph{Buch}\index{Buch} und Brille\index{Brille} auf.
\section{Dynamische Tabellen aus beliebigen Quellen}
R-Code kann direkt im Text eingebettet werden, sogar mit Syntax-Highlighting. Man kann damit z.B. eine Tabelle von einer beliebigen Datenquelle (beispielsweise wie hier aus einer Excel-Datei) direkt einlesen und (selektiv) ausgeben lassen. Tabellen sollten auch als floating-Objekte von latex automatisch positioniert werden. Eine typische Konvention ist es auch, dass Beschriftungen oberhalb von Tabellen, Abbildungsbeschriftungen unterhalb positioniert werden sollten.
<<size="small">>=
Tabelle = rio::import("Umfrage.xlsx")
Tabelle %>%
select(Geschlecht, Alter, Groesse, GroesseV, GroesseM, ) %>%
slice_sample(n=7) %>%
kbl(caption = paste0("Diese Tabelle wurde direkt aus ",
"Excel eingelesen ",
"und automatisch formatiert"),
align = "c",
booktabs=T, linesep="") %>%
kable_styling(position = "center")
@
\blindtext
\blindtext \blindtext
\blindtext
\blindtext
\section{Grafiken aus R}
Dynamisch aus Datenquellen generierte Grafiken in Vektorgraphikqualität im Text (siehe Abbildung~\ref{R-Graph1}) sind auch kein Problem.
<<R_Plot1, eval=FALSE>>=
Tabelle %>%
drop_na(AlterV, AlterM) %>%
ggplot(aes(x=AlterV, y=AlterM)) +
geom_jitter(alpha=0.4, size=2, color="darkblue") +
theme_light() +
xlab("Alter des Vaters") +
ylab("Alter der Mutter")
@
\begin{figure}
\centering
<<fig.width=8, fig.height=4, out.width=".9\\textwidth", echo=FALSE>>=
<<R_Plot1>>
@
\caption{\index{Grafik}\index{R}Eine dynamisch generierte Grafik\label{R-Graph1}}\par
\end{figure}
\blindtext
\blindtext
\blindtext \blindtext \blindtext
\include{Beispielinhalt}
\appendix
% Selbständigkeitserklärung
\AutorErklaerung
\listoffigures % Abbildungsverzeichnis
\listoftables % Tabellenverzeichnis
% --------------------------------------------------
% Bibliographie
% --------------------------------------------------
\renewcommand{\bibfont}{\footnotesize}
\printbibliography[title={Literaturverzeichnis},
heading=bibintoc]
<<biber_run, echo=FALSE, results='hide'>>=
bibtex.file = current_input() %>% str_replace("\\.Rnw", "")
biber.run = paste("biber", bibtex.file)
system(biber.run)
@
% --------------------------------------------------
% Index
% --------------------------------------------------
{\setkomafont{section}{\Huge} % temporarily set chapter font
\printindex
}
\end{document}