%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%    This is file 'mrsej.cls'  Version 01:11 (Apr 26, 2022)
%    Magnetic Resonance in Solids. Electronic Journal.                                                                         
%    http://mrsej.kpfu.ru
%
%    Authors:
%    M.V. Avdeev*, Yu.N. Proshin, A.S. Kutuzov
%
%    *e-mail: avdeyev_mv@mail.ru
%
%    This file is distributed in the hope that it will be useful, 
%    but WITHOUT ANY WARRANTY; without even the implied warranty of 
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                                                      
%       
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mrsej}[2019/05/01 (http://mrsej.kpfu.ru)]


\DeclareOption*{
   \PassOptionsToClass{\CurrentOption}{extarticle}
   \ClassWarning{mrsej}{mrsej class: extarticle class received additional option '\CurrentOption'} 
}

%\DeclareOption{MRSejOptions}{}

\ProcessOptions

\LoadClass[11pt, a4paper, twoside]{extarticle}

\RequirePackage[calcwidth]{titlesec}
\RequirePackage[russian, english]{babel}
\RequirePackage[perpage, symbol*]{footmisc}
\RequirePackage[margin=0pt,font=small,labelfont=bf,labelsep=period]{caption}
\RequirePackage{cite}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{fancyhdr}
\RequirePackage[mag=1000,a4paper,inner=25mm,outer=25mm,top=15mm, bottom=20mm, includehead, includefoot, headsep=8pt]{geometry}
\RequirePackage{lastpage}
\RequirePackage{ifthen}
\RequirePackage{color}
\RequirePackage[hidelinks=true]{hyperref}

%%% Footnote
\renewcommand{\@makefntext}[1]{\parindent=1em\noindent\hbox to 0.35em{\hss\@makefnmark}#1}
\setlength{\skip\footins}{13 pt plus 1 pt minus 1 pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Figure separation
\setlength{\textfloatsep}{10pt}
\setlength{\floatsep}{10pt}
\setlength{\intextsep}{10pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DefineFNsymbols*{mrsejlamport}[math]{\dagger\ddagger*\S\P\|{\dagger\dagger}{\ddagger\ddagger}{**}}
\setfnsymbol{mrsejlamport}

% Titlesec Package Configuration 
\titleformat{\section}{\large\bfseries}{\thesection.}{5pt}{}
\titleformat{\subsection}{\normalsize\itshape\bfseries}{\thesubsection.}{3pt}{}
\titleformat{\subsubsection}{\normalsize\itshape}{\thesubsubsection.}{3pt}{}

\titlespacing*{\section}{0pt}{9pt}{0pt}
\titlespacing*{\subsection}{0pt}{9pt}{0pt}
\titlespacing*{\subsubsection}{0pt}{9pt}{0pt}

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

\newcommand{\acknowledgments}{\section*{Acknowledgments}}

\renewcommand{\@biblabel}[1]{{#1.}\hfill}

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

\newcommand{\thetitle}{}
\newcommand{\theshorttitle}{}
\renewcommand{\title}[2][]{
    \renewcommand{\thetitle}{#2}
    \ifthenelse{\equal{#1}{}}
        {\renewcommand{\theshorttitle}{#2}}
        {\renewcommand{\theshorttitle}{#1}}
\thispagestyle{firststyle}        
{\centering\Large\textbf{#2}\par}
}

\renewcommand{\author}[2][]{
	{\vspace{11pt}\ifthenelse{\equal{#1}{}}
		{}{\renewcommand{\baselinestretch}{#1}\selectfont}
		\centering{#2}\par}
}
%\renewcommand{\author}[1]{
%{\vspace{11pt}\centering{#1}\par}
%}

\newcommand{\affiliation}[2][]{
	{\vspace{4.5pt}\centering{
			\ifthenelse{\equal{#1}{}}
			{}{\renewcommand{\baselinestretch}{#1}\selectfont}
			#2}\par}
}
%\newcommand{\affiliation}[1]{
%{\vspace{4.5pt}\centering{#1}\par}
%}

\newcommand{\email}[1]{
{\vspace{3pt}\centering\textit{#1}\par}    
}

\newcommand{\ReceivedAcceptedPublished}[3] {
{\vspace{7pt}\centering\small
(Received~#1; accepted~#2; published~#3)
\vspace{8pt}\par}
}

\newcommand{\ReceivedRevisedAcceptedPublished}[5][6pt] {
{\vspace{5pt}
\renewcommand{\baselinestretch}{1.1}\centering\small
(received~#2; revised~#3; accepted~#4; published~#5)
%(received~#2; revised~#3;%\\\hspace{#1}
% accepted~#4; published~#5)
\vspace{7pt}\par}
}

\renewenvironment{abstract}[1][14.6cm]{
	\renewcommand{\baselinestretch}{1.05}
	\noindent\hfill\small
	\begin{minipage}{#1}
}
{\end{minipage}\hfill}


\newcommand{\pacs}[1]{
{\vspace{14pt}\noindent\small\textbf{PACS: }{#1}\par}
}

\newcommand{\keywords}[1]{
{\settowidth{\hangindent}{\small\textbf{Keywords:\hspace{5pt}}}
\vspace{2pt}\noindent\small\textbf{Keywords:\hspace{5pt}}{#1}\vspace{4pt}\par}
}

\renewcommand{\maketitle}{
	\setlength{\parindent}{0.45cm}
	\setlength{\parskip}{2.5pt plus 1pt}
	\renewcommand{\baselinestretch}{1.1}\selectfont
}

%%%%%%% HEAD and FOOT %%%%%%%%%%

\newcommand{\theyear}{20??}
\newcommand{\thevol}{??}
\newcommand{\theno}{??}
\newcommand{\theart}{??}
\newcommand{\thepp}{\pageref{LastPage}}
\newcommand{\theauthor}{??}
\newcommand{\makehead}[5]{%
    \renewcommand{\theyear}{#1}
    \renewcommand{\thevol}{#2}
    \renewcommand{\theno}{#3}
    \renewcommand{\theart}{#4}
    \renewcommand{\theauthor}{#5}
}

\newcommand{\MRSej}{Magnetic Resonance in Solids. Electronic Journal.}
\newcommand{\footMRSej}{\MRSej~\theyear,~Vol.~\thevol,~No~\theno,~\theart\,(\thepp~pp.)}

\pagestyle{fancy}
\fancyhead{} 
\addtolength{\headheight}{2ex}
\renewcommand{\headrulewidth}{0.0 mm}
\fancyhead[LE]{\textbf{\textit{\footnotesize\theshorttitle}}}
\fancyhead[RO]{\textbf{\textit{\footnotesize\theauthor}}}
\fancyfoot{}
\fancyfoot[LE,RO]{\footnotesize\thepage} 
\fancyfoot[LO,RE]{\textit{\footnotesize\footMRSej}} 
 
\fancypagestyle{firststyle}{
\fancyfoot{}
\fancyfoot[RO]{\footnotesize\thepage} 
\fancyfoot[LO]{\textit{\footnotesize\footMRSej}} 

\fancyhead{}

% doi :
\fancyheadoffset[R]{35pt}
\fancyhead[R]{
	\raisebox{17pt}[0pt][0pt]{
	\textcolor[gray]{0.5}{	
	\footnotesize \href{http://doi.org/10.26907/mrsej-\theart}{doi:\:10.26907/mrsej-\theart}
	}%textcolor
	}%raisebox
	}%fancyhead

% Short cite this: Magn. Reson. Solids Vol, ArtNo (20??) :
\fancyheadoffset[L]{35pt}
\fancyhead[L]{
	\raisebox{17pt}[0pt][0pt]{
		\textcolor[gray]{0.5}{	
			\footnotesize Short cite this: \textit{Magn.\:Reson.\:Solids} \textbf{\thevol}, \theart~(\theyear)
		}%textcolor
	}%raisebox
}%fancyhead
}%fancypagestyle{firststyle}


%%%%%% Caption Package Configuration 
\DeclareCaptionLabelFormat{mrsej_simple}{\bothIfFirst{#1}{\hspace{3pt}#2}}
\DeclareCaptionLabelSeparator{mrsej_period}{.\hspace{5pt}}
\captionsetup{labelformat=mrsej_simple,labelseparator=mrsej_period,format=hang}

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

\endinput
