%% ==============================================================================
%% Reference Manual
%% ==============================================================================

%% NEMO release version
\def\version{X.X~}

%% Preamble
%% ==============================================================================

%% Document layout
\documentclass[draft]{scrreport}

%% Engine name and Zenodo DOI
\input{definitions}

%% Custom style (.sty)
\usepackage{../../global/packages}

%% Include references and index for single subfile compilation
\newcommand{\biblio}{\bibliography{../main/bibliography}}
\newcommand{\pindex}{\printindex}

\makeindex

%% End of common preamble between main and sub-files
\begin{document}
\pagenumbering{gobble}

%% Override custom cmds for full manual compilation
\renewcommand{\biblio}{}
\renewcommand{\pindex}{}


%% Frontmatter
%% ==============================================================================

%% Title and information pages
\input{../../global/frontpages}

%% Engine citation
\input{../../global/citation}

%% Foreword
\newpage
%\frontmatter   %% Chapter numbering off and Roman numerals for page numbers
\pagenumbering{roman}
\subfile{../subfiles/foreword}

%% ToC i.e. Table of Contents
\newpage
\dominitoc
\tableofcontents

\clearpage
%\end{document}


%% Mainmatter
%% ==============================================================================

%\mainmatter   %% Chapter numbering on, page numbering is reset with Arabic numerals
\pagenumbering{arabic}

\graphicspath{{../../figures/\engine/}}
\input{chapters}


%% Appendix
%% ==============================================================================

%% Chapter numbering is reset with letters now
\appendix   

\input{appendices}


%% Backmatter
%% ==============================================================================

%\backmatter   %% Chapter numbering off

%% Bibliography
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{../main/bibliography}

%% Index
\clearpage
\phantomsection
\addcontentsline{toc}{chapter}{Index}
\printindex

\end{document}
