%% !TEX encoding = UTF-8 Unicode
%% Compiler: XeLatex
%% Packages: TeX Live version 2023/2024
%% VISTEC Thesis Template © 2024 by Rattanaphon Chaisaen is licensed under CC BY-NC-SA 4.0 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%% VISTEC documentclass %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Required options:
    %% (1) Degree type:
        %% phd      → \degreefield{Doctor of Philosophy}
        %% master   → \degreefield{Master of Engineering}
    %% (2) School and program:
        %% ist → School of Information Science and Technology
        %% mse → School of Materials Science and Engineering
        %% ese → School of Energy Science and Engineering
        %% bse → School of Biomolecular Science and Engineering
    %% Otherwise:
        %% Fill \degreefield, \school, and \program manually in `thesisinfo.tex`
                
%% Optional options:
    %% final      → (default) Final version
    %% showframe  → Display frame boxes
    %% showgrid   → Display a grid layout
%% Example usage:                
%%  \documentclass[phd, ist]{VISTEC}
%%  \documentclass[master, mse]{VISTEC}
%%  \documentclass[phd, ist, showframe]{VISTEC}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[phd, ist]{VISTEC}
%% Load thesisinfo.tex
\input{thesisinfo} %% edit title, thesis approval, and committee at `thesisinfo.tex`
%% Load bibliography file
\addbibresource{bibliography.bib}
%%%%%%%%%%%%%%%%%%%%%% Add your custom packages %%%%%%%%%%%%%%%%%%%%%
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[version=4]{mhchem}
\usepackage{chemfig}
%% Customize chemical bond printing
\DeclareMathAlphabet{\foo}{OT1}{phv}{m}{n}
\renewcommand*\printatom[1]{\ensuremath{\foo{#1}}}
%%%%%%%%%%%%%%%%%%%%%% Hyphenation Fix / Overflow Text Fix %%%%%%%%%%%%%%%%%%%%%
%% Fix "Overfull \hbox" warnings by defining custom hyphenation points.
%% Use when default hyphenation breaks words improperly or causes layout issues.
\hyphenation{version}       %% Applied to resolve Approval page (title)
\hyphenation{disabili-ties} %% Applied to resolve issue on page 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document} 
    %% Set global line spacing
    \singlespacingplus % 1.5x line spacing
    %% Roman page numbering
    \fancyhf[cf]{\thepage}
    \pagenumbering{roman}
    \setcounter{page}{1}
    %% Title and approval pages
    \maketitle
    \makeapproval
   
    %% Acnowledgment
    \acknowledgment                 %% Content at `contents/acknowledgment.tex`
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%% Prologue %%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    
    \abstract                       %% Content at `contents/abstract.tex`
    \tableofcontents
    \listoftables
    \listoffigures
    \abbreviations                  %% Content at `contents/abbreviations.tex`
    % \blankpage                    %% add \blankpage if you don't have list of abbreviations
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%% Main Chapters %%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    %% Arabic page numbering
    \pagenumbering{arabic}
    \setcounter{page}{1}
    
    \includechapter{contents/chapter1}
    \includechapter{contents/chapter2} 
    \includechapter{contents/chapter3} 
    \includechapter{contents/chapter4} 
    \includechapter{contents/chapter5}
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%% Epilogue %%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    %% References
    \vancouverbib
    %% Appendices
    \appendix
    \includechapter{contents/appendix}   %% Content at `contents/appendix.tex`
    %% Author Biography
    \authorbiography                %% Content at `contents/authorbiography.tex`
    %%%%%%%%%%%%%%%%%%%%%%%%%%%% Fix "List of XXXXXX (Cont.)" Header Issue %%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % If the continuation header (e.g., "List of Tables (Cont.)") fails to appear on the second page,
    % uncomment the corresponding dummy entry below to manually trigger a page break or layout update.
    % \addtocontents{toc}{\protect\contentsline{content}{\phantom{Dummy Invisible Content Entry}}{\phantom{\thepage}}{}}
    \addtocontents{lot}{\protect\contentsline{table}{\phantom{Dummy Invisible Table Entry}}{\phantom{\thepage}}{}}
    \addtocontents{lof}{\protect\contentsline{figure}{\phantom{Dummy Invisible Figure Entry}}{\phantom{\thepage}}{}}
\end{document}