\documentclass[12pt, a4paper, unicode]{report}
\usepackage[utf8]{inputenc}
\usepackage{ifthen} %% If then else
\usepackage{verbatim} %% For printing latex code
\usepackage{lipsum} %% For lorem ipsum sample text
\usepackage{etoolbox} %% Bibliography chapter to section
\usepackage{multibbl} %% Multiple bibliographies
\usepackage{epigraph} %% Adding text to part pages
\usepackage{epipart} %% Custom code to add epigraph to part pages
\usepackage{titletoc} %% Multiple tables of content
\usepackage{graphicx} %% Sample images
\usepackage{longtable} %% Tables spanning more pages
\usepackage{ragged2e} %% Alignment of quotes
%% PACKAGES USED ONLY IN FOREWORD PAGE (SAFE TO DELETE)
\usepackage{setspace} %% Changing line height in foreword (delete this)
\usepackage{xcolor} %% Changing the background color of foreword (delete this)
\usepackage{afterpage} %% Changing the color back (delete this)
\usepackage[hypertexnames=false]{hyperref}
\usepackage[all]{hypcap}%% Hyperlinks to the beginning of the figure
% Epigraph on the full textwidth justified to the left
% We use the epigraph in custom epipart.sty to display toc on \part page
\setlength{\epigraphwidth}{\textwidth}
\renewcommand{\epigraphflush}{flushleft}
\newcommand{\smalltoc}[4]{
% Custom command for easy creation of the partial table of content
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First argument is the identifier of the toc
% Second argument is starting depth of the toc
% Third argument is depth of the toc
% Fourth argument is optional section* name
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents of this toc is stopped automatically when
% the next startcontent with the same name is issued.
% To alter this, you can use \stopcontents[name] to
% manually set what needs to be in your toc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{1pc}
\ifthenelse{\equal{#4}{}}{}{\section*{#4}}
\hrule\vspace{1pc}
\startcontents[#1]
\printcontents[#1]{}{#2}[#3]{}
\vspace{1pc}
\hrule
\vspace{1pc}
}
% Redefining the default behavior of Chapters in report
% to get rid of the "Chapter" line before chapter title
% Comment this code if you do not like it
\makeatletter
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
%\huge\bfseries \@chapapp\space \thechapter
\Huge\bfseries \thechapter.\space%
%\par\nobreak
%\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
}}
\makeatother
% Removing the page number from parts in TOC + some spacing
\titlecontents{part}[0em]{\vspace*{1.5em}\bfseries\Large}{}{}{}[\vspace*{0.5em}]
% Changing spacing of the chapters in TOC (with dotted rule)
% \titlecontents{chapter}[0em]{
% \vspace*{0.2em}\bfseries}{}{}{\titlerule*[9.2pt]{.}\contentspage}[\vspace*{0.1em}]
% Changing spacing of the chapters in TOC (without dotted rule)
\titlecontents{chapter}[0em]{
\vspace*{0.2em}\bfseries}{}{}{\hfill\contentspage}[\vspace*{0.1em}]
% Document information
\author{Pavol Harar}
\title{\Huge{Cumulative Dissertation Template}\\
\vspace{2pc}\large{Overleaf example of the document structure}}
\date{\the\year}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BEGIN DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Template foreword page (DELETE THIS)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{foreword(todelete)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialization of TOCs, LOT, LOF & bibliographies
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialization of separate tables of contents for each part
% because we want a different depth in each part of the main toc.
\startcontents[tocpart1] % TOC only containing items from Part 1
\startcontents[tocpart2] % TOC only containing items from Part 2
\stopcontents[tocpart2] % Stopping and resuming in Part 2
\startcontents[tocappendix] % TOC only containing items from Appendix
\stopcontents[tocappendix] % Stopping and resuming in Appendix
% Initialization of separate bibliographies because we want
% one bibliography for the first part and separate for each
% chapter of the second part.
\newbibliography{preamble}
\bibliographystyle{preamble}{plain}
\newbibliography{ch1}
\bibliographystyle{ch1}{plain}
\newbibliography{ch2}
\bibliographystyle{ch2}{plain}
% Initialization of LOT (list of tables) and LOF (list of figures)
\startlist[lotpart1]{lot}
\startlist[lofpart1]{lof}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying Abstract & Keywords page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty}
\section*{Abstract}
\lipsum[1]
\section*{Keywords}
keyword, keyword, keyword
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying Acknowledgement page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty}
\section*{Acknowledgement}
\lipsum[1-3]
% Signature
\vspace{5em}
\hfill
\begin{minipage}[t][][t]{16em}%
\begin{center}%
\dotfill \\
Author's signature
\end{center}%
\end{minipage}%
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying main TOC (Table of Contents)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying merged tocpart1 and tocpart2 as one main TOC
% Benefit of doing this is separate settings for each TOC
\printcontents[tocpart1]{}{-1}[2]{\chapter*{Contents}}
\printcontents[tocpart2]{}{-1}[0]{}
\printcontents[tocappendix]{}{-1}[0]{}
\thispagestyle{empty} % turn off page numbering for TOC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying LOT (Lists of Tables)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter*{List of Tables}
\thispagestyle{empty} % turn off page numbering for LOT
\printlist[lotpart1]{lot}{}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Displaying LOF (List of Figures)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter*{List of Figures}
\thispagestyle{empty} % turn off page numbering for LOF
\printlist[lofpart1]{lof}{}{}{}
\cleardoublepage\pagestyle{plain} % turning on the page numbering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART 1 PREAMBLE
% In this part you can write an Introduction to your dissertation,
% you can summarize all the publications which will be included
% later on in full, and you can conclude your dissertation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% In this part, we want arabic numbering of chapters
\renewcommand\thechapter{\arabic{chapter}}
\epigraphhead{} % Use before parts without epigraph
\part*{Preamble}
\addcontentsline{toc}{part}{Preamble} % Add starred part to contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART 1 - CHAPTER 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Introduction}
This is an example text \cite{preamble}{example}.
\lipsum[1]
% QUOTE
\begingroup
\setlength{\epigraphwidth}{13.0cm}
\renewcommand{\epigraphflush}{flushright}
\vspace{0.3cm}
\epigraph{\justifying\large\textit{"A thesis has to be presentable… but don't attach too much importance to it. If you do succeed in the sciences, you will do later on better things and then it will be of little moment. If you don’t succeed in the sciences, it doesn’t matter at all."}}{\textit{Paul Ehrenfest, 1985}}
\vspace{0.3cm}
\endgroup
\section{Some section}
\lipsum[1]
\subsection{Some subsection}
\lipsum[1]
\begin{table}[ht]
\centering
\begin{tabular}{|c|c|}
\hline
Example col 1 & Example col 2 \\
10 & 20 \\
\hline
\end{tabular}
\caption{Example table}
\label{tab:exampleTab}
\end{table}
\begin{figure}[ht]
\centering
\includegraphics[width=5cm]{example-grid-100x100pt}
% \includegraphics{}
\caption{Example figure}
\label{fig:exampleFig}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART1 - CHAPTER 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Summary of the Publications}
\lipsum[1]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART1 - CHAPTER 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Conclusions}
\lipsum[1]
% Bibliography
\bibliography{preamble}{ms}{Bibliography}
\addcontentsline{toc}{chapter}{Bibliography} % Add starred chapter to contents
% Closing the tocs and lists
\stopcontents[tocpart1] % Stops the tocpart1
\stoplist[lotpart1]{lot} % Stops the lotpart1
\stoplist[lofpart1]{lof} % Stops the lofpart1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GROUP FOR PART 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begingroup
% In this group, we want Bibliographies to show up as sections
\patchcmd{\thebibliography}{\chapter*}{\section*}{}{}
% In this group, we want Roman numbering of chapters
\renewcommand\thechapter{\Roman{chapter}}
% In this group, we want to restart the chapter numbering
\setcounter{chapter}{-1}\stepcounter{chapter}
% Resume the contents counter of tocpart2 to include items from PART 2
\resumecontents[tocpart2]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART 2 PUBLICATIONS
% In this part you can include all your publications which
% the dissertation should comprise of. Depending on your uni
% guidelines, the publications could be attached in their original
% templates (just as pdfs), or they can be put into a unified
% style of this dissertation. Adding them as pdfs is for sure
% easier, but it degrades the style of the document and it
% also can introduce problems with copyright (check the guidelines
% of the publishers where your papers were printed).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\epigraphhead[400]{\smalltoc{p2}{0}{0}{}}
\part*{Publications}\label{Publications}
\addcontentsline{toc}{part}{Publications}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART2 - CHAPTER 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \chapter{Title of the First Publication}
\chapter[Shortened Title of the First Publication \dots]
{Very Long Title of the First Publication}
% Mini table of content for this chapter {name}{start}{depth}{section name}
\smalltoc{p2ch1}{0}{3}{Outline}
\section*{Bibliographic Information}
% The package biblatex which supports \fullcite collides with the package multibbl
% I have not found a solution how to print a bib item in the text so I write it out.
% If you find a solution, please, post it here: https://tex.stackexchange.com/questions/173935
Doe,~J., Coffee,~T., Zinn,~C., Leleux,~E., Corcoran,~B., (2019, July). Example research topic in example spaces. In 2019 international example conference (IEC) (pp.1-5). Publisher. \href{https://doi.org}{xxxx.xxxx.xxxxxxx}. \href{https://arxiv.org}{arXiv:xxxx.xxxxx}.
\section*{Author's contribution}
The author contributed to \dots. Furthermore, wrote a significant part of \dots.
\section*{Copyright Notice}
\copyright \the\year\ Publisher. This is an accepted version of this article published in \href{https://doi.org}{doi-xx-xxxx}. Clarification of the copyright adjusted according to the guidelines of the publisher.
\clearpage
% Include the contents of the publication here
\include{publication1/publication1}
% Bibliography
\phantomsection
\addcontentsline{toc}{section}{Bibliography}
\bibliography{ch1}{publication1/publication1}{Bibliography}
\stopcontents[p2ch1]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PART 2 - CHAPTER 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Title of the Second Publication}
% Mini table of content for this chapter {name}{start}{depth}{section name}
\smalltoc{p2ch2}{0}{3}{Outline}
\section*{Bibliographic Information}
% The package biblatex which supports \fullcite collides with the package multibbl
% I have not found a solution how to print a bib item in the text so I write it out.
% If you find a solution, please, post it here: https://tex.stackexchange.com/questions/173935
Doe,~J., Coffee,~T., Zinn,~C., Leleux,~E., Corcoran,~B., (2019, July). Example research topic in example spaces. In 2019 international example conference (IEC) (pp.1-5). Publisher. \href{https://doi.org}{xxxx.xxxx.xxxxxxx}. \href{https://arxiv.org}{arXiv:xxxx.xxxxx}.
\section*{Author's contribution}
The author contributed to \dots. Furthermore, wrote a significant part of \dots.
\section*{Copyright Notice}
\copyright \the\year\ Publisher. This is an accepted version of this article published in \href{https://doi.org}{doi-xx-xxxx}. Clarification of the copyright adjusted according to the guidelines of the publisher.
\clearpage
% Include the contents of the publication here
\include{publication2/publication2}
% Bibliography
\phantomsection
\addcontentsline{toc}{section}{Bibliography}
\bibliography{ch2}{publication2/publication2}{Bibliography}
\stopcontents[p2]
\stopcontents[p2ch2]
\stopcontents[tocpart2]
\endgroup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX (in case you need one)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Resume the contents counter of tocpart2 to include items from PART 2
\resumecontents[tocappendix]
\appendix
\cleardoublepage
\epigraphhead[400]{
\hrule\vspace{1pc}
\printcontents[tocappendix]{}{0}[0]{}
\vspace{1pc}\hrule}
\part*{Appendix}
\addcontentsline{toc}{part}{Appendix} % Add starred part to contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX - CHAPTER 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{First Appendix}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX - CHAPTER 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Second Appendix}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX - CHAPTER 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter*{Complete List of Publications}
\addcontentsline{toc}{chapter}{Complete list of publications} % Add starred part to contents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX - CV
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Curriculum Vit\ae} % Add starred part to contents
\include{cv}
\stopcontents[tocappendix]
\end{document}