%%%%%%%%%%
%Präambel%
%%%%%%%%%%

%Hier sind Parameter einzustellen (Pakete werden geladen und durch [Optionen] 
%und {Argumente} bestimmt 
\documentclass[%
  paper=A4,%
  a4paper,%
  BCOR=8mm,%
  DIV=current,%
  twoside,%
  12pt,%
  headinclude=true,%
  headlines=1.8,%
  footinclude=false,version=first,%
  bibliography=totoc,%
  bibtotoc]{scrbook}

%Kodierung des Tex-Dokumentes
\usepackage[T1]{fontenc}
%\usepackage[latin1]{inputenc}
\usepackage[utf8x]{inputenc}

% bessere typewriter font

%erlaubt die deutschsprachigen Zeichen
\usepackage[ngerman]{babel}
%\usepackage{marvosym}

%erlaubt Graphiken einzubinden
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{wrapfig}

%ermöglicht verschiedene Stile des Literaturverzeichnises
%\usepackage{jurabib}
%\usepackage{plain}
%weitere Stile auf der 
\usepackage[sectionbib,square]{natbib}

%\usepackage{a4wide}
%\usepackage{amsfonts}

%Mathematische Formeln
\usepackage{amsmath,mathrsfs,amssymb}
%\usepackage[intlimits]{empheq}
\usepackage{theorem}
%\usepackage{mathpazo}
%\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
%\usepackage{courier}
\usepackage{inconsolata}

\usepackage[disable=true]{todonotes}
%\usepackage{todonotes}

%Listen
\usepackage{eqlist}

%erlaubt Referenzen im Inhaltsverzeichnis
\usepackage[
  pdftex,
  pdfpagelabels,
  plainpages=false,
  colorlinks,
  urlcolor=gray,
  linkcolor=black,
  citecolor=black,
  pdfauthor={Max Mustermann},
%  pdftitle={GZ:if expand("%") == ""|browse confirm w|else|confirm w|endif}
]{hyperref}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}

% programm code
\usepackage{listings} 
\lstset{basicstyle=\small\ttfamily, stringstyle=\ttfamily,
backgroundcolor=\color{lightgray}, numbers=left, numberstyle=\small,
stepnumber=1, numbersep=5pt}

%\usepackage[Bjornstrup]{fncychap}
%\ChNumVar{\fontsize{76}{80}\usefont{OT1}{pzc}{m}{n}\selectfont}
%\ChTitleVar{\raggedleft\Large\sffamily\bfseries}

%(nummeriert auch \paragraph)
%\setcounter{secnumdepth}{4}

%(Anzahl Ebenen ins Inhaltsverzeichnis) 
%\setcounter{tocdepth}{3} 

%\setcounter{section}{4}
%\setcounter{chapter}{+2}

\usepackage{float}
 
\newfloat{mybox}{thp}{lop}[chapter]
\floatname{mybox}{Infobox}


\usepackage{makeidx}

%Zeilenabstand
% \linespread{1}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%Paket fancyhdr einbinden%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{fancyhdr}
%\renewcommand{\headrulewidth}{0.4pt}
%Seitenstil auf fancy schalten. Das Paket pagestyle Bestimmt, ob Kopf- und/oder 
%Fusszeile angezeigt werden
%\pagestyle{fancyplain}	

%löscht vordefinierte Einstellungen
%\fancyhf{}			

%\fancyhead[L]{homomorphic encryption friendfinder ..}
%\fancyhead[R]{}
%\fancyfoot[C]{\thepage}

\usepackage{scrpage2}

\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Chapter thumbs with scrpage2
%

% Safty first
\@ifundefined{chapter}{\let\chapter\undefined
  \chapter must be defined to use chapter thumbs!}{%

\newcommand*{\putoddnumbers}{%
\begin{tikzpicture}[remember picture, overlay]
    \node [shift={(-1.4cm,-3.6cm)}] at (current page.north east)
        {%
            \begin{tikzpicture}[remember picture, overlay] 
                \fill[fill=gray] (0,0) rectangle (1.4cm,1.2cm);
                \node [shift={(0.7cm,0.55cm)}] {
                    \textcolor{white}{%
                    \strut\thepage%
                    }%
                };
            \end{tikzpicture}
        };
\end{tikzpicture}
}

\newcommand*{\putevennumbers}{%
\begin{tikzpicture}[remember picture, overlay]
    \node [shift={(0cm,-3.6cm)}] at (current page.north west)
        {%
            \begin{tikzpicture}[remember picture, overlay] 
                \fill[fill=gray] (0,0) rectangle (1.4cm,1.2cm);
                \node [shift={(0.7cm,0.55cm)}] {
                    \textcolor{white}{%
                    \strut\thepage%
                    }%
                };
            \end{tikzpicture}
        };
\end{tikzpicture}
}

\newcommand*{\fancypagenumbers}[2][]{%
  \rohead[\putoddnumbers#1]{\putoddnumbers#2}%
  \lehead[\putevennumbers#1]{\putevennumbers#2}%
}


% initial use
\fancypagenumbers{}
\pagestyle{scrheadings}

}
%
%  End of chapter thumbs with scrpage2
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother

\pagestyle{scrheadings}
\setkomafont{pageheadfoot}{\normalfont\large\sffamily\bfseries}
\setkomafont{pagenumber}{\normalfont\large\sffamily\bfseries}


% beidseitig innen
\ihead[]{\textcolor{gray}{\headmark}}

% beidseitig aussen
%\ohead[\textcolor{gray}{\pagemark}]{%
%\fcolorbox{gray}{gray}{%
%\rule[-1mm]{0mm}{6mm}%
%\hspace{1cm}%
%\textcolor{white}{\pagemark}}%
%\rule{3mm}{0mm}%
%}

% lösche Inhalt restlicher Felder
% header Mitte
\chead[]{}

% footer
\ofoot[]{}
\cfoot[]{}
\ifoot[]{}


%Lädt Symbolschriften
%\usepackage{pifont}

%Setzt den Abstand zwischen den Absätzen auf "groß"
\setlength{\parskip}\bigskipamount

%%%%%%%%%%%%%%%%%%%%%%%%
%Anfang des Textkörpers%
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagenumbering{roman}

%%% Titel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{titel}
\pagenumbering{Roman}

%%% .. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{erklaerung}
\tableofcontents
\cleardoublepage
\pagenumbering{arabic}

\renewcommand*{\dictumwidth}{.45\textwidth}

\newcommand{\miniheading}[1]{\noindent\textsf{\textbf{#1}}\vspace{2mm}\nopagebreak[4]\\}
\newcommand{\otodo}[1]{\todo[color=green!40]{#1}}

%%% Hauptteil %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{kapitel_x}

%%% Anhang %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\appendix
\renewcommand*{\thesection}{\Alph{section}}
\addtocounter{secnumdepth}{1}

\include{kapitel_A}

%% Literatur %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{dinat}
\bibliography{bib/literatur}

\nocite{*}

\end{document}
