\documentclass[12pt, a4paper]{treport}

\usepackage{setspace}
\usepackage[cmex10]{amsmath}
\usepackage{amsfonts, amssymb}
\usepackage[font={stretch=1.2,small},labelfont=bf]{caption}
\usepackage{url, ifthen, verbatim}
\usepackage[nocompress]{cite}
\usepackage{color, epsfig, graphicx, stfloats, multirow}
%\usepackage{subfigure}
\usepackage[font=small]{subcaption}
\usepackage{fancyheadings, style_thesis, afterpage}
%\usepackage[part]{algorithm}
\usepackage{algorithmic}
\usepackage[lined,boxed,algopart]{algorithm2e}
\usepackage{chngcntr}
%\usepackage[titles]{tocloft}

\usepackage{mathtools}
\usepackage[left=4cm,top=2.5cm,right=2.5cm, bottom=2.5cm]{geometry}
%\usepackage[bookmarks, colorlinks=false, pdftitle={Online Structured Learning for Real-Time Computer Vision Gaming Applications}, pdfauthor={Sam Hare}]{hyperref}
\usepackage{bookmark}
\usepackage{rotating}

%\usepackage[bookmarks, colorlinks=false, pdftitle={Online Structured Learning for Real-Time Computer Vision Gaming Applications}, pdfauthor={Sam Hare}]{hyperref}

%\include{MyMacros}
%\usepackage[T1]{fontenc}

\counterwithin{chapter}{part}
\counterwithin{section}{chapter}
\counterwithin{subsection}{section}
\counterwithout{table}{chapter}
\counterwithout{figure}{chapter}
\counterwithin{table}{part}
\counterwithin{figure}{part}
\counterwithin{equation}{part}

%%%\numberwithin{chapter}{part}
%%%%\numberwithin{table}{part}
%%%%\numberwithin{figure}{part}
%%%\numberwithin{equation}{part}
%%%\numberwithin{section}{chapter}
%%%\numberwithin{subsection}{section}

\hypersetup{%
    pdfborder = {0 0 0}
}

\SetAlCapSkip{0.4cm}
\SetAlgoCaptionLayout{small}
 % Define the algorithm listing for list of algorithms to be spaced the same as LOF and LOT with dotted lines
\makeatletter
\def\l@algocf#1#2{\@dottedtocline{1}{1.5em}{3.2em}{#1}{#2}}
\makeatother

\def\eg{\emph{e.g.}}
\def\Eg{\emph{E.g.}}
\def\ie{\emph{i.e.}}
\def\Ie{\emph{I.e.}}
\def\etal{\emph{et al.}}
\newcommand{\TODO}[1]{{\textcolor{red}{TODO: #1}}}
\newcommand{\vt}[1]{{\bf #1}} % vector formatting
\newcommand{\vg}[1]{\boldsymbol{#1}} % vector formatting for greek symbols
\newcommand{\vi}[1]{{\mathit{#1}}} % vector formatting
\newcommand{\vu}[1]{{\underline{#1}}} % vector formatting
\newcommand{\argmin}{\operatornamewithlimits{argmin}}
\newcommand{\argmax}{\operatornamewithlimits{argmax}}
\def\transp{^{\mathsf{T}}}
\newcommand{\dotp}[2]{\langle #1, #2 \rangle}

%\graphicspath{{tex/chapter1/figures/}{tex/chapter2/figures/}{tex/chapter3/figures/}{tex/chapter4/figures/}{tex/chapter5/figures/}{tex/chapter7/figures/}{tex/chapter7/figures/manmade}}

\graphicspath{{chapters/background/}{chapters/struck/}{chapters/learnmatch/}{chapters/reconstructor/}}

% Headers and footers
\pagestyle{fancyplain}
\lhead{\fancyplain{}{\nouppercase{\leftmark}}}     \chead{\fancyplain{}{}}       \rhead{\fancyplain{}{}}
\lfoot{\fancyplain{}{}}        \cfoot{\fancyplain{}{}} \rfoot{\fancyplain{\thepage}{\thepage}}

\begin{document}

%\doublespacing

\pagenumbering{roman}
\renewcommand{\baselinestretch}{1.5}
\selectfont
\input{chapters/title}
\input{chapters/abstract}
\pagebreak
%\input{tex/chapter0/Dedication}
%\pagebreak
%\input{tex/chapter0/Copyright}
%\pagebreak
%\input{chapters/acknowledgements}
%\pagebreak

%\renewcommand{\cftpartfont}{\fontsize{14}{14}\bf}
%\renewcommand{\cftchapfont}{\normalsize\bf}
%\setlength{\cftbeforechapskip}{0ex}
\renewcommand{\baselinestretch}{1.08} % hack to get contents looking nice
\selectfont

\setcounter{tocdepth}{1}
\thispagestyle{plain}
\tableofcontents
\clearpage
\thispagestyle{plain}
\listoffigures
\clearpage
\thispagestyle{plain}
\listoftables
\vspace{2cm}
\listofalgorithms
\clearpage
%\thispagestyle{plain}
%\listoftables

\newpage
\pagenumbering{arabic}
\renewcommand{\baselinestretch}{1.5}
\selectfont

%\doublespacing

\input{chapters/intro}
\input{chapters/background/background}
\input{chapters/struck/struck}
\input{chapters/learnmatch/learnmatch}
\input{chapters/reconstructor/reconstructor}
\input{chapters/conclusions}

\newpage
\clearpage
\thispagestyle{plain}
\bibliographystyle{abbrv}
\addcontentsline{toc}{part}{Bibliography}
%\bibliography{IEEEabrv,thesis}
%\bibliography{bibs/amirsaffari,bibs/leistner,bibs/grabner,bibs/learnmatch,bibs/library}
\bibliography{bibs/library}

\end{document}
