\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mm-cys}[2001/11/26 v1.1]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message
 {^^JConference for Young Scientists
  ^^JFaculty of Mechanics and Mathematics
  ^^JMoscow State University^^J^^J}

\def\package@warning#1{\message{^^JMM-CYS Package Warning: #1
 ^^JPress any key... }\read\m@ne to \@tempa}

\def\package@error#1{\errmessage{MM-CYS Package error: #1}}

\def\mm@forbid#1{\def#1{%
 \errhelp={Sorry, but this command has been forbidden intentionally.
  ^^JPlease refer to the sample file for details.}%
 \package@error{Command \string#1 is forbidden}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{Loading page layout,}
\textwidth 11cm
\textheight 173mm
\@twosidetrue \@mparswitchtrue
\def\ps@jumpfoot
 {%
   \let\@oddhead\@empty\let\@evenhead\@empty
   \def\@evenfoot{\small\normalfont\thepage \hfill \slshape\mm@author}%
   \def\@oddfoot{\small\normalfont{\slshape\mm@author}\hfill \thepage}%
 }
\ps@jumpfoot
\evensidemargin\oddsidemargin
\flushbottom
\righthyphenmin\tw@
\emergencystretch 15\p@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{title page macros,}
%\def\udc#1{\gdef\mm@udc{УДК #1}}
\def\title#1{\gdef\mm@title{#1}}
\def\author#1{\gdef\mm@author{#1}}
\def\affil#1{\gdef\mm@affil{#1}}
\def\maketitle{%
 %\@ifundefined{mm@udc}%
 % {\package@warning{No Universal Decimal Classification code given.}}%
 % {\par\hbox{\mm@udc}\penalty\@M \medskip}%
 \@ifundefined{mm@title}%
  {\errhelp={Use the control sequnce \title before.}%
   \package@error{No title given}}%
  {{\leftskip \z@ plus 1fil \rightskip \z@ plus 1fil
    \parfillskip\z@ \interlinepenalty\@M \large \bfseries \noindent
    \mm@title \thispagestyle{plain}\par}\penalty\@M \medskip}%
 \@ifundefined{mm@author}%
  {\package@warning{No author given.}\def\mm@author{}}%
  {\centerline{\bfseries \itshape \mm@author}\penalty\@M}%
 \penalty\@M
 \@ifundefined{mm@affil}%
  {\package@warning{No affiliation (name of institution) given.}}%
  {\medskip {\leftskip \z@ plus 1fil \rightskip \z@ plus 1fil
    \parfillskip\z@ \interlinepenalty\@M \small \itshape \noindent
    \mm@affil \par}\penalty\@M}%
 \bigskip
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{sectioning,}
\mm@forbid\section
\mm@forbid\subsection
\mm@forbid\subsubsection
\def\paragraph{\@ifstar{\x@paragraph}{\y@paragraph}}
\def\x@paragraph#1{\par{\normalfont\bfseries#1.}\space\ignorespaces}
\def\y@paragraph#1{\par\refstepcounter{paragraph}%
  {\normalfont\bfseries\theparagraph.\if!#1!\else\space#1.\fi}\space
  \ignorespaces}
\def\theparagraph{\arabic{paragraph}}
\def\subparagraph{\@ifstar{\x@subparagraph}{\y@subparagraph}}
\def\x@subparagraph#1{\par{\normalfont\itshape#1.}\space\ignorespaces}
\def\y@subparagraph#1{\par\refstepcounter{subparagraph}%
  {\normalfont\itshape\theparagraph.\if!#1!\else\space#1.\fi}\space
  \ignorespaces}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{bibliography,}
\def\thebibliography#1{\par\medskip
 \settowidth\@tempdima{\small\normalfont[#1]\enskip}%
 \addvspace\medskipamount \small \frenchspacing \parindent\z@
 \setcounter{enumiv}{0}%
 \def\theenumiv{\arabic{enumiv}}%
 \def\bibitem##1{\refstepcounter{enumiv}%
   \immediate\write\@auxout{\string\bibcite{##1}{\the\c@enumiv}}\par
   \makebox[\@tempdima][l]{[\theenumiv]}\hangindent\@tempdima \ignorespaces}%
 \let\by\textsc \let\jour\textit \let\vol\textbf
}
\def\endthebibliography{\par \vskip\medskipamount \relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{text symbols,}
\@ifundefined{textnumero}{%
 \DeclareRobustCommand{\textnumero}{{\upshape N$^\circ$}}}{}
\@ifundefined{No}{%
 \DeclareRobustCommand{\No}{%
   \ifmmode{\nfss@text{\textnumero}}\else\textnumero\fi}}{}
\@ifundefined{flqq}{%
 \DeclareRobustCommand{\flqq}{\ifmmode{\nfss@text{``}}\else``\fi}}{}
\@ifundefined{frqq}{%
 \DeclareRobustCommand{\frqq}{\ifmmode{\nfss@text{''}}\else''\fi}}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{lists,}

\def\@listI{\leftmargin\leftmargini
 \topsep\z@ \parsep\z@ \itemsep\z@}

\def\@listii{\leftmargin\leftmarginii
   \labelwidth\leftmarginii\advance\labelwidth-\labelsep
   \topsep\z@ \parsep\z@ \itemsep\z@}

\def\itemize{\ifnum\@itemdepth>\@ne \@toodeep \else \advance\@itemdepth\@ne
  \leftmarginii 30\p@
  \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
  \list{\csname\@itemitem\endcsname}{\def\makelabel##1{\hss\llap{##1}}}\fi}

\def\enumerate{\ifnum\@enumdepth>\@ne \@toodeep \else
  \advance\@enumdepth\@ne
  \settowidth\leftmargini {\indent 9)\enskip}%
  \leftmarginii 27\p@
  \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
  {\csname label\@enumctr\endcsname}{\usecounter
    {\@enumctr}\def\makelabel##1{\hss\llap{##1}}}\fi}

\def\labelitemi{$\bullet$}
\def\labelitemii{--}

\def\labelenumi{\theenumi)}
\def\labelenumii{\theenumii)}
\def\theenumi{\arabic{enumi}}
\def\theenumii{\alph{enumii}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{captions,}
\def\tablename{Таблица}
\def\figurename{Рис.}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\textsf{#1.} #2}%
  \ifdim \wd\@tempboxa >\hsize
    \textsf{#1.} #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{theorem environments,}

\def\newtheorem{%
 \@ifnextchar*{\provide@unn@theorem}{\provide@num@theorem}%
}

\def\provide@num@theorem{%
 \edef\provide@new@theorem{\noexpand\new@num@thm{\thm@style}}%
 \provide@new@theorem
}

\def\provide@unn@theorem{%
 \edef\provide@new@theorem{\noexpand\new@unn@thm{\thm@style}}%
 \provide@new@theorem
}

\def\new@unn@thm#1*#2#3{%
 \newenvironment{#2}%
  {\@nameuse{ts@#1}\begin@unn@thm{#3}}%
  {\end@thm}%
}

\def\new@num@thm#1#2{\@ifnextchar[{\S@count@thm{#1}{#2}}{\P@count@thm{#1}{#2}}}

\def\S@count@thm#1#2[#3]#4{%
 \newenvironment{#2}%
  {\@nameuse{ts@#1}\begin@num@thm{#4}{#3}}%
  {\end@thm}%
}

\def\P@count@thm#1#2#3{%
 \newcounter{#2}%
 \newenvironment{#2}%
  {\@nameuse{ts@#1}\begin@num@thm{#3}{#2}}%
  {\end@thm}%
 \@ifnextchar[{\@Add@to@Reset{#2}}{}%
}

\def\@Add@to@Reset#1[#2]{%
 \@ifundefined{c@#2}%
  {\errhelp{You must have the counter `#2' already defined
            ^^Jbefore you say \newtheorem{foo}{Foo}[#2].}%
   \package@error{Counter `#2' has not yet been defined.}}%
  {\@addtoreset{#1}{#2}}%
}

\def\begin@num@thm#1#2{%
 \refstepcounter{#2}%
 \def\@thm@name{#1~\@nameuse{the#2}}%
 \@ifnextchar({\x@open@thm}{\y@open@thm}%
}

\def\begin@unn@thm#1{%
 \def\@thm@name{#1}%
 \@ifnextchar({\x@open@thm}{\y@open@thm}%
}

\def\y@open@thm{\par{\thm@head@font\@thm@name.}\space
 \thm@body@font\ignorespaces}

\def\x@open@thm(#1){\par{\thm@head@font\@thm@name\space
 \def\thm@note{\@ifnextchar\cite
   {\let\end@thm@note=\relax}{(\let\end@thm@note=)}}%
 \textnormal{\thm@note#1\end@thm@note}.}\space\thm@body@font\ignorespaces}

\def\end@thm{\par}

\def\theoremstyle#1{%
 \@ifundefined{ts@#1}%
  {\package@error{Theorem style `#1' is undefined}}%
  {\def\thm@style{#1}}%
}

\def\newtheoremstyle#1#2#3{%
 \@namedef{ts@#1}{\def\thm@head@font{#2}\def\thm@body@font{#3}}%
}

\newtheoremstyle{plain}{\normalfont\sffamily}{\normalfont\slshape}
\newtheoremstyle{definition}{\normalfont\sffamily}{\normalfont}
\newtheoremstyle{proof}{\normalfont\itshape}{\normalfont}

\def\newtheorems#1#2{\newtheorem{#1}{#2}\newtheorem*{#1*}{#2}}

\theoremstyle{definition}
\newtheorems{definition}{Определение}
\newtheorems{example}{Пример}
\newtheorem*{x@definition}{\x@thm@name}
\newtheorems{remark}{Замечание}
\theoremstyle{proof}
\newtheorem*{proof}{Доказательство}
\newtheorem{case}{Случай}
\newtheorem{step}{Шаг}
\newtheorem*{x@proof}{\x@thm@name}
\theoremstyle{plain}
\newtheorems{theorem}{Теорема}
\newtheorems{lemma}{Лемма}
\newtheorems{proposition}{Предложение}
\newtheorems{corollary}{Следствие}
\newtheorems{statement}{Утверждение}
\newtheorems{problem}{Проблема}
\newtheorems{hypothesis}{Гипотеза}
\newtheorem*{x@theorem}{\x@thm@name}
\newenvironment{x-theorem}[1]%
  {\def\x@thm@name{#1}\begin{x@theorem}}{\end{x@theorem}}
\newenvironment{x-definition}[1]%
  {\def\x@thm@name{#1}\begin{x@definition}}{\end{x@definition}}
\newenvironment{x-proof}[1]%
  {\def\x@thm@name{#1}\begin{x@proof}}{\end{x@proof}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{math packages:}
\usepackage{amsmath,amssymb,latexsym}
\mm@forbid\eqnarray
\mm@forbid\eqno
\mm@forbid\leqno
\mm@forbid\atop
\def\above{\genfrac{}{}{\z@}{}}
\mm@forbid\over
\mm@forbid\choose
\mm@forbid\cal
\mm@forbid\frak
\mm@forbid\Bbb
\let\le\leqslant \let\leq\le
\let\ge\geqslant \let\geq\ge

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\message{... finished.^^J^^J}

\endinput
