%%%%
%% This Source Code Form is subject to the terms of the MIT License. 
%% If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/mit
%%
%% Last update: 2024/03/11
%% 
%% author: Dorian Gouzou <jackred@tuta.io>
%% repository hosted on github at https://github.com/jackred/Heriot_Watt_Thesis_Template
%%%%
\documentclass[12pt,a4paper]{report}

\input{I-packages}
\input{I-config}
\input{I-info}
\input{I-glossary}
\input{I-packages-2} % some package need to be loaded last in preamble

\begin{document}

\dominitoc

\pagestyle{empty}
\input{Preliminaries/1-titlepages}
\clearpage
% % remove this line if you don't want pagination on preliminary pages
% % also read the comment below, for table of content and other
% \pagestyle{preliminary}
\input{Preliminaries/2-abstract}
\clearpage
%\input{Preliminaries/3-dedication}
%\clearpage
\input{Preliminaries/4-acknowledgments}
\clearpage
% % read about declaration in file
% % \input{Preliminaries/5-declaration}
\includepdf[pages=-]{Preliminaries/5-declaration.pdf}

{
    \setstretch{1}
    \hypersetup{linkcolor=black}
    \tableofcontents
    \listoftables % optional
    \listoffigures % optional
    \glsaddall % this is to include all acronym. You can do a sort of citation for acronym and include only the one you use, Look at the glossary package for details.
    \printnoidxglossary[type=\acronymtype, title=Glossary] % optional
    %% put your publications in BibMine.bib 
    %% They will be displayed here
    \begin{refsection}[BibMine.bib]
    \DeclareFieldFormat{labelnumberwidth}{#1}
    \nocite{*}
    \printbibliography[omitnumbers=true,title={List of Publications}]
    \end{refsection}
}

%% if you don't want pagination you need to use this commented part instead of the one above for the table of content/list of figure/etc
%% this is because the toc is defined in an annoying way, especially multi page one
%% solution found here: https://tex.stackexchange.com/a/173423
% {
%     \hypersetup{linkcolor=black}
%     \pagestyle{empty}              % Removes numbers from middle pages.
%     \fancypagestyle{plain}         % Re-definition removes numbers from first page.
%     {
%         \fancyhf{}%                       % Clear all header and footer fields.
%         \renewcommand{\headrulewidth}{0pt}% Clear rules (remove these two lines if not desired).
%         \renewcommand{\footrulewidth}{0pt}%
%     }
%     \tableofcontents
%     \thispagestyle{empty}
%     \listoftables %optional
%     \thispagestyle{empty}
%     \listoffigures %optional
%     \thispagestyle{empty}
%     \glsaddall % this is to include all acronym. You can do a sort of citation for acronym and include only the one you use, Look at the glossary package for details.
%     \printnoidxglossary[type=\acronymtype, title=Glossary] % optional
%     \thispagestyle{empty}
%     %% put your publications in BibMine.bib 
%     %% They will be displayed here
%     \begin{refsection}[BibMine.bib]
%     \DeclareFieldFormat{labelnumberwidth}{#1}
%     \nocite{*}
%     \printbibliography[omitnumbers=true,title={List of Publications}]
%     \end{refsection}
%     \thispagestyle{empty}
% }



\clearpage

\pagestyle{chapter}
\subfile{Chapters/Cavitation}
\subfile{Chapters/Chapter1-Introduction}
\subfile{Chapters/Chapter2}
\subfile{Chapters/Chapter3}
\appendix
\subfile{Appendices/Appendix1}

%% add publications in pdf format
\clearpage
\stepcounter{chapter}
\addcontentsline{toc}{chapter}{\thechapter\ \ \ \ Publication 1}
\includepdf[pages=-]{Publications/Publication1.pdf}


%% using biblatex rather than bibtex to easily have further reading and references
%% you need to remove the cache file when adding files to the bibliography
%% Log and output files > trash icons in Overleaf
%% sorted by citation
\label{Bibliography}
\printbibliography[title={References}, heading=bibintoc, resetnumbers=true]
%% sorted by alphabetical order, using author name
%\begin{refsection}
%\DeclareFieldFormat{labelnumberwidth}{#1}
%\nocite{*}
%\printbibliography[title={Bibliography}, notcategory=cited, omitnumbers=true, heading=bibintoc]
%\end{refsection}

\end{document}

