%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%     Suleyman Demirel University                                                                                                    %%
%%     Journal of Natural and Applied Sciences                                                                                  %%
%%                                                                                                                                                      %%
%%     'sdufbed.cls'  Document class  --- LaTeX2e     (14.08.2017)                                                    %%
%%                                                                                                                                                      %%
%%     Class file provided by Zakir Deniz for any information please send an e-mail to:                    %%
%%         zakirdeniz@gmail.com                                                                                                          %%
%%                                                                                                                                                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sdufbed}[12/12/2015 fbe paper class]
\AtEndOfClass{\RequirePackage{microtype}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\ProcessOptions*
\LoadClass{extarticle}




% Fonts and language
\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
%\RequirePackage[fleqn]{amsmath} % for equation left align
\RequirePackage{amsmath}
\RequirePackage{amsfonts,amssymb}
\RequirePackage{mathptmx} %times new roman
\RequirePackage[T1]{fontenc}
\RequirePackage{url}
\RequirePackage[colorlinks=true, allcolors=blue, urlcolor=black]{hyperref}
\RequirePackage{pbox}
\RequirePackage{enumitem}
\RequirePackage{float}



%%%%%%%%%%%%%%%%%%%%5
\RequirePackage{xifthen}
\newboolean{languageofthepaper}
\newcounter{mycounter}
%%%%%%%%%%%%%%%%%%%%%%%%%%5




\newcommand{\headerfont}{\normalfont\fontsize{6.5}{8} \selectfont}
\newcommand{\titlefont}{\bfseries\fontsize{12}{12}\selectfont}
\newcommand{\datesfont}{\normalfont}
\newcommand{\absfont}{\normalfont}
\newcommand{\copyrightfont}{\normalfont\fontsize{8}{10}\selectfont}
\newcommand{\doifont}{\normalfont\fontsize{9}{11}\selectfont}
\newcommand{\footfont}{\normalfont\fontsize{7.5}{8}\selectfont}
\renewcommand\UrlFont{\normalfont}




% Author and affiliation
\RequirePackage{authblk}
\setlength{\affilsep}{5pt}
\renewcommand\Authfont{\normalfont}
\renewcommand\Affilfont{\normalfont}
\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }




% Copyright statement
\RequirePackage{textcomp} 


% Graphics, tables and other formatting
\RequirePackage{graphicx,xcolor}
\RequirePackage{colortbl}
\RequirePackage{booktabs}
\RequirePackage{algorithm}
\RequirePackage[noend]{algpseudocode}
\RequirePackage{changepage}
\RequirePackage[left=2cm,%
                right=2cm,%
                top=1.8cm,%
                bottom=2.4cm,%
                headheight=15pt,%
                headsep=10pt,%
                a4paper,twoside]{geometry}%
\RequirePackage[labelfont={bf},%
                labelsep=period,%
                figurename=Fig.,%
                singlelinecheck=off,%
                justification=RaggedRight]{caption}
\setlength{\columnsep}{24pt} % Distance between the two columns of text
\setlength{\parindent}{0pt} % Paragraph indent







%Rename Table and Figure
\AtBeginDocument{%
  \renewcommand\tablename{\ifthenelse{\boolean{languageofthepaper}}
{Tablo}{Table}}
}

\AtBeginDocument{%
  \renewcommand\figurename{\ifthenelse{\boolean{languageofthepaper}}
{Şekil}{Figure}}
}

%\RequirePackage[font={ small}]{caption}     %caption font style

\setlength{\abovecaptionskip}{0pt}   %space between figure( or table) and caption 

%\setlength{\belowcaptionskip}{0pt}    %space between figure( or table) and caption 


\RequirePackage[numbers,sort&compress]{natbib}
\renewcommand\bibname{Referencdddde}

% Table style
\renewcommand{\arraystretch}{1} % Increased line spacing
\captionsetup[table]{position=above} % Reduce spacing below caption



% Headers and footers
\RequirePackage{fancyhdr}  % custom headers/footers
\RequirePackage{lastpage}  % Number of pages in the document
\pagestyle{fancy}          % Enables the custom headers/footers
% Headers


\fancyhead[C]{\headerfont \shortau~/~\shortartic}
\fancyhead[L,R]{}




%\chead{\headerfont \headtit}
%\lhead{Guides and tutorials}
% Footers
\lfoot{}%
\cfoot{\vspace{-2em} \thepage}%
\rfoot{}%
\renewcommand{\headrulewidth}{0pt}% % No header rule
\renewcommand{\footrulewidth}{0pt}% % No footer rule




%%%%%  ispat & proof
\usepackage{amsthm}
\renewenvironment{proof}{{\itshape\ifthenelse{\boolean{languageofthepaper}}
{İspat}{Proof}.}}{\qed}



% Section/subsection/paragraph set-up
\RequirePackage[explicit]{titlesec}
%\renewcommand{\thesubsection}{\Alph{subsection}}

