\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{dma}[2026/08/16 v3.0 SDMA Package - Overleaf final font integration]

\RequirePackage[english]{babel}
\RequirePackage[a4paper,top=2.54cm,bottom=2.54cm,left=1.91cm,right=1.91cm,headheight=28pt,headsep=9pt,footskip=18pt]{geometry}
\RequirePackage{iftex}

% -----------------------------------------------------------------------------
% SDMA 3.0 FONT INTEGRATION - OVERLEAF/XeLaTeX
% These declarations intentionally mirror the minimal font test verified in
% Overleaf. File names are case-sensitive on Overleaf (Linux).
% -----------------------------------------------------------------------------
\ifXeTeX\else
  \PackageError{dma}{SDMA Template 3.0 requires XeLaTeX}{In Overleaf: Settings -> Compiler -> XeLaTeX.}
\fi
\RequirePackage{fix-cm}
\RequirePackage{fontspec}

% Calibri - default journal/body font
\setmainfont[
  Path=./Fonts/,
  UprightFont=calibri.ttf,
  BoldFont=calibrib.ttf,
  ItalicFont=calibrii.ttf,
  BoldItalicFont=calibriz.ttf
]{Calibri}
\newcommand{\calibri}{\rmfamily}

% Cambria - title/authors/article-info/abstract/keywords
\newfontfamily\cambria[
  Path=./Fonts/,
  UprightFont=cambria.ttc,
  BoldFont=cambriab.ttf,
  ItalicFont=cambriai.ttf,
  BoldItalicFont=cambriaz.ttf
]{Cambria}

% Times New Roman - masthead title/running header/DOI/licence
% IMPORTANT: Overleaf displays these uploaded files in lower case.
\newfontfamily\timesnewroman[
  Path=./Fonts/,
  UprightFont=times.ttf,
  BoldFont=timesbd.ttf,
  ItalicFont=timesi.ttf,
  BoldItalicFont=timesbi.ttf
]{TimesNewRoman}

\RequirePackage{adjustbox}
\RequirePackage{amsmath}
\RequirePackage{authblk}
\RequirePackage{booktabs}
\RequirePackage{caption}
\RequirePackage{fancyhdr}
\RequirePackage{graphicx}
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\RequirePackage{ragged2e}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{silence}
\WarningFilter{hyperref}{Ignoring empty anchor}
\WarningFilter{latexfont}{Font shape}
\WarningFilter{latexfont}{Size substitutions}
\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\RequirePackage{cite}

\renewcommand\Authfont{\raggedright\normalfont\calibri\fontsize{12pt}{12pt}\selectfont} 
\renewcommand\Affilfont{\raggedright\fontsize{8pt}{9pt}\selectfont\hspace{1em}}
\renewcommand\Authand{, }
\renewcommand\Authands{, }

\newlength\figurelength
\newlength\tablelength

