\chapter{Introduction}
\label{cha:introduction}

This \LaTeX \- template has been developed as an alternative to the Microsoft Word template.
\path{main.tex} is the master file and the \path{config/settings.tex} file contains all the meta-information about you and your thesis.
You should write down your information there.

This document is work-in-progress and provides instructions on how to use the template.
It does not give advices on scientific writing.

These instructions are not intended to be of a legal nature and do not contain any legal information.
For further information, please refer to the relevant, legally binding documents (study regulations, examination regulations, etc.) of the respective degree program.
These documents contain information on examination law requirements, deadlines, etc., which you must meet and follow independently.

\section{Elements}
This chapter gives examples on what you can do with this template.
It's just a brief overview.
Please consult the common sources on how to write scientific documents and documents with \LaTeX.

\subsection{Structure}
This template provides three structural levels that appear in the table of contents, \viz, \texttt{\textbackslash chapter}, \texttt{\textbackslash section}, and \texttt{\textbackslash subsection}.
Chapters will always start on a new page.
Additionally, you can use \texttt{\textbackslash subsubsection} and \texttt{\textbackslash paragraph} as non-hierarchical means to structure your thesis.

\subsubsection{Lists}
You can use the default \LaTeX \- functions for writing lists, \viz, \texttt{\textbackslash enumerate} for numbered lists and \texttt{\textbackslash itemize} for bullet point lists.
Again, the \texttt{\textbackslash subsubsection} and \texttt{\textbackslash paragraph} can be used as structural elements, \eg, when listing definitions of terms.

\subsubsection{Footnotes}
Footnotes are contiguously numbered throughout the whole document.
Use the \\\texttt{\textbackslash footnote\{text\}} command.
They appear on the page their reference is on \footnote{This is an exemplary footnote.}.
Footnotes have to be placed without white space behind the word and within the sentence boundaries, \ie, before the period.

\subsubsection{ToDo-Notes}
You can use ToDo notes using the \texttt{\textbackslash todo\{text\}}  command.
Please make sure to remove any ToDo notes before handing your thesis! \todo[inline]{ToDo: Remove me before publishing}

\subsection{Formatting Text}
\LaTeX \- provides \texttt{\textbackslash textit\{text\}} for \textit{italics}, \texttt{\textbackslash textbf\{text\}} for \textbf{bold face}, \\\texttt{\textbackslash texttt\{text\}} for \texttt{typewriter}, \texttt{\textbackslash textsc\{text\}} for \textsc{small caps}, \texttt{\textbackslash underline\{text\}} for \underline{underline}.
Additionally, the template provides  \texttt{\textbackslash texthl\{text\}} for \texthl{highlighted text}.
Please remove any highlighted text before handing your thesis!
Please use the \\ \texttt{\textbackslash enquote\{text\}} command for \enquote{direct quotes}.

\subsection{Figures}
The \texttt{figure} environment is wrapped around images.
These images should either be included as PDF-file via \texttt{\textbackslash includegraphics}, or created via \textit{TikZ/PGF}.
For included images, make sure to use high-resolution images, preferably vector images.

Figures float, \ie, they do not necessarily appear at exact the same position you have defined them.
Make sure to set a  \textit{caption} and an optional \textit{label} as figure parameters. 

\begin{figure}[caption={Relationship of students and theses}, label={fig:img01}]
	\includegraphics[width=.6\textwidth]{assets/figure01.pdf}
\end{figure}

\subsubsection{Subfigures}
Sometimes it might be handy to contrast figures, \ie, by placing them next to each other.
The template uses the \textit{subcaption} package to provide subfigures.
The following example contains two figures, where each subfigure has its own \texttt{\textbackslash label} and \texttt{\textbackslash caption}.
Additionally, the whole figure has its own \textit{caption} and \textit{label}.
That means, you can reference subfigures \fig \ref{fig:subfig1} and \fig  \ref{fig:subfig2}.
Only the whole figure will be listed in the table of figures.

