% This is the format file for a DIN thesis layout. 
% Use it with the input command
% It was created by Mike Gerdes 2011
% There is no guarantee for correctness.

% main latex includes
\usepackage[pdftex]{graphicx}
\usepackage{multicol}
\usepackage{pdfpages}
\usepackage{color} % Farbe \textcolor{Farbe}{Text} oder \color{Farbe}
\definecolor{HAW-Schrift}{rgb}{0,0,0.4} % HAW-Farben
\usepackage{listings} % include source code
\lstset{language=Matlab,breaklines,frame=single,basicstyle=\small\sffamily} % setting for listings
\usepackage{helvet}
\usepackage{mathptmx} % Times New Roman
\renewcommand{\familydefault}{\rmdefault}
\DeclareGraphicsExtensions{.png,.pdf,.jpg,.jpeg}
\usepackage{natbib} % Use DIN bibilography
%\usepackage{tocbibind} % Include bibilography into ToC
\usepackage[thinspace,thinqspace,squaren,textstyle]{SIunits} %Abstände für Einheiten \unit{Wert}{Einheit}
\usepackage{multirow}
\usepackage{tabularx, booktabs}
\usepackage{hyperref}
\usepackage[ngerman, iso]{isodate}

%Colored boxes
\usepackage{framed}
\definecolor{shadecolor}{gray}{.75}

\usepackage{lastpage}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page layout (geometry)
\setlength\voffset{-1in}
\setlength\hoffset{-1in}
\setlength\topmargin{1cm}
\setlength\oddsidemargin{2.5cm}
\setlength\evensidemargin{2.5cm} % Only for two sided documents
\setlength\textheight{9.732699in}
\setlength\textwidth{6.3075in}
\setlength\footskip{1.25cm}
\setlength\headheight{1cm}
\setlength\headsep{0.5cm} % Distance head to text
%\setlength{\columnsep}{0.5cm} %Spaltenabstand

%Überschriften Layout
\setkomafont{sectioning}{\bfseries\rmfamily}
\setkomafont{section}{\pagebreak\Large}

%\Format für Listen
\setkomafont{descriptionlabel}{\bfseries}

%Gliederungstiefe
\setcounter{secnumdepth}{3}

%Zeileneinzug
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}

%Zeilenabstand
\linespread {1}\selectfont

% Footnote rule
\setlength{\skip\footins}{0.0469in}
\renewcommand\footnoterule{\vspace*{-0.0071in}\setlength\leftskip{0pt}\setlength\rightskip{0pt plus 1fil}\noindent\textcolor{black}{\rule{0.25\columnwidth}{0.0071in}}\vspace*{0.0398in}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% miscalleneous packages

%\usepackage[UKenglish]{babel} % use this if you are writting in english
\usepackage[ngerman]{babel} % use this if you are writting in german
\usepackage[T1]{fontenc} % use this if you are using Umlaute
\usepackage{eurosym} %euro symbol example usage \EUR{1.20} or \EUR{}

% math extension (American Mathematical Society)- one probably wants to use symbols like '[' (written as '$[$')
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{verbatim} % include eg: source code easily

% headers and footers includes for your document
\usepackage{fancyhdr}

%clear all preset formats
\fancyhf{}

% line width for header and footer
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\footrulewidth}{0.0pt}

%redefine headings for the title page
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0.0pt}}

%\addtolength{\headwidth}{\marginparsep}

% uncomment the following lines for headers
% the following command need picture files : "logo-school.jpg"
% and "logo-company.jpg" in the project directory
%
%        \lhead{\sl \includegraphics[height=1.1cm]{logo-school}}
        \chead{\thepage}
%        \rhead{\sl \includegraphics[height=1.2cm]{logo-company}}
%        \lfoot{}
%        \cfoot{}
%        \rfoot{}
%

% use the headers and footers for the document
\pagestyle{fancy}