\DeclareCaptionLabelFormat{figure}{Fig.~#2}
\DeclareCaptionFont{elevenpt}{\fontsize{11pt}{11pt}\selectfont}
\captionsetup[figure]{labelsep=period, labelformat=figure, font=elevenpt, labelfont={bf}, justification=centering, singlelinecheck=true, width=\figurelength}

\captionsetup[table]{labelsep=newline,font=elevenpt, labelfont={bf}, parskip=0pt,justification=raggedright, singlelinecheck=false, skip=0pt}

\newenvironment{margintable}{\Collect@Body\@margintable}{}
\long\def\@margintable#1{\bgroup\let\@vspace\@vspace@orig
  \let\@vspacer\@vspacer@orig\captionsetup{type=table}%
  \marginpar{\centering\small#1}\egroup}

\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\captionsetup[figure]{position=bottom, justification=centering, singlelinecheck=true}

\newcommand{\correspondingAuthor}{${}^{\*}$\textit{Corresponding author.\newline
E-mail address: author.mail@gmail.com} \\ \newline
\colorbox{yellow}{https://doi.org/10.31181/dma0101xxxxx}}

% References use a lightweight LaTeX list so the template compiles on
% Overleaf Free with XeLaTeX only (no Biber pass required).
\renewenvironment{thebibliography}[1]
  {\list{\@biblabel{\@arabic\c@enumiv}}
    {\settowidth\labelwidth{[99]}%
     \setlength\leftmargin{2.0em}%
     \setlength\labelsep{0.35em}%
     \setlength\itemindent{0pt}%
     \setlength\listparindent{0pt}%
     \setlength\itemsep{0pt}%
     \setlength\parsep{0pt}%
     \setlength\topsep{0pt}%
     \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}

% Word template hierarchy: Calibri/Carlito 12 pt headings.
\titleformat{\section}[block]
  {\normalfont\fontsize{12pt}{12pt}\selectfont\bfseries}
  {\thesection.\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\section}{0pt}{12pt}{0pt}

\titleformat{name=\section,numberless}[block]
  {\normalfont\fontsize{12pt}{12pt}\selectfont\bfseries}
  {}
  {0pt}
  {}
\titlespacing{name=\section,numberless}{0pt}{12pt}{0pt}

\titleformat{\subsection}[block]
  {\normalfont\fontsize{12pt}{12pt}\selectfont\itshape}
  {\thesubsection\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\subsection}{0pt}{0pt}{0pt}

\titleformat{\subsubsection}[block]
  {\normalfont\fontsize{12pt}{12pt}\selectfont\itshape}
  {\thesubsubsection\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}


% Word body paragraph settings.
\setlength{\parindent}{0.63cm}
\setlength{\parskip}{0pt}
% Suppress non-actionable underfull-box diagnostics; layout is unchanged.
\AtBeginDocument{\hbadness=10000\relax\vbadness=10000\relax\hfuzz=10pt\relax}

% Word template: compact enumerations with no extra vertical gaps.
\setlist[enumerate]{topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt}

% Data table content in the Word template is Calibri 10 pt.
\AtBeginEnvironment{table}{\fontsize{10pt}{10pt}\selectfont}

\setlength{\abovedisplayskip}{-10pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowcaptionskip}{0pt}

\newcommand{\titleOfArticle}[1]{\def\@titleOfArticle{#1}}
\newcommand{\authors}[1]{\def\@authors{#1}}
\newcommand{\corrAuthor}[1]{\def\@corrAuthor{#1}}
\newcommand{\emailCorrespondingAuthor}[1]{\def\@emailCorrespondingAuthor{#1}}
\newcommand{\receivedDate}[1]{\def\@receivedDate{#1}}
\newcommand{\receivedInRevised}[1]{\def\@receivedInRevised{#1}}
\newcommand{\accepted}[1]{\def\@accepted{#1}}
\newcommand{\availableOnline}[1]{\def\@availableOnline{#1}}
\newcommand{\affilations}[1]{\def\@affilations{#1}}
\newcommand{\abstractOfArticle}[1]{\def\@abstractOfArticle{#1}}
\newcommand{\keywords}[1]{\def\@keywords{#1}}
\newcommand{\volume}[1]{\def\@volume{#1}}
\newcommand{\issue}[1]{\def\@issue{#1}}
\newcommand{\doi}[1]{\def\@doi{#1}}

\newtoks\auth@toks
\renewcommand{\authors}[2][]{%
  \if!#1!%
    \auth@toks=\expandafter{\the\auth@toks#2\ }%
  \else
    \auth@toks=\expandafter{\the\auth@toks#2$^{#1}$\ }%
  \fi
}

\newtoks\affil@toks\newif\ifaffil\affilfalse
\newcommand{\affiliations}[2][]{%
\affiltrue
  \if!#1!%
    \affil@toks=\expandafter{\the\affil@toks{\item[]#2}}%
  \else
    \affil@toks=\expandafter{\the\affil@toks{\item[$^{#1}$]#2}}%
  \fi
}

\newcommand{\captionOfArticle}{%
\thispagestyle{firstpagestyle}%
\begingroup
\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt}

% Word template: compact enumerations with no extra vertical gaps.
\setlist[enumerate]{topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt}%
\noindent\hrule height 0.7pt
\vspace{1.5pt}
\noindent
\begin{minipage}[c][3.85cm][c]{0.285\textwidth}
  \raggedright\includegraphics[width=\linewidth,height=3.56cm,keepaspectratio]{Images/image1.png}
\end{minipage}%
\begin{minipage}[c][3.85cm][c]{0.43\textwidth}
  \centering
  \vspace*{8pt}% shift the central masthead block slightly downward without changing horizontal centering
  {\timesnewroman\fontsize{14pt}{14pt}\selectfont\color{Blue}Management Science Advances\par}
  \vspace{12pt}
  {\cambria\fontsize{8pt}{8.5pt}\selectfont\color{Blue}Journal homepage: \href{https://msa-journal.org/journal}{www.msa-journal.org}\par}
  {\cambria\fontsize{8pt}{8.5pt}\selectfont\color{Blue}ISSN: 3042-2205\par}
\end{minipage}%
\begin{minipage}[c][3.85cm][c]{0.285\textwidth}
  \raggedleft\includegraphics[width=2.52cm,height=3.56cm,keepaspectratio]{Images/image2.png}
\end{minipage}
\vspace{1.5pt}
\hrule height 0.7pt
\vspace{12pt}

\noindent{\cambria\fontsize{16pt}{18.5pt}\selectfont\color{Blue}\@titleOfArticle\par}
\vspace{12pt}
\noindent{\cambria\fontsize{12pt}{13.5pt}\selectfont
Full Name${}^{1}$, Corresponding Author${}^{1,*}$, Author${}^{2}$ (All Authors names must be written in a \textcolor{red}{\textbf{FULL NAME}}; Font type: Calibri; Font size: 12; Paragraph: Align Left)\par}
\vspace{7pt}
{\calibri\fontsize{8pt}{9.2pt}\selectfont
${}^{1}$\hspace{0.7em}Department of Aeronatical, Automotive and Offfshore Engineering, Fakulti Kejuruteraan Mekanikal, Universiti Teknologi Malaysia, Johor, Malaysia\par
${}^{2}$\hspace{0.7em}Department of Mechanical Engineering, Faculty of Engineering, Kano University of Science and Technology, Wudil, Nigeria\par}
\vspace{12pt}
\hrule height 0.7pt
\vspace{4pt}
\noindent
\begin{minipage}[t]{0.36\textwidth}
  {\calibri\fontsize{8.5pt}{9.7pt}\selectfont\bfseries ARTICLE INFO\par}
  \vspace{3pt}\hrule height 0.45pt\vspace{5pt}
  {\cambria\fontsize{8pt}{9.2pt}\selectfont
   \textbf{\textit{Article history:}}\par
   Received \@receivedDate\par
   Received in revised form \@receivedInRevised\par
   Accepted \@accepted\par
   Available online \@availableOnline\par
   \vspace{10pt}
   {\cambria\fontsize{9pt}{9pt}\selectfont\setlength{\fboxsep}{0pt}\textbf{\textit{Keywords:}}\par
   \@keywords\par}}
\end{minipage}%
\hfill
\begin{minipage}[t]{0.62\textwidth}
  {\cambria\fontsize{8.5pt}{9.7pt}\selectfont\bfseries ABSTRACT\par}
  \vspace{3pt}\hrule height 0.45pt\vspace{5pt}
  {\cambria\fontsize{9pt}{10.5pt}\selectfont\justifying\setlength{\parindent}{0pt}\@abstractOfArticle\par}
\end{minipage}
\vspace{5pt}
\hrule height 0.7pt
\endgroup
\vspace{8pt}
\footnotetext{\setlength{\parindent}{0pt}\hspace{-20pt}%
{\cambria\fontsize{10pt}{10.5pt}\selectfont ${}^{*}$\textit{\@corrAuthor.\newline E-mail address: \@emailCorrespondingAuthor}}\\[8pt]
{\timesnewroman\fontsize{10pt}{10.5pt}\selectfont \@doi}}
}

\fancyhead[L]{{\timesnewroman\fontsize{8pt}{8pt}\selectfont\textcolor{gray}{\textit{Management Science Advances}\newline
Volume \@volume, Issue \@issue}}}
\fancyhead[R]{\empty}
\fancyfoot[R]{\textcolor{gray}\thepage}
\fancyfoot[C]{\empty}

\fancypagestyle{firstpagestyle}{
  \fancyhead[C]{{\timesnewroman\fontsize{8pt}{8pt}\selectfont\textcolor{gray}{\textit{Management Science Advances}
    Volume \@volume, Issue \@issue}}}
    \fancyhead[L]{\empty}
    \renewcommand{\headrulewidth}{0pt}
    \rfoot{\textcolor{gray}\thepage}
}

\pagestyle{fancy}

\endinput