\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{njsv-faithful}[2026/03/17 Faithful NJSV journal template]

\LoadClass[12pt,a4paper]{article}
\newcommand{\journalname}{New Journal for Science Vulgarization}
\newcommand{\journalvolume}{XX}
\newcommand{\journalyear}{2024}
\newcommand{\journalpages}{XXX--XXX}
\newcommand{\journalissn}{xxxx-xxxx}
\newcommand{\journalwebsite}{www.supmit.org}
\newcommand{\journalcopyrightyear}{2021}
% =========================
% Packages
% =========================
\RequirePackage[a4paper,top=18mm,bottom=22mm,left=23mm,right=23mm,headheight=14pt,headsep=10pt,footskip=20pt]{geometry}
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage{fancyhdr}
\RequirePackage{caption}
\RequirePackage{array}
\RequirePackage{booktabs}
\RequirePackage{tabularx}
\RequirePackage{amsmath}
\let\openbox\relax
\RequirePackage{amsthm}
\RequirePackage{enumitem}
\RequirePackage{float}
\RequirePackage{url}
\RequirePackage[hidelinks]{hyperref}

% =========================
% Colors
% =========================
\definecolor{NJSVTitleBlue}{RGB}{9,37,112}

% =========================
% General style
% =========================
\setlength{\parindent}{16pt}
\setlength{\parskip}{0pt}
\linespread{1.10}
\emergencystretch=1.5em

% =========================
% Captions
% =========================
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
\captionsetup{font=normalsize,labelfont=normalfont,labelsep=colon}

% =========================
% Section styles without titlesec
% =========================
\makeatletter

\renewcommand\section{%
	\@startsection{section}{1}{\z@}%
	{3ex}%
	{2.6ex}%
	{\normalfont\bfseries\fontsize{12}{14}\selectfont}%
}

\renewcommand\subsection{%
	\@startsection{subsection}{2}{\z@}%
	{1.8ex}%
	{0.4ex}%
	{\normalfont\bfseries\fontsize{11}{13}\selectfont}%
}

\makeatother

% =========================
% Journal info
% =========================


\newcommand{\bannerimage}{banner.png}
\newcommand{\logoimage}{_logo.png}
\newcommand{\shortauthors}{}
\newcommand{\correspondingauthor}{}
\newcommand{\emailaddress}{}
\newcommand{\keywordslist}{}

% =========================
% Setters
% =========================
\newcommand{\setjournalinfo}[6]{%
	\renewcommand{\journalname}{#1}%
	\renewcommand{\journalyear}{#2}%
	\renewcommand{\journalvolume}{#3}%
	\renewcommand{\journalpages}{#4}%
	\renewcommand{\journalissn}{#5}%
	\renewcommand{\journalwebsite}{#6}%
}

\newcommand{\setcopyrightyear}[1]{%
	\renewcommand{\journalcopyrightyear}{#1}%
}

\newcommand{\setbannerimage}[1]{%
	\renewcommand{\bannerimage}{#1}%
}

\newcommand{\setlogoimage}[1]{%
	\renewcommand{\logoimage}{#1}%
}

\newcommand{\setshortauthors}[1]{%
	\renewcommand{\shortauthors}{#1}%
}

\newcommand{\corresponding}[1]{%
	\renewcommand{\correspondingauthor}{#1}%
}

\newcommand{\email}[1]{%
	\renewcommand{\emailaddress}{#1}%
}

\newcommand{\keywords}[1]{%
	\renewcommand{\keywordslist}{#1}%
}

% =========================
% Authors / affiliations
% =========================
\makeatletter
\newcommand{\@authorsblock}{}
\newcommand{\@affilblock}{}

\renewcommand{\author}[1]{%
	\gdef\@authorsblock{#1}%
}

\newcommand{\affiliations}[1]{%
	\gdef\@affilblock{#1}%
}
\makeatother

% =========================
% Header / footer
% =========================
\fancypagestyle{njsvfirst}{%
	\fancyhf{}
	\fancyfoot[L]{%
		\fontsize{8.5}{10}\selectfont
		ISSN : \journalissn\ © \journalcopyrightyear\ \journalwebsite
	}
	\renewcommand{\headrulewidth}{0pt}
	\renewcommand{\footrulewidth}{0pt}
}

\fancypagestyle{njsvmain}{%
	\fancyhf{}
	\fancyhead[R]{%
		\fontsize{8}{10}\selectfont\itshape
		\shortauthors\ / \journalname\ \journalvolume\ (\journalyear) \journalpages \hspace{17pt}
		\fontsize{8}{10}\selectfont \thepage
	}
	\fancyfoot[L]{%
		\fontsize{8.5}{10}\selectfont
		ISSN : \journalissn
	}
	\renewcommand{\headrulewidth}{0pt}
	\renewcommand{\footrulewidth}{0pt}
}

\pagestyle{njsvmain}

% =========================
% Theorems
% =========================
\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{example}[theorem]{Example}

% =========================
% Abstract
% =========================
\renewenvironment{abstract}{%
	\par
	\noindent\rule{\textwidth}{0.45pt}\par
	\vspace{5pt}
	\noindent
	{\bfseries\fontsize{11}{13}\selectfont Abstract }%
	\fontsize{11}{13}\selectfont
	\ignorespaces
}{%
	\par
	\vspace{8pt}
}

% =========================
% Keywords
% =========================
\newcommand{\printkeywords}{%
	\noindent
	{\itshape\fontsize{11}{13}\selectfont Keywords: }%
	{\fontsize{11}{13}\selectfont \keywordslist}\par
	\vspace{6pt}
	\noindent\rule{\textwidth}{0.45pt}\par
}

% =========================
% Corresponding author
% =========================
\newcommand{\printcorresponding}{%
	\vspace{3pt}
	\noindent
	{\fontsize{9}{11}\selectfont
		\correspondingauthor\space \\
		E-mail address: \emailaddress\par}
	\vspace{10pt}
}

% =========================
% Title block
% =========================
\makeatletter
\newcommand{\NJSVTitleBlock}{
	\thispagestyle{njsvfirst}
	
	% Banner full width
	\noindent\makebox[\textwidth][c]{%
		\ifx\bannerimage\empty\else
		\includegraphics[width=\dimexpr\textwidth\relax]{\bannerimage}
		\fi
	}
	
	\par\vspace{-2.5mm}
	
	\begin{center}
		{\color{NJSVTitleBlue}\bfseries\fontsize{14}{16}\selectfont \journalname\par}
		\vspace{2mm}
		{\color{NJSVTitleBlue}{\bfseries\itshape\fontsize{9}{11}\selectfont \journalvolume\ (\journalyear) \journalpages\par}}
	\end{center}
	
	\vspace{-17mm}
	
	\noindent\hfill
	\ifx\logoimage\empty\else
	\includegraphics[width=18mm]{\logoimage}
	\fi
	
	\vspace{6mm}
	
	\begin{center}
		{\bfseries\fontsize{14}{16}\selectfont
			\MakeUppercase{\@title}\par}
		
		\vspace{5mm}
		
		{\fontsize{12}{14}\selectfont
			\@authorsblock\par}
		
		\vspace{3mm}
		
		{\itshape\fontsize{10}{12}\selectfont
			\@affilblock\par}
	\end{center}
	
	\vspace{4mm}
}
\renewcommand{\maketitle}{\NJSVTitleBlock}
\makeatother

\AtBeginDocument{\fontsize{12}{14.5}\selectfont}

\endinput