% ToC configuration
% cftXnumwidth is the width of the section number
% cftXindent is the width before the section number
% X can be sec,subsec,subsubsec,tab or fig
\usepackage{tocloft}
\setcounter{tocdepth}{3} %ToC Tiefe
\setlength{\cftsecnumwidth}{3em}
\setlength{\cftsecindent}{0em}
\setlength{\cftsubsecnumwidth}{3em}
\setlength{\cftsubsecindent}{0em}
\setlength{\cftsubsubsecnumwidth}{3em}
\setlength{\cftsubsubsecindent}{0em}
\setlength{\cftparskip}{0cm}
\setlength{\cftbeforesecskip}{\baselineskip}
\setlength{\cftbeforesubsecskip}{0cm}
\renewcommand{\cftdotsep}{2}            %keine Punkte mit \cftnodots
\renewcommand{\cftsecdotsep}{\cftdotsep}

%List of Figures
\setlength{\cftfignumwidth}{5cm}
\setlength{\cftfigindent}{0em}

%Zeileneinzug
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}

% Zähler für Listings
\newcounter{code}
\setcounter{code}{0}

%Zeilenabstand
\linespread {1}\selectfont

%Nummeringunsformat
\makeatletter
\def\@seccntformat#1{\hb@xt@ 15mm{\csname the#1\endcsname \hfil}}
\makeatother


%Section Headings
\makeatletter
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{\z@}%                       % the indent
{3\baselineskip}%            % the before skip
{1\baselineskip}%          % the after skip
{\newpage\bfseries\LARGE}} % the style
\makeatother

\makeatletter
\renewcommand{\subsection}{\@startsection
{subsection}%                   % the name
{2}%                         % the level
{\z@}%                       % the indent
{-\baselineskip}%            % the before skip
{0.5\baselineskip}%          % the after skip
{\bfseries\Large}} % the style
\makeatother

\makeatletter
\renewcommand{\subsubsection}{\@startsection
{subsubsection}%                   % the name
{3}%                         % the level
{\z@}%                       % the indent
{-\baselineskip}%            % the before skip
{0.01\baselineskip}
%{0.5\baselineskip}%          % the after skip
{\bfseries\large}} % the style
\makeatother

\numberwithin{figure}{section}
\numberwithin{table}{section}