Subfigures are not limited to images, but may also include listings or tables.
\Fig \ref{fig:subfig} shows a sample database query expressed in \ac{sql} (\fig \ref{fig:subfig1}) and as query plan in relational algebra  (\fig \ref{fig:subfig2}).
 
\begin{figure}[caption={Exemplary use of subfigures}, label={fig:subfig}]
	\begin{subfigure}[b]{.45\textwidth}
		\begin{lstlisting}[nolol, language=SQL]
		SELECT b, d FROM 
			EXAMPLE.RELATION1 r,
			EXAMPLE.RELATION2 s,
		WHERE 
			r.a = 'c'
		AND 
			s.e = 2
		AND 
			r.c = s.c; 
		\end{lstlisting}
		\caption{\acs{sql} select statement}\label{fig:subfig1}
	\end{subfigure}
	\begin{subfigure}[b]{.53\textwidth}
		\centering	
		\begin{tikzpicture}[node distance = 2cm, auto,
		database/.style={
			cylinder,
			cylinder uses custom fill,
			cylinder body fill=gray!30,
			cylinder end fill=gray!20,
			shape border rotate=90,
			aspect=0.25,
			draw
		}]
		\node [] (queue) {$\Pi_{b, d}$};
		\node [below of=queue] (join) {$\Join_{r.c = s.c}$};
		
		\node [below left of=join,xshift=-1cm] (l1) {$\sigma_{r.a = 'c'}$};
		\node [database, below of=l1] (l2) {\texttt{r}};
		
		\node [below right of=join,xshift=1cm] (r1) {$\sigma_{s.e = 2}$};
		\node [database,below of=r1] (r2) {\texttt{s}};
		
		\draw [<-] (queue) -- (join);
		\draw [<-] (join) -- (r1);
		\draw [<-] (r1) -- (r2);
		\draw [<-] (join) -- (l1);
		\draw [<-] (l1) -- (l2);
		\end{tikzpicture}
		\caption{Sample evaluation plan}\label{fig:subfig2}
	\end{subfigure}
\end{figure}

\subsection{Listings}
You can use listings to typeset source code.
This template uses the \textit{listings} package.
Wrap code inside the \texttt{lstlisting} environment and set the \textit{language} (e.g., Java, SQL), \textit{caption}, and optional \textit{label} parameters.
If the source code highlighting highlights the wrong keywords or misses keywords, use the \textit{deletekeywords} \resp \textit{morekeywords} parameters.
Consult the package documentation for further information.

