
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{MBU_Long_Abstract}[2026/04/17 MBU Long Abstract Class]

\LoadClass[12pt,oneside]{report}

\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{setspace}
\RequirePackage{fontspec}
\RequirePackage{ragged2e}
\RequirePackage{tabularx}
\RequirePackage[hidelinks]{hyperref}
\RequirePackage{xcolor}
\RequirePackage{titlesec}
\RequirePackage{enumitem}

\setcounter{secnumdepth}{1}
\renewcommand{\thesection}{\arabic{section}}

\geometry{
  a4paper,
  left=1.5in,
  right=1.0in,
  top=1.25in,
  bottom=1.25in
}

\onehalfspacing
\setlength{\parindent}{1.27cm}
\setlength{\parskip}{0pt}

% -------------------------------------------------
% Fonts
% -------------------------------------------------
\setmainfont[
  Path = fonts/,
  UprightFont = calibri.ttf,
  BoldFont = calibrib.ttf,
  ItalicFont = calibrii.ttf,
  BoldItalicFont = calibriz.ttf
]{Calibri}

\newfontfamily\CalibriBlack[
  Path = fonts/,
  UprightFont = calibrib.ttf
]{Calibri Black}

\newfontfamily\BitterGold[
  Path = fonts/,
  UprightFont = Bitter-Bold.ttf
]{Bitter}

\definecolor{mbured}{RGB}{180,0,0}
\newcommand{\UniversityStyle}[1]{%
  \BitterGold\textcolor{mbured}{\MakeUppercase{#1}}%
}

% -------------------------------------------------
% Metadata
% -------------------------------------------------
\newcommand{\thesistitle}[1]{\def\@thesistitle{#1}}
\newcommand{\thesiscandidate}[1]{\def\@thesiscandidate{#1}}
\newcommand{\regnumber}[1]{\def\@regnumber{#1}}
\newcommand{\thesisdept}[1]{\def\@thesisdept{#1}}
\newcommand{\thesissupervisor}[1]{\def\@thesissupervisor{#1}}
\newcommand{\thesisuniv}[1]{\def\@thesisuniv{#1}}
\newcommand{\thesisaddress}[1]{\def\@thesisaddress{#1}}
\newcommand{\thesisdate}[1]{\def\@thesisdate{#1}}
\newcommand{\thesislogo}[1]{\def\@thesislogo{#1}}

% -------------------------------------------------
% Blank line helpers
% -------------------------------------------------
\newcommand{\OneBlankLine}{\vspace{1\baselineskip}}
\newcommand{\TwoBlankLines}{\vspace{2\baselineskip}}
\newcommand{\ThreeBlankLines}{\vspace{3\baselineskip}}

% -------------------------------------------------
% Title page for Long Abstract
% -------------------------------------------------
\newcommand{\makelongabstracttitle}{%
\begin{titlepage}
\centering

{\fontsize{16}{18}\selectfont\CalibriBlack\MakeUppercase{\@thesistitle}}

\TwoBlankLines

{\fontsize{16}{18}\selectfont\CalibriBlack\MakeUppercase{\@thesiscandidate}}

\OneBlankLine

{\fontsize{16}{18}\selectfont\CalibriBlack \@regnumber}

\OneBlankLine

{\fontsize{16}{18}\selectfont\CalibriBlack\MakeUppercase{\@thesisdept}}

\OneBlankLine

{\fontsize{16}{18}\selectfont\CalibriBlack \@thesissupervisor}

\ThreeBlankLines
\TwoBlankLines

% -------- LOGO (CENTERED) --------
\includegraphics[width=2.5in,height=1.5in]{\@thesislogo}
% --------------------------------

\vfill

{\fontsize{15}{17}\selectfont\CalibriBlack\MakeUppercase{\@thesisdept}}

\OneBlankLine

{\fontsize{15}{17}\selectfont \UniversityStyle{\@thesisuniv}}

\OneBlankLine

{\fontsize{15}{17}\selectfont\CalibriBlack \@thesisaddress}

\TwoBlankLines

{\fontsize{15}{17}\selectfont\CalibriBlack\MakeUppercase{\@thesisdate}}

\end{titlepage}
}

% -------------------------------------------------
% Section formatting
% -------------------------------------------------
\titleformat{\section}
  {\centering\normalfont\fontsize{14}{15}\selectfont\bfseries}
  {}
  {0pt}
  {\thesection.\ }

\titlespacing*{\section}
  {0pt}
  {18pt}
  {12pt}

\titleformat{\subsection}
  {\normalfont\fontsize{12}{14}\selectfont\bfseries}
  {\thesubsection}
  {0.5em}
  {}

\titlespacing*{\subsection}
  {0pt}
  {12pt}
  {6pt}

\makeatletter


\renewenvironment{thebibliography}[1]
     {\section{Bibliography}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

% -------------------------------------------------
% Long Abstract heading page
% -------------------------------------------------
\newcommand{\makelongabstractpage}{%
\clearpage
\thispagestyle{plain}
\begin{center}
{\fontsize{15}{17}\selectfont\CalibriBlack\MakeUppercase{Long Abstract}}
\end{center}
\vspace{1\baselineskip}
}

% -------------------------------------------------
% Simple ToC page command (optional)
% -------------------------------------------------
\newcommand{\maketableofcontentspage}{%
\clearpage
\thispagestyle{plain}
\begin{center}
{\fontsize{15}{17}\selectfont\CalibriBlack\MakeUppercase{Table of Contents}}
\end{center}
\vspace{1\baselineskip}
\tableofcontents
\clearpage
}