\titleformat{\section}
  {\bfseries}
  {\thesection.}
  {0.5em}
  {#1}
  []
\titleformat{name=\section,numberless}
  {\bfseries}
  {}
  {0em}
  {#1}
  []
\titleformat{\subsection}
  {\bfseries}
  {\thesubsection.}
  {0.5em}
  {#1}
  []
\titleformat{\subsubsection}
  {\bfseries}
  {\thesubsubsection.}
  {0.5em}
  {#1}
  []
\titleformat{\paragraph}[runin]
  {\bfseries}
  {}
  {0em}
  {#1}
\titlespacing*\section{0pt}{1em plus 3pt minus 3pt}{1em plus 3pt minus 4pt}
\titlespacing*{\subsection}{0pc}{1em plus 3pt minus 3pt}{1em plus 3pt minus 4pt}
\titlespacing*{\subsubsection}{0pc}{1em plus 3pt minus 3pt}{1em plus 3pt minus 4pt}
\titlespacing*{\paragraph}{0pc}{1em plus 3pt minus 3pt}{1em plus 3pt minus 3pt}


% Article meta data additional fields
\newcommand{\dates}[1]{\def\@dates{#1}}
\newcommand{\doi}[1]{\def\@doi{\copyrightfont {DOI: } #1}}




%\setlength{\mathindent}{10pt}  %Math mode align left (equation)
%\setlength{\parskip}{0pt}%
\setlength{\parindent}{0pt}%
%\par\vspace{\baselineskip}
%\setlength{\intextsep}{0pt plus 0pt}
\addtolength{\skip\footins}{6pt}   %space between footnote and text



\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}   %text entry centered with "C{2.5cm}"


\newcommand{\shortartic}{}
\newcommand{\shortarticle}[1]{\renewcommand{\shortartic}{#1}}
\newcommand{\entit}{}
\newcommand{\entitle}[1]{\renewcommand{\entit}{#1}}
\newcommand{\trabs}{}
\newcommand{\trabstract}[1]{\renewcommand{\trabs}{\absfont{\bf{ Özet: }}#1}}
\newcommand{\enabs}{}
\newcommand{\enabstract}[1]{\renewcommand{\enabs}{\absfont{\bf{ Abstract: }}#1}}
\newcommand{\trkeyw}{}
\newcommand{\trkeywords}[1]{\renewcommand{\trkeyw}{\doifont{\bf{ Anahtar Kelimeler  }} \vspace{-8pt}  \begin{flushleft} #1 \end{flushleft} }}
\newcommand{\enkeyw}{}
\newcommand{\enkeywords}[1]{\renewcommand{\enkeyw}{\doifont{\bf{ Keywords  }} \vspace{-8pt}  \begin{flushleft} #1 \end{flushleft} }}
\newcommand{\trvoln}{}
\newcommand{\trvolnum}[1]{\renewcommand{\trvoln}{#1}}
\newcommand{\envoln}{}
\newcommand{\envolnum}[1]{\renewcommand{\envoln}{#1}}
\newcommand{\shortau}{}
\newcommand{\shortauthor}[1]{\renewcommand{\shortau}{#1}}
\newcommand{\corau}{}
\newcommand{\corauthor}[1]{\renewcommand{\corau}{#1}}



\RequirePackage{stfloats}

\setlength{\bibsep}{5pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555
\RequirePackage[some,bottom]{background}

\SetBgContents{
\begin{tikzpicture}[remember picture,overlay]
\node[] at (1,.6) {\rule{7.65cm}{0.4pt}};
\node[] at (-3,.35) [label=right:{\footfont{\itshape ~$^*$ \corau }}]  {};
\end{tikzpicture}}

\SetBgScale{1}
\SetBgOpacity{1}
\SetBgColor{black}
\SetBgVshift{1cm}
\SetBgHshift{-5.5cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%55






\renewcommand{\footnoterule}{%
   \hrule 
  \kern 2pt
}



% Custom title page
\renewcommand{\@maketitle}{
\vskip-20pt
{%
{  \parbox[t]{\linewidth}{ \copyrightfont {Süleyman Demirel Üniversitesi} \hfill {Süleyman Demirel University}  \par
 {Fen Bilimleri Enstitüsü Dergisi} \hfill {Journal of Natural and Applied Sciences} \par
{\trvoln} \hfill  {\envoln} \par \vskip8pt \hfill  {\doifont{\@doi}}  }}
\rule{\linewidth}{.4pt}
\vskip10pt
{\centering \titlefont \ifthenelse{\boolean{languageofthepaper}}
{\@title}{\entit} \par}%
\vskip10pt
{\centering \@author\par}
\vskip2em%
{\centering \doifont \@dates\par}
\vskip2pt
\rule{\linewidth}{.4pt}
\vskip9pt
{ \parbox[t]{0.23\linewidth}{ \par
	\ifthenelse{\boolean{languageofthepaper}}
{\trkeyw  \vskip-7pt}{\enkeyw  \vskip-7pt}}\hskip5pt \hfill \parbox[t]{0.73\linewidth}{
	 \ifthenelse{\boolean{languageofthepaper}}
{\trabs}{\enabs} }
}
\vskip11pt
\rule{\linewidth}{.4pt}
\vskip2pt
{\begin{center}
\titlefont{\ifthenelse{\boolean{languageofthepaper}}
{\entit}{\@title} }
\end{center}}
\vskip-8pt
\rule{\linewidth}{.4pt}
\vskip9pt
{ \parbox[t]{0.23\linewidth}{ 
	 \ifthenelse{\boolean{languageofthepaper}}
{\enkeyw  \vskip-5pt}{\trkeyw  \vskip-5pt}}\hskip5pt \hfill \parbox[t]{0.73\linewidth}{%
	 \ifthenelse{\boolean{languageofthepaper}}
{\enabs}{\trabs}}
}
\vskip11pt
\rule{\linewidth}{.4pt}
\vskip1em
}%
}%




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\settlanguage}{
\ifnum\value{mycounter}=1
\setboolean{languageofthepaper}{true} 
\renewcommand\refname{Kaynakça}
%\usepackage[turkish]{babel}
%\usepackage{keyval,kvsetkeys}
%\let\setkeys\kvsetkeys
\else
\setboolean{languageofthepaper}{false} 
%\usepackage[english]{babel}
\fi
\BgThispage 
 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\setbibname}{
\ifthenelse{\boolean{languageofthepaper}}{\renewcommand\refname{Kaynakça}}{} 
 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END