%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[dsingle]{Dissertate}
% \documentclass[ddouble]{Dissertate}
% \usepackage[backend=biber,style=ieee]{biblatex} % or another style of your choice
\usepackage[english]{babel}
\usepackage{hhline}
\usepackage{subcaption}
%\usepackage{showframe}
% Include other packages here, before hyperref.
\usepackage{algorithm}
\usepackage[noend]{algorithmic}
\usepackage{eqparbox}
\usepackage{sidecap}
% \usepackage[labelfont=bf]{caption}
\usepackage[labelfont=it,textfont={it},justification=centering]{subcaption}
\usepackage{comment}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{fontspec}
\usepackage{gensymb}
\usepackage[T1]{fontenc}
\usepackage{bitter}
\usepackage{anyfontsize}
\usepackage{placeins}
\usepackage{tabularx}
% Set Bitter font with the uploaded files
\setmainfont[
Path = ./fonts/Bitter/static/,
UprightFont = Bitter-Regular.ttf,
ItalicFont = Bitter-Italic.ttf,
BoldFont = Bitter-Bold.ttf,
BoldItalicFont = Bitter-BoldItalic.ttf,
Scale = 0.9 % Adjust the scale to make the font smaller
]{Bitter}
% Set Libertinus Math font for math
% \setmathfont{Libertinus Math}
\setmathfont{Fira Math}
% \setmathfont{"Fira Math"}
\usepackage{xcolor}
\usepackage[export]{adjustbox}
\usepackage{lipsum}
\usepackage{pgf}
% \usepackage{pdflscape}
\usepackage{rotating,multirow}
\newcommand*\rot{\rotatebox{90}}
% \usepackage{float}
\usepackage{tikz}
\usepackage{cases}
%\usepackage{subfigure}
\usepackage{makecell}
\setlength{\emergencystretch}{3em} % Allows some additional stretchability
% \tolerance=9999 % Increase tolerance for bad lines
% \hbadness=9999 % Increase threshold for warnings
% Add cite package for citation formatting
% \usepackage[superscript]{cite}
% Customizing cite for superscript citations
% \renewcommand{\citeleft}{\textsuperscript{[}}
% \renewcommand{\citeright}{]}}
% \captionsetup{labelfont={bf,sf}, textfont={sf,small,singlespacing}}
\renewcommand{\algorithmiccomment}[1]{\hfill\eqparbox{COMMENT}{\# #1}}
% https://stackoverflow.com/questions/1744197/formatting-comments-in-latexs-algorithmic-environment
\def\ie{\emph{i.e., }} \def\Ie{\emph{I.e., }}
\def\eg{\emph{e.g., }} \def\Eg{\emph{E.g., }}
\def\cf{\emph{c.f}\onedot} \def\Cf{\emph{C.f}\onedot}
\def\etal{\emph{et al}\onedot}
\makeatletter
\newcommand\footnoteref[1]{\protected@xdef\@thefnmark{\ref{#1}}\@footnotemark}
\makeatother
\def\-{\raisebox{.75pt}{-}}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\def\httilde{\mbox{\tt\raisebox{-.5ex}{\symbol{126}}}}
% ====================
% SHOW CHANGES
% ====================
% \newcommand{\changed}[1]{\textcolor{blue}{#1}}
% \newcommand{\deleted}[1]{\textcolor{red}{\sout{#1}}}
% ====================
% DO NOT SHOW CHANGES
% ====================
\newcommand{\changed}[1]{#1}
\newcommand{\deleted}[1]{}
% ====================
\usepackage{ragged2e}
\usepackage{xparse} % For more advanced command definitions
\NewDocumentCommand{\inlinesection}{m +m}{%
\noindent\textbf{\sffamily{\fontsize{11}{14}\selectfont{#1}}} #2\par
}
\newcommand{\chapterBasedOn}[1]{
\vspace*{\fill}
#1
}
% Making sure all fonts are sffamily except main text
\titleformat{\section}{\sffamily\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\sffamily\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\sffamily\large\bfseries}{\thesubsubsection}{1em}{}
\titleformat{\part}[display]
{\sffamily\Huge\bfseries\centering}
{\thispagestyle{emptyplain}\partname~\thepart}
{0pt}
{\vspace{10pt}} % Adds extra vertical space before the title
{}
% Redefine the chapter title font
\renewcommand*{\sectfont}{\sffamily\huge}
% Define custom font for Part and Chapter in the ToC
\renewcommand{\cftpartfont}{\sffamily\bfseries\large} % Part titles in sans-serif and bold
\renewcommand{\cftpartpagefont}{\sffamily\bfseries\large} % Page numbers for part titles
\renewcommand{\cftchapfont}{\sffamily\large} % Chapter titles in sans-serif
\renewcommand{\cftchappagefont}{\sffamily\large} % Page numbers for chapter titles
% Keep subsections in default serif font
% (no changes needed for section/subsection as it uses default settings)
\begin{document}
% Start of subappendices environment
\AtBeginEnvironment{subappendices}{%
\chapter*{Chapter appendix}
% \addcontentsline{toc}{chapter}{Appendix}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\setcounter{section}{0} % Reset section counter
\renewcommand{\thesection}{\thechapter.\Alph{section}} % Section as 5.A, 5.B, etc.
\thispagestyle{emptyplain}
}
% End of subappendices environment
\AtEndEnvironment{subappendices}{%
\counterwithout{figure}{section}
\counterwithout{table}{section}
\setcounter{section}{0} % Optionally reset section counter if normal chapters follow
\counterwithin{figure}{chapter} % Ensure figures are numbered within chapter
\counterwithin{table}{chapter} % Ensure tables are numbered within chapter
}
% the front matter
\input{frontmatter/personalize}
\frontmatter
% \pagenumbering{gobble}
\setstretch{\dnormalspacing}
\AddLabels % for chapterthumbs
\graphicspath{{figures/}}
\pagestyle{fancy}
\fancyhf{} % Clear default header and footer
\renewcommand{\headrulewidth}{0pt}
% Left header on even pages: bold page number, then the section title
\fancyhead[LE]{\sffamily\textbf{\thepage} \, | \, \small{\leftmark}}
% Right header on odd pages: bold page number, then the subsection title
\fancyhead[RO]{\sffamily\small{\rightmark} \, | \, \textbf{\thepage}}
% Redefine the plain page style to remove headers, footers, and chapter thumbs from blank pages
\fancypagestyle{emptyplain}{
\fancyhf{} % Clear all header and footer fields
\renewcommand{\headrulewidth}{0pt} % Remove header rule
\renewcommand{\footrulewidth}{0pt} % Remove footer rule
}
\fancypagestyle{fancyonlypagenumber}{
\fancyhf{} % Clear all header and footer fields
\fancyhead[LE,RO]{\sffamily\small\textbf{\thepage}} % Page number only on both left and right headers
\renewcommand{\headrulewidth}{0pt} % Remove header rule if desired
\renewcommand{\footrulewidth}{0pt} % Remove footer rule if desired
}
% Automatically apply the custom emptyplain style to blank pages before chapters,
% and disable chapter thumbs on these pages
\let\origclearpage\cleardoublepage
\renewcommand{\cleardoublepage}{%
\clearpage%
\RemoveLabels % Disable chapter thumbs for blank pages
\thispagestyle{emptyplain}% Apply the empty page style
\origclearpage%
% \AddLabels % Re-enable chapter thumbs after the blank page
}
\newcommand*{\thischapter}{.}
\newcommand{\customchapter}[2][]{%
\chapter[#1]{#2}%
\AddLabels%
\thispagestyle{emptyplain}%
}
\renewcommand\chaptermark[1]{\markboth{\MakeUppercase{\thechapter. #1}}{\MakeUppercase{\thechapter. \small #1}}}
%\renewcommand\sectionmark[1]{\markright{#1}}
\newcommand\mylettrine[2]{\lettrine[lines=3,findent=0.35em,nindent=0em]{\textcolor{SchoolColor}{#1}}{#2}}
% \bibliographystyle{IEEEtran}
\AtBeginEnvironment{tabular}{\small\sffamily}
\AtBeginEnvironment{tabularx}{\small\sffamily}
\mainmatter
\include{chapters/1_introduction/1_introduction}
\part{The title of part 1}
\label{part:part1}
\include{chapters/2_chapter2/2_chapter2}
\include{chapters/3_chapter3/3_chapter3}
\part{The title of part 2}
\label{part:part2}
\include{chapters/4_chapter4/4_chapter4}
\part{The title of part 3}
\label{part:part3}
\include{chapters/5_chapter5/5_chapter5}
\include{chapters/6_chapter6/6_chapter6}
\include{chapters/7_chapter7/7_chapter7}
\include{chapters/8_discussion/8_discussion}
\RemoveLabels
\setstretch{\dnormalspacing}
\backmatter
\end{document}