\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{dmap}[2024/11/19 v1.0 DMA Package]

\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage[a4paper,top=2.54cm,bottom=2.54cm,left=1.91cm,right=1.91cm]{geometry}
\RequirePackage[sfdefault]{carlito}
\RequirePackage{adjustbox}
\RequirePackage{amsmath}
\RequirePackage{arydshln}
\RequirePackage{authblk}
\RequirePackage{booktabs}
\RequirePackage{caption}
\RequirePackage{float}
\RequirePackage{fancyhdr}
\RequirePackage{gensymb}
\RequirePackage{graphicx}
\RequirePackage{titlesec}
\RequirePackage{csquotes}
\RequirePackage{xpatch}
\RequirePackage{threeparttable}
\RequirePackage{etoolbox}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\RequirePackage[citestyle=numeric-comp, bibstyle=apa, sorting=custom]{biblatex}

\addbibresource{sample.bib}

\DeclareSortingTemplate{custom}{
  \sort{
    \field{presort}
  }
}

\renewcommand\Authfont{\raggedright\normalfont\carlito} 
\renewcommand\Affilfont{\raggedright\scriptsize\hspace{1em}}
\renewcommand\Authand{, }
\renewcommand\Authands{, }

\newlength\figurelength
\newlength\tablelength

\DeclareCaptionLabelFormat{figure}{Fig.~#2}
\captionsetup[figure]{labelsep=period, labelformat=figure, labelfont={bf}, justification=centering, width=\figurelength}

\captionsetup[table]{labelsep=newline,font=normalsize, labelfont={bf}, parskip=2ex,justification=centering, singlelinecheck=false, skip=0pt, width=\linewidth}

\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}

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

\defbibenvironment{numberedbibliography}
  {\list
     {[\printfield{labelnumber}]}
     {\setlength{\labelwidth}{2em}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{1em}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\titleformat{\section}[block]
  {\normalfont\Large\bfseries}
  {\thesection.\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\section}{5pt}{1em}{1em}

\titleformat{name=\section,numberless}[block]
  {\normalfont\bfseries}
  {\hspace{-6pt}}
  {0pt}
  {}

\titleformat{\subsection}[block]
  {\normalfont\large\itshape}
  {\thesubsection\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\subsection}{5pt}{1em}{1em}

\titleformat{\subsubsection}[block]
  {\normalfont\large\itshape}
  {\thesubsubsection\hspace{10pt}}
  {0pt}
  {}
\titlespacing{\subsubsection}{5pt}{1em}{1em}

\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}{%
\begin{tabular*}{\textwidth}{ccccr} 
\toprule
\multicolumn{2}{p{2in}}{\includegraphics*[width=1.27in, height=1.27in]{Images/image1.png}\vspace{-20pt}} & \multicolumn{2}{p{3.5in}}{\vspace{-70pt}\hspace{-50pt}\textcolor{Blue}
{\large \centering{{Journal of Engineering Management  \hspace{\\}\hspace{35pt}   and Systems Science}}}}
& \includegraphics*[width=0.8in, height=1.27in]{Images/image2.png}\hspace{20pt}\vspace{-20pt} \\ 
\multicolumn{2}{p{1in}}{} & \multicolumn{2}{p{2.6in}}{\vspace{-25pt}\footnotesize \textcolor{Blue}{Journal homepage:} \href{https://jemsci-journal.org/index.php/jemsci/index}{www.jemsci-journal.org} \hfill\break \raggedleft \textcolor{Blue}{ISSN: XXXX-XXXX}\hspace{60pt} \vspace{-20pt}} &  \\ 
\midrule
\multicolumn{5}{p{1in}}{} \\  
\multicolumn{5}{p{\textwidth}}{\vspace{-45pt}\title{\raggedright \textcolor{Blue}{\@titleOfArticle}}\date{}\maketitle } \vspace{-10pt} \\ 
 \midrule
\multicolumn{3}{p{2in}}{\textbf{ARTICLE INFO}} & \multicolumn{2}{p{4.5in}}{\textbf{ABSTRACT}} \\ \midrule
\multicolumn{3}{p{2in}}{\textbf{\textit{Article history:\newline }}\scriptsize Received \@receivedDate\newline Received in revised form\@receivedInRevised\newline Accepted \@accepted\newline Available online \@availableOnline} & \multicolumn{2}{p{4.5in}}{\footnotesize \@abstractOfArticle } \\ 
\multicolumn{3}{p{2in}}{\vspace{-25pt}\textbf{\textit{Keywords:}}} & \multicolumn{2}{p{2.5in}}{\textbf{}} \\  
\multicolumn{3}{p{2in}}{\vspace{-25pt} \footnotesize \@keywords } & \multicolumn{2}{p{2.5in}}{\textbf{\vspace{-10pt}}} \\ \bottomrule
\thispagestyle{firstpagestyle}
\vspace{-15pt}
\end{tabular*}

\footnotetext{\hspace{-20pt}${}^{*}$\textit{\@corrAuthor.\newline
E-mail address: \@emailCorrespondingAuthor} \\ \newline
\@doi}
}

\fancyhead[L]{\footnotesize\textcolor{gray}{\textit{Journal of Engineering Management and Systems Science}\newline
Volume \@volume, Issue \@issue}}
\fancyhead[R]{\empty}
\fancyfoot[R]{\textcolor{gray}\thepage}
\fancyfoot[C]{\empty}

\fancypagestyle{firstpagestyle}{
  \fancyhead[C]{\footnotesize\textcolor{gray}{\textit{Journal of Engineering Management and Systems Science}
    Volume \@volume, Issue \@issue}}
    \fancyhead[L]{\empty}
    \renewcommand{\headrulewidth}{0pt}
    \rfoot{\textcolor{gray}\thepage}
}

\pagestyle{fancy}

\endinput