\begin{lstlisting}[
    float=htp,
    caption={Euclid's GCD algorithm implemented in Java},
    label={lst:euclid},
    language=Java,
    deletekeywords={},
    morekeywords={}
]
public class Euclid {

	public static int gcd(int p, int q) {
		if (q == 0) return p;
		else return gcd(q, p % q);
	}

}
\end{lstlisting}

\subsection{Algorithms}
Some users might require specifying algorithms.
This template uses the \textit{algorithm}, \textit{algorithmicx}, and \textit{algopseudocode} packages.
Consult the respective manuals for further information.
Algorithms do not appear in a table at the beginning of the document, \ie, there is no list of algorithms.

\begin{algorithm}[htb]
	\begin{algorithmic}
		\Require nonnegative integer $a$, nonnegative integer $b$
		\Function{Euclid}{$a, b$}
    		\If {$b = 0$} \Comment{comment}
    		  \State{return $a$;}
    		\Else 
    		  \State {return \textsc{Euclid}$(b, a\mod b)$;}
    		\EndIf
		\EndFunction
	\end{algorithmic}
	\caption{Euclid's GCD algorithm in pseudocode}
	\label{alg:garbage}
\end{algorithm}

\subsection{Acronyms and Abbreviations}
This template provides comprehensive support for acronyms and abbreviations.
The template uses the \textit{acronyms} package. 
Please do only define abbreviations and symbols that are uncommon.
That means, common abbreviations such as \enquote{\eg} or \enquote{\ie} should not be listed.
Abbreviations and symbols are not sorted automatically by their label.
You should sort them by yourself before handing your thesis!

\subsubsection{Common Abbreviations}
Please note that each full stop in a common abbreviation should be followed by a non-breaking space.
This template comes with a variety of macros for common abbreviations, that can be used throughout your theses.
The macros differ for English and German theses.
Please see the tables below.

\begin{table}[caption={Common abbreviation macros for English theses}, label=tab:macros1]
	\centering
	\begin{tabular}{@{}ll@{}}
		\toprule
		{\bf Command}                   & {\bf Result} \\
        \midrule
        \textbackslash apprx            & \apprx \\
        \textbackslash as               & \as \\
        \textbackslash cf               & \cf \\
        \textbackslash eg               & \eg \\
        \textbackslash Eg               & \Eg \\
        \textbackslash esp              & \esp \\
        \textbackslash etal             & \etal \\
        \textbackslash fig              & \fig \\
        \textbackslash Fig              & \Fig \\
        \textbackslash ie               & \ie \\
        \textbackslash Ie               & \Ie \\
        \textbackslash iid              & \iid \\
        \textbackslash p\{4711\}        & \p{4711} \\
        \textbackslash pf\{4711\}       & \pf{4711} \\
        \textbackslash pp\{11$--$47\}   & \pp{11--47} \\
        \textbackslash resp             & \resp \\
        \textbackslash sect             & \sect \\
        \textbackslash tab              & \tab \\
        \textbackslash Tab              & \Tab \\
        \textbackslash viz              & \viz \\
        \textbackslash wrt              & \wrt \\
        \bottomrule
	\end{tabular}
\end{table}

\begin{table}[caption={Common abbreviation macros for German theses}, label=tab:macros2]
	\centering
	\begin{tabular}{@{}ll@{}}
		\toprule
		{\bf Command}               & {\bf Result} \\
        \midrule
        \textbackslash aaO          & \aaO \\
        \textbackslash Abb          & \Abb \\
        \textbackslash bspw         & \bspw \\
        \textbackslash bzgl         & \bzgl \\
        \textbackslash bzw          & \bzw \\
        \textbackslash ca           & \ca \\
        \textbackslash dgl          & \dgl \\
        \textbackslash dsgl         & \dsgl \\
        \textbackslash dh           & \dh \\
        \textbackslash etc          & \etc \\
        \textbackslash eV           & \eV \\
        \textbackslash evtl         & \evtl \\
        \textbackslash fs           & \fs \\
        \textbackslash gdw          & \gdw \\
        \textbackslash ggf          & \ggf \\
        \textbackslash hc           & \hc \\
        \textbackslash iAllg        & \iAllg \\
        \textbackslash iBa          & \iBa \\
        \textbackslash idR          & \idR \\
        \textbackslash ieS          & \ieS \\
        \textbackslash inkl         & \inkl \\
        \textbackslash insb         & \insb \\
        \textbackslash Prof         & \Prof \\
        \textbackslash Dr           & \Dr \\
        \textbackslash PD           & \PD \\
        \textbackslash Ing          & \Ing \\
        \textbackslash iV           & \iV \\
        \textbackslash iW           & \iW \\
        \textbackslash iwS          & \iwS \\
        \textbackslash Nr\{123\}    & \Nr{123} \\
        \textbackslash nW           & \nW \\
        \textbackslash oa           & \oa \\
        \textbackslash oAe          & \oAe \\
        \textbackslash oae          & \oae \\
        \bottomrule
    \end{tabular}
    \qquad
    \begin{tabular}{@{}ll@{}}
        \toprule
        {\bf Command}               & {\bf Result} \\ \midrule
        \textbackslash oE           & \oE \\
        \textbackslash oEdA         & \oEdA \\
        \textbackslash OEdA         & \OEdA \\ 
        \textbackslash oV           & \oV \\
        \textbackslash OV           & \OV \\
        \textbackslash resp         & \resp \\
        \textbackslash S\{123\}     & \S{123} \\
        \textbackslash Sf\{123\}    & \Sf{123} \\
        \textbackslash Sff\{123\}   & \Sff{123} \\
        \textbackslash siehe        & \siehe \\
        \textbackslash sog          & \sog \\
        \textbackslash sS\{123\}    & \sS{123}\\
        \textbackslash sSf\{123\}   & \sSf{123} \\
        \textbackslash sSff\{123\}  & \sSff{123} \\
        \textbackslash stu          & \stu \\
        \textbackslash su           & \su \\
        \textbackslash Tab          & \Tab \\
        \textbackslash tw           & \tw \\
        \textbackslash ua           & \ua \\
        \textbackslash etal         & \etal \\
        \textbackslash uae          & \uae \\
        \textbackslash uAe          & \uAe \\
        \textbackslash uiv          & \uiv \\
        \textbackslash usw          & \usw \\
        \textbackslash uU           & \uU \\
        \textbackslash va           & \va \\
        \textbackslash vgl          & \vgl \\
        \textbackslash Vgl          & \vgl \\
        \textbackslash vs           & \vs \\
        \textbackslash zB           & \zB \\
        \textbackslash zT           & \zT \\
        \textbackslash zz           & \zz \\
        \textbackslash zzgl         & \zzgl \\
        & \\ 
        \bottomrule
	\end{tabular}
\end{table}

\subsubsection{Custom Abbreviations}
Custom abbreviations are defined in the \path{acronyms.tex} file, using the \\
\texttt{\textbackslash newacronym[longplural=\{<long plural>\},} \\ \texttt{shortplural=\{<short plural>\}] \\
\{<label>\}\{<short>\}\{<long>\}} command. The \textit{longplural} and \textit{shortplural} parameters are optional.
The abbreviations are sorted by their labels.
The label is furthermore used to reference the abbreviations in your text.
You can do so using commands listed in \tab \ref{tab:glossaries}.
In most cases, you just use \textbackslash gls\{<label>\}.
On the first occurrence, the full version is displayed, \eg, \ac{ERCIS}.
Afterwards, the short version will be displayed, \eg, \acs{ERCIS}.

You pluralize your abbreviation by adding a \texttt{pl} to the \resp command.
This will add a small s to the abbreviation, \eg, \acp{CD}.
\Tab \ref{tab:glossaries} shows custom short and long plural versions of the abbreviation \acs{kmu}.
You might need this \esp for more complex German abbreviations that do not have a \enquote{s} plural form.

\begin{table}[caption={Commands for printing abbreviations}, label=tab:glossaries]
	\centering
	\begin{tabular}{@{}ll@{}}
		\toprule
		{\bf Command}                         & {\bf Result} \\
        \midrule
		\textbackslash ac\{<label>\}          & \ac{kmu} \\
		                                       & [long form only on first occurence] \\
		\textbackslash acp\{<label>\}         & \acp{kmu} \\
		                                       & [same as \textbackslash ac, but with plural (switch this two lines to see)] \\
		\textbackslash acs\{<label>\}         & \acs{kmu} \\
		\textbackslash acsp\{<label>\}        & \acsp{kmu} \\
		\textbackslash acl\{<label>\}         & \acl{kmu} \\
		\textbackslash aclp\{<label>\}        & \aclp{kmu} \\
		\textbackslash acf\{<label>\}         & \acf{kmu} \\
		\textbackslash acfp\{<label>\}        & \acfp{kmu} \\
        \bottomrule
	\end{tabular}
\end{table}

Only referenced abbreviations will be added to the list of abbreviations. For more information, read the documentation (see \path{config/acronyms.tex})

\subsubsection{Symbols}
If required, you can define symbols in the \path{config/symbols.tex} file, using the same commands as the abbreviations.
Using the symbols is the same as the abbreviations (\ac{pi}, \ac{join}, \ac{selection}).
The symbols are also not sorted by their labels.
You should sort them by yourself before handing in your thesis!

\subsection{Citations and Bibliography}
This template uses {BibTeX} for bibliographies.
It comes with the MISQ style that takes care of proper formating and sorting of your references.
Of course, you have to maintain a clean \path{.bib} file that caters all necessary attributes.
References will appear in the alphabetical order of the surname of the first author.
In case of several works by the same author, they are sorted by year.

Citing in the text is done with the \textbackslash citep[<before>][<after>]\{<citekey>\} command.
Citations without parenthesis are done with \textbackslash cite\{<citekey>\}.
You can reference authors with \textbackslash citeauthor\{<citekey>\}.
However, we suggest typesetting authors in \textsc{Small Caps}, \eg, \textsc{\citeauthor{Hammer2015}} is one father of \acs{BPM}.

\paragraph{Exemplary citations}

\begin{itemize}
	\item \ac{BPM} is an integral management paradigm for building and running effective and efficient organizations \citep{Hammer2015, VomBrocke2014a}.
	\item A holistic approach to \acs{BPM} goes beyond process modeling and workflow management systems \citep[\p{530}]{VomBrocke2014a}.
	\item See \cite{VomBrocke2014a} for a comprehensive review on \acs{BPM} best practices.
	\item \textsc{\citeauthor{Hammer2015}} lists organizational capabilities for \acs{BPM} \citep[\cf][\pf{9}]{Hammer2015}, while \textsc{vom Brocke} \etal give principles of good \acs{BPM} \citep[\cf][\pp{530--546}]{VomBrocke2014a}.
	\item Two authors are automatically divided by an \enquote{and} in English or an \enquote{und} in German, \eg, \citep{Becker2011}.
	\item \enquote{\acs{BPM} can provide a solid set of capabilities essential to master contemporary and future challenges} \citep[\p{534}]{VomBrocke2014a}.
\end{itemize}

\subsubsection{Misc}
The name and matriculation number of the student will automatically be displayed on the header of every page when the thesis type \textit{seminar} is selected.

\section{Compiling the document}
You have different ways to compile this document.
The most common ways are written down in the following subsections.

\subsection{Compiling the document with texstudio}
You can use the default editor \hyperlink{https://www.texstudio.org/}{TeXstudio} for editing Latex files.

\subsection{Compiling the document with vs-code}
In the first step, you need to install \LaTeX on your machine (\hyperlink{https://miktex.org/}{miktex} or \hyperlink{https://www.tug.org/texlive/}{TexLive}).
In the second step, install \hyperlink{https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop}{LaTeX Workshop}-extension for your vs-code editor.
Everything changed in a \LaTeX file, will cause an compile of your document.
You can display the result, next to your code, by clicking on the \enquote{split}-icon on the top-right corner of your editor.

\subsection{Compiling the document with overleaf}
The easiest way for compiling this document is, to upload it to the \hyperlink{https://overleaf.uni-paderborn.de/}{Overleaf}-instance of the Univeryity.
You need to activate your IMT on the \hyperlink{https://serviceportal.uni-paderborn.de/}{Serviceportal} first.
To activate your account for this service, you need to turn on the option \enquote{Overleaf LaTeX Editor} in \enquote{Benutzerverwaltung / Weitere Dienste}.

\subsection{Compiling the document with grunt}
In order to generate a PDF-file from your \TeX-file you have to run the following commands. We assume you have a master file \path{main.tex} that you want to typeset.

\begin{lstlisting}[
    float=htp, 
    caption={Commands to compile this document}, 
    label={lst:compiling}, 
    language=bash, 
    morekeywords={pdflatex, bibtex, makeglossaries}
]
pdflatex main
pdflatex main
makeglossaries main
bibtex main
pdflatex main
pdflatex main
\end{lstlisting}

Alternatively, you can use your favorite task runner.
This thesis comes with a \textit{Grunt} file to kick-start your \LaTeX writing.

When running, Grunt will monitor your thesis and on file changes, the PDF-file is automatically rebuild using the commands from listing \ref{lst:compiling}.
 
Please make sure to have node.js and the \ac{npm} installed.
Now you can open a command prompt at the document root and run the commands in listing \ref{lst:grunt}. 

\begin{lstlisting}[float=htp, caption={Installing and running Grunt}, label={lst:grunt}, language=bash]
# Install Grunt via npm (use sudo on Unix-based OS)
npm install -g grunt-cli

# Install Grunt plugins / dependencies
npm install

# Run the Grunt listener 
grunt
\end{lstlisting}