%%
%% This is file `pvntsh.cls'.
%%
%%
%% Copyright 2022 O.R. Nykyforchyn, 2023-2025 A.I. Bandura
%% All rights reserved.
%%
%% ---------------------------------------------------
%%   This system 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.
%%
%% IMPORTANT COPYRIGHT NOTICE:
%%
%% Permission is granted to customize the declarations in this file to
%% serve the needs of your installation.
%%
%% However, NO PERMISSION is granted to distribute a modified version
%% of this file under its original name.
%%
%%
%% MODIFICATION ADVICE:
%%
%% If you want to customize this file, it is best to make a copy of
%% the source file(s) from which it was produced.  Use a different
%% name for your copy(ies) and modify the copy(ies); this will ensure
%% that your modifications do not get overwritten when you install a
%% new release of the standard system.
%%
%% You can then easily distribute your modifications by distributing
%% the modified and renamed copy of the source file.
%%
%%
\ProvidesClass{pvntsh}
[2026/03/28 v0.4 article style for Prykarpatskyi Visnyk NTSH]
%
\def\pj@theoname{Theorem}
\def\pj@proponame{Proposition}
\def\pj@lemmaname{Lemma}
\def\pj@corolname{Corollary}
\def\pj@remarkname{Remark}
\def\pj@defname{Definition}
\def\pj@exampname{Example}
\def\pj@recname{Received by Editorial Board}
\def\pj@accname{Accepted by Editorial Board}
\def\pj@ddmain{english}
%
\DeclareOption{ua}{%
    \def\pj@ddmain{ukrainian}%
    \def\pj@theoname{\CYRT\cyre\cyro\cyrr\cyre\cyrm\cyra}%
    \def\pj@proponame{\CYRT\cyrv\cyre\cyrr\cyrd\cyrzh\cyre\cyrn\cyrn\cyrya}%
    \def\pj@lemmaname{\CYRL\cyre\cyrm\cyra}%
    \def\pj@corolname{\CYRN\cyra\cyrs\cyrl\cyrii\cyrd\cyro\cyrk}%
    \def\pj@remarkname{\CYRZ\cyra\cyru\cyrv\cyra\cyrzh\cyre\cyrn\cyrn\cyrya}%
    \def\pj@defname{\CYRO\cyrz\cyrn\cyra\cyrch\cyre\cyrn\cyrn\cyrya}%
    \def\pj@exampname{\CYRP\cyrr\cyri\cyrk\cyrl\cyra\cyrd}%
    \def\pj@recname{������ ������� �� ���������� ����㳿}%
    \def\pj@accname{�������� �� �����}%
}

%
\DeclareOption{en}{%
    \def\pj@ddmain{english}%
    \def\pj@theoname{Theorem}%
    \def\pj@proponame{Proposition}%
    \def\pj@lemmaname{Lemma}%
    \def\pj@corolname{Corollary}%
    \def\pj@remarkname{Remark}%
    \def\pj@defname{Definition}%
    \def\pj@exampname{Example}%
    \def\pj@recname{Received by Editorial Board}%
    \def\pj@accname{Accepted by Editorial Board}%
}

\let\ifpj@times\iffalse %\else
\DeclareOption{times}{\let\ifpj@times\iftrue}
%
\DeclareOption{win}{\PassOptionsToPackage{cp1251}{inputenc}}
\DeclareOption{koi}{\PassOptionsToPackage{koi8-u}{inputenc}}
\PassOptionsToPackage{cp1251}{inputenc}

\let\ifpj@draft\iffalse %\else
\let\ifpj@othsec\iffalse %\else
\let\ifpj@thmsec\iffalse %\else

\DeclareOption{draft}{\let\ifpj@draft\iftrue \PassOptionsToClass{draft}{article}}
\DeclareOption{bysec}{\let\ifpj@othsec\iftrue}
\DeclareOption{thmbysec}{\let\ifpj@thmsec\iftrue \let\ifpj@othsec\iftrue}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ProcessOptions

\LoadClass[b5paper,12pt]{article}

%%%%%%%%%%%%%%%%%%%%%%% ��������� ������� %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\topmargin=-10mm
\oddsidemargin=5mm
\evensidemargin=-5mm
\headsep=0mm
\headheight=0pt
\headsep=6mm
\headheight=12pt
\paperwidth=182mm
\paperheight=257mm
\special{papersize=182mm,257mm}
\textheight=200mm
\textwidth=132mm
\parindent=25pt
\expandafter\def\expandafter\@listi\expandafter{\@listi
    \parsep 0pt plus 2.5pt minus 1pt
    \itemsep 0pt plus 2.5pt minus 1pt
    \relax}
\let\@listI\@listi
\expandafter\def\expandafter\@listii\expandafter{\@listii
    \parsep 0pt plus 2.5pt minus 1pt
    \itemsep 0pt plus 2.5pt minus 1pt
    \relax}
\expandafter\def\expandafter\@listiii\expandafter{\@listiii
    \parsep 0pt plus 2.5pt minus 1pt
    \itemsep 0pt plus 2.5pt minus 1pt
    \relax}

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

\edef\pj@babelopts{english,ukrainian,\pj@ddmain}
\let\@xp\expandafter
\@xp\PassOptionsToPackage\@xp{\pj@babelopts}{babel}

\let\englishhyphenmins\undefined
\usepackage{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[english,ukrainian]{babel}
\usepackage{amsmath,amsfonts,amsthm,amssymb,amstext,latexsym}
\usepackage{pscyr}
\usepackage{orcidlink}
\usepackage{doi}
\usepackage{ccicons}
%\usepackage{corruclc}
\lccode`\�=`\�
\uccode`\�=`\�
\lccode`\�=`\�
\uccode`\�=`\�
\lccode`\�=`\�
\uccode`\�=`\�
\lccode`\�=`\�
\uccode`\�=`\�


\ifpj@times
% MathTime fonts or Belleek free replacement
\let\Bbbk\undefined % to quiet amssymb.sty
%\usepackage{mtpro2}
\DeclareMathAlphabet{\mathbbi}{U}{mt2hrb}{m}{it}

% URWCyr text fonts (corrected by Nick)
%\usepackage{newtxtext}
\usepackage{mathptmx}
%\usepackage{helvet}
\renewcommand{\rmdefault}{ftm}
\renewcommand\sfdefault{far}
\renewcommand\ttdefault{mathptmx}
%
\fi

\def\th@plain{\itshape}
\theoremstyle{plain}


\ifpj@othsec
\newtheorem{theorem}{\pj@theoname}[section]
\newtheorem{proposition}{\pj@proponame}[section]
\newtheorem{lemma}{\pj@lemmaname}[section]
\newtheorem{corollary}{\pj@corolname}[section]
\newtheorem{remark}{\pj@remarkname}[section]
\newtheorem{definition}{\pj@defname}[section]
\newtheorem{example}{\pj@exampname}
\else
\newtheorem{theorem}{\pj@theoname}
\newtheorem{proposition}{\pj@proponame}
\newtheorem{lemma}{\pj@lemmaname}
\newtheorem{corollary}{\pj@corolname}
\newtheorem{remark}{\pj@remarkname}
\newtheorem{definition}{\pj@defname}
\newtheorem{example}{\pj@exampname}
\fi

\newtheorem*{theorem*}{\pj@theoname}
\newtheorem*{proposition*}{\pj@proponame}
\newtheorem*{lemma*}{\pj@lemmaname}
\newtheorem*{corollary*}{\pj@corolname}
\newtheorem*{remark*}{\pj@remarkname}
\newtheorem*{definition*}{\pj@defname}
\newtheorem*{example*}{\pj@exampname}

\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname.\quad}
\renewcommand\section{\@startsection {section}{1}{\parindent}% {\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {1sp}%{2.3ex \@plus.2ex}%
                                   {\normalfont\bfseries}}

\let\@email\empty
\newcommand\email[1]{%
  \gdef\@email{\hfil e-mail:\ {\itshape #1} \hfil}}

\let\@volume\empty
\newcommand\volume[1]{%
  \gdef\@volume{#1}}

\@xp\gdef\@xp\@year\@xp{\the\year}
\newcommand\pyear[1]{%
  \gdef\@year{#1}}

\let\@ISSN\empty
\newcommand\ISSN[1]{%
  \gdef\@ISSN{#1}}

\let\@UDC\empty
\newcommand\UDC[1]{%
  \gdef\@UDC{#1}}

\let\@branchi\empty
\let\@branchii\empty
\newcommand\branch[2]{%
  \gdef\@branchi{#1}%
  \gdef\@branchii{#2}%
}

\let\@branchseci\empty
\let\@branchsecii\empty
\newcommand\branchsec[2]{%
	\gdef\@branchseci{#1}%
	\gdef\@branchsecii{#2}%
}

\let\@branchsubseci\empty
\newcommand\branchsubsec[1]{%
	\gdef\@branchsubseci{#1}%
}

\let\@subjclass\empty
\newcommand\subjclass[1]{%
  \gdef\@subjclass{#1}}

\let\@received\empty
\newcommand\received[1]{%
  \gdef\@received{#1}}

\let\@accepted\empty
\newcommand\accepted[1]{%
	\gdef\@accepted{#1}}

\author{\phantom{author}}
\title{\phantom{title}}

\let\@eninfo\empty
\let\@enaddress\empty
\let\@enauthor\empty
\let\@enkeywords\empty
\let\@entitle\empty

\newcommand\eninfo{}
\newcommand\uainfo{}

\long\def\eninfo#1#2#3#4#5{
  \gdef\@entitle{#1}
  \gdef\@enauthor{#2}%
  \gdef\@enaddress{#3}%
  \gdef\@enkeywords{#4}
  \global\long\def\@enabstract{#5}%
}

\let\@uainfo\empty
\let\@uaaddress\empty
\let\@uaauthor\empty
\let\@uakeywords\empty
\let\@uatitle\empty

\long\def\uainfo#1#2#3#4#5{
  \gdef\@uatitle{#1}
  \gdef\@uaauthor{#2}%
  \gdef\@uaaddress{#3}%
  \gdef\@uakeywords{#4}
  \global\long\def\@uaabstract{#5}%
}

\AtBeginDocument{%
    \let\volume\undefined
    \let\pyear\undefined
    \let\UDC\undefined
    \let\subjclass\undefined
    \let\received\undefined
    \let\accepted\undefined
}

\def\pj@printeninfo{%
           \selectlanguage{english}%
           \begin{center} \renewcommand{\baselinestretch}{1.1}%
           {\bfseries\expandafter\uppercase\expandafter{\@entitle}}
           \par
           \vspace{0.4cm}
           {\sffamily\bfseries {\@enauthor}}
           \par
           \vspace*{-0.2cm}
           \itshape
           \@enaddress\par
           \@email\par
           \end{center}%
           {\itshape
           \par\vspace{7pt plus 0.5pt}%
           \@enabstract
           \par
           {\bfseries Key words:}
           \@enkeywords.
           }
}

\def\pj@printuainfo{%
           \selectlanguage{ukrainian}%
           \begin{center} \renewcommand{\baselinestretch}{1.1}%
           {\bfseries\expandafter\uppercase\expandafter{\@uatitle}}
           \par
           \vspace{0.4cm}
           {\sffamily\bfseries {\@uaauthor}}
           \par
           \vspace*{-0.2cm}
           \itshape
           \@uaaddress\par
           \@email\par
           \end{center}%
           {\itshape
           \par\vspace{7pt plus 0.5pt}%
           \@uaabstract
           \par
           {\bfseries ������ �����:}
           \@uakeywords.} 
           }

\long\def\maketitle{%
    \ifpj@draft
       \ifx\@enauthor\empty   \def\@enauthor{???}   \fi
       \ifx\@uaauthor\empty   \def\@uaauthor{???}   \fi
       \ifx\@entitle\empty    \def\@entitle{???}    \fi
       \ifx\@uatitle\empty    \def\@uatitle{???}    \fi
       \ifx\@ISSN\empty       \def\@ISSN{???}       \fi
       \ifx\@UDC\empty        \def\@UDC{???}        \fi
       \ifx\@volume\empty     \def\@volume{???}     \fi
       \ifx\@subjclass\empty  \def\@subjclass{???}  \fi
       \ifx\@branchi\empty    \def\@branchi{???}    \fi
       \ifx\@received\empty   \def\@received{???}   \fi
       \ifx\@accepted\empty   \def\@accepted{???}   \fi
       \ifx\@enkeywords\empty \def\@enkeywords{???} \fi
       \ifx\@uakeywords\empty \def\@uakeywords{???} \fi
       \ifx\@enabstract\empty \def\@enabstract{???} \fi
       \ifx\@uaabstract\empty \def\@uaabstract{???} \fi
    \fi
    \@xp\gdef\@xp\pj@firstpage\@xp{\the\c@page}%
    \gdef\@DOI{DOI: 10.31471/\@ISSN-\@year-\@volume-\pj@firstpage-\pageref{pj-LastPage}}
    \markboth{{\@branchi}}{{\@branchi}}%
    \ifx\@branchsecii\empty
    \else
    \phantom{t}
    \par
 % ������ ����� ������� �����
    \bgroup \itshape\bfseries\huge
    \noindent \@branchseci\
    \leaders
    \hbox{\parbox{15pt}{\par\noindent
    		\hrule height 1pt width 5pt
    		\vskip 1.5pt
    		\hrule height 2pt width 5pt
    		\vskip 1.5pt
    		\hrule height 1pt width 5pt
    }}\hfill 
\vspace{1cm}
    \par\itshape\bfseries\huge
    \noindent\@branchsecii\
    \leaders
      \hbox{\parbox{15pt}{\par\noindent
                    \hrule height 1pt width 5pt
                    \vskip 1.5pt
                    \hrule height 2pt width 5pt
                    \vskip 1.5pt
                    \hrule height 1pt width 5pt
           }}\hfill
    \egroup
    \vspace{1cm} % ������ ����� ��� i DOI
    \fi
    %������ ������� �� ������ �����
    \ifx\@branchsubseci\empty
    \else
    \phantom{t}
    \par
    % ������ ����� ������� �����
    \bgroup \itshape\bfseries\huge
    \noindent \@branchsubseci\
    \leaders
    \hbox{\parbox{15pt}{\par\noindent
    		\hrule height 1pt width 5pt
    		\vskip 1.5pt
    		\hrule height 2pt width 5pt
    		\vskip 1.5pt
    		\hrule height 1pt width 5pt
    }}\hfill 
    \egroup
    \vspace{1cm} % ������ ����� ��� i DOI
    \fi
    \par
    \ifx\@UDC\empty
    \else
        \noindent ��� \@UDC\\
    \fi
    \ifx\@subjclass\empty
    \else
        \noindent MSC 2020: \@subjclass\\
    \fi
    \noindent \@DOI\\
    % ������ ����� ������ �����
    \def\@len{english}
    \def\@lua{ukrainian}
%    \show\@uclclist
    {%
    \ifx\pj@ddmain\@len %% ���� ������ ���������� �����
      \pj@printeninfo
    \fi%
    \ifx\pj@ddmain\@lua %% ���� ������ ���������� �����
      \pj@printuainfo
    \fi
    }
    %\vskip-5pt %% ������ ���� ��������
} % end of \maketitle

\pagestyle{myheadings}

\newcommand{\pageno}[1]{\setcounter{page}{#1}}

%
%    Headlines
%
\newdimen\headruleskip
\renewcommand{\@evenhead}{\vtop{\setbox\@tempboxa\hbox to\textwidth
   {\normalsize \thepage\ \hfill {\selectlanguage{ukrainian}\leftmark}\hskip15pt}%
   \dp\@tempboxa=\z@\box\@tempboxa\vskip\headruleskip
   \hbox to\textwidth{%
       \hskip15pt
       \leaders
         \hbox{\parbox{5pt}{\par\noindent
                    \hrule height .3pt width 5pt
                    \vskip .5pt
                    \hrule height .3pt width 5pt
                    \vskip .5pt
                    \hrule height .3pt width 5pt
           }}\hfill
       \hskip15pt}%
   }}
\renewcommand{\@oddhead}{\vtop{\setbox\@tempboxa\hbox to\textwidth
   {\normalsize \hskip15pt{\selectlanguage{ukrainian}\leftmark}\ \hfill \thepage}%
   \dp\@tempboxa=\z@\box\@tempboxa\vskip\headruleskip
   \hbox to\textwidth{%
       \hskip15pt
       \leaders
         \hbox{\parbox{5pt}{\par\noindent
                    \hrule height .3pt width 5pt
                    \vskip .5pt
                    \hrule height .3pt width 5pt
                    \vskip .5pt
                    \hrule height .3pt width 5pt
           }}\hfill
       \hskip15pt}%
   }}
\headruleskip 4pt
\def\corauthor#1{\noindent\footnotetext{*Corresponding author}}
%\newdimen\footruleskip
%\renewcommand{\@evenfoot}{\vtop{\hrule height 1.3pt
%   \vskip\footruleskip
%   \setbox\@tempboxa\hbox to\textwidth
%     {\footnotesize  
%     	 ISSN \@ISSN.
%       \selectlanguage{ukrainian}%
%       �������������� ����� ���. �����. -- \@year.
%       -- \No\ \@volume. -- �.\pj@firstpage-\pageref{pj-LastPage}.} \par
%   \dp\@tempboxa=\z@\box\@tempboxa
%}}
%    {%
%	\ifx\pj@ddmain\@len %% ���� ������ ���������� �����
%	\pj@printuainfo
%	\fi%
%	\ifx\pj@ddmain\@lua %% ���� ������ ���������� �����
%	\pj@printeninfo
%	\fi
%}%
\newdimen\footruleskip
\renewcommand{\@evenfoot}{%
	\vtop{%
		\hrule height 1.3pt%
		\vskip5pt
		%\footruleskip
		% ---- �������� ����� ����������� ----
		\setbox\@tempboxa\hbox to\textwidth{%
			\footnotesize
			ISSN \@ISSN.\ 
			\selectlanguage{ukrainian}%
			�������������� ����� ���. �����. -- \@year.
			-- � \@volume. -- �.\pj@firstpage-\pageref{pj-LastPage}.%
		}%
		\par\dp\@tempboxa=\z@\box\@tempboxa
		
				\ifnum\value{page}=\pj@firstpage
		{\vskip-20pt
		\footnotesize 
		\ifx\pj@ddmain\@lua *³����������� ����� \hfill\copyright\, 
			\CopyName, \@year\fi%
		\ifx\pj@ddmain\@len *Corresponding author \hfill\copyright\,
			\CopyName, \@year\fi%
		}
		\else
		% ======== ��ز ���в��� � �������� ����� ========
		{}
		\fi
		
		% ---- ���������� ����� � ������� ����糿 ----
		\ifnum\value{page}=\pj@firstpage
		{\vskip-20pt
		\setbox\@tempboxa\hbox to\textwidth{%
			\footnotesize
			\ifx\pj@ddmain\@lua%
				�� ������ ���������� �� ������\ %
				\href{https://creativecommons.org/licenses/by-nc-nd/4.0/}{CC BY-NC-ND 4.0}\ \ccbyncnd\hfill%
			\fi%
			\ifx\pj@ddmain\@len%
				This work is licensed under\ %
				\href{https://creativecommons.org/licenses/by-nc-nd/4.0/}{CC BY-NC-ND 4.0}\ \ccbyncnd\hfill%
			\fi
			}%
			\par\dp\@tempboxa=\z@\box\@tempboxa}
			\else
			% ======== ��ز ���в��� � �������� ����� ========
			{}
			\fi
	}%
}


\let\@oddfoot\@evenfoot
\footruleskip 12pt



%\renewcommand{\footnoterule}{\vspace*{-3pt}
%    \hrule width 5cm \vspace*{2.6pt}}

\renewcommand{\@makefntext}[1]{\parindent=1em\noindent  #1}

\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \bfseries\itshape %% ����� ����� ``���������''/``Proof''
    #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}

\let\pj@thebibliography\thebibliography
\def\thebibliography{\footnotesize\pj@thebibliography}
\renewcommand{\@biblabel}[1]{\hfill #1.}
\renewenvironment{thebibliography}[1]
     {%
      \centerline{\bfseries\itshape ˳��������}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep %% ³����� ���� � ������ ���������
            \advance\leftmargin by -5pt
            \itemindent 5pt
            \topsep 0pt
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}

\long\def\@lastpage{%
    \par\hbox to \textwidth{\hfill \itshape\pj@recname\ \@received}
    \par\hbox to \textwidth{\hfill \itshape\pj@accname\ \@accepted}
    \vspace{1cm} % ������ ����� ������ �����
    \def\@len{english}%
    \def\@lua{ukrainian}%

    {%
    \ifx\pj@ddmain\@len %% ���� ������ ���������� �����
      \pj@printuainfo
    \fi%
    \ifx\pj@ddmain\@lua %% ���� ������ ���������� �����
      \pj@printeninfo
    \fi
    }%
    \label{pj-LastPage}%
} % end of \@lastpage

\AtEndDocument{\@lastpage}

%% End of file `ntsh.cls'.
