\documentclass[DIV15,BCOR12mm]{scrbook}
\newif\ifAFive\AFivetrue
\ifAFive
  \KOMAoptions{paper=a5,twoside=true}
\else
  \KOMAoptions{paper=a4,twoside=false}
\fi
\usepackage{etoolbox}
\usepackage{amsmath,amssymb}% math symbols / fonts
\usepackage{mathtools}      % \xRightarrow
\usepackage{nicefrac}       % \nicefrac
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[framed,amsmath,thmmarks,hyperref]{ntheorem}
\usepackage{framed}
\usepackage{marvosym}
\usepackage{makeidx}        % for automatically generation of an index
\usepackage{xcolor}
\usepackage[bookmarks,bookmarksnumbered,hypertexnames=false,pdfpagelayout=OneColumn,colorlinks,hyperindex=false]{hyperref} % has to be after makeidx
\usepackage{breakurl} % allow line breaks in \href{ ... }
\ifAFive
  \hypersetup{hidelinks=true}
% no \else branch needed in this case
\fi
\usepackage{enumitem}       % Better than \usepackage{enumerate}, because it allows to set references
\usepackage{multicol}       % Breaking a list into multiple columns
\usepackage{tabto}
\usepackage{braket}         % needed for \Set
\usepackage{csquotes}       % \enquote{}
\usepackage{subfig}         % multiple figures in one
\usepackage{parskip}        % nicer paragraphs
\usepackage{xifthen}        % \isempty
\usepackage{changepage}     % for the adjustwidth environment
\usepackage{pst-solides3d}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usepackage[arrow, matrix, curve]{xy}
\usepackage{caption}        % get newlines within captions
\usepackage{tikz}           % draw
\usepackage{tikz-3dplot}    % draw
\usepackage{tkz-fct}        % draw
\usepackage{tkz-euclide}    % draw
\usetkzobj{all}             % tkz-euclide
\usetikzlibrary{3d,calc,intersections,er,arrows,positioning,shapes.misc,patterns,fadings,decorations.pathreplacing}
\usepackage{tqft}
\usepackage{xspace}   % for new commands; decides weather I want to insert a space after the command
\usepackage[german,nameinlink]{cleveref} % has to be after hyperref, ntheorem, amsthm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{array,xtab,ragged2e} % for symbol table
\newlength\mylengtha
\newlength\mylengthb
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}
\tabcolsep=3pt % default: 6pt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{acronym}
\usepackage{minted} % needed for the inclusion of source code
\usemintedstyle{bw}
\usepackage{courier}
\usepackage{wasysym}
\usepackage[binary-units = true]{siunitx} % this package is for units!
\sisetup{locale=DE}

%%% Pseudocode settings
\usepackage{algorithm,algpseudocode}
\algtext*{EndIf}        % Remove "end if" text
\algtext*{EndWhile}     % Remove "end while" text
\algtext*{EndFunction}  % Remove "end while" text
\algnewcommand\Global{\textbf{global }}
\makeatletter
\addto\captionsngerman{\renewcommand{\ALG@name}{Algorithmus}}
\makeatother
%%% End of Pseudocode settings
\usepackage{shortcuts}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]%
{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\renewcommand{\sectionmark}[1]%
{\markright{\MakeUppercase{\thesection.\ #1}}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\newcommand{\helv}{%
\fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
\fancyhf{}
\fancyhead[LO,RE]{\helv \thepage}
\fancyhead[LE]{\helv \rightmark}
\fancyhead[RO]{\helv \leftmark}
\fancypagestyle{plain}{%
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
}

\hypersetup{ 
  pdfauthor   = {Martin Thoma}, 
  pdfkeywords = {Programmierparadigmen}, 
  pdftitle    = {Programmierparadigmen} 
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The patch for minted: http://tex.stackexchange.com/a/168021/5645
\makeatletter
\def\FV@BeginListFrame@Lines{%
  \begingroup
  \lineskip\z@skip
  \FV@SingleFrameLine{\z@}%
  \kern-0.5\baselineskip\relax
  \baselineskip\z@skip
  \kern\FV@FrameSep\relax
  \penalty\@M% added line
\endgroup}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\makeindex
\allowdisplaybreaks
\usepackage{microtype}

\begin{document}
%-------------------------------------------------------------
\newcolumntype{C}{>{\centering\arraybackslash}p{2cm}}
%-------------------------------------------------------------
\pagenumbering{roman}
\setcounter{page}{1}
\input{titlepage}
\input{Vorwort}
\tableofcontents

\pagenumbering{arabic}
\setcounter{page}{1}
\input{Programmiersprachen}
\input{Programmiertechniken}
\input{Logik}
\input{Lambda}
\input{Typinferenz}
\input{Parallelitaet}
\input{Java}
\input{Haskell}
\input{Prolog}
\input{Scala}
\input{X10}
\input{C}
\input{MPI}
\input{Compilerbau}
\input{Java-Bytecode}

\appendix
\input{Bildquellen}
\clearpage
\input{Abkuerzungen}
\clearpage
\input{Definitionen} 
\clearpage
\input{Symbolverzeichnis} 
\clearpage
\addcontentsline{toc}{chapter}{Stichwortverzeichnis}
\renewcommand{\indexname}{Stichwortverzeichnis}
\printindex
\end{document}