% Befehl für Norm-Bilder, setzt Caption richtig. Figure kann auch in Abbildung geändert werden.
\newcommand{\normpicture}[5]{
\begin{figure}[htb]
\includegraphics[#1,#2]{#3}
\vspace*{0.1cm}\\
\refstepcounter{figure}\label{#5}
\addcontentsline{lof}{subsection}{\numberline{\textbf{Bild \thefigure}}\hspace{10mm}#4}
\vspace{-8mm}\begin{description}\sffamily \footnotesize 
 \item[\sffamily \footnotesize Bild \thefigure]#4
\end{description}\vspace{-2mm}
\end{figure}
}

\newenvironment{zitat}[1]{\begin{quote}\itshape #1}{\end{quote}}

%Widertables
\renewcommand{\arraystretch}{1.5}

%\normpicture{Parameter1}{Parameter1}{Name}{Label}{Reference}
% example: \normpicture{Width}{Heigth}{Picture.jpg}{A fine Caption}{Ref}

% Befehl für Norm-Tabellen. Setzt die wichtigsten Layout-Sachen und die Caption. Der Inhalt der Tabelle muss in Latex-Format übergeben werden. Siehe Beispiel
\newcommand{\normtable}[5]{
 \begin{table}[htb]
 \refstepcounter{table}
\addcontentsline{lot}{subsection}{\numberline{\textbf{Tabelle \thetable}}\hspace{10mm}#1}
 \label{#2}
\begin{description}\sffamily \footnotesize 
 \item[\sffamily \footnotesize Tabelle \thetable]#1
\end{description}\vspace{-2mm}
 \begin{tabular}{#3}
 \hline
 #4\\
 \hline
 #5\\
 \hline 
 \end{tabular}
 \end{table}}

% \normtable{Lable}{Reference}{Column-Definition}{Header}{Table Body}
% example: \normtable{Tabelle mit Einer}{einertab}{ccc}{First & Second & Third}{1&1&1\\1&1&1\\1&1&1}

% \begin{multicols}{2} % Befehl um zweisplatigen Text anzufangen
%\end{multicols} % Befehl um zweiplatigigen Text zu beenden

%% this next section (till \makeatother) makes sure that blank pages
%% are actually completely blank, cause they're not usually
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
        \hbox{}
        \vspace*{\fill}
        \thispagestyle{empty}
        \newpage
        \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

%Set font encoding
\usepackage[utf8]{inputenc}

%% Din bibilography
\bibliographystyle{natdin}

%Anpassung der Bib-Labels
\def\bibabstand{5cm}
\makeatletter
\renewcommand{\bibstyle@natdin}%
     {\bibpunct[,~]{(}{)}{;}{a}{}{,~}
     \gdef\NAT@biblabelnum##1{\makebox[\bibabstand][l]{\textbf{##1}}}}
\bibstyle@natdin
\setlength{\bibhang}{\bibabstand}
\makeatother

\numberwithin{equation}{section}
\newcommand{\normequation}[2]{\vspace*{-0.5cm}
\begin{equation}\label{eq:#1}
\begin{split}
#2 
\end{split}
\end{equation}
}

\newcommand{\Def}[3]{\medskip {\noindent \bfseries #1} \par {\noindent ``#2''}\ifthenelse{\equal{#3}{}}{}{\newline \citep{#3}} \par}

%From Tweaklist.sty
\makeatletter
\def\enumhook{}
\def\enumhooki{}
\def\enumhookii{}
\def\enumhookiii{}
\def\enumhookiv{}
\def\itemhook{}
\def\itemhooki{}
\def\itemhookii{}
\def\itemhookiii{}
\def\itemhookiv{}
\def\descripthook{}
\def\enumerate{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \expandafter
      \list
        \csname label\@enumctr\endcsname
        {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}%
          \enumhook \csname enumhook\romannumeral\the\@enumdepth\endcsname}%
  \fi}
\def\itemize{%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {\def\makelabel##1{\hss\llap{##1}}%
        \itemhook \csname itemhook\romannumeral\the\@itemdepth\endcsname}%
  \fi}
\renewenvironment{description}
                 {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                          \let\makelabel\descriptionlabel\descripthook}}
                 {\endlist}
\makeatother

%Define space between list items
\renewcommand{\itemhook}{\setlength{\topsep}{0pt}%
  \setlength{\itemsep}{-5mm}}

%% Definition of the title page layout
\renewcommand{\abstract}[1]{
\def\abstractvar{#1}
}

\renewcommand{\title}[1]{
\def\titlevar{#1}
}

\renewcommand{\author}[1]{
\def\authorvar{#1}
}

\renewcommand{\date}[1]{
\def\datevar{#1}
}

\newcommand{\adress}[1]{
\def\adressvar{#1}
}

\newcommand{\receipants}[1]{
\def\receipantsvar{#1}
}

\newcommand{\phone}[1]{
\def\phonevar{#1}
}

\newcommand{\documentname}[1]{
\def\documentnamevar{#1}
}

\newcommand{\documenttype}[1]{
\def\documenttypevar{#1}
}

\newcommand{\email}[1]{
\def\emailvar{#1}
}

\newcommand{\tutor}[1]{
\def\tutorvar{#1}
}

\newcommand{\aufgabenstellung}[1]{
\def\aufgabenstellungvar{#1}
}

\newcommand{\docsubtitle}[1]{
\def\subtitlevar{#1}
}

\newcommand{\makeThesis}{
\thispagestyle{empty}

\vspace*{-2.75cm}
\hspace*{6.4cm}
\includegraphics[height=3.25cm]{layout-pictures/haw-logo.png}

\vspace{41.5mm}
\hspace*{-20.0mm}
\begin{minipage}{20cm}
\begin{shaded}\color{white}
{\hspace*{2cm}\sffamily\Large \documenttypevar}\\

\vspace*{76mm}

{\hspace*{2cm}\sffamily\Large Department Fahrzeugtechnik und Flugzeugbau}
\end{shaded}
\end{minipage}
\color{black}

\vspace*{2mm}

{\sffamily\LARGE\textbf{\titlevar}}

\vfill

{\sffamily\Large Verfasser: \authorvar}

\vspace{1.5cm}

{\sffamily\large \makebox[1.5cm][l]{Prüfer:} Prof. Dr.-Ing. Dieter Scholz, MSME\\
\makebox[1.5cm][l]{Tutor:} \tutorvar\\
\\
Abgabedatum: \datevar}

\newpage

\begin{center}
   \begin{minipage}{\textwidth} 
         \noindent\textbf{\Large\vspace{1cm}\\ Kurzreferat} \\
        \phantomsection
        \addcontentsline{toc}{subsection}{Kurzreferat}
        \\
      \abstractvar
   \end{minipage}
\end{center}

\newpage

\includepdf[pages=-,offset=25mm -25mm]{\aufgabenstellungvar}

\newpage

\setcounter{tocdepth}{2}

\tableofcontents
\phantomsection 
\addcontentsline{toc}{subsection}{Inhaltsverzeichnis}

\thispagestyle{empty}

\listoffigures
\phantomsection 
\addcontentsline{toc}{subsection}{Liste der Bilder}

\thispagestyle{empty}

\listoftables
\phantomsection
\addcontentsline{toc}{subsection}{Liste der Tabellen}

\newpage

\normalsize
}

\newcommand{\makeFormlessThesis}{
\thispagestyle{empty}

\begin{center}

\vspace*{2cm}

\large
\adressvar

\vspace*{5cm}

{\Large\textbf{\titlevar}}\\
\vspace*{2\baselineskip}
\subtitlevar\\
\vspace*{4cm}
\authorvar\\
\vspace*{4cm}
Abgabedatum: \datevar\\
\vspace*{2\baselineskip}
\documenttypevar\\
\vspace*{2\baselineskip}
\normalsize

\end{center}

%\cleardoublepage 

\begin{center}
   \begin{minipage}{\textwidth} 
         \noindent\textbf{\Large\vspace{1cm}\\ Kurzreferat} \\
         \phantomsection 
         \addcontentsline{toc}{subsection}{Kurzreferat}
        \\
      \abstractvar
   \end{minipage}
\end{center}

\newpage

\includepdf[pages=-,offset=25mm -25mm]{\aufgabenstellungvar}

\newpage

\textbf{\large Erklärung}

\normalsize
Ich versichere, dass ich diese Diplomarbeit ohne fremde Hilfe selbstständig verfasst und nur die angegebenen Quellen und Hilfsmittel benutzt habe. Wörtlich oder dem Sinn nach aus anderen Werken entnommene Stellen sind unter Angabe der Quellen kenntlich gemacht.

\vspace{2cm}

\datevar \hspace{4.2cm} \authorvar\\
\vspace{0.4cm}\\
\rule{4cm}{1pt } \hspace{2cm} \rule{4cm}{1pt }\\
Datum   \hspace{5cm}    Unterschrift

\newpage

\tableofcontents
\phantomsection 
\addcontentsline{toc}{subsection}{Inhaltsverzeichnis}

\thispagestyle{empty}

\listoffigures
\phantomsection 
\addcontentsline{toc}{subsection}{Liste der Bilder}

\thispagestyle{empty}

\listoftables
\phantomsection 
\addcontentsline{toc}{subsection}{Liste der Tabellen}

\newpage

\normalsize
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
