%% The class is for journal “Multiphase Systems”
%% Author: Constantin Mikhaylenko
%% License GPL
%% All questions and ideas please send to mailto:const@uimech.org
%%
%% The class is based on the article class and set the next article's parameters
%%  a4paper, 10pt
%%
%% The class has the next parameters:
%%  koi8-r, cp1251, utf8 — a codepage of the text (default is cp1251)
%%  nodoi, noudc — if article doesn't have DOI and/or UDC indexes
%%  noauthor — editor's article
%%  noabstract — article doesn't have abstract
%%  nokeywords — article doesn't have keywords
%%  noenglish — article only has titles in Russian
%%  pdfonly — if article only has link to pdf-file
%%  russian, english — the main language of an article (default is Russian)
%%  final — it means the article is in two-column final result
%%  draft — it means just one-column text without pictures, page headers and so on
%%  contents — creates Contents pages 
%%
%% The class uses a list of packages by default:
%% fontenc     - set font codepage as T2A
%% inputenc    - for setting text codepage (by default is cp1251)
%% babel       - languages [english,russian]
%% paratype    - fonts for text
%% mathpazo    - fonts for maths
%% cmap        - corrects codepage for cyrillic in pdf
%% hyperref    - organize hyperlinks
%% lastpage    - returns the last page nnumber for hyperlinks
%% indentfirst - print the first paragraph with indention
%% amsmath     \
%% amssymb     - math improving
%% amsfonts    /
%% mathtext    - allows cyrillic in math
%% cite        - “smart” cites
%% graphicx    - let include graphics
%% tikz        - for painting, it partially makes the first-page header
%% qrcode      - QR-code generator
%% caption     - configures captionf of figures and tables
%% balance     - balances columns in the last page
%% microtype   - small typography improves
%% doclicense  - CC-BY licence sign
%% multicol    - two/single column format during a page
%% etoolbox    - actions at the end of document
%% utfsym      - some special symbols
%%
%% The class provides the next commands end enviromnments
%% \Year{}       - sets year
%% \Volume{}     - sets volume
%% \Number{}     - sets issue number
%% \Numbers{}    - additional command which sets double issue number for printing
%% \Article{}    - an article number
%% \Startpage{}  - the articles's first page number
%% \Incomedate{} - sets incoming date
%% \Outputdate{} - sets publish date
%%
%% \UDC{}          - sets UDC index
%% \title{}        \
%% \thanks{}        > there are standard command
%% \author{}       /
%% \aff{}          - makes indexes for affiliation description
%% \email{}        - a corresponding author's email
%% \institute{}    - this command makes affiliation
%% \abstract{}     - command parameter has to content an abstract, command is instead environment
%% \keywords{}     - list of keywords
%%
%% \engtitle{}     -
%% \engauthor{}     \
%% \enginstitute{}   > translated parts if article's language is Russian
%% \engabstract{}   /
%% \engkeywords{}  -
%%
%% \authordata{}{}{}{}{}{}{}{} - put an info for each author 
%%                     (full name in Russian #1 and English #2, scientific degrees in Russian #3 and English #4,
%%                      affiliation in Russian #5 and English #6, ORCID #7 and email #8)
%%
%% \tocolontitle{}{} - put authors names to colontitle in Russian #1 and English #2
%%
%% \cover        - makes the journal's titlepage
%% \maketitle    - print an article's title
%%
%% \doi{}        - prints an cited article's DOI index
%% \edn{}        - ... EDN index
%% \elib{}       - ... eLibrary index (deprecated by \edn{} command)
%% \mathnet{}    - ... MathNet index
%%
%% \startsinglecolumneq - start and stop area for wide equations in one-column regime
%% \stopsinglecolumneq  /
%%
%% \stretchtheline  - stretching the last line of paragraph
%% \le   - for \leqslant
%% \leq  - for \leqslant
%% \ge   - for \geqslant
%% \geq  - for \geqslant

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{mfs}[2025/01/22 v5.1 Non Standard LaTeX document class]

% Output parameters (default values and setup commands)
\def\mfs@volume{20}\def\Volume#1{\def\mfs@volume{#1}}
\def\mfs@year{2025}\def\Year#1{\def\mfs@year{#1}}
\def\mfs@number{1}\def\Number#1{\def\mfs@number{#1}}
\def\mfs@numbers{\mfs@number}\def\Numbers#1{\def\mfs@numbers{#1}}
\def\mfs@article{000}\def\Article#1{\def\mfs@article{#1}}
\def\mfs@startPage{1}\def\Startpage#1{\def\mfs@startPage{#1}\setcounter{page}{#1}}
\def\mfs@endPage{\pageref{LastPage}}%\def\Endpage#1{\def\mfs@endPage{#1}}
\def\mfs@income{\today}\def\Incomedate#1{\def\mfs@income{#1}}
\def\mfs@output{\today}\def\Outputdate#1{\def\mfs@output{#1}}

% Default codepage is 1251
\def\MFS@encoding{cp1251}
  \DeclareOption{koi8-r}{\def\MFS@encoding{koi8-r}}
  \DeclareOption{utf8}{\def\MFS@encoding{utf8}}
  \DeclareOption{cp1251}{\def\MFS@encoding{cp1251}}
\def\MFS@pdfonly{0}\DeclareOption{pdfonly}{\def\MFS@pdfonly{1}}
\def\MFS@nodoi{0}\DeclareOption{nodoi}{\def\MFS@nodoi{1}}
\def\MFS@noudc{0}\DeclareOption{noudc}{\def\MFS@noudc{1}}
\def\MFS@noauthor{0}\DeclareOption{noauthor}{\def\MFS@noauthor{1}}
\def\MFS@noabstract{0}\DeclareOption{noabstract}{\def\MFS@noabstract{1}}
\def\MFS@nokeywords{0}\DeclareOption{nokeywords}{\def\MFS@nokeywords{1}}
\def\MFS@noenglish{0}\DeclareOption{noenglish}{\def\MFS@noenglish{1}}
\def\MFS@language{russian}\DeclareOption{english}{\def\MFS@language{english}}
\def\MFS@contents{0}\DeclareOption{contents}{\def\MFS@contents{1}}
\def\MFS@final{0}\DeclareOption{final}{\def\MFS@final{1}}
\def\MFS@draft{}\DeclareOption{draft}{%
    \def\MFS@draft{draft}
    \tolerance=1
    \emergencystretch=\maxdimen
    \hyphenpenalty=10000
    \hbadness=10000
    \def\newcolumn{}
  }
\ProcessOptions

% mfs.cls based on article class
\LoadClass[10pt,a4paper,\MFS@draft]{article}

% Preloaded packages
\RequirePackage{cmap}
\RequirePackage[T2A,T1]{fontenc}
\RequirePackage{mathpazo}
\RequirePackage{paratype}
\RequirePackage[colorlinks=true,citecolor=blue,urlcolor=blue,linkcolor=blue,pdftex,unicode]{hyperref}
%\RequirePackage{cuted}
\RequirePackage{mathtext}
\RequirePackage[\MFS@encoding]{inputenc}
\RequirePackage[english,russian]{babel}
\RequirePackage{indentfirst}
\RequirePackage[pdftex]{graphicx}
\RequirePackage{tikz}
\RequirePackage{amsfonts}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{caption}
\RequirePackage{balance}
\RequirePackage{cite}
\RequirePackage{lastpage}
\RequirePackage{microtype}
\RequirePackage{qrcode}
\RequirePackage[type={CC},modifier={by},version={4.0}]{doclicense}
\IfFileExists{multicol.sty}{\RequirePackage{multicol}}{}
\RequirePackage{utfsym}
\RequirePackage{etoolbox}

% Pages sizes
\setlength\paperheight{297mm}
\setlength\paperwidth{210mm}
\setlength\voffset{-11mm}
\setlength\hoffset{-7mm}
\setlength\textheight{245mm}
\setlength\textwidth{185mm}
\setlength\topmargin{1.6mm}
\setlength\headheight{5mm}
\setlength\headsep{8mm}
\setlength\footskip{0mm}
\setlength\oddsidemargin{-5.4mm}
\setlength\evensidemargin{-5.4mm}
\@twosidetrue

% Here are defined names, standard captions and typography text strings
\def\mfs@journalName{\iflanguage{russian}{\CYRM\cyrn\cyro\cyrg\cyro\cyrf\cyra\cyrz\cyrn\cyrery\cyre\ %
	\cyrs\cyri\cyrs\cyrt\cyre\cyrm\cyrery}{Multiphase Systems}}
\def\mfs@ISSN{ISSN 2658--5782}
\def\mfs@DOIHeading{DOI}
\def\mfs@UDCHeading{\iflanguage{russian}{\CYRU\CYRD\CYRK\ /\ UDC}{UDC}}
\def\mfs@incomeHeading{\ifdefstring{\MFS@draft}{draft}{}{\iflanguage{russian}{\CYRP\cyro\cyrl\cyru\cyrch\cyre\cyrn\cyra\ /\ Received}{Received}}}
\def\mfs@outputHeading{\ifdefstring{\MFS@draft}{draft}{}{\iflanguage{russian}{\CYRP\cyrr\cyri\cyrn\cyrya\cyrt\cyra\ /\ Accepted}{Accepted}}}
\def\mfs@abstractHeading{}
%{\ifdefstring{\MFS@draft}{draft}{}{\iflanguage{russian}{\CYRA\cyrn\cyrn\cyro\cyrt\cyra\cyrc\cyri\cyrya}{Abstract}}}
\def\mfs@keywordsHeading{\ifdefstring{\MFS@draft}{draft}{}{\iflanguage{russian}{\CYRK\cyrl\cyryu\cyrch\cyre\cyrv\cyrery\cyre\ 			\cyrs\cyrl\cyro\cyrv\cyra}{Keywords}}}
\def\mfs@emailHeading{E-mail}
\addto\captionsrussian{\def\refname{\CYRS\cyrp\cyri\cyrs\cyro\cyrk\ \cyrl\cyri\cyrt\cyre\cyrr\cyra\cyrt\cyru\cyrr\cyrery\ /\ References}}
\def\mfs@authorSection{\CYRS\cyrv\cyre\cyrd\cyre\cyrn\cyri\cyrya\ \cyro\cyrb\ \cyra\cyrv\cyrt\cyro\cyrr\cyra\cyrh}
\def\mfs@authorSectionEng{Information about the Authors}

% The Journal and an article parameter strings
\def\mfs@url{http://mfs.uimech.org/mfs\mfs@year.\mfs@number.\mfs@article}
\ifnum\MFS@pdfonly=1
  \def\mfs@url{http://mfs.uimech.org/\mfs@year/pdf/mfs\mfs@year.\mfs@number.\mfs@article.pdf}
\fi

\def\mfs@textDOI{10.21662/mfs\mfs@year.\mfs@number.\mfs@article}
\def\mfs@DOI{\ifdefstring{\MFS@draft}{draft}{\mfs@textDOI}{\href{https://doi.org/\mfs@textDOI}{\mfs@DOIHeading\ \mfs@textDOI}}}
\ifnum\MFS@nodoi=1
  \def\mfs@DOI{}
\fi

\def\mfs@textUDC{00.00}\def\UDC#1{\def\mfs@textUDC{#1}}
\def\mfs@UDC{\ifdefstring{\MFS@draft}{draft}{}{\mfs@UDCHeading\ \mfs@textUDC}}
\ifnum\MFS@noudc=1
  \def\mfs@UDC{}
\fi

% Commands set an article's title parameters
\def\mfs@titleEng{}\def\engtitle#1{\def\mfs@titleEng{#1}}
\def\mfs@authorEng{}\def\engauthor#1{\def\mfs@authorEng{#1}}
%\def\aff#1{${}^{#1}$}
\def\aff#1{\raisebox{.9ex}{\mdseries\scriptsize #1\ }}
\let\institute\date
\def\mfs@instituteEng{}\def\enginstitute#1{\def\mfs@instituteEng{#1}}
\def\mfs@email{}\def\email#1{\gdef\mfs@email{#1}%
	\aff{\href{mailto:\mfs@email}
    \scriptsize\color{blue}\usym{1F582}}}
\def\mfs@abstract{}\def\abstract#1{\def\mfs@abstract{#1}}
\def\mfs@abstractEng{}\def\engabstract#1{\def\mfs@abstractEng{#1}}
\def\mfs@keywords{}\def\keywords#1{\def\mfs@keywords{#1}}
\def\mfs@keywordsEng{}\def\engkeywords#1{\def\mfs@keywordsEng{#1}}
\def\@thanks{}\def\thanks#1{\def\@thanks{#1}}
\def\mfs@thanksEng{}\def\engthanks#1{\def\mfs@thanksEng{#1}}

\def\mfs@toColontitle{}\def\mfs@toColontitleEng{}
\def\tocolontitle#1#2{\def\mfs@toColontitle{#1}\def\mfs@toColontitleEng{#2}}

% The Logo picture
\def\mfs@logo#1#2{
	\path[draw=black,line width=.5pt] (.5*#1,15*#1)arc(0:135:-14.5*#1);
	\path[draw=black,line width=.5pt] (.5*#1,15*#1)arc(0:-125:-14.5*#1);
	\path[draw=black,line width=1pt] (3.5*#1,15*#1)arc(0:135:-11.5*#1);
	\path[draw=black,line width=1pt] (3.5*#1,15*#1)arc(0:-125:-11.5*#1);
	\path[cm={{0.9,0.0,0.0,0.9,(1.6*#1,1.6*#1)}},draw=black,line width=1.5pt] (5.5*#1,15*#1)arc(0:135:-9.5*#1);
	\path[cm={{0.9,0.0,0.0,0.9,(1.6*#1,1.6*#1)}},draw=black,line width=1.5pt] (5.5*#1,15*#1)arc(0:-135:-9.5*#1);
	\path[cm={{0.8,0.0,0.0,0.8,(3.2*#1,3.2*#1)}},draw=black,line width=2pt] (8*#1,15*#1)arc(0:135:-7*#1);
	\path[cm={{0.8,0.0,0.0,0.8,(3.2*#1,3.2*#1)}},draw=black,line width=2pt] (8*#1,15*#1)arc(0:-135:-7*#1);
	\path[cm={{0.56,0.0,0.0,0.56,(6.7*#1,6.7*#1)}},draw=black,line width=2.5pt] (10.5*#1,15*#1)arc(0:135:-4.5*#1);
	\path[cm={{0.56,0.0,0.0,0.56,(6.7*#1,6.7*#1)}},draw=black,line width=2.5pt] (10.5*#1,15*#1)arc(0:-135:-4.5*#1);
	\path[draw=black,line join=round,line cap=round,miter limit=4,line width=.7pt]
	  (80.0*#1*#2,3*#1) .. controls (65.9*#1,3*#1)
	  and (32.4*#1,3*#1) .. (30*#1,3*#1) .. controls (24.5*#1,3*#1)
	  and (25.5*#1,25*#1) .. (24*#1,25*#1) .. controls (22.5*#1,25*#1)
	  and (23.5*#1,11*#1) .. (21.5*#1,11*#1) .. controls (20*#1,11*#1)
	  and (20.5*#1,17.5*#1) .. (19.5*#1,17.5*#1) .. controls (18.5*#1,17.5*#1)
	  and (18.5*#1,14*#1) .. (17.5*#1,14*#1) .. controls (16.5*#1,14*#1)
	  and (17*#1,15*#1) .. (16*#1,15*#1) .. controls (14*#1,15*#1)
	  and (16.5*#1,15*#1) .. (15*#1,15*#1);
}

% It sets URL hypenation point at "/"
\g@addto@macro{\UrlBreaks}{\UrlOrds}
\urlstyle{sf}

% Point 1: the cover.
\newcommand{\cover}{%
  \selectlanguage{\MFS@language}
  \ifdefstring{\MFS@draft}{draft}{}{%
    \def\text@issue{\iflanguage{russian}{\CYRN\cyro\cyrm\cyre\cyrr}{Issue}}
    \def\text@Multiphase{\iflanguage{russian}{\CYRM\CYRN\CYRO\CYRG\CYRO\CYRF\CYRA\CYRZ\CYRN\CYRERY\CYRE}{MULTIPHASE}}
    \def\text@Systems{\iflanguage{russian}{\CYRS\CYRI\CYRS\CYRT\CYRE\CYRM\CYRERY}{SYSTEMS}}
    \def\text@IMfirst{\iflanguage{russian}{\CYRI\CYRM\cyre\cyrh}{Mavlyutov}}
    \def\size@IMfirst{\iflanguage{russian}{1.35}{.86}}
    \def\text@IMsecond{\iflanguage{russian}{\cyri\cyrm.\ \CYRR.\CYRR.\,\CYRM\cyra\cyrv\cyrl\cyryu\cyrt\cyro\cyrv\cyra}{Institute of Mchanics}}
    \def\size@IMsecond{\iflanguage{russian}{.95}{1.05}}
	\thispagestyle{empty}\enlargethispage{5cm}\vspace*{-28mm}\hspace*{-22mm}
	\definecolor{b1}{HTML}{2F2483} \definecolor{b2}{HTML}{A199CB}
	\begin{tikzpicture}
      \usefont{T2A}{PTSerif-TLF}{b}{n}
	  \draw[color=white](0,0)--(21,29.7);
	  \draw (5,26.5) node [above,left] {\qrcode[nolink,height=25mm]{http://mfs.uimech.org/mfs\mfs@year.\mfs@number}};
	  \draw (19.8,27) node [above,left] {\large\scalebox{1.4}{ISSN: 2658--5782}};
	  \draw (5.5,25.5) node [above,right] {\Large\scalebox{1.5}{\text@issue\ \mfs@numbers}};
	  \draw (19.8,25.5) node [above,left] {\Large\scalebox{1.5}{\mfs@year}};
	  \draw[color=b1,fill=b1,line width=1pt] (0,14.5)--(5,14.5)--(5,24.5)--(0,24.5)--cycle;
	  \draw[color=b1,fill=b1,line width=1pt] (5.5,14.5)--(21,14.5)--(21,24.5)--(5.5,24.5)--cycle;
	  \path[text=white] (6,22) node[above right] {\Huge\scalebox{1.9}{\text@Multiphase}};
	  \path[text=white] (6,20) node[above right] {\Huge\scalebox{1.9}{\text@Systems}};
	  \draw[color=b1,fill=b2] (12.5,13.5)--(18.5,13.5)--(18.5,15.5)--(12.5,15.5)--cycle;
	  \draw[color=b1] (12.7,13.7)--(18.3,13.7)--(18.3,15.3)--(12.7,15.3)--cycle;
	  \draw[color=b1] (12.5,13.5)--(12.7,13.7); \draw[color=b1] (12.5,15.5)--(12.7,15.3);
	  \draw[color=b1] (18.5,13.5)--(18.3,13.7); \draw[color=b1] (18.5,15.5)--(18.3,15.3);
	  \draw (15.5,14.5) node[text=b1] {\Large\scalebox{1.2}{mfs.uimech.org}};
	  \put(160,100){%
	  	\mfs@logo{.08}{1}
	  	\path(2.38,.9) node[above right] {\Huge\scalebox{\size@IMfirst}{\text@IMfirst}};
	  	\path(2.42,.4) node[above right] {\scalebox{\size@IMsecond}{\text@IMsecond}};
	  };
	\end{tikzpicture}
    \addtocounter{page}{-1}
  }
}

% Point 2: the title
% Typography of the title data in single language
\def\mfs@putTitle#1#2#3#4#5#6#7{%
  \vskip6pt plus1pt minus1pt%
  \par\noindent{\Large\sffamily\bfseries\upshape\usefont{T2A}{PTSansCaption-TLF}{b}{n}\noindent#1}%title
  \ifnum\MFS@noauthor=0
    \vskip6pt plus1pt minus1pt%
    \par{\parbox{170mm}{\sffamily\bfseries\noindent#2}}%author
    \vskip.5ex plus.5pt minus.5pt%
    \par{\parbox{170mm}{\sffamily\small\noindent#3}}%nstitute
    \if&#7&\else
      \vskip.5em plus.1em minus.5ex%
      \par{\parbox{170mm}{\sffamily\small\noindent\mfs@emailHeading:\ \href{mailto:\mfs@email}{\mfs@email}}}%email
    \fi
  \fi
  \ifnum\MFS@noabstract=0
    \vskip.7em plus.1em minus.1ex%
    \par{\sffamily\small\noindent#4}%abstract
  \fi
  \ifnum\MFS@nokeywords=0
    \vskip1em plus.2em minus.2ex%
    \par{\small\sffamily\textbf{\mfs@keywordsHeading:}\ #5}%keywords
  \fi
  \if&#6&\else
   \vskip1em plus.5em minus1ex%
    \par{\parbox{170mm}{\sffamily\small\noindent#6}}%thanks
  \fi
  \ifnum\MFS@noenglish=0
    \begin{center}\rule{#7}{.5pt}\end{center}
  \fi
}

% Typography of an article's title
\newdimen\mfs@titleLine
\def\mfs@maketitle#1{%
  \newpage
  \selectlanguage{\MFS@language}
  \vspace*{-10mm}
  \thispagestyle{empty}
  \ifdefstring{\MFS@draft}{draft}{%
    \textsf{%
      \mfs@volume (\mfs@year) \mfs@numbers: \mfs@startPage--\mfs@endPage\\
      \mfs@income\\
      \mfs@output\\
      \mfs@url\\
      \mfs@DOI\\
      \mfs@UDC
    }
  }{
    \noindent\textsf{\scriptsize\mfs@ISSN\hfill\textbf{\mfs@volume}\ (\mfs@year)\ \mfs@numbers: \mfs@startPage--\mfs@endPage}\\[-.5mm]
    \rule[2mm]{\textwidth}{.2mm} \\[-1mm] 
    \hbox{\tikz{\mfs@logo{.065}{3.152}
    		\path[fill=black] (92mm,4mm) node[above] {\usefont{T2A}{PTSerifCaption-TLF}{m}{ui} \Huge\scalebox{1.2}{\hbox{\mfs@journalName}}};}
      }\hspace*{0mm}\raisebox{9mm}{\qrcode{\mfs@url}}\\ %\rule[2.7mm]{\textwidth}{.2mm}\\[-3.5mm]
    \parbox[t]{.686\textwidth}{\textsf{\scriptsize\url{\mfs@url}\\[-1.2mm]\mfs@DOI\\[-1.2mm]\mfs@UDC}}%
    \parbox[t]{.20\textwidth}{\raggedleft\textsf{\scriptsize\mfs@incomeHeading\ \mfs@income\\[-1.2mm]\mfs@outputHeading\ \mfs@output}}%
    \parbox[t]{20mm}{\raisebox{-4mm}{\href{\doclicenseURL}{\doclicenseImage[imagewidth=20mm]}}}%
  }
  \vspace{5mm}%
  \iflanguage{russian}{\mfs@titleLine=.3\textwidth}{\mfs@titleLine=#1}
  \mfs@putTitle{\@title}{\@author}{\@date}{\mfs@abstract}{\mfs@keywords}{\@thanks}{\mfs@titleLine}%
  \ifnum\MFS@noenglish=0
        \def\mfs@keywordsHeading{Keywords}
   	\mfs@putTitle{\mfs@titleEng}{\mfs@authorEng}{\mfs@instituteEng}{\mfs@abstractEng}{\mfs@keywordsEng}{\mfs@thanksEng}{#1}
  \fi
  \normalsize\rmfamily
}

% Redefined \maketitle. The optional parameter shift vertical space to main text
\renewcommand\maketitle[1][]{%
  \if&#1&
    \mfs@maketitle{\textwidth}
  \else
    \mfs@maketitle{0pt}
    \vspace{#1}
  \fi
  \ifnum\MFS@final=1
    \begin{multicols}{2}
  \fi
  \setcounter{equation}{0}
  \setcounter{section}{0}
  \setcounter{figure}{0}
  \setcounter{table}{0}
  \setcounter{footnote}{0}%
  \selectlanguage{\MFS@language}
}

% Point 3: a regular page
% Colontitles
\def\text@evenHead{\selectlanguage{russian}\thepage\hfill\mfs@toColontitle\hfill\textbf{\mfs@volume}\ (\mfs@year)\ \mfs@numbers\ \mfs@journalName}
\def\text@oddHead{\selectlanguage{english}\mfs@journalName\ \textbf{\mfs@volume}\ (\mfs@year)\ \mfs@numbers\hfill\mfs@toColontitleEng\hfill\thepage}
\def\@oddhead{\vbox{\hbox to\textwidth{\textsf{\small\text@oddHead\strut}}{\hrule}}}%
\def\@evenhead{\vbox{\hbox to\textwidth{\textsf{\small\text@evenHead\strut}}{\hrule}}}%
\def\@oddfoot{}
\def\@evenfoot{}
\ifdefstring{\MFS@draft}{draft}{%
	\def\@oddhead{}
	\def\@evenhead{}
	\def\includegraphics#1[#2]{}
}{}

% Sections numbering and printing
\def\thesection{\@arabic\c@section.}
\def\thesubsection{\thesection\@arabic\c@subsection.}
\def\section{\@startsection{section}{1}{\z@}%
	{1.5ex \@plus .3ex \@minus .1ex}%
	{.8ex \@plus.2ex}%
	{\normalfont\large\usefont{T2A}{PTSansCaption-TLF}{b}{n}}}
\def\subsection{\@startsection{subsection}{2}{\z@}%
	{-1.5ex \@plus -1ex \@minus -.2ex}%
	{.8ex \@plus.2ex}%
	{\normalfont\usefont{T2A}{PTSansCaption-TLF}{b}{n}}}

% Captions format
\captionsetup{labelsep=period,textformat=simple,format=hang,font={sf,small},margin=2mm}

% The first line indent
\setlength\parindent{2em}

% The begining of one-column part in two-column page
\def\startsinglecolumneq{%
	\ifdefstring{\MFS@draft}{draft}{}{%
		\protect\end{multicols}\noindent\vspace*{0mm}\rule[5mm]{.5\textwidth}{.1pt}\rule[5mm]{.1pt}{1mm}\vspace*{-5mm}%
}%
}

% The ending of one-column part in two-column page
\def\stopsinglecolumneq{%
\ifdefstring{\MFS@draft}{draft}{}{%
	\protect\vspace*{-5mm}\ %
	\hfill\rule[1mm]{.1pt}{1mm}\rule[2mm]{.5\textwidth}{.1pt}\vspace*{2mm}%
	\begin{multicols}{2}\ifdefstring{\MFS@language}{russian}{\selectlanguage{russian}}\noindent%
	}%
}

% Parameters of the space length at the end of paragraph
\parfillskip=0pt plus .4\textwidth

% The last paragraph spase turned to zero for special cases
\def\stretchtheline{\unskip{\parfillskip0pt\par}}

% Point 4: the bibliography
\renewenvironment{thebibliography}[1]{%
    \balance
  \section*{\refname}%
  \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
  \vspace*{2mm}%
  \list{\@biblabel{\@arabic\c@enumiv}}%
    {\settowidth\labelwidth{\@biblabel{#1}}%
	  \leftmargin\labelwidth
	  \advance\leftmargin\labelsep
	  \@openbib@code
	  \usecounter{enumiv}%
	  \let\p@enumiv\@empty
	  \renewcommand\theenumiv{\@arabic\c@enumiv}
	}%
  \small \scriptsize\usefont{T2A}{PTSansCaption-TLF}{m}{n}
  \sloppy
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m}%
  {\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}\endlist}

\def\doi#1{\href{https://doi.org/#1}{DOI: #1}}
\def\mathnet#1{\href{http://mi.mathnet.ru/#1}{MathNet: #1}}
\def\elib#1{\href{https://elibrary.ru/item.asp?id=#1}{eLIBRARY ID: #1}}
\def\edn#1{\href{https://elibrary.ru/#1}{EDN: #1}}

% Point 5: put author's info
% The section's title
\def\mfs@printAuthorInfo{%
	\noindent
	{\normalfont\large\usefont{T2A}{PTSansCaption-TLF}{b}{n}%
		\ifdefstring{\MFS@language}{russian}{%
			\parbox{.48\textwidth}{\raggedleft\mfs@authorSection}%
			\parbox{.04\textwidth}{\begin{center}/\end{center}}%
		}{\hfill}
		\parbox{.48\textwidth}{\mfs@authorSectionEng}%
	}%
	\vspace*{3mm}%
}

% Add information about author (with typograpy)
\def\authordata#1#2#3#4#5#6#7#8{%
  \g@addto@macro\mfs@printAuthorInfo{%
  	\sffamily
    \ifdefstring{\MFS@draft}{draft}{%
      \par\noindent
  	  \ifdefstring{\MFS@language}{russian}{#1\\}{}#2\\\ifdefstring{\MFS@language}{russian}{#5\\}{}#6\\#8\\[5mm]
    }{%
      \par\noindent
	  \ifdefstring{\MFS@language}{russian}{%
	    \parbox[t]{.48\textwidth}{\raggedleft\textbf{#1}}\parbox{.04\textwidth}{\hfill}%
	  }{\hfill}
	  \parbox[t]{.48\textwidth}{\textbf{#2}}\\[.5mm]%
	  \ifx&#4&\else{%
		\ifdefstring{\MFS@language}{russian}{%
		  \parbox{.48\textwidth}{\raggedleft\ifx&#3&\else#3\fi}\parbox{.04\textwidth}{\hfill}%
		}{%
		  \parbox{.52\textwidth}{\hfill}
		}
		\parbox{.48\textwidth}{#4}
		}\\[.5mm]
	  \fi%
	  \ifdefstring{\MFS@language}{russian}{%
		\parbox{.48\textwidth}{\raggedleft#5}\parbox{.04\textwidth}{\hfill}%
	  }{\parbox{.52\textwidth}{\hfill}}
	  \parbox{.48\textwidth}{#6}\\[.5mm]%
	  \parbox{.52\textwidth}{\hfill}\parbox{.48\textwidth}{\href{mailto:#7}{\texttt{#7}}}%
	  \ifx&#8&\else{%
		\\[.5mm]\parbox{.52\textwidth}{\hfill}%
		\parbox{.48\textwidth}{ORCID: \href{https://orcid.org/#8}{#8}}
	  }
	  \fi%
	  \vspace{1em}
	}
  }
}

% Point 6: The end of document
\ifnum\MFS@contents=0
  \AtEndDocument{%
    \ifnum\MFS@final=1
      \end{multicols}
    \fi
    \ifnum\MFS@noauthor=0
      \selectlanguage{russian}\mfs@printAuthorInfo
    \fi
  }
\fi

% New commands	 and redifined commands

% \No for cyrillic number if command is not exist
\def\No{\cyr\textnumero}

% Upright Greek math symbols (for Russian typography)
\DeclareSymbolFont{lettersA}{U}{txmia}{m}{it} 
\SetSymbolFont{lettersA}{bold}{U}{txmia}{bx}{it} 
\DeclareFontSubstitution{U}{txmia}{m}{it} 
\DeclareSymbolFontAlphabet{\mathfrak}{lettersA}

\DeclareMathSymbol{\alphaup}{\mathord}{lettersA}{11}
\DeclareMathSymbol{\betaup}{\mathord}{lettersA}{12}
\DeclareMathSymbol{\gammaup}{\mathord}{lettersA}{13}
\DeclareMathSymbol{\deltaup}{\mathord}{lettersA}{14}
\DeclareMathSymbol{\epsilonup}{\mathord}{lettersA}{15}
\DeclareMathSymbol{\zetaup}{\mathord}{lettersA}{16}
\DeclareMathSymbol{\etaup}{\mathord}{lettersA}{17}
\DeclareMathSymbol{\thetaup}{\mathord}{lettersA}{18}
\DeclareMathSymbol{\iotaup}{\mathord}{lettersA}{19}
\DeclareMathSymbol{\kappaup}{\mathord}{lettersA}{20}
\DeclareMathSymbol{\lambdaup}{\mathord}{lettersA}{21}
\DeclareMathSymbol{\muup}{\mathord}{lettersA}{22}
\DeclareMathSymbol{\nuup}{\mathord}{lettersA}{23}
\DeclareMathSymbol{\xiup}{\mathord}{lettersA}{24}
\DeclareMathSymbol{\piup}{\mathord}{lettersA}{25}
\DeclareMathSymbol{\rhoup}{\mathord}{lettersA}{26}
\DeclareMathSymbol{\sigmaup}{\mathord}{lettersA}{27}
\DeclareMathSymbol{\tauup}{\mathord}{lettersA}{28}
\DeclareMathSymbol{\upsilonup}{\mathord}{lettersA}{29}
\DeclareMathSymbol{\phiup}{\mathord}{lettersA}{30}
\DeclareMathSymbol{\chiup}{\mathord}{lettersA}{31}
\DeclareMathSymbol{\psiup}{\mathord}{lettersA}{32}
\DeclareMathSymbol{\omegaup}{\mathord}{lettersA}{33}
\DeclareMathSymbol{\varepsilonup}{\mathord}{lettersA}{34}
\DeclareMathSymbol{\varthetaup}{\mathord}{lettersA}{35}
\DeclareMathSymbol{\varpiup}{\mathord}{lettersA}{36}
\DeclareMathSymbol{\varrhoup}{\mathord}{lettersA}{37}
\DeclareMathSymbol{\varsigmaup}{\mathord}{lettersA}{38}
\DeclareMathSymbol{\varphiup}{\mathord}{lettersA}{39}

\let\alpha\alphaup
\let\beta\betaup
\let\gamma\gammaup
\let\delta\deltaup
\let\epsilon\epsilonup
\let\zeta\zetaup
\let\eta\etaup
\let\theta\thetaup
\let\iota\iotaup
\let\kappa\kappaup
\let\lambda\lambdaup
\let\mu\muup
\let\nu\nuup
\let\xi\xiup
\let\pi\piup
\let\rho\rhoup
\let\sigma\sigmaup
\let\tau\tauup
\let\upsilon\upsilonup
\let\phi\phiup
\let\chi\chiup
\let\psi\psiup
\let\omega\omegaup
\let\vartheta\varthetaup
\let\varpi\varpiup
\let\varrho\varrhoup
\let\varsigma\varsigmaup
\let\varepsilon\varepsilonup
\let\varphi\varphiup

% Simplify a few of popular commands
\def\le{\ensuremath{\leqslant}}
\def\leq{\ensuremath{\leqslant}}
\def\ge{\ensuremath{\geqslant}}
\def\geq{\ensuremath{\geqslant}}

\endinput
%